-
-
Notifications
You must be signed in to change notification settings - Fork 553
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
Optimize computing points of lattice polytopes #22524
Comments
Branch: u/novoselt/points_without_PALP |
comment:2
Had to fix a doctest, results of
Last 10 new commits:
|
Commit: |
comment:3
For large enough lattice point listing problems, considering using normaliz. Recent tickets have added it as a backend for |
comment:4
Sure, but in toric geometry especially related to mirror symmetry it is important to handle very simple cases fast (e.g. all reflexive polytopes have precisely one interior lattice point, the origin). Of course, it would be nice to handle all cases efficiently, and to be able to choose new methods appropriately I tried to first optimize existing one as much as possible, in particular not to take too much time just to convert data between different types. Thanks for taking a look! |
Branch pushed to git repo; I updated commit sha1. New commits:
|
Changed keywords from none to sd91 |
Branch pushed to git repo; I updated commit sha1. New commits:
|
Reviewer: Travis Scrimshaw |
comment:9
I think an even faster way than n = N.zero_vector()
for i, coef in enumerate(c.coefficients()):
n[i] = coef
n.set_immutable()
normals.append(n) would be n = N.element_class(N, c.coefficients(), coerce=False, copy=False)
n.set_immutable() (although perhaps the coerce and copy are unnecessary). In general, if you know your input is good, you can bypass the extra overhead of Also, it might be better to do - points = list(p.vertices())
- for j in range(nv, m.ncols()):
- current = M.zero_vector()
- for i in range(M.rank()):
- current[i] = m[i, j]
- current.set_immutable()
- points.append(current)
+ points = list(p.vertices()) + m.columns(copy=False)
p._points = PointCollection(points, M) Although I have not checked if the columns are longer than Otherwise LGTM. |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:11
Thank you for the pointer, Regarding using matrix columns - that code deals with only some part of a matrix and, more importantly, is only used in "bad" cases: when dealing with non-full-dimensional polytopes or with a separate PALP call for a single polytope rather than sequence. My quick attempts to improve them now just broke things and I don't think they are worthy of more effort - the real solution is to rely on different backend. On the other hand, for computing points of many full-dimensional polytopes at once PALP interface still may be the fastest. |
comment:12
I see. Well, you can do the same current = M.zero_vector()
for i in range(M.rank()):
current[i] = m[i, j] (there are 2 of these) and p = lattice.zero_vector()
for j, e in enumerate(f.readline().split()):
p[j] = int(e) |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
comment:14
Travis - many many many thanks for reviewing all these tickets, making suggestions, and pushing me to implement them! I got 3-fold reduction in function calls for Regarding using columns of matrices - it is kind of incompatible with I have also dropped |
comment:15
Replying to @novoselt:
Not a problem. I'm sorry to took me a while to get through them all.
I see.
Yea, that's not too surprising. I didn't think they were being used considering the datatypes, but it was more just-in-case. LGTM. Positive review. |
Changed branch from u/novoselt/points_without_PALP to |
A follow up to #22391. My original problem was too slow computation of zero via
Sage 7.6.beta4 gives
With Always use PPL for facet normals of lattice polytopes #22391
With this one
As a less contrived example, it now takes 0.41s to get
ReflexivePolytopes(3)
(cached afterwards) instead of 7.61s. Part of the speed up is due to omitting some precomputation, but it is possible to do so because of speed up on demand.Next goal is not to rely on PALP for computing points of standalone polytopes at all, although for large sets of polytopes it still may be the fastest option.
Depends on #22391
Depends on #22400
Component: geometry
Keywords: sd91
Author: Andrey Novoseltsev
Branch/Commit:
e37e8f7
Reviewer: Travis Scrimshaw
Issue created by migration from https://trac.sagemath.org/ticket/22524
The text was updated successfully, but these errors were encountered: