Opened 12 years ago
Closed 12 years ago
#11312 closed enhancement (fixed)
Speed up the computation of the Hilbert basis of a cone
Reported by: | vbraun | Owned by: | mhampton |
---|---|---|---|
Priority: | major | Milestone: | sage-4.7.2 |
Component: | geometry | Keywords: | sd31 |
Cc: | novoselt, zaf | Merged in: | sage-4.7.2.alpha0 |
Authors: | Volker Braun | Reviewers: | Andrey Novoseltsev |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
My first implementation of the Hilbert basis eventually uses PALP to compute the points in the parallelotope spanned by the rays of a simplicial cone. This can be done much faster with just the Smith normal form of the ray matrix.
This makes it easy to compute the points in the semi-open parallelotope, so the actual number of semigroup generators is sometimes less than the PALP version (which computed the integral points in the closure). As a pleasant side effect, arbitrary dimension cones work now as we are no longer limited to PALP's compile-time bounds.
Apply:
Attachments (2)
Change History (18)
comment:1 Changed 12 years ago by
Cc: | novoselt added |
---|---|
Description: | modified (diff) |
Status: | new → needs_review |
comment:2 Changed 12 years ago by
Reviewers: | → Andrey Novoseltsev |
---|---|
Status: | needs_review → needs_work |
Work issues: | → non-full-dimensional errors |
comment:3 Changed 12 years ago by
I think I'm just implementing the same algorithm as PALP would use to enumerate the points in the parallelotope spanned by the rays, though I'm not sure. Essentially you have to compute the Smith form to enumerate the points, the rest is a simple loop. I'll try to get some more info about Palp's inner workings out of Harald Skarke at the Kreuzer Memorial conference.
And thanks for catching the non-full dimensional cone bug, I should have thought about that but didn't.
comment:4 Changed 12 years ago by
Status: | needs_work → needs_review |
---|
Fixed:
sage: Cone([(1,1), (-1,1)], check=False).Hilbert_basis() (N(1, 1), N(-1, 1), N(0, 1)) sage: Cone([(1,1,0), (-1,1,0)], check=False).Hilbert_basis() (N(1, 1, 0), N(-1, 1, 0), N(0, 1, 0))
comment:5 Changed 12 years ago by
On further thought, I think its better to also remove non-primitive vectors from the semigroup generators. The new version of the patch saves a few generators, which should speed up the Hilbert basis a little bit.
comment:6 Changed 12 years ago by
New version of the patch breaks out the parallelotope_points()
function so it can be reused in #11429
comment:7 Changed 12 years ago by
Work issues: | non-full-dimensional errors |
---|
comment:8 Changed 12 years ago by
Keywords: | sd31 added |
---|---|
Status: | needs_review → needs_work |
Work issues: | → One long test fails in cone module |
comment:9 Changed 12 years ago by
As the patch has to be adjusted one more time anyway - what do you think about creating some kind of sage.geometry.misc
module for "helper functions"? Names and rays normalization functions are also natural candidates to go there. This will reduce the potential for circular imports and clarify the structure. cone.parallelotope_points
seems a bit strange ;-)
comment:10 Changed 12 years ago by
Ah, this particular function is moved to another place in the next patch anyway!
comment:11 Changed 12 years ago by
Status: | needs_work → needs_review |
---|
Good catch! I fixed the offending doctest. Up to the ordering the Hilbert bases before and after the patch are the same, of course.
Changed 12 years ago by
Attachment: | trac_11312_speed_up_Hilbert_cone.2.patch added |
---|
Two corrections to REST formatting
comment:13 Changed 12 years ago by
Description: | modified (diff) |
---|---|
Work issues: | One long test fails in cone module |
I have made tiny adjustments to the patch to make the documentation compile without warnings, I'll leave it at positive review. (Added one column and replaced a quote with a backward one.)
Volker: subsequent patches may need to be rebased.
comment:14 Changed 12 years ago by
Cc: | zaf added |
---|
comment:15 Changed 12 years ago by
Milestone: | sage-4.7.1 → sage-4.7.2 |
---|
comment:16 Changed 12 years ago by
Merged in: | → sage-4.7.2.alpha0 |
---|---|
Resolution: | → fixed |
Status: | positive_review → closed |
The speed-up looks impressive! About 20x on trivial examples (no surprise here since we are avoiding system calls to both cdd and PALP), on a "complicated" 6-d example that I picked the new version worked for 15sec and the old one didn't finish before my patience ran out ;-) Am I right that this speed is partially due to taking into account the special structure of the polytopes in which you are computing integral points?
There are, however, issues with non-full-dimensional cones::