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.
Definitions in source order
upper_unitriangular_inverse
L8
upper_unitriangular_inverse (mat U) = matalso defined in polynomial.at
ech_up
L25
ech_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 exitL43
left_inverse
L45
left_inverse(mat A) = matfor injective map to saturated sublattice
also defined in ratmat.at
right_inverse
L55
right_inverse(mat A) = matsection of a surjective lattice map A
also defined in ratmat.at
weak_left_inverse
L65
weak_left_inverse(mat A) = (mat,int)left inverse after saturation
factor_scalar
L72
factor_scalar (mat M) = (int,mat)factor out common divisor
principal_submatrix
L75
principal_submatrix(mat M, [int] S) = matchoice |S| of rows, columns
main_diagonal_square_block
L78
main_diagonal_square_block(mat M, int size, int offset) = mattop_left_square_block
L80
top_left_square_block(mat M,int size) = matalso defined in polynomial.at
leading_principal_minor
L81
leading_principal_minor(mat M,int size) = matselect/first_rows/columns are defined in lattice.atL83
row_echelon
L86
row_echelon(mat M) = matrow echelon form, just the mat itself, see builtin |echelon|
merge_matrices
L89
merge_matrices ([mat] matrices) = matconcatenate matrices with same number of rows
also defined in K_Nilpotent.at
string_compact
L92
string_compact (mat M) = stringprint_matrix_compact
L98
print_matrix_compact(mat M)add_to_matrix_entry
L101
add_to_matrix_entry(mat M, int i, int j, int value) = matadd 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
L134
kronecker_product(mat A,mat B) = matmp rows, nq columnsL140
Kronecker_product
L142
Kronecker_product(mat A,mat B) = mattools to keep track of the indicesL144
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 bijectionsL145kronecker_f
L153
kronecker_f(int m, int n, int p, int q) = ((int, int)->(int,int,int,int))kronecker_g
L158
kronecker_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).