00001 00008 #ifndef MORPHEUS_MATRIX_H_ 00009 #define MORPHEUS_MATRIX_H_ 00010 00011 #include "Morpheus_Vector.h" 00012 00013 namespace Morpheus { 00014 00025 class Matrix { 00026 public: 00029 00036 Matrix(const int nrows, const int ncols); 00037 00042 ~Matrix(); 00044 00047 00067 double& operator()(const int row, const int col); 00068 00070 int getNumRows() const; 00071 00073 int getNumCols() const; 00074 00076 int getNumEntries() const; 00078 00081 00094 void multiply(const Vector& X, Vector& Y) const; 00095 00108 void multiply(const Matrix& X, Matrix& Y) const; 00110 00113 00119 bool isSymmetric() const; 00120 00127 bool isUpperTriangular() const; 00128 00139 bool approxEqual(const Matrix& m, const double tol) const; 00141 00144 00146 double norm1() const; 00147 00149 double normInf() const; 00151 00154 00165 void print() const; 00167 00168 private: 00170 int nrows_; 00172 int ncols_; 00174 double** data_; 00175 }; 00176 00177 } /* namespace Morpheus */ 00178 #endif /* MORPHEUS_MATRIX_H_ */