Package to help transform 2-D matrix into reduced row-echelon form.
Reduced Row-Echelon Form (RREF) library
This is a simple library for transforming a 2-D matrix to reduced row-echelon form (RREF)1.
In linear algebra, a matrix is in echelon form if it has the shape resulting from a Gaussian elimination.
A matrix being in row echelon form means that Gaussian elimination has operated on the rows, and column echelon form means that Gaussian elimination has operated on the columns. In other words, a matrix is in column echelon form if its transpose is in row echelon form. Therefore, only row echelon forms are considered in the remainder of this article. The similar properties of column echelon form are easily deduced by transposing all the matrices.
A matrix is in reduced row-echelon form if it satisfies the following:
- In each row, the left-most nonzero entry is 1 and the column that contains this 1 has all other entries equal to 0. This 1 is called a leading 1.
- The leading 1 in the second row or beyond is to the right of the leading 1 in the row just above.
- Any row containing only 0's is at the bottom.
Below is a screenshot showing RREF matrices3:
import rref ### Create an uninstanced matrix helper (MatrixMadness) mm = rref.main.MatrixMadness() ### Create a sample matrix of 20 x 20 with random integers ### in the range of -5 to 20. matrix = mm.creatrix(20, [-5, 20]) ### Create an RREF instance with your matrix. r = rref.RREF(matrix) ### Run the processor # Note: The output matrix will be in the r.mm.matrix variable. r.run() ### Print the matrix to check results. result = r.mm.matrix print([i for i in result])
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.