GENERIC INTERFACE GaussElim (Elem); (* Gaussian elimination on matrices of "Elem.T"s. Created 95-02-27 by J. Stolfi. Last edited by stolfi *) PROCEDURE Triangularize(VAR m: ARRAY OF ARRAY OF Elem.T; total: BOOLEAN := FALSE); (* Reduces "m" to upper triangular form by elementary row operations. A matrix "m" is {\em upper tr1iangular} if the elements "m[i][j]" with "i > j" are all zero. An {\em elementary row operation} consists of adding a multiple of one row to another row; a {\em row swap} consists of exchanging two rows and negating one of them. Observe that these operations are equivalent to premultiplying the matrix by a square matrix with unit determinant. If "total" is true, the procedure keeps applying elementary row operations until "m" is {\em totally reduced}, that is, each row that is not entirely zero has at least one more leading zero than the preceding row. *) END GaussElim.