00001 #ifndef matrix_h 00002 #define matrix_h 00003 00004 #include <list> 00005 #include <vector> 00006 00007 #include "ncutMemory.h" 00008 00015 class Matrix{ 00016 00017 public: 00018 00019 // functions for read & write access to data members ------ 00020 00027 inline double& val(unsigned int row, unsigned int col) 00028 {return value_[row][col];}; 00029 00030 // functions for read-only access to data members ------ 00031 00038 inline const double& val(unsigned int row, unsigned int col) const 00039 {return value_[row][col];}; 00044 inline unsigned int dim() const 00045 {return dimension_;}; 00046 00047 // class-specific functions ------ 00048 00057 void changeDimension(const unsigned int dimension); 00058 00064 void add(const Matrix* m); 00070 void subtract(const Matrix* m); 00071 00081 auto_array<double> band(int&n, int& nsdiag) const; 00082 00093 int split(Matrix& a, Matrix& b, std::vector<unsigned int>& indexMap, 00094 std::list<unsigned int>& indices) const; 00095 00109 Matrix& inject(const Matrix& m, unsigned int index); 00110 00120 void transform(double* vec) const; 00121 00128 void diag(const double* diag, unsigned int dim); 00129 00136 Matrix& operator=(double val); 00143 Matrix& operator+=(const Matrix& operand); 00150 Matrix& operator-=(const Matrix& operand); 00151 00152 // standard functions ------ 00153 00159 Matrix(unsigned int dimension=0); 00168 Matrix(const double *diag, unsigned int dim); 00174 Matrix(const Matrix& clone); 00178 virtual ~Matrix(); 00179 00186 virtual Matrix& operator=(const Matrix& clone); 00187 00188 protected: 00189 00190 double** value_; 00191 unsigned int dimension_; 00192 }; 00193 00194 #endif