I have the following Magma code, and I want to rewrite it in Sage.
L:=Lattice(Matrix(Rationals(),2,2,[N2t,0,tau,1]), Matrix(Rationals(),2,2,[1,0,0,1]));
Matrix(Rationals(),2,2,[1,0,0,D]));
"Lattice:\n",L;
"\nBasis matrix:\n",LLLBasisMatrix(L);
In Sage I have something like this:
M = Matrix(QQ, [(N2t,0,tau,1), (1,0,0,1)])
M.LLL()
Whose output is not exactly the same thing produced by the above Magma code. I think the main problem is that I use a matrix and just apply the LLL algorithm to it in the Sage part. Whereas, in Magma there a lattice created, and then the LLLBasisMatrix
function (https://magma.maths.usyd.edu.au/magma/handbook/text/312#2964) called. Roughly speaking that function does this:
Given a lattice L with basis matrix B,
return the LLL basis matrix B' of L,
together with the transformation
matrix T such that B'=TB. The LLL
basis matrix B' is simply defined to
be a LLL-reduced form of B; it is
stored in L when computed and
subsequently used internally by many
lattice functions. The LLL basis
matrix will be created automatically
internally as needed with δ=0.999 by
default (note that this is different
from the usual default of 0.75); by
the use of parameters to this function
one can ensure that the LLL basis
matrix is created in a way which is
different to the default.
How does one create a lattice in Sage? And does Sage have a function similar to LLLBasisMatrix
above? If not, how can I achieve the same functionality in Sage?
As for numeric example, I have the following values:
N2t = 1136868377216160297393798828125
D = 53364935730486508893809772233249725927747397616650814998641
tau = 954690521650617175389887577728
and if I call the above Magma code with these values, I get the following result for the basis matrix:
[-182177855565543122003911250397 1]
[ 772512666085074053385976327331 2]
whereas if I call the above Sage code with the above values, I get the following result:
[1136868377216160297393798828125 0 954690521650617175389887577728 1]
[1 0 0 53364935730486508893809772233249725927747397616650814998641]