-
-
Notifications
You must be signed in to change notification settings - Fork 491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a Polymake pexpect interface #22452
Comments
Changed keywords from Polymake, days85 to Polymake, days84 |
Commit: |
Last 10 new commits:
|
comment:4
Here I am showcasing some things that work already:
So, there is access to Polymake' help system.
So, tab completion of the interface itself works, it yields ALL function names, including those that are not part of the current Polymake application.
So, calling a function with parameters works
So, string representation works, actually nicer than in Polymake (more examples below).
So, this shows how the f-vector would be computed for this polytope.
So, tab completion for Polymake elements works. It shows both members (including those that aren't computed yet) and functions (including those that won't be applicable to the object).
So, when verbosity is set to a positive value, comments printed by Polymake will be printed by Sage.
So, string representation is (at least for the things that are currently wrapped) meaningful.
So, attribute access works.
So, error handling is implemented. Meanwhile, more members are known:
Of course, some things won't work yet. For example, I am not catching warnings yet. |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:6
Example for the next commit:
New commits:
|
comment:8
Now I am totally puzzled. After doing some changes, many thinks didn't work. Thus, I reverted all changes. I even deleted my local git branch and downloaded the branch from here. But things still don't work (tab completion etc). Of course I did sage -br. Do you have any idea what could cause such persisting problems? |
comment:9
It seems that my Sage installation is totally broken. I did "make start" and it seems that it installs python3 without my asking for it. |
Branch pushed to git repo; I updated commit sha1. New commits:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:12
Replying to @simon-king-jena:
Yes. That is normal. python2 and python3 do install by default now (since 2 or 3 beta already). |
comment:13
Replying to @videlec:
Thanks, I didn't notice that before. I still don't know what went wrong, but it is now again working, including the synchronisation code that I posted in the previous commit. |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:15
Finally I found a reasonable source explaining a part of perl that seems particularly relevant: http://perldoc.perl.org/perlref.html So, I am now rewriting a couple of things in terms of what I learn about perl references. |
comment:16
It is of course conceivable that I am just lacking experience, but I find Perl sucks. In order to write an interface, it is important to do things uniformly. Hence, all variables created by Sage in Polymake should be "the same". In the current branch, "the same" means that they are all references (which in Perl means they are SCALAR). So, how to assign any object x in Polymake to a variable var? If you define a SCALAR "var" and assign to "x", you of course do not get a reference to x but some scalar interpretation of whatever is in x. Thus, I need to create a reference to x. Sounds trivial (and perhaps it is). However, all what I found is that one needs to do Instead, let var uniformly be an array whose single entry is x. Thus:
WTF?? I should better replace something that I did not write??? From what I thought I have learnt about Perl syntax, |
comment:17
Aha, my mistake. Apparently it works slightly differently:
So, creating a new variable that points to the content of the old variable should work like this, and it does:
Access to members also works as expected:
So, I'll rewrite my branch accordingly. |
comment:18
Argh. The same trick won't work when I want a list in a list:
|
comment:19
Next thing to try: Use a reference to an array. According to http://perldoc.perl.org/5.20.0/perllol.html, I expect it to work as follows:
So, for wrapping lists, it won't work either. |
comment:20
It seems that the problem with nested arrays is known and is discussed here. |
comment:21
Apparently there are no arrays of arrays in Perl. Instead, each item in an array has to be a scalar. Hence, an array of arrays would in fact be implemented as an array of references to arrays. And it seems that Perl would automagically create such references if you assign something to an entry of an existing array, according to the reference given in the previous post. So, I expect that things would finally work as follows:
WTF?? I suppose the problem here is that in the line Crap. |
comment:22
I will now try this model:
Anyway. I will next try to use this approach to assign
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
Changed work issues from use print function in doctests to none |
comment:93
The doctests are now using print function, not print statements. And for completeness, I have merged with the current version of #22501. Needs review, again. |
comment:95
|
Changed branch from u/SimonKing/create_a_polymake_pexpect_interface to u/mkoeppe/create_a_polymake_pexpect_interface |
Changed branch from u/mkoeppe/create_a_polymake_pexpect_interface to |
comment:101
Great!!!!! Thanks so much for all this work!!! I will let polymake people know and start showing it around! As a follow up, I guess it would make sense to make a thematic tutorial on the interface?!?! I can volunteer to do it since I was playing a lot with the doc lately. I will continue to bug you with questions when I have them! Thanks a lot again! |
Changed commit from |
comment:102
Indeed this is good news! I think it would be appropriate to show one example of a computation with polymake inside the thematic tutorial that you started at #22572. It can be a follow up ticket if you do not want to delay it. |
There is PyPolymake, to be added at #21170. But I think it wouldn't hurt to additionally have a pexpect interface to Polymake. And the purpose of this ticket is to create one.
Depends on #22501
CC: @videlec @jplab
Component: packages: optional
Keywords: Polymake, days84
Author: Simon King
Branch:
52a77ee
Reviewer: Vincent Delecroix
Issue created by migration from https://trac.sagemath.org/ticket/22452
The text was updated successfully, but these errors were encountered: