Isis 3 Programmer Reference
Matrix.h
Go to the documentation of this file.
1 #ifndef Matrix_h
2 #define Matrix_h
3 
25 #include <vector>
26 #include "tnt/tnt_array2d.h"
27 
28 namespace Isis {
50  class Matrix {
51  public:
52  Matrix(const int n, const int m, const double value = 0.0);
53  Matrix(TNT::Array2D<double> matrix);
54  ~Matrix();
55 
56  static Matrix Identity(const int n);
57 
58  inline int Rows() {
59  return p_matrix.dim1();
60  };
61  inline int Columns() {
62  return p_matrix.dim2();
63  };
64 
65  double Determinant();
66  double Trace();;
67 
68  std::vector<double> Eigenvalues();
69 
70  Matrix Add(Matrix &matrix);
71  Matrix Subtract(Matrix &matrix);
72  Matrix Multiply(Matrix &matrix);
73  Matrix Multiply(double scalar);
75  Matrix Transpose();
76  Matrix Inverse();
78 
79  inline double *operator[](int index) {
80  return p_matrix[index];
81  };
82  Matrix operator+ (Matrix &matrix) {
83  return Add(matrix);
84  };
85  Matrix operator- (Matrix &matrix) {
86  return Subtract(matrix);
87  };
88  Matrix operator* (Matrix &matrix) {
89  return Multiply(matrix);
90  };
91  Matrix operator* (double scalar) {
92  return Multiply(scalar);
93  };
94 
95  private:
96  TNT::Array2D<double> p_matrix;
97  };
98 
99  std::ostream &operator<<(std::ostream &os, Matrix &matrix);
100 };
101 
102 #endif
Matrix Eigenvectors()
Compute the eigenvectors of the matrix and return them as columns of a matrix in ascending order...
Definition: Matrix.cpp:240
Matrix Add(Matrix &matrix)
Add the two matrices.
Definition: Matrix.cpp:120
Matrix(const int n, const int m, const double value=0.0)
Constructs an n x m Matrix containing the specified default value.
Definition: Matrix.cpp:40
double Determinant()
Compute the determinant of the matrix.
Definition: Matrix.cpp:76
Matrix Transpose()
Compute the transpose of the matrix.
Definition: Matrix.cpp:186
Matrix Multiply(Matrix &matrix)
Multiply the two matrices.
Definition: Matrix.cpp:103
double Trace()
Compute the determinant of the matrix.
Definition: Matrix.cpp:88
Matrix Inverse()
Compute the inverse of the matrix.
Definition: Matrix.cpp:199
~Matrix()
Destroys the Matrix object.
Definition: Matrix.cpp:56
Matrix Subtract(Matrix &matrix)
Subtract the input matrix from this matrix.
Definition: Matrix.cpp:137
std::vector< double > Eigenvalues()
Compute the eigenvalues of the matrix.
Definition: Matrix.cpp:219
Matrix MultiplyElementWise(Matrix &matrix)
Multiply the two matrices element-wise (ie compute C such that C[i][j] = A[i][j]*B[i][j]) ...
Definition: Matrix.cpp:156
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
static Matrix Identity(const int n)
Create an n x n identity matrix.
Definition: Matrix.cpp:61
QDebug operator<<(QDebug debug, const Hillshade &hillshade)
Print this class out to a QDebug object.
Definition: Hillshade.cpp:308
Matrix class.
Definition: Matrix.h:50