|
Open PaperOpt
|
00001 00006 #pragma once 00007 #ifndef MATRIX_H 00008 #define MATRIX_H 00009 00010 // INCLUDES 00011 // 00012 #include "wavepacket.h" 00013 00014 class Matrix 00015 { 00016 public: 00017 // LIFECYCLE 00018 00022 Matrix(void); 00023 00032 Matrix(int rows, int columns); 00033 00039 Matrix(const Matrix& m); 00040 00044 ~Matrix(void); 00045 00046 // OPERATIONS 00047 00053 const Matrix transpose() const; 00054 00060 void identity(void); 00061 00062 // OPERATORS 00063 00071 const Matrix operator*(const Matrix& m) const; 00072 00080 const V3<double> operator*(const V3<double>& v) const; 00081 Matrix &operator=(const Matrix& m); 00082 00083 // ACCESS 00084 00095 double& operator()(int i, int j) const {return *(mP + mRows * j + i);} 00096 00106 const V3<double> row(int i) const; 00107 00117 void set_row(int i, const V3<double>& v); 00118 00119 int get_r_size() const { return mRows; } 00120 int get_c_size() const { return mColumns; } 00121 00122 private: 00123 //Used internally to change the dimension 00124 void Matrix::setSize(int rows, int columns); 00125 //Number of rows and columns stored here 00126 int mRows; 00127 int mColumns; 00128 //Pointer to the data stored here 00129 double *mP; 00130 }; // Matrix 00131 00132 #endif // MATRIX_H