Imagine++
|
Classes | |
class | Imagine::Matrix< T > |
Matrix of variable size. More... | |
class | Imagine::SymMatrix< T > |
Symmetric Matrix of variable size. More... | |
class | Imagine::Vector< T > |
Vector of variable size. More... | |
Functions | |
template<typename T , int N> | |
FMatrix< T, N, N > | Imagine::cholesky (const FMatrix< T, N, N > &A, bool low=true) |
Cholesky decomposition. More... | |
template<typename T , int N> | |
T | Imagine::detFMatrix (const FMatrix< T, N, N > &A) |
Determinant. More... | |
template<typename T > | |
Matrix< T > | Imagine::Diagonal (const Vector< T > &d) |
Diagonal. More... | |
template<typename T > | |
void | Imagine::eigenvalues (const Matrix< T > &A, Vector< T > &wr, Vector< T > &wi) |
Eigenvalues calculation Given square matrix, only eigenvalues are obtained. More... | |
template<typename T , int N> | |
FMatrix< T, N, N > | Imagine::inverseFMatrix (const FMatrix< T, N, N > &A) |
Inverse. More... | |
template<typename T , int M, int N> | |
FVector< T, N > | Imagine::linSolve (const FMatrix< T, M, N > &A, const FVector< T, M > &b) |
Linear system. More... | |
template<typename T > | |
Matrix< T > | Imagine::outerProduct (const Vector< T > &v1, const Vector< T > &v2) |
Outer product matrix. More... | |
template<typename T , int M, int N> | |
FMatrix< T, N, M > | Imagine::pseudoInverse (const FMatrix< T, M, N > &A, T tolrel=0) |
Pseudo inverse. More... | |
template<typename T , int M, int N> | |
bool | Imagine::QR (const FMatrix< T, M, N > &A, FMatrix< T, M, N > &Q, FMatrix< T, N, N > &R) |
QR decomposition. More... | |
template<typename T , int M, int N> | |
bool | Imagine::QRAll (const FMatrix< T, M, N > &A, FMatrix< T, M, M > &Q, FMatrix< T, M, N > &R) |
QR decomposition. More... | |
template<typename T , int M, int N> | |
void | Imagine::svd (const FMatrix< T, M, N > &A, FMatrix< T, M, M > &U, FVector< T, M > &S, FMatrix< T, N, N > &Vt, bool all=false) |
SVD. More... | |
FMatrix<T,N,N> Imagine::cholesky | ( | const FMatrix< T, N, N > & | A, |
bool | low = true |
||
) |
Cholesky decomposition of symmetric positive-definite matrix.
A | matrix |
low | Choose lower (default) or upper
|
T Imagine::detFMatrix | ( | const FMatrix< T, N, N > & | A | ) |
Determinant. Try Cholesky decomposition just in case. If not sym def pos, uses SVD.
A | matrix |
Diagonal matrix
d | diagonal vector |
void Imagine::eigenvalues | ( | const Matrix< T > & | A, |
Vector< T > & | wr, | ||
Vector< T > & | wi | ||
) |
A | square matrix to decompose |
wr | real parts of eigenvalues |
wi | imaginary parts of eigenvalues |
Inverse of an FMatrix. If non invertible, ouptuts a message to cerr
and returns a matrix with zeroed elements. This works for any FMatrix size, on the contrary to inverse(), the latter being limited to N<=3.
A | matrix to inverse |
FVector<T,N> Imagine::linSolve | ( | const FMatrix< T, M, N > & | A, |
const FVector< T, M > & | b | ||
) |
Solve linear system. Returns x such that:
A | matrix |
b | right term |
Matrix<T> Imagine::outerProduct | ( | const Vector< T > & | v1, |
const Vector< T > & | v2 | ||
) |
Vector outer product, i.e. the matrix given by v1 * v2^T
v1,v2 | arguments |
FMatrix<T,N,M> Imagine::pseudoInverse | ( | const FMatrix< T, M, N > & | A, |
T | tolrel = 0 |
||
) |
Pseudo-inverse using SVD
A | matrix |
tolrel | relative tolerance (under which a sing. value is considered nul) |
bool Imagine::QR | ( | const FMatrix< T, M, N > & | A, |
FMatrix< T, M, N > & | Q, | ||
FMatrix< T, N, N > & | R | ||
) |
QR decomposition. A is MxN with M>=N. A=QR where:
A | matrix |
Q,R | output |
bool Imagine::QRAll | ( | const FMatrix< T, M, N > & | A, |
FMatrix< T, M, M > & | Q, | ||
FMatrix< T, M, N > & | R | ||
) |
QR decomposition. A is MxN with M>=N. A=QR where:
A | matrix |
Q,R | output |
void Imagine::svd | ( | const FMatrix< T, M, N > & | A, |
FMatrix< T, M, M > & | U, | ||
FVector< T, M > & | S, | ||
FMatrix< T, N, N > & | Vt, | ||
bool | all = false |
||
) |
Singular value decomposition. A is MxN. S is of size M with decreasing singular values (only min(M,N) first coefficients are filled). A=U*diag(S)*Vt where U (resp. Vt) is MxM (resp NxN) orthonormal, diag(S) is MxN with S as diagonal. If M<N (resp. M>N) then Vt (resp. U) is incompletely filled, except if all is true.
A | matrix |
U,S,Vt | SVD output |
all | completely fill U and V, even columns multiplied by zero |