-
-
Notifications
You must be signed in to change notification settings - Fork 518
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
expose fplll enumeration routines in IntegralLattice #38492
expose fplll enumeration routines in IntegralLattice #38492
Conversation
(Cc: @GiacomoPope) |
basis = L.basis_matrix() | ||
|
||
import fpylll | ||
gmat = fpylll.IntegerMatrix(dim, dim) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's the IntegerMatrix.from_matrix()
method, could you not do
gmat = fpyll.IntegerMatrix.from_matrix(gram)
gso = fpylll.GSO.Mat(gmat, gram=True)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some very small comments which could be ignored. Thank you for adding this to Sage, I should have done it ages ago.
coord = None | ||
if target is not None: | ||
coord = basis.solve_left(target) | ||
Mu = 1 + matrix([gso.get_mu(i,j) for j in range(dim)] for i in range(dim)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's also a to_matrix()
method, so something like:
Mu = 1 + matrix(gso.to_matrix())
might work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't work for me https://sagecell.sagemath.org/?q=yduvls (10.3)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh for the MatGSO type it's the property .gso.G
Mu = 1 + matrix(gso.G)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahha yes. I think this should be added before it's merged, seems quicker :-)
if len(combs) < count: | ||
bound *= 2 | ||
continue | ||
for length,comb in combs: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for length,comb in combs: | |
for length, comb in combs: |
Documentation preview for this PR (built with commit f2c4e22; changes) is ready! 🎉 |
Thanks for the reviews! I think this is now already in the process of getting merged. Perhaps your suggested changes would best be done as a (small) follow-up? |
Sure I'll make a PR for those two. It's essentially meaningless tho! |
This seems to be causing doctest failures for me on OS X 14.6:
Can you please open up a follow-up to fix this? |
FWIW, here is what I get on Apple Silicon for macOS 12.7.6: All tests passed! |
Is the enumeration order relevant? The only difference in the output is the transposition of the two vectors |
Yeah I don't think the output order is/should be deterministic for any reason. I can make a PR and add a |
Actually, since the norm of the vectors aren't necessarily non-decreasing, the first n outputs of the iterator might not be the same. So I think it's best to mark it #random. |
…andomness Reported at sagemath#38492 (comment) by @jhpalmieri and @GMS103. Added an extra test because why not. URL: sagemath#38524 Reported by: grhkm21 Reviewer(s): Lorenz Panny
…andomness Reported at sagemath#38492 (comment) by @jhpalmieri and @GMS103. Added an extra test because why not. URL: sagemath#38524 Reported by: grhkm21 Reviewer(s): Lorenz Panny
This is useful for situations where we'd like to iterate over short-ish or close-ish vectors without necessarily requiring the shortest/closest solution, and without knowing a priori how many vectors we need to try. Among other things, it shows up in some algorithms for solving (quaternion) norm equations.