#include #include #include #include "Matrix.h" using namespace std; int main() { int m, n; cout << "Enter dimensions of matrix: "; cin >> m >> n; Matrix a(m, n); cout << "Enter elements of matrix:" << endl; cin >> a; Matrix a0 = a; cout << fixed << setprecision(6); cout << "Initial matrix:" << endl; cout << a; int rank = a.gauss(); cout << "Rank of matrix = " << rank << endl; cout << "Echelon form:" << endl; cout << a; if (a.rows() == a.cols()) { double d = a[0][0]; for (int i = 1; i < a.rows(); ++i) { d *= a[i][i]; } cout << "Determinant = " << d << endl; } int rank1 = a0.rref(); assert(rank == rank1); cout << "Reduced row echelon form:" << endl; cout << a0; return 0; }