Public Member Functions

Matrix Class Reference

#include <linalg.h>

List of all members.

Public Member Functions

 Matrix (const std::vector< std::vector< double > > &A)
 Construct a matrix from a vector of vectors.
 Matrix (unsigned int nrows, unsigned int ncols)
 Construct a matrix with given dimensions initialized to 0.
 Matrix (const Matrix &A)
 copy a matrix
 ~Matrix (void)
 delete a matrix
double & operator() (unsigned int i, unsigned int j) const
 data access to the element in row i and column j (indices starting with 0!)
void print (void)
 print the matrix to stdout
unsigned int getnrows (void) const
 get the number of rows
unsigned int getncols (void) const
 get the number of columns
Matrixcholesky_dec (void) const
 return a pointer to a newly allocated Matrix L, such that L*L^T = A
Matrixlu_dec (void) const
 return a pointer to a newly allocated Matrix LU. If you construct a matrix L from the elements of LU below the diagnonal and L_ii = 1, and a matrix U from the elements above the diagnonal, then A=LU
Matrixqr_dec (void) const
 QR-decomposition of a matrix, where Q is orthogonal and R is upper right triangular.
Matrixinverse_qr (void) const
 Matrix inversion based on QR decomposition (more stable but slower).
Matrixregularized_inverse (double alpha) const
 Matrix inversion with Tichonov regularization (regularization factor alpha).
std::vector< double > solve (const std::vector< double > &b)
 solve a linear equation Ax=b for x
Matrixinverse (void)
 return a pointer to the (newly allocated) inverse Matrix
std::vector< double > operator* (std::vector< double > &x)
 right multiplication with a vector
void scale (double a)
 scale the whole matrix by a constant factor
bool symmetric (void)
 check whether the matrix is symmetric

Detailed Description

A very simple matrix class


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