Calculates the row echelon form of a matrix (performs Gaussian elimination on it).