Hi there,
You can do it by calling down to FPyLLL which (together with NTL) powers
lattice reduction in Sage. Here’s an example:
#+begin_src jupyter-python :kernel sagemath
A = random_matrix(ZZ, 10, 10, x=-1, y=2)
A.echelonize() # make it interesting by turning into HNF
print("# Input")
print(A)
print()
from fpylll import IntegerMatrix, GSO, LLL
B = IntegerMatrix.from_matrix(A)
M = GSO.Mat(B)
M.update_gso()
L = LLL.Reduction(M)
L.size_reduction()
C = B.to_matrix(matrix(ZZ, 10, 10)) # back to Sage's format
print("# Output")
print(C)
print()
#+end_src
#+RESULTS:
#+begin_example
# Input
[ 1 0 0 0 0 0 0 0 0 41]
[ 0 1 0 0 0 0 0 0 0 34]
[ 0 0 1 0 0 0 0 0 1 27]
[ 0 0 0 1 0 0 0 0 1 96]
[ 0 0 0 0 1 0 0 0 0 38]
[ 0 0 0 0 0 1 0 0 1 78]
[ 0 0 0 0 0 0 1 0 1 1]
[ 0 0 0 0 0 0 0 1 1 91]
[ 0 0 0 0 0 0 0 0 2 69]
[ 0 0 0 0 0 0 0 0 0 100]
# Output
[ 1 0 0 0 0 0 0 0 0 41]
[ -1 1 0 0 0 0 0 0 0 -7]
[ -1 0 1 0 0 0 0 0 1 -14]
[ -1 -1 -1 1 0 0 0 0 0 -6]
[ -1 0 0 0 1 0 0 0 0 -3]
[ 0 0 0 -1 0 1 0 0 0 -18]
[ 0 0 0 0 0 0 1 0 1 1]
[ 0 0 0 -1 0 0 0 1 0 -5]
[ 1 0 0 -1 0 0 0 0 1 14]
[ 0 0 0 -1 0 0 0 0 -1 4]
#+end_example
Cheers,
Martin
Santanu Sarkar <[email protected]> writes:
> Dear all,
> In Sagemath, is it possible to change a basis
> of a lattice which is size reduced? That is my interest is only on
> 1st condition of LLL basis.
>
>
> Kind regards,
> Santanu
--
_pgp: https://keybase.io/martinralbrecht
_www: https://malb.io
--
You received this message because you are subscribed to the Google Groups
"sage-support" 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/sage-support/871rcet773.fsf%40googlemail.com.