Documentation contents

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
Source
atlas-scripts/lattice.at (228 lines)
Definitions
31
Loads
Loaded by
galois.at projectors_using_character_tables.at synthetic.at group_operations.at center.at extended_misc.at

Definitions in source order

image_lattice

L14image_lattice (mat A) = mat
Compute 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

L22is_saturated (mat M) = bool
whether |image_lattice(M)| is a saturated lattice (direct factor of $\Z^n$)

adapted_direct_sum

L42adapted_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

L57image_subspace (mat M) = mat
generators for $\Q$-span of image of |M|

image_complement_basis

L60image_complement_basis (mat M) = mat

saturation

L63saturation = image_subspace@mat
intersection of $\Z^n$ with $\Q$-span

free_quotient_lattice_basis

L67free_quotient_lattice_basis (mat M) = mat
a 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

L74saturation_quotient_basis = image_complement_basis@mat
a basis representing the quotient by saturation of sublattice, so no test

projector_to_image

L81projector_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

L85image_projector(mat M) = mat
alternate form: an mxc matrix, giving projection to Im(M) in the basis image_subspace(M)

projector_mod_image

L89projector_mod_image (mat M) = mat
complementary projector, to chosen complement to |image_subspace(M)|

mod_image_projector

L94mod_image_projector(mat M) = mat
alternate form: an mx(m-c) matrix, giving projection to the complement of Im(M),
in the basis image_complement_basis(M)

decompose 2 overloads

L101decompose (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.
L105decompose (mat M, ratvec w) = (ratvec,ratvec)

also defined in character_tables.at

restrict_action

L112restrict_action (mat A, mat M) = mat
assuming 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

L118corestrict_action (mat M,mat A) = mat
assuming 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

L127quotient_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

L130solve_ratvec (mat A, vec v) = ratvec
integer vector (lattice) solutions to linear system
L133

in_lattice

L136in_lattice (mat A, ratvec u) = bool
whether v in image lattice of A

also in this file at line 224

in_lattice_subspace_sum

L140in_lattice_subspace_sum (mat L,mat V) = (ratvec->bool)
whether in the sum of lattice |L| and rational subspace spanned by |V|

vec_solve

L150vec_solve (mat A, ratvec u) = Maybe<vec>
integer solution to A*x=b

in_lattice_basis

L158in_lattice_basis (mat A,mat M) = mat
express 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

L163select_columns([int] columns, mat M) = mat

select_rows

L164select_rows([int] rows, mat M) = mat

first_columns

L165first_columns(int n,mat M) = mat

first_rows

L166first_rows(int n,mat M) = mat

intersection_plus

L174intersection_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

L184intersection(mat A,mat B) = mat
just return the matrix giving the intersection

also defined in sub_cells.at

adapted_direct_sum_plus

L203adapted_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

L216finite_quotient(mat M)
generators of finite abelian group Z^n/A

in_lattice

L224in_lattice (ratmat A, ratvec v) = bool
test 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).