Documentation contents

atlas Library · Script File

matrix.at

Functions for some non elementary but general matrix operations, like finding
a left or right inverse of a given matrix, if one exists.
Source
atlas-scripts/matrix.at (161 lines)
Definitions
19
Loads
Loaded by
restricted_roots.at K.at ratmat.at structure_constants.at

Definitions in source order

upper_unitriangular_inverse

L8upper_unitriangular_inverse (mat U) = mat

also defined in polynomial.at

ech_up

L25ech_up (mat M, [int] pivot) = (mat,mat)
The function |ech_up| is a complement to the built-in |echelon@mat| (which
produces an "upper" column echelon form by column operations) that, in case
some pivots are below the main diagonal, complements this with row operations
to make the result truly "upper" (meaning all sub-diagonal entries are zero).

Make (assumed) result of |echelon| upper triangular using row operations,
possibly with trailing null rows; return the resulting triangular matrix, and
the row operations matrix (the one left-multiplied by to obtain it)
transpose back on exit
L43

left_inverse

L45left_inverse(mat A) = mat
for injective map to saturated sublattice

also defined in ratmat.at

right_inverse

L55right_inverse(mat A) = mat
section of a surjective lattice map A

also defined in ratmat.at

weak_left_inverse

L65weak_left_inverse(mat A) = (mat,int)
left inverse after saturation

factor_scalar

L72factor_scalar (mat M) = (int,mat)
factor out common divisor

principal_submatrix

L75principal_submatrix(mat M, [int] S) = mat
choice |S| of rows, columns

main_diagonal_square_block

L78main_diagonal_square_block(mat M, int size, int offset) = mat

top_left_square_block

L80top_left_square_block(mat M,int size) = mat

also defined in polynomial.at

leading_principal_minor

L81leading_principal_minor(mat M,int size) = mat
select/first_rows/columns are defined in lattice.at
L83

row_echelon

L86row_echelon(mat M) = mat
row echelon form, just the mat itself, see builtin |echelon|

merge_matrices

L89merge_matrices ([mat] matrices) = mat
concatenate matrices with same number of rows

also defined in K_Nilpotent.at

string_compact

L92string_compact (mat M) = string

add_to_matrix_entry

L101add_to_matrix_entry(mat M, int i, int j, int value) = mat
add an integer to one entry of a matrix; language already provides this
A: (m,n) matrix, m rows, n columns
 B: (p,q) matrix  p rows, q columns
recall:
 in atlas A[i] is the i^th column
 A[i][j]: j^th row, i^th column
 A[i,j]:  i^th row, j^th column (the usual)

So
A=A[i,j] 0<=i<=p-1, 0<=j<=q-1
B=B[k,l] 0<=k<=m-1, 0<=l<=n-1
let
K=A\otimes B of size (mp,nq)
so
K=K[x,y] with 0<= x <= mp-1, 0<= y <= nq-1

K[pr+v,qs+w]=A[r,s]*B[v,w]
where r<=m-1, v<=p-1 => pr+v<=p(m-1)+(p-1)=pm-1
where s<=n-1, w<=q-1 => qs+w<=q(n-1)+(q-1)=qn-1
inverting:
K[x,y]=A[r,s]*B[v,w] where
x=pr+v,r<=m-1, v<=p-1 => r=x\p, v=x%p
y=qs+w,s<=n-1, w<=q-1 => r=y\q, w=y%q

Conclusion:

K[x,y]=A[x\p,y\q]*B[x%p,y%q]  (x<=mp-1, y<=nq-1)
L105

kronecker_product

L134kronecker_product(mat A,mat B) = mat
mp rows, nq columns
L140

Kronecker_product

L142Kronecker_product(mat A,mat B) = mat
tools to keep track of the indices
L144
Given (m,n) and (p,q)
 X={(x,y) | x<=mp-1, y<=nq-1}
 Y={(r,s,v,w) | r<=m-1, s<=n-1 v<=p-1, w<=q-1}
 (all indices are >=0)
 kronecker_f: X -> Y
 kronecker_g: Y -> X
are inverse bijections
L145

kronecker_f

L153kronecker_f(int m, int n, int p, int q) = ((int, int)->(int,int,int,int))

kronecker_g

L158kronecker_g(int m, int n, int p, int q) = ((int,int, int, int)->(int,int))

Generated from atlas-scripts at commit 648506c (2026-10-13).