atlas Library · Script File
lattice.at
General linear algebra over $\Z$. In so far as saturation of lattices is done, this actually relates to vector spaces over $\Q$, but all computations are done with integers only, distinguishing this script from Gaussian-elim.at
Definitions in source order
image_lattice
L14
image_lattice (mat A) = matCompute what appears to be called the Hermite form of an integral matrix. |M| is an $n\times k$ matrix, so columns of |M| span a $\Z$-submodule $ W=image(M)$ of $\Z^n$; get canonical generators for this submodule
is_saturated
L22
is_saturated (mat M) = boolwhether |image_lattice(M)| is a saturated lattice (direct factor of $\Z^n$)
adapted_direct_sum
L42
adapted_direct_sum (mat M) = (int,mat)The function |adapted_direct_sum| finds the dimenion |k| of the image of |M|, and a $\Z$-inverible matrix |R| whose first |c| columns span the saturation of the image, while remaining ones span a chosen complement of that saturation. Apart from the initial call of |echelon| to standardise the image and compute the list of |pivot| positions, this function is very similar to |ech_up| in matrix.at, but the inverse of the recording matrix is needed here, and since replacing columns is easier than replacing rows, we maintain the matrix in inverse transposed form so that we can still maintina it by column operations. We avoid using |adapted_basis| and |diagonalize|, which may suffer severe coefficient growth for not too small matrices; we do however use |echelon| and |Bezout| that might have similar effects. It is to be used in situations where only the (saturated) image subspace as a whole, and possibly a choice of a complementary subspace, are needed, not a special basis for the image.
image_subspace
L57
image_subspace (mat M) = matgenerators for $\Q$-span of image of |M|
image_complement_basis
L60
image_complement_basis (mat M) = matsaturation
L63
saturation = image_subspace@matintersection of $\Z^n$ with $\Q$-span
free_quotient_lattice_basis
L67
free_quotient_lattice_basis (mat M) = mata basis representing the quotient by sublattice spanned by columns of |M|; tests that this sublattice is a direct factor, and throws an error if not
saturation_quotient_basis
L74
saturation_quotient_basis = image_complement_basis@mata basis representing the quotient by saturation of sublattice, so no test
projector_to_image
L81
projector_to_image (mat M) = mat|M| is an $n\times k$ matrix; its columns span a submodule $W$ of $\Z^n$. Compute $n\times n$ matrix of projection onto the saturation (or $\Q$-span) of $W$, parallel to its complement from |adapted_direct_sum(M)|.
image_projector
L85
image_projector(mat M) = matalternate form: an mxc matrix, giving projection to Im(M) in the basis image_subspace(M)
projector_mod_image
L89
projector_mod_image (mat M) = matcomplementary projector, to chosen complement to |image_subspace(M)|
mod_image_projector
L94
mod_image_projector(mat M) = matalternate form: an mx(m-c) matrix, giving projection to the complement of Im(M), in the basis image_complement_basis(M)
decompose 2 overloads
L101
decompose (mat M, vec v) = (vec,vec)|M| is an $n\times k$ matrix; its columns span a submodule $W$ of $\Z^n$. A complement to |image_subspace(M)| is chosen by |adapted_direct_sum(M)|, and |decompose(M,w)=(u,v)| with |u| in |image_subspace(M)| and |v| in complement.
L105
decompose (mat M, ratvec w) = (ratvec,ratvec)also defined in character_tables.at
restrict_action
L112
restrict_action (mat A, mat M) = matassuming M injective and Im(M) is A-stable, return unique B with A*M=M*B, which is action of A restricted to that sublattice $\Z^m$, embedded via M
shapes A: n by n, M: n by m
corestrict_action
L118
corestrict_action (mat M,mat A) = matassuming M full row rank and ker(M) is A-stable, find unique B with M*A=B*M
shapes M: m by n, A: n by n
quotient_matrix
L127
quotient_matrix (mat A,mat M) = mat|M| is an $n\times k$ matrix; its columns span a subspace $W$ of $\Q^n$. Assuming this subspace is |A|-stable, |A| induces an operator in $\Q^n/W$; return its matrix w.r.t the complement chosen by |adapted_direct_sum(M)|.
solve_ratvec
L130
solve_ratvec (mat A, vec v) = ratvecinteger vector (lattice) solutions to linear systemL133
in_lattice
L136
in_lattice (mat A, ratvec u) = boolwhether v in image lattice of A
also in this file at line 224
in_lattice_subspace_sum
L140
in_lattice_subspace_sum (mat L,mat V) = (ratvec->bool)whether in the sum of lattice |L| and rational subspace spanned by |V|
vec_solve
L150
vec_solve (mat A, ratvec u) = Maybe<vec>integer solution to A*x=b
in_lattice_basis
L158
in_lattice_basis (mat A,mat M) = matexpress columns of M relative to basis A of a sub-lattice that contains them A: nxm matrix, columns are a basis of a Z-module V of rank m M: nxr matrix, columns span a submodule of V; returns mxr matrix C, column i gives column i of M as a sum of columns of A i.e., A*C=M
some auxiliary lattice functions L161
select_columns
L163
select_columns([int] columns, mat M) = matselect_rows
L164
select_rows([int] rows, mat M) = matfirst_columns
L165
first_columns(int n,mat M) = matfirst_rows
L166
first_rows(int n,mat M) = matintersection_plus
L174
intersection_plus(mat A,mat B) = (mat,mat)basis of intersection of two matrices returns (X,Y) where the columns of X span the intersection Y is the first rows of kernel A##B
intersection
L184
intersection(mat A,mat B) = matjust return the matrix giving the intersection
also defined in sub_cells.at
adapted_direct_sum_plus
L203
adapted_direct_sum_plus (mat A) = (int,mat,mat,mat,mat,mat)adapted_direct_sum in all its glory A: (r,n) matrix E: echelon form of A is an (r,n) matrix E= M##Z where M (r,c) matrix (nonzero columns) and Z=(r,n-c) zero matrix echelon(A)=(mat M,mat C,vec s,int eps) (see atlas-functions.help) M: (r,c) matrix, C (n,n) invertible (s: pivot rows, eps is a sign) c=#columns of M n-c=dimension(kernel(A)) Then AC=E=M##Z Furthermore M -> (mat N,mat R) E: (r,c) N:(r,c) R: (r,r) invertible (RN)##Z=E##Z=AC AC=RN##Z Note: image_complement_basis is the last n-c columns of R
finite_quotient
L216
finite_quotient(mat M)generators of finite abelian group Z^n/A
in_lattice
L224
in_lattice (ratmat A, ratvec v) = booltest if ratvec v is in Z-linear span of columns of ratmat A require: columns of A are linearly independent let w=unique solution to A*w=v, return false if w doesn't exist, or boolean is_integer(w) if it does
also in this file at line 136
Generated from atlas-scripts at commit 648506c (2026-10-13).