|
Isis 3.0 Developer's Reference (API) |
Home |
00001 #ifndef Matrix_h 00002 #define Matrix_h 00003 00025 #include <vector> 00026 #include "tnt/tnt_array2d.h" 00027 00028 namespace Isis { 00050 class Matrix { 00051 public: 00052 Matrix(const int n, const int m, const double value = 0.0); 00053 Matrix(TNT::Array2D<double> matrix); 00054 ~Matrix(); 00055 00056 static Matrix Identity(const int n); 00057 00058 inline int Rows() { 00059 return p_matrix.dim1(); 00060 }; 00061 inline int Columns() { 00062 return p_matrix.dim2(); 00063 }; 00064 00065 double Determinant(); 00066 double Trace();; 00067 00068 std::vector<double> Eigenvalues(); 00069 00070 Matrix Add(Matrix &matrix); 00071 Matrix Subtract(Matrix &matrix); 00072 Matrix Multiply(Matrix &matrix); 00073 Matrix Multiply(double scalar); 00074 Matrix MultiplyElementWise(Matrix &matrix); 00075 Matrix Transpose(); 00076 Matrix Inverse(); 00077 Matrix Eigenvectors(); 00078 00079 inline double *operator[](int index) { 00080 return p_matrix[index]; 00081 }; 00082 Matrix operator+ (Matrix &matrix) { 00083 return Add(matrix); 00084 }; 00085 Matrix operator- (Matrix &matrix) { 00086 return Subtract(matrix); 00087 }; 00088 Matrix operator* (Matrix &matrix) { 00089 return Multiply(matrix); 00090 }; 00091 Matrix operator* (double scalar) { 00092 return Multiply(scalar); 00093 }; 00094 00095 private: 00096 TNT::Array2D<double> p_matrix; 00097 }; 00098 00099 std::ostream &operator<<(std::ostream &os, Matrix &matrix); 00100 }; 00101 00102 #endif