This function is provided by the package
LLLBases.
The first n-1 columns of the matrix z form a basis of the kernel of the n integers of the list s, and the dot product of the last column of z and s is the gcd g.
The method used is described in the paper:
Havas, Majewski, Matthews,
Extended GCD and Hermite Normal Form Algorithms via Lattice Basis Reduction, Experimental Mathematics 7:2 p. 125 (1998).
For an example,
i1 : s = apply(5,i->372*(random 1000000))
o1 = {311481552, 113741232, 177918672, 194802264, 284807664}
o1 : List
|
i2 : (g,z) = gcdLLL s
o2 = (744, | 8 -16 5 3 -6 |)
| 9 16 22 -6 9 |
| -11 -16 14 15 5 |
| -8 6 0 -34 -9 |
| 0 17 -23 13 6 |
o2 : Sequence
|
i3 : matrix{s} * z
o3 = | 0 0 0 0 744 |
1 5
o3 : Matrix ZZ <--- ZZ
|