A C++ program that converts a matrix into Reduced Row Echelon Form (RREF) using the Gauss–Jordan elimination method.
g++ rref.cpp
./rref
When the program runs you will be prompted for the number of columns and rows of your input matrix, after which the program will do the row calculations and print the RREF.
The program follows these steps:
- Find a nonzero entry in the current column at or below the pivot row. If none exists, move to the next column.
- Swap the selected row into the pivot position.
- Divide the pivot row by its pivot so the pivot becomes 1.
- Subtract multiples of the pivot row from every other row to make the remaining entries in that column zero.
- Move to the next pivot row and repeat.
The program uses the double datatype to represent matrix entries and a tolerance of 1e-9 (small) to handle the floating-point rounding errors.
This project is licensed under the MIT License.
See LICENSE for details.