The following functions allow basic operations on elements of lattices. The elements of lattices are simply (row) vectors, just as for R-spaces. Most of the operations for R-space elements are also applicable to lattice elements.
Return the i-th basis element of the current basis of the lattice L.
Given a lattice L of degree n and a sequence Q of length n, create the lattice element with the corresponding sequence elements as entries. The sequence must consist of elements coercible into the base ring of L. The resulting vector must lie within L.
Given a lattice L of rank m and a sequence or vector C=[c1, ..., cm] of length m of integers, create the lattice element c1 .b1 + ... + cm .bm, where [b1, ..., bm] is the basis of L.
Return the zero element of the lattice L.
Given an element v in a lattice L, return its negation -v in L.
Given elements v and w in a lattice L, return the sum v + w in L.
Given elements v and w in a lattice L, return the difference v - w in L.
Given an element v in a lattice L and a scalar s of the ring S, return the product s.v (scalar multiplication of v by s). If s is an integer, the resulting vector will lie in L; otherwise the resulting vector will lie in the R-space of the appropriate degree whose coefficient ring is the parent S of s.
Given an element v in a lattice L and a scalar s of the ring S, return the product (1/s).v (scalar multiplication of v by 1/s). The resulting vector will always lie in the R-space of the appropriate degree whose coefficient ring is the field of fractions of the parent S of s.
Given an element v in a lattice L and an integer d, return the vector (1/d).v (scalar multiplication of v by 1/d) as an element of L if the scaled vector lies in L. If the scaled vector does not lie in L, an error ensues. Note that this is different from v/d.
(Assignment statement.) Replace lattice element v by the sum v + w.
(Assignment statement.) Replace lattice element v by the difference v - w.
(Assignment statement.) Replace lattice element v by the scalar product n.v, where n is an integer.
Given an element v in a lattice L of degree n, return the result of multiplying v from the right by the n x n matrix T. The matrix T may be any matrix which is n by n and over the base ring of L. The resulting product must lie in the lattice L.
Given elements v and w of a lattice L, return their inner product (v, w) with respect to the inner product of L. This is v M wtr where M is the inner product matrix of L.
Given an element v of a lattice L, return its norm (v, v) with respect to the inner product of L. This is v M vtr where M is the inner product matrix of L. Note that in the case of a lattice with standard Euclidean inner product this is the square of the usual Euclidean length.
Given an element v of a lattice L, return its length Sqrt((v, v)) with respect to the inner product of L as an element of the real field K. This is Sqrt(v M vtr) where M is the inner product matrix of L. The argument for the real field K may be omitted, in which case K is taken to be the current default real field. In the case of a lattice with standard Euclidean inner product this is the usual Euclidean length.
Given an element v of a lattice L, return its support, i.e., the numbers of the columns at which v has non-zero entries.
Given an element v of a lattice which is compatible with the lattice L, return true if and only if v is in L.
Given elements v and w of a lattice L, return true if and only if lattice elements v and w of lattice L are equal.
Given elements v and w of a lattice L, return false if and only if lattice elements v and w of lattice L are equal.
Given an element v of a lattice L, return true if and only if v is the zero element L.
Given an element v of a lattice L of degree n, return the sequence of entries of v of length n.
Given an element v of a lattice L having Z-basis [b1, ..., bm], return a sequence [c1, ..., cm] of elements of Z giving the (unique) coordinates of v relative to the Z-basis, so that v = c1 .b1 + ... + cm .bm.
Given a lattice L of degree n having Z-basis [b1, ..., bm], together with an element v of a lattice L' (also of degree n), return a sequence [c1, ..., cm] of elements of Z giving the (unique) coordinates of v relative to the Z-basis of L, so that v = c1 .b1 + ... + cm .bm.
Given an element v of a lattice L having Z-basis [b1, ..., bm], return the vector c = (c1, ..., cm) of the coordinate lattice C of L (see the function CoordinateLattice) giving the (unique) coordinates of v relative to the Z-basis, so that v = c1 .b1 + ... + cm .bm.
Given a lattice L of degree n having Z-basis [b1, ..., bm], together with an element v of a lattice L' (also of degree n), return the vector c = (c1, ..., cm) of the coordinate lattice C of L (see the function CoordinateLattice) giving the (unique) coordinates of v relative to the Z-basis of L, so that v = c1 .b1 + ... + cm .bm.
> L := LatticeWithBasis(3, [1,0,0, 1,2,3, 3,6,2]); > L; Lattice of rank 3 and degree 3 Basis: (1 0 0) (1 2 3) (3 6 2) > Coordelt(L, [1, 2, 1]); ( 6 10 8) > v := L.2; > w := L ! [2, 4, 6]; > Eltseq(v); [ 1, 2, 3 ] > Coordinates(w); [ 0, 2, 0 ] > Coordelt(L, [1, 1, 1]); (5 8 5) > Norm(v); 14 > InnerProduct(v, w); 28 > A := MatrixRing(Integers(), 3); > X := A ! [0,-1,0, 1,0,0, 0,1,2]; > X; [ 0 -1 0] [ 1 0 0] [ 0 1 2] > u := L.1 + L.3; > Determinant(X); 2 > Norm(u); 56 > u * X; ( 6 -2 4) > Norm(u * X); 56