Isis 3 Programmer Reference
Isis::Matrix Class Reference

Matrix class. More...

#include <Matrix.h>

Collaboration diagram for Isis::Matrix:
Collaboration graph

Public Member Functions

 Matrix (const int n, const int m, const double value=0.0)
 Constructs an n x m Matrix containing the specified default value.
 
 Matrix (TNT::Array2D< double > matrix)
 Constructs a Matrix from the specified TNT Array2D.
 
 ~Matrix ()
 Destroys the Matrix object.
 
int Rows ()
 
int Columns ()
 
double Determinant ()
 Compute the determinant of the matrix.
 
double Trace ()
 Compute the determinant of the matrix.
 
std::vector< double > Eigenvalues ()
 Compute the eigenvalues of the matrix.
 
Matrix Add (Matrix &matrix)
 Add the two matrices.
 
Matrix Subtract (Matrix &matrix)
 Subtract the input matrix from this matrix.
 
Matrix Multiply (Matrix &matrix)
 Multiply the two matrices.
 
Matrix Multiply (double scalar)
 Multiply the matrix by a scalar value.
 
Matrix MultiplyElementWise (Matrix &matrix)
 Multiply the two matrices element-wise (ie compute C such that C[i][j] = A[i][j]*B[i][j])
 
Matrix Transpose ()
 Compute the transpose of the matrix.
 
Matrix Inverse ()
 Compute the inverse of the matrix.
 
Matrix Eigenvectors ()
 Compute the eigenvectors of the matrix and return them as columns of a matrix in ascending order.
 
double * operator[] (int index)
 
Matrix operator+ (Matrix &matrix)
 
Matrix operator- (Matrix &matrix)
 
Matrix operator* (Matrix &matrix)
 
Matrix operator* (double scalar)
 

Static Public Member Functions

static Matrix Identity (const int n)
 Create an n x n identity matrix.
 

Private Attributes

TNT::Array2D< double > p_matrix
 

Detailed Description

Matrix class.

A Matrix

This class stores a matrix and compute matrix calculations such as addition, subtraction,multiplication, transposes, inverses, and eigenvalues.

Author
2006-05-19 Jacob Danton
History
2006-05-19 Jacob Danton Original Version
History
2007-07-11 Brendan George Fixed unitTest to print values in "fixed" (non-scientific) format, added system specific unitTest for Linux i686 systems

Definition at line 34 of file Matrix.h.

Constructor & Destructor Documentation

◆ Matrix() [1/2]

Isis::Matrix::Matrix ( const int n,
const int m,
const double value = 0.0 )

Constructs an n x m Matrix containing the specified default value.

Definition at line 24 of file Matrix.cpp.

References Isis::IException::Programmer.

Referenced by Add(), Eigenvectors(), Inverse(), Multiply(), MultiplyElementWise(), Subtract(), and Transpose().

◆ Matrix() [2/2]

Isis::Matrix::Matrix ( TNT::Array2D< double > matrix)

Constructs a Matrix from the specified TNT Array2D.

Definition at line 35 of file Matrix.cpp.

◆ ~Matrix()

Isis::Matrix::~Matrix ( )

Destroys the Matrix object.

Definition at line 40 of file Matrix.cpp.

Member Function Documentation

◆ Add()

Matrix Isis::Matrix::Add ( Matrix & matrix)

Add the two matrices.

Definition at line 104 of file Matrix.cpp.

References Matrix(), and Isis::IException::Programmer.

◆ Columns()

int Isis::Matrix::Columns ( )
inline

Definition at line 45 of file Matrix.h.

◆ Determinant()

double Isis::Matrix::Determinant ( )

Compute the determinant of the matrix.

Definition at line 60 of file Matrix.cpp.

References Isis::IException::Programmer.

◆ Eigenvalues()

std::vector< double > Isis::Matrix::Eigenvalues ( )

Compute the eigenvalues of the matrix.

Definition at line 203 of file Matrix.cpp.

References Isis::E, and Isis::IException::Programmer.

◆ Eigenvectors()

Matrix Isis::Matrix::Eigenvectors ( )

Compute the eigenvectors of the matrix and return them as columns of a matrix in ascending order.

Definition at line 224 of file Matrix.cpp.

References Isis::E, Matrix(), and Isis::IException::Programmer.

◆ Identity()

Matrix Isis::Matrix::Identity ( const int n)
static

Create an n x n identity matrix.

Definition at line 45 of file Matrix.cpp.

References Isis::IException::Programmer.

◆ Inverse()

Matrix Isis::Matrix::Inverse ( )

Compute the inverse of the matrix.

Definition at line 183 of file Matrix.cpp.

References Matrix(), and Isis::IException::Programmer.

◆ Multiply() [1/2]

Matrix Isis::Matrix::Multiply ( double scalar)

Multiply the matrix by a scalar value.

Definition at line 157 of file Matrix.cpp.

◆ Multiply() [2/2]

Matrix Isis::Matrix::Multiply ( Matrix & matrix)

Multiply the two matrices.

Definition at line 87 of file Matrix.cpp.

References Matrix(), and Isis::IException::Programmer.

◆ MultiplyElementWise()

Matrix Isis::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 at line 140 of file Matrix.cpp.

References Matrix(), and Isis::IException::Programmer.

◆ operator*() [1/2]

Matrix Isis::Matrix::operator* ( double scalar)
inline

Definition at line 75 of file Matrix.h.

◆ operator*() [2/2]

Matrix Isis::Matrix::operator* ( Matrix & matrix)
inline

Definition at line 72 of file Matrix.h.

◆ operator+()

Matrix Isis::Matrix::operator+ ( Matrix & matrix)
inline

Definition at line 66 of file Matrix.h.

◆ operator-()

Matrix Isis::Matrix::operator- ( Matrix & matrix)
inline

Definition at line 69 of file Matrix.h.

◆ operator[]()

double * Isis::Matrix::operator[] ( int index)
inline

Definition at line 63 of file Matrix.h.

◆ Rows()

int Isis::Matrix::Rows ( )
inline

Definition at line 42 of file Matrix.h.

◆ Subtract()

Matrix Isis::Matrix::Subtract ( Matrix & matrix)

Subtract the input matrix from this matrix.

Definition at line 121 of file Matrix.cpp.

References Matrix(), and Isis::IException::Programmer.

◆ Trace()

double Isis::Matrix::Trace ( )

Compute the determinant of the matrix.

Definition at line 72 of file Matrix.cpp.

References Isis::IException::Programmer.

◆ Transpose()

Matrix Isis::Matrix::Transpose ( )

Compute the transpose of the matrix.

Definition at line 170 of file Matrix.cpp.

References Matrix().

Member Data Documentation

◆ p_matrix

TNT::Array2D<double> Isis::Matrix::p_matrix
private

Definition at line 80 of file Matrix.h.


The documentation for this class was generated from the following files: