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 = {292835796, 51167112, 365399232, 36053868, 106038972}
o1 : List
|
i2 : (g,z) = gcdLLL s
o2 = (372, | -9 10 20 13 0 |)
| 27 18 15 16 -7 |
| 1 -7 -22 -7 3 |
| 7 -27 1 25 6 |
| 6 -3 13 -28 -9 |
o2 : Sequence
|
i3 : matrix{s} * z
o3 = | 0 0 0 0 372 |
1 5
o3 : Matrix ZZ <--- ZZ
|