#include <LinAlg.h>
Static Public Member Functions | |
| static Real | cond (const MatrixN &x) |
| static MatrixN | to_matrix (const std::string &s) |
| Constructs a matrix from a string. | |
| static VectorN | to_vector (const std::string &s) |
| Constructs a vector from a string. | |
| static VectorN | solve (const MatrixNN &A, const VectorN &b) |
| Solves the general system Ax = b. | |
| static VectorN | solve_symmetric (const MatrixNN &A, const VectorN &b) |
| Solves a symmetric, indefinite square matrix. | |
| static VectorN | solve_PD (const MatrixNN &A, const VectorN &b) |
| Solves a symmetric, positivie-definite square matrix. | |
| static void | solve_iterative (const MatrixNN &A, const VectorN &b, VectorN &x, unsigned iter) |
| Iteratively solves a system of equations using the Conjugate-Gradient method. | |
| static void | svd (const MatrixN &A, MatrixN &U, VectorN &S, MatrixN &V) |
| Performs singular value decomposition on A. | |
| static MatrixNN | inverse (const MatrixNN &mat) |
| Inverts the matrix A using LU decomposition. | |
| static MatrixNN | inverse_symmetric (const MatrixNN &mat) |
| Inverts the symmetric, indefinite matrix A. | |
| static MatrixNN | inverse_PD (const MatrixNN &mat) |
| Inverts the symmetric, positive-definite matrix A using Cholesky factorization. | |
| static MatrixN | pseudo_inverse (const MatrixNN &A, Real tol=0) |
| Computes the psuedo-inverse of a square matrix. | |
| static MatrixN | pseudo_inverse (const MatrixN &A, Real tol=0) |
| Computes the psuedo-inverse of a non-square matrix. | |
| static MatrixN | right_pseudo_inverse (const MatrixN &A) |
| Computes the right pseudo inverse of a matrix. | |
| static MatrixN | left_pseudo_inverse (const MatrixN &A) |
| Computes the left pseudo inverse of a matrix. | |
| static unsigned | calc_rank (const MatrixN &x, Real tol=1e-10) |
| static Matrix3 | rot_X (Real angle) |
| Returns the rotation matrix of the specified angle about the X-axis. | |
| static Matrix3 | rot_Y (Real angle) |
| Returns the rotation matrix of the specified angle about the Y-axis. | |
| static Matrix3 | rot_Z (Real angle) |
| Returns the rotation matrix of the specified angle about the Z-axis. | |
| static void | eig_symm (const MatrixNN &A, VectorN &evals) |
| Computes the eigenvalues of the matrix A. | |
| static bool | is_PSD (const MatrixNN &A, Real tolerance) |
| Determines whether a symmetric matrix is positive semi-definite. | |
| static bool | is_PD (const MatrixNN &A, Real tolerance) |
| Determines whether a matrix is positive-definite. | |
LinAlg is a set of static routines that interface to LAPACK. I have included only very few routines here, however they should be some of the most utilized: SVD, (SVD-based) pseudo-inverse, linear equation solving, and matrix inverse.
| MatrixN LinAlg::to_matrix | ( | const std::string & | str | ) | [static] |
Constructs a matrix from a string.
Elements in a row are separated ustd::sing whitespace or commas. Rows are separated ustd::sing semicolons.
| VectorN LinAlg::to_vector | ( | const std::string & | str | ) | [static] |
Constructs a vector from a string.
| str | a string representing the vector; elements are separated ustd::sing whitespace, comma, or semicolon |
Solves the general system Ax = b.
| A | a square matrix | |
| b | a vector of length A.rows() |
| void LinAlg::solve_iterative | ( | const MatrixNN & | A, | |
| const VectorN & | b, | |||
| VectorN & | x, | |||
| unsigned | iter | |||
| ) | [static] |
Iteratively solves a system of equations using the Conjugate-Gradient method.
Performs singular value decomposition on A.
The singular value decomposition of A is U*S*V' (' is the transpose operator); to recompose A, it will be necessary to transpose V before multiplication (i.e., V is returned by the algorithm, not V'). Note: passed matrices and vectors U, S, and V are resized as necessary.
| A | the matrix on which the SVD will be performed | |
| U | on output, a A.rows() x A.rows() orthogonal matrix | |
| S | on output, a min(A.rows(), A.columns()) length vector of singular values | |
| V | on output, a A.columns() x A.columns() orthogonal matrix |
Inverts the matrix A using LU decomposition.
| A | a square matrix |
Inverts the symmetric, indefinite matrix A.
| A | a square, symmetric indefinite matrix |
Inverts the symmetric, positive-definite matrix A using Cholesky factorization.
| A | a square, symmetric positive-definite matrix |
Computes the eigenvalues of the matrix A.
| A | a matrix | |
| evals | on return, the eigenvalues will be stored here |
1.5.1