smith2.spad line 1 [edit on github]

Gaussian elimination using only 1 or -1 as pivots

pre_gauss: Matrix Integer -> Matrix Integer

pre_gauss(m) performs Gaussian eliminaton on rows of m using only 1 and -1 as pivots. Note: m is modified in place

pre_lr: (Matrix Integer, Vector Integer, Vector Integer) -> Matrix Integer

pre_lr(m, pi, pj) is like pre_gauss, but records positions of pivots in pi and pj and returns transformation matrix. m, pi, pj are modified in place

pre_smith: Matrix Integer -> Matrix Integer

pre_smith(m) first performs pre_gauss(m) and then drops all rows and colums of m contaning pivots.