ModularU32MatrixOperations

u32vec.spad line 1038 [edit on github]

This is specialized solver for systems of linear equations modulo 32-bit prime, using efficient low-level representation of data.

copy_mat_part: (U32Matrix, Integer, Integer) -> U32Matrix

copy_mat_part(m, nr, nc) returns a copy of inital nr by nc part of m.

inverse: (U32Matrix, Integer) -> Union(U32Matrix, failed)

inverse(m, p) computes inverse of m modulo p. Returns “failed” when m is not invertible.

lower_triangular_inverse: (U32Matrix, U32Vector, Integer) -> U32Matrix

lower_triangular_inverse(m, piv, p) computes transpose of the inverse of m modulo p. m is assumed lower triangular, piv should contains inverses of diagonal elements of m.

lup_decomposition: (U32Matrix, Integer) -> Record(lpart: U32Matrix, upart: U32Matrix, udinv: U32Vector, ppart: U32Vector)

lup_decomposition(m, p) computes LUP decomposition of m modulo p, that us [l, u, ud, pp] such that l*transpose(u) equals to permutation of rows of m given by pp, l and u are lower triangular and l has ones at diagonal. ud gives inverses of pivots (zero if there is no pivot in a given column).

mmul: (U32Matrix, U32Matrix, Integer, Integer) -> U32Matrix

mmul(m1, m2, d, p) multiplies m1 by ncols(m1) times d part of transpose of m2 modulo p. Error if m2 is too small.

mul_mv: (U32Vector, U32Matrix, U32Vector, Integer) -> Void

mul_mv(vr, m, v, p) multiples v by m modulo p and puts the result in vr.

shift_mat!: (U32Matrix, Integer, Integer, Integer) -> Void

shift_mat!(m, sa, nr, nc) replace entries in inital nr by nc part of m by corresonding entries with row index increaded by sa.

triangular_multiply: (U32Matrix, U32Matrix, U32Vector, Integer) -> U32Matrix

triangular_multiply(m1, m2, pa, p) multiplies m1 by transpose of m2 modulo p. After that columns of the product are permuted, column j of the product goes to column pa(j) of the result. m1 and m2 are assumed upper triangular.