A python algorithm for converting a matrix to reduced row echelon form