GEL
2
GEL is a library for Geometry and Linear Algebra
|
Interface to some of the LAPACK functionality. More...
Go to the source code of this file.
Namespaces | |||||||||||
namespace | LinAlg | ||||||||||
The Linear Algebra Implementation/Module/Package. | |||||||||||
Functions | |||||||||||
void | LinAlg::LinearSolveSym (const CMatrix &A, const CVector &b, CVector &x) | ||||||||||
Singular Value Decomposition SVD | |||||||||||
These functions perform the Singular Value Decomposition SVD of the MxN matrix A. The SVD is defined by: A=U*S*V^T where:
| |||||||||||
void | LinAlg::SVD (const CMatrix &A, CMatrix &U, CMatrix &S, CMatrix &V) | ||||||||||
SVD of A, where the singular values are returned in a 'diagonal' Matrix. | |||||||||||
CVector | LinAlg::SVD (const CMatrix &A) | ||||||||||
SVD of A, returning only the singular values in a Vector. | |||||||||||
Linear Equations | |||||||||||
These functions solve the system of linear equations A*x=b for x, where:
There a speceilaized functions for symetric positive definite (SPD) matrices yeilding better performance. These are denote by SPD in there function name.
| |||||||||||
void | LinAlg::LinearSolve (const CMatrix &A, const CVector &b, CVector &x) | ||||||||||
Solves Ax=b for x. | |||||||||||
CVector | LinAlg::LinearSolve (const CMatrix &A, const CVector &b) | ||||||||||
Solves Ax=b for x and returns x. | |||||||||||
void | LinAlg::LinearSolveSPD (const CMatrix &A, const CVector &b, CVector &x) | ||||||||||
Solves Ax=b for x, where A is SPD. | |||||||||||
CVector | LinAlg::LinearSolveSPD (const CMatrix &A, const CVector &b) | ||||||||||
Solves Ax=b for x and returns x, where A is SPD. | |||||||||||
Linear Least Squares | |||||||||||
These functions solve the Linear Least Squares problem: min_x ||Ax-b||^2 for x, where:
If the solution is not well formed the algorithm provided will find a solution, x, which is not unique, but which sets the objective function to 0. The reson being that the underlining algorithm works by SVD.
| |||||||||||
void | LinAlg::LinearLSSolve (const CMatrix &A, const CVector &b, CVector &x) | ||||||||||
Solves the Linear Least Squares problem min_x ||Ax=b||^2 for x. | |||||||||||
CVector | LinAlg::LinearLSSolve (const CMatrix &A, const CVector &b) | ||||||||||
Solves the Linear Least Squares problem min_x ||Ax=b||^2 for x, and returnes x. | |||||||||||
Matrix Inversion | |||||||||||
These functions inverts the square matrix A. This matrix A must have full rank.
| |||||||||||
void | LinAlg::Invert (CMatrix &A) | ||||||||||
Invertes the square matrix A. That is here A is altered as opposed to the other Invert functions. | |||||||||||
void | LinAlg::Inverted (const CMatrix &A, CMatrix &InvA) | ||||||||||
Returns the inverse of the square matrix A in InvA. | |||||||||||
CMatrix | LinAlg::Inverted (const CMatrix &A) | ||||||||||
Returns the inverse of the square matrix A. | |||||||||||
QR Factorization | |||||||||||
This function returns the QR factorization of A, such that Q*R=A where Q is a orthonormal matrix and R is an upper triangular matrix. However, in the case of A.Col()>A.Row(), the last A.Col-A.Row columns of Q are 'carbage' and as such not part of a orthonormal matrix.
| |||||||||||
void | LinAlg::QRfact (const CMatrix &A, CMatrix &Q, CMatrix &R) | ||||||||||
RQ Factorization | |||||||||||
This function returns the RQ factorization of A, such that R*Q=A where Q is a orthonormal matrix and R is an upper triangular matrix. However, in the case of A not beeing a square matrix, there might be some fuck up of Q.
| |||||||||||
void | LinAlg::RQfact (const CMatrix &A, CMatrix &R, CMatrix &Q) | ||||||||||
Find eigensolutions of a symmetric real matrix. | |||||||||||
This function accepts a real symmetric matrix Q and a vector b. When the function returns, the eigenvalues of the matrix Q will be stored in b and the eigenvectors form the columns of Q. This function is based on the Lapack function dsyev, and returns its info code. A code of 0 indicates success, and a code < 0 indicates an error. Probably Q is not a real symmetric matrix. If the code is > 0 "the algorithm failed to converge; code off-diagonal elements of an intermediate tridiagonal form did not converge to zero." Presumably this means that code contains the number of eigenvalues which are ok. | |||||||||||
int | LinAlg::EigenSolutionsSym (CMatrix &Q, CVector &b) |
Interface to some of the LAPACK functionality.
These are functions which more or less directly interface with the Lapack provided algorithms.
For indepth reference to the LAPACK functions see: LAPACK Users' Guide - 3rd Edition, by E. Anderson et al., ISBN 0-89871-447-8, Published by SIAM,
This book is also available at: {http://www.netlib.org/lapack/lug/lapack_lug.html}
The official LAPACK sites where from the source can be downloaded are: {http://www.netlib.org/clapack/} and {http://www.netlib.org/lapack/}
NB: When running this in MS Visual C++ it is usually required to set the multithread "\MD" compiler option. This is to ensure correct linkage to the precompiled library "clapack.lib" and/or "clapackDB.lib".