On Mon, 6 Nov 2023 at 11:46, Oscar Benjamin <[email protected]> wrote:
>
> I don't anticipate any changes to the LLL code between now and the
> 1.13 release except that I might try to add the lll method to Matrix
> so that it is not necessary to convert to DomainMatrix explicitly.

I just did this:
https://github.com/sympy/sympy/pull/25880

As of SymPy 1.13 there will be Matrix methods lll and lll_transform:

In [5]: r = sqrt(2).evalf(10)

In [6]: r
Out[6]: 1.414213562

In [7]: M = Matrix.hstack(eye(3), Matrix([round(10**10*r**2),
round(10**10*r), 10**10]))

In [8]: M
Out[8]:
⎡1  0  0  20000000000⎤
⎢                    ⎥
⎢0  1  0  14142135620⎥
⎢                    ⎥
⎣0  0  1  10000000000⎦

In [9]: M.lll()
Out[9]:
⎡  -1      0       2       0   ⎤
⎢                              ⎥
⎢18928   -33461   9465   19180 ⎥
⎢                              ⎥
⎣-48945  86523   -24472  249260⎦

Top row gives coefficients for the minpoly of sqrt(2):

In [11]: print(minpoly(sqrt(2)))
_x**2 - 2

In [12]: print(Poly(M.lll()[0,:-1], x))
Poly(-x**2 + 2, x, domain='ZZ')

The lll_transform method also gives the transformation matrix that
sends the original basis to the reduced basis:

In [25]: B, T = M.lll_transform()

In [26]: T*M == B
Out[26]: True

--
Oscar

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAHVvXxSWx%2BYd-vT5eMpxG7S9bYrOYeLX7VFatRYotmX0vB%2BeEA%40mail.gmail.com.

Reply via email to