Opened 5 years ago
Closed 5 years ago
#21491 closed defect (fixed)
IndexError in integral_points_count of Polyhedron
Reported by:  slabbe  Owned by:  

Priority:  major  Milestone:  sage7.5 
Component:  geometry  Keywords:  days79 
Cc:  mkoeppe  Merged in:  
Authors:  Sébastien Labbé  Reviewers:  Moritz Firsching, Travis Scrimshaw 
Report Upstream:  N/A  Work issues:  
Branch:  ce82303 (Commits, GitHub, GitLab)  Commit:  ce82303ab9a0fd27576464c9a7f1900537b45d5e 
Dependencies:  Stopgaps: 
Description
With latte_int
installed:
$ sage experimental ... latte_int...............................1.7.3 (1.7.3) ...
I get:
sage: eqns = [[10, 0, 1], [10, 1, 0]] sage: P = Polyhedron(ieqs=[], eqns=eqns) sage: P.integral_points_count() ... sage/geometry/polyhedron/base.pyc in integral_points_count(self, verbose) 4259 raise RuntimeError("LattE integrale failed (exit code {}) to execute {}".format(ret_code, ' '.join(args)) + err.strip()) 4260 > 4261 return Integer(ans.splitlines()[1]) 4262 4263 def integral_points(self, threshold=100000): IndexError: list index out of range
Same error with:
sage: P = Polyhedron(ieqs=[], eqns=[[11,0,2],[10,1,0]]) sage: P.vertices() (A vertex at (10, 11/2),)
The culprit might be the empty string:
sage: "".splitlines()[1]  IndexError Traceback (most recent call last) <ipythoninput17faf349df14a> in <module>() > 1 "".splitlines()[Integer(1)] IndexError: list index out of range
Change History (16)
comment:1 Changed 5 years ago by
 Cc mkoeppe added
comment:2 Changed 5 years ago by
comment:3 Changed 5 years ago by
 Branch set to u/slabbe/21491
 Commit set to 27948e85f24bcf0c757bd4cee65143845194cb84
 Status changed from new to needs_review
New commits:
27948e8  21491: using file numOfLatticePoints for integral_points_count method

comment:4 Changed 5 years ago by
This seems to work!
comment:5 Changed 5 years ago by
 Status changed from needs_review to positive_review
comment:7 Changed 5 years ago by
 Reviewers set to Moritz Minzlaff
comment:8 Changed 5 years ago by
 Status changed from positive_review to needs_review
Since opening a file takes ~10x longer than a try/except block, I suggest the following:
try: return Integer(ans.splitlines()[1]) except IndexError: with open(SAGE_TMP+'/numOfLatticePoints', 'r') as f: return Integer(f.read())
comment:9 Changed 5 years ago by
 Status changed from needs_review to needs_work
comment:10 Changed 5 years ago by
 Reviewers changed from Moritz Minzlaff to Moritz Firsching
comment:11 Changed 5 years ago by
 Commit changed from 27948e85f24bcf0c757bd4cee65143845194cb84 to 347aa90df56bd59874377452afc130b2c8981f23
Branch pushed to git repo; I updated commit sha1. New commits:
347aa90  21491: catching the IndexError instead

comment:12 Changed 5 years ago by
 Reviewers changed from Moritz Firsching to Moritz Firsching, Travis Scrimshaw
 Status changed from needs_work to positive_review
Thanks.
comment:13 Changed 5 years ago by
 Status changed from positive_review to needs_work
Documentation doesn't build, see patchbot.
comment:14 Changed 5 years ago by
 Branch changed from u/slabbe/21491 to u/tscrim/21491
 Commit changed from 347aa90df56bd59874377452afc130b2c8981f23 to ce82303ab9a0fd27576464c9a7f1900537b45d5e
 Milestone changed from sage7.4 to sage7.5
 Status changed from needs_work to positive_review
comment:15 Changed 5 years ago by
Thank you for fixing this Travis.
Sébastien
comment:16 Changed 5 years ago by
 Branch changed from u/tscrim/21491 to ce82303ab9a0fd27576464c9a7f1900537b45d5e
 Resolution set to fixed
 Status changed from positive_review to closed
Note: See
TracTickets for help on using
tickets.
Just to say that in both cases,
latte_int
gets the answer right.1 in this case:
0 in this case: