next | previous | forward | backward | up | top | index | toc | home
LLLBases > gcdLLL

gcdLLL -- compute the gcd of integers, and small multipliers

Synopsis

Description

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 = {308594832, 59928828, 4302924, 193869660, 286246560}

o1 : List
i2 : (g,z) = gcdLLL s

o2 = (372, | 3   15  11  -6  -2  |)
           | 0   -12 15  -37 21  |
           | 21  -16 17  27  -3  |
           | 11  -8  -24 -18 13  |
           | -11 -8  1   26  -11 |

o2 : Sequence
i3 : matrix{s} * z

o3 = | 0 0 0 0 372 |

              1        5
o3 : Matrix ZZ  <--- ZZ

See also

Ways to use gcdLLL :