// Modular matrix implementation file // Implementor: Michael J. Fischer // Date: February 6, 2005 #include #include #include #include "error.h" #include "matrix.h" #define DEBUG(x) using namespace std; //=============================================================== // Construct n x m matrix Matrix::Matrix(int n, int m) : nrows_(n), ncols_(m) { allocate(); } //--------------------------------------------------------------- // Copy constructor from submatrix Matrix::Matrix(const Matrix& A, int r1, int r2, int c1, int c2) : nrows_(r2-r1), ncols_(c2-c1) { allocate(); for (int i=r1; i> n; // Allocate n x n matrix for K Matrix K(n, n); // Read input into K for (int i=0; i> K[i][j]; } } cout << "K:" << endl << K << endl; // Compute K inverse Matrix KINV(n, n); KINV.inverse26(K); cout << "K inverse:" << endl << KINV << endl; return 0; } #endif