Matrix Class Reference

two-dimensional array of double used for matrix computations More...

#include <VecMat.h>

List of all members.

Public Member Functions

 Matrix ()
 Constructor.
 Matrix (unsigned int rows, unsigned int cols, bool zero=false)
 Constructor.
 Matrix (const Array< double > &other)
 Copy constructor (deep copy).
 Matrix (const Matrix &other)
 Copy constructor (deep copy).
 ~Matrix ()
 Destructor.
void operator= (double value)
 set all entries to the same value
Matrix transpose () const
 Returns the transpose of the matrix.
Matrix inverse (unsigned maxIterations=200, double tolerance=1e-10, bool ignoreThreshold=true) const
 Compute the generalized Moore-Penrose inverse of the matrix using SVD.
Matrix inverseSymm () const
 Compute the inverse of the matrix.
Matrix inverseSymmPositiveDefinite () const
 Compute the inverse of a symmetric positive definite matrix.
Matrix inverseCholesky (double thresholdFactor=1e-9) const
 Returns the generalized inverse matrix of input matrix using Cholesky decomposition.
Matrix inverseMoorePenrose () const
 Returns the generalized inverse matrix of input matrix assuming that the matrix has full rank.
void svd (Matrix &U, Matrix &V, Vector &lambda, unsigned int maxIterations=200, bool ignoreThreshold=false) const
 Compute the Singular Value Decomposition.
void eigensymm (Matrix &eigenvectors, Vector &eigenvalues) const
 Compute eigenvectors and eigenvalues.
void eigenvalues (Vector &real, Vector *imaginary=NULL) const
 Compute real and imaginary parts of the eigenvalues.
double detSymm () const
 Computes the determinant of the matrix.
double logDetSymm () const
 Computes the determinant of the matrix.
double trace () const
 Computes the trace of the matrix.
bool isSquare () const
 Checks whether the matrix is a square matrix.
Vector row (unsigned int r) const
 Returns a row vector of the matrix (deep copy).
Vector col (unsigned int c) const
 Returns a column vector of the matrix (deep copy).
Vector operator[] (unsigned int i)
 Returns a row vector of the matrix.
const Vector operator[] (unsigned int i) const
 Returns a const row vector of the matrix.
ArrayBase * clone () const
 Clone the matrix (deep copy).
ArrayBase * cloneEmpty () const
 Clone the class of the matrix.

Static Public Member Functions

static Matrix unitmatrix (unsigned int dim)
 Returns a matrix object filled with the unit matrix of the given dimensionality.
static Matrix diagonal (const Array< double > &diag)
 Returns the diagonal matrix built from the given vector.

Protected Member Functions

void resize_i (unsigned int *d, unsigned int nd, bool copy)
 inherited internal resize interface

Friends

class Vector


Detailed Description

two-dimensional array of double used for matrix computations

Definition at line 133 of file VecMat.h.


Constructor & Destructor Documentation

Matrix::Matrix (  ) 

Constructor.

Definition at line 134 of file VecMat.cpp.

Referenced by clone(), and cloneEmpty().

Matrix::Matrix ( unsigned int  rows,
unsigned int  cols,
bool  zero = false 
)

Constructor.

Definition at line 139 of file VecMat.cpp.

Matrix::Matrix ( const Array< double > &  other  ) 

Copy constructor (deep copy).

Definition at line 145 of file VecMat.cpp.

Matrix::Matrix ( const Matrix other  ) 

Copy constructor (deep copy).

Definition at line 151 of file VecMat.cpp.

Matrix::~Matrix (  ) 

Destructor.

Definition at line 157 of file VecMat.cpp.


Member Function Documentation

ArrayBase * Matrix::clone (  )  const

Clone the matrix (deep copy).

This method is inherited from ArrayBase.

Definition at line 311 of file VecMat.cpp.

References Matrix().

ArrayBase * Matrix::cloneEmpty (  )  const

Clone the class of the matrix.

The method returns a new uninitialized object of the class of the current array.
This method is inherited from ArrayBase.

Definition at line 316 of file VecMat.cpp.

References Matrix().

Vector Matrix::col ( unsigned int  c  )  const

Returns a column vector of the matrix (deep copy).

Definition at line 300 of file VecMat.cpp.

