#ifndef MATRIXH #define MATRIXH #include #include using namespace std; void error(const char* s); class Matrix{ // This is a row x col matrix int row, col; double *m; public: Matrix(int r , int c=1); // constructors & destructor Matrix(const Matrix& ); ~Matrix(){delete [] m;}; inline double& operator()(int i, int j){ // external store & read return (m[i*col + j]);}; Matrix& operator=( const Matrix& B){ // *this=B // note that this does not follow the standard form for // writing assignment operators. Instead it says it is // an error to write A = B unless A & B have the same size. if( row!=B.row || col!=B.col) error("Matrix=: incompatible sizes"); int i, rc = row*col; for( i=0; i