#11429: Count integral points without PALP
----------------------------------+-----------------------------------------
Reporter: vbraun | Owner: AlexGhitza
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-4.7.1
Component: algebraic geometry | Keywords:
Work_issues: | Upstream: N/A
Reviewer: | Author: Volker Braun
Merged: | Dependencies: #11312
----------------------------------+-----------------------------------------
Description changed by vbraun:
Old description:
> We want our own code to enumerate lattice points in polyhedra because:
> * Going through the PALP pexpect interface is annoyingly slow.
> * no more compile-time bounds
> * It seems like PALP uses a very unsophisticated algorithm:
> {{{
> sage: v = [(1,0,7,-1), (-2,-2,4,-3), (-1,-1,-1,4), (2,9,0,-5),
> (-2,-1,5,1)]
> sage: lp = LatticePolytope(matrix(v).transpose()); lp
> A lattice polytope: 4-dimensional, 5 vertices.
> sage: lp.npoints()
> }}}
> takes forever with PALP but only 500ms with my Python code.
>
> Comparing timings, it seems that PALP always runs over the integral
> points of a rectangular bounding box. This is good for small polytopes
> (low overhead) but bad for large ones. To match PALP's speed for small
> polytopes, I implemented the same algorithm in Cython (the second patch)
> and use it for bounding boxes containing <50k points.
New description:
We want our own code to enumerate lattice points in polyhedra because:
* Going through the PALP pexpect interface is annoyingly slow.
* no more compile-time bounds
* It seems like PALP uses a very unsophisticated algorithm:
{{{
sage: v = [(1,0,7,-1), (-2,-2,4,-3), (-1,-1,-1,4), (2,9,0,-5),
(-2,-1,5,1)]
sage: lp = LatticePolytope(matrix(v).transpose()); lp
A lattice polytope: 4-dimensional, 5 vertices.
sage: lp.npoints()
}}}
takes forever with PALP but only 500ms with my Python code.
Comparing timings, it seems that PALP always runs over the integral points
of a rectangular bounding box. This is good for small polytopes (low
overhead) but bad for large ones. To match PALP's speed for small
polytopes, I implemented the same algorithm in Cython (the second patch)
and use it for bounding boxes containing <50k points.
Apply trac_11429_native_enumeration_of_lattice_polytope_points.patch,
trac_11429_cythonize_lattice_points.patch, trac_11429_fix_doctests.patch
--
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11429#comment:4>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.