// Modular matrix header file // Implementor: Michael J. Fischer // Date: February 6, 2005 #ifndef MATRIX_H #define MATRIX_H #include #include using namespace std; //=============================================================== // Matrix class class Matrix { private: const int nrows_; const int ncols_; int** rowhead_; void allocate(); public: Matrix(int n, int m); Matrix(const Matrix& A, int row1, int row2, int col1, int col2); ~Matrix(); Matrix(const Matrix& A) : nrows_(0), ncols_(0) { cerr << "Program error: default copy constructor called by mistake" << endl; exit(1); } int* operator[] (int k) const { return rowhead_[k]; } int nrows() const { return nrows_; } int ncols() const { return ncols_; } void mod( const Matrix& A, int n ); void chinese( const Matrix& A1, int n1, const Matrix& A2, int n2 ); void swapRows(int i, int j); void scaleRow(int i, int c, int n, int col); void addMultToRow(int k, int c, int n, int i, int col); int gauss(int modulus); void inverse26( const Matrix& A ); void print(ostream& out ) const; }; //=============================================================== // Extend ostream << operator inline ostream& operator<< ( ostream& out, const Matrix& A ) { A.print( out ); return out; } #endif