Skip to content

Conversation

@GiacomoPope
Copy link
Contributor

Very small edits which were noticed while reviewing #38492 but missed before merge. Could marginally help performance for larger matrices by using fpylll class methods.

@yyyyx4
Copy link
Member

yyyyx4 commented Aug 11, 2024

**********************************************************************
File "src/sage/modules/free_quadratic_module_integer_symmetric.py", line 1544, in sage.modules.free_quadratic_module_integer_symmetric.FreeQuadraticModule_integer_symmetric._fplll_enumerate
Failed example:
    [next(close) for _ in range(10)]
Expected:
    [(1, 0, 6, -9), (1, -1, 5, -9), (2, 0, 6, -9), (1, 0, 5, -9), (1, -1, 5, -10),
     (2, 1, 6, -9), (1, 0, 5, -10), (2, 0, 5, -9), (1, 0, 6, -8), (1, -1, 6, -9)]
Got:
    [(-12, -3, 15, -20),
     (-12, -2, 16, -19),
     (-12, -2, 16, -20),
     (-12, -3, 16, -19),
     (-12, -3, 16, -20),
     (-13, -3, 15, -20),
     (-12, -2, 17, -19),
     (-11, -2, 16, -19),
     (-11, -2, 16, -20),
     (-13, -4, 15, -20)]
**********************************************************************
File "src/sage/modules/free_quadratic_module_integer_symmetric.py", line 1621, in sage.modules.free_quadratic_module_integer_symmetric.FreeQuadraticModule_integer_symmetric.enumerate_close_vectors
Failed example:
    [next(close) for _ in range(10)]
Expected:
    [(1, -18, 123, 148), (2, -19, 124, 148), (0, -17, 122, 148), (3, -20, 125, 148), (-1, -16, 121, 148),
     (-2, -20, 125, 152), (-2, -23, 123, 148), (4, -21, 126, 148), (-3, -22, 122, 148), (-3, -19, 124, 152)]
Got:
    [(597, 2079, 2106, 3216),
     (598, 2078, 2107, 3216),
     (598, 2081, 2109, 3220),
     (597, 2082, 2108, 3220),
     (596, 2080, 2105, 3216),
     (599, 2077, 2108, 3216),
     (599, 2080, 2110, 3220),
     (601, 2083, 2107, 3216),
     (602, 2082, 2108, 3216),
     (596, 2083, 2107, 3220)]
**********************************************************************

@GiacomoPope
Copy link
Contributor Author

Oh I'm stupid. I shouldn't have made this change.

Only thing I'd like to try is make gso.babai(target) work, but I can only get this working with gso.babai(target, gso=True) and gso.to_canonical() errors...

Will close this unless you think making gso.babai work for the closest vector is interesting @yyyyx4

@yyyyx4
Copy link
Member

yyyyx4 commented Aug 11, 2024

There's already a reference to Babai in sage.modules.free_module_integer.FreeModule_submodule_with_basis_integer. I guess this one would be more general? Not sure.

@GiacomoPope
Copy link
Contributor Author

sage: LL = IntegerLattice(gram)
sage: LL.babai(t)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[32], line 1
----> 1 LL.babai(t)

File /private/var/tmp/sage-10.4-current/local/var/lib/sage/venv-python3.12.4/lib/python3.12/site-packages/sage/modules/free_module_integer.py:875, in FreeModule_submodule_with_basis_integer.approximate_closest_vector(self, t, delta, *args, **kwargs)
    873 b = t
    874 for i in reversed(range(G.nrows())):
--> 875     b -= B[i] * ((b * G[i]) / (G[i] * G[i])).round("even")
    876 return (t - b).change_ring(ZZ)

TypeError: round() takes exactly 0 positional arguments (1 given)

haha another error from types, I guess?

I'm sure the babai should just work but who knows if it's even any faster as we'd have to make the integer lattice here which is annoying. I was hoping to just keep everything within the MatGSO object to avoid having to call "solve" etc to get the closest vector

@GiacomoPope GiacomoPope deleted the enumerate_edit branch August 21, 2024 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants