This class stores a full matrix and allows one to do some simple matrix operations. More...
#include <Matrix.h>
Public Member Functions | |
Matrix (const Matrix< T > &t) | |
Matrix (const unsigned nr=0, const unsigned nc=0) | |
std::vector< T > & | getVector () |
Return the contents of the matrix as a vector of length rw*cl. More... | |
unsigned | isSymmetric () const |
Test if the matrix is symmetric or not. More... | |
unsigned | ncols () const |
Return the number of columns. More... | |
unsigned | nrows () const |
Return the number of rows. More... | |
T & | operator() (const unsigned &i, const unsigned &j) |
Return a referenre to element i,j of the matrix. More... | |
const T & | operator() (const unsigned &i, const unsigned &j) const |
Return element i,j of the matrix. More... | |
Matrix< T > | operator*= (const T &v) |
Multiply all elements by v. More... | |
Matrix< T > & | operator+= (const Matrix< T > &m) |
Matrix addition. More... | |
Matrix< T > | operator+= (const T &v) |
Add v to all elements of the Matrix. More... | |
Matrix< T > & | operator-= (const Matrix< T > &m) |
Matrix subtraction. More... | |
Matrix< T > | operator-= (const T &v) |
Subtract v from all elements of the Matrix. More... | |
Matrix< T > & | operator= (const Matrix< T > &m) |
Set the Matrix equal to another Matrix. More... | |
Matrix< T > & | operator= (const std::vector< T > &v) |
Set the Matrix equal to the value of a standard vector - used for readin. More... | |
Matrix< T > & | operator= (const T &v) |
Set all elements of the matrix equal to the value of v. More... | |
Row | operator[] (unsigned i) |
access element (with [][] syntax) More... | |
Const_row | operator[] (unsigned i) const |
access element (with [][] syntax) More... | |
void | resize (const unsigned nr, const unsigned nc) |
Resize the matrix. More... | |
void | setFromVector (const std::vector< T > &vecin) |
Set the matrix from a vector input. More... | |
Private Attributes | |
unsigned | cl |
Number of columns in matrix. More... | |
std::vector< T > | data |
The data in the matrix. More... | |
unsigned | rw |
Number of rows in matrix. More... | |
unsigned | sz |
Number of elements in matrix (nrows*ncols) More... | |
Friends | |
template<typename U > | |
void | chol_elsolve (const Matrix< U > &, const std::vector< U > &, std::vector< U > &) |
Solve a system of equations using the cholesky decomposition. More... | |
template<typename U > | |
void | cholesky (const Matrix< U > &, Matrix< U > &) |
Do a cholesky decomposition of a matrix. More... | |
template<typename U > | |
int | diagMat (const Matrix< U > &, std::vector< double > &, Matrix< double > &) |
Diagonalize a symmetric matrix - returns zero if diagonalization worked. More... | |
template<typename U > | |
int | Invert (const Matrix< U > &, Matrix< double > &) |
Invert a matrix (works for both symmetric and asymmetric matrices) - returns zero if sucesfull. More... | |
template<typename U > | |
int | logdet (const Matrix< U > &, double &) |
Calculate the logarithm of the determinant of a symmetric matrix - returns zero if succesfull. More... | |
template<typename U > | |
void | matrixOut (Log &, const Matrix< U > &) |
Output the Matrix in matrix form. More... | |
template<typename U > | |
void | mult (const Matrix< U > &, const Matrix< U > &, Matrix< U > &) |
Matrix matrix multiply. More... | |
template<typename U > | |
void | mult (const Matrix< U > &, const std::vector< U > &, std::vector< U > &) |
Matrix times a std::vector. More... | |
template<typename U > | |
void | mult (const std::vector< U > &, const Matrix< U > &, std::vector< U > &) |
std::vector times a Matrix More... | |
template<typename U > | |
Matrix< U > | operator* (U &, const Matrix< U > &) |
Multiply matrix by scalar. More... | |
template<typename U > | |
Log & | operator<< (Log &, const Matrix< U > &) |
Output the entire matrix on a single line. More... | |
template<typename U > | |
int | pseudoInvert (const Matrix< U > &, Matrix< double > &) |
Calculate the Moore-Penrose Pseudoinverse of a matrix. More... | |
template<typename U > | |
void | transpose (const Matrix< U > &, Matrix< U > &) |
Matrix transpose. More... | |
This class stores a full matrix and allows one to do some simple matrix operations.
|
inline |
|
inline |
|
inline |
Return the contents of the matrix as a vector of length rw*cl.
|
inline |
Test if the matrix is symmetric or not.
|
inline |
Return the number of columns.
|
inline |
Return the number of rows.
|
inline |
Return a referenre to element i,j of the matrix.
|
inline |
Return element i,j of the matrix.
|
inline |
Multiply all elements by v.
|
inline |
Matrix addition.
|
inline |
Add v to all elements of the Matrix.
|
inline |
Matrix subtraction.
|
inline |
Subtract v from all elements of the Matrix.
|
inline |
|
inline |
Set the Matrix equal to the value of a standard vector - used for readin.
|
inline |
Set all elements of the matrix equal to the value of v.
|
inherited |
access element (with [][] syntax)
|
inherited |
access element (with [][] syntax)
|
inline |
Resize the matrix.
|
inline |
Set the matrix from a vector input.
|
friend |
Solve a system of equations using the cholesky decomposition.
|
friend |
Do a cholesky decomposition of a matrix.
|
friend |
Diagonalize a symmetric matrix - returns zero if diagonalization worked.
|
friend |
Invert a matrix (works for both symmetric and asymmetric matrices) - returns zero if sucesfull.
Calculate the logarithm of the determinant of a symmetric matrix - returns zero if succesfull.
Output the Matrix in matrix form.
|
friend |
Matrix matrix multiply.
|
friend |
Matrix times a std::vector.
|
friend |
std::vector times a Matrix
|
friend |
Multiply matrix by scalar.
Output the entire matrix on a single line.
|
friend |
Calculate the Moore-Penrose Pseudoinverse of a matrix.
|
friend |
Matrix transpose.
|
private |
Number of columns in matrix.
|
private |
The data in the matrix.
|
private |
Number of rows in matrix.
|
private |
Number of elements in matrix (nrows*ncols)
Hosted by GitHub | 1.8.17 |