double Matrix::detSymm (  )  const

Computes the determinant of the matrix.

For non-symmetric matrices the result is undefined.

Definition at line 259 of file VecMat.cpp.

References detsymm().

Matrix Matrix::diagonal ( const Array< double > &  diag  )  [static]

Returns the diagonal matrix built from the given vector.

Definition at line 172 of file VecMat.cpp.

void Matrix::eigensymm ( Matrix eigenvectors,
Vector eigenvalues 
) const

Compute eigenvectors and eigenvalues.

For non-symmetric matrices the result is undefined.

Definition at line 235 of file VecMat.cpp.

void Matrix::eigenvalues ( Vector real,
Vector imaginary = NULL 
) const

Compute real and imaginary parts of the eigenvalues.

Definition at line 242 of file VecMat.cpp.

References eigen().

Matrix Matrix::inverse ( unsigned  maxIterations = 200,
double  tolerance = 1e-10,
bool  ignoreThreshold = true 
) const

Compute the generalized Moore-Penrose inverse of the matrix using SVD.

Definition at line 190 of file VecMat.cpp.

References g_inverse().

Matrix Matrix::inverseCholesky ( double  thresholdFactor = 1e-9  )  const

Returns the generalized inverse matrix of input matrix using Cholesky decomposition.

Definition at line 198 of file VecMat.cpp.

References g_inverseCholesky().

Matrix Matrix::inverseMoorePenrose (  )  const

Returns the generalized inverse matrix of input matrix assuming that the matrix has full rank.

Definition at line 206 of file VecMat.cpp.

References g_inverseMoorePenrose().

Matrix Matrix::inverseSymm (  )  const

Compute the inverse of the matrix.

For non-symmetric matrices the result is undefined.

Definition at line 214 of file VecMat.cpp.

References invertSymm().

Matrix Matrix::inverseSymmPositiveDefinite (  )  const

Compute the inverse of a symmetric positive definite matrix.

Definition at line 222 of file VecMat.cpp.

References invertSymmPositiveDefinite().

bool Matrix::isSquare (  )  const [inline]

Checks whether the matrix is a square matrix.

Definition at line 207 of file VecMat.h.

Referenced by powerseries(), and trace().

double Matrix::logDetSymm (  )  const

Computes the determinant of the matrix.

For non-symmetric or non-positive definite matrices the result is undefined.

Definition at line 269 of file VecMat.cpp.

References logdetsymm().

void Matrix::operator= ( double  value  )  [inline]

set all entries to the same value

Definition at line 162 of file VecMat.h.

const Vector Matrix::operator[] ( unsigned int  i  )  const [inline]

Returns a const row vector of the matrix.

Definition at line 230 of file VecMat.h.

References row().

Vector Matrix::operator[] ( unsigned int  i  )  [inline]

Returns a row vector of the matrix.

This vector is a reference to (no deep copy of) the matrix row.

Definition at line 222 of file VecMat.h.

References Vector.

void Matrix::resize_i ( unsigned int *  d,
unsigned int  nd,
bool  copy 
) [protected]

inherited internal resize interface

Definition at line 321 of file VecMat.cpp.

Vector Matrix::row ( unsigned int  r  )  const

Returns a row vector of the matrix (deep copy).

Definition at line 289 of file VecMat.cpp.

Referenced by operator[]().

void Matrix::svd ( Matrix U,
Matrix V,
Vector lambda,
unsigned int  maxIterations = 200,
bool  ignoreThreshold = false 
) const

Compute the Singular Value Decomposition.

Definition at line 230 of file VecMat.cpp.

double Matrix::trace (  )  const

Computes the trace of the matrix.

Definition at line 279 of file VecMat.cpp.

References isSquare().

Matrix Matrix::transpose (  )  const

Returns the transpose of the matrix.

Definition at line 182 of file VecMat.cpp.

Matrix Matrix::unitmatrix ( unsigned int  dim  )  [static]

Returns a matrix object filled with the unit matrix of the given dimensionality.

Definition at line 163 of file VecMat.cpp.

Referenced by powerseries().


Friends And Related Function Documentation

friend class Vector [friend]

Definition at line 136 of file VecMat.h.

Referenced by operator[]().


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