casacore
|
Linear algebra functions on Vectors and Matrices. More...
#include <MatrixMathLA.h>
Public Member Functions | |
template<class T > | |
void | invert (Matrix< T > &out, T &determinate, const Matrix< T > &in) |
Routines which calculate the inverse of a matrix. More... | |
template<class T > | |
Matrix< T > | invert (const Matrix< T > &in) |
template<class T > | |
T | determinate (const Matrix< T > &in) |
template<class T > | |
void | invertSymPosDef (Matrix< T > &out, T &determinate, const Matrix< T > &in) |
This function inverts a symmetric positive definite matrix. More... | |
template<class T > | |
Matrix< T > | invertSymPosDef (const Matrix< T > &in) |
Linear algebra functions on Vectors and Matrices.
Definition at line 52 of file MatrixMathLA.h.
T casacore::MatrixMathLA_global_functions_Linear_Algebra::determinate | ( | const Matrix< T > & | in | ) |
void casacore::MatrixMathLA_global_functions_Linear_Algebra::invert | ( | Matrix< T > & | out, |
T & | determinate, | ||
const Matrix< T > & | in | ||
) |
Routines which calculate the inverse of a matrix.
The inverse is very often the worst way to do a calculation. Nevertheless it is often convenient. The present implementation uses LU decomposition implemented by LAPACK. The determinate can be calculated "for free" as it is the product of the diagonal terms after decomposition. If the input matrix is singular, a matrix with no rows or columns is returned. in
must be a square matrix.
Warning: This function will only work for complex types if Complex and DComplex map onto their FORTRAN counterparts;
Matrix<T> casacore::MatrixMathLA_global_functions_Linear_Algebra::invert | ( | const Matrix< T > & | in | ) |
void casacore::MatrixMathLA_global_functions_Linear_Algebra::invertSymPosDef | ( | Matrix< T > & | out, |
T & | determinate, | ||
const Matrix< T > & | in | ||
) |
This function inverts a symmetric positive definite matrix.
It is written in C++, so it should work with any data type for which operators +, -, *, /, =, and sqrt are defined. The function uses the Cholesky decomposition method to invert the matrix. Cholesky decomposition is about a factor of 2 better than LU decomposition where symmetry is ignored.
Matrix<T> casacore::MatrixMathLA_global_functions_Linear_Algebra::invertSymPosDef | ( | const Matrix< T > & | in | ) |