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 initalnrbyncpart ofm.
- inverse: (U32Matrix, Integer) -> Union(U32Matrix, failed)
inverse(m, p)computes inverse ofmmodulop. Returns “failed” whenmis not invertible.
- lower_triangular_inverse: (U32Matrix, U32Vector, Integer) -> U32Matrix
lower_triangular_inverse(m, piv, p)computes transpose of the inverse ofmmodulop.mis assumed lower triangular,pivshould contains inverses of diagonal elements ofm.
- lup_decomposition: (U32Matrix, Integer) -> Record(lpart: U32Matrix, upart: U32Matrix, udinv: U32Vector, ppart: U32Vector)
lup_decomposition(m, p)computes LUP decomposition ofmmodulop, that us [l,u, ud,pp] such that l*transpose(u) equals to permutation of rows ofmgiven bypp,landuare lower triangular andlhas 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)multipliesm1by ncols(m1) timesdpart of transpose ofm2modulop. Error ifm2is too small.
- mul_mv: (U32Vector, U32Matrix, U32Vector, Integer) -> Void
mul_mv(vr, m, v, p)multiplesvbymmodulopand puts the result invr.
- shift_mat!: (U32Matrix, Integer, Integer, Integer) -> Void
shift_mat!(m, sa, nr, nc)replace entries in initalnrbyncpart ofmby corresonding entries with row index increaded bysa.
- triangular_multiply: (U32Matrix, U32Matrix, U32Vector, Integer) -> U32Matrix
triangular_multiply(m1, m2, pa, p)multipliesm1by transpose ofm2modulop. After that columns of the product are permuted, columnjof the product goes to columnpa(j) of the result.m1andm2are assumed upper triangular.