Back Table of content Next

LAPACK wrappers

To use those functions, include the file CM_lapack.h in your program and link with -lCheapMatrix -lCM_lapack -lm plus what's usually necessary to link with LAPACK on your system (-lblas -llapack -lg2c on mine).
All those functions are located in the CheapMatrix namespace, and return true if their operation completed successfuly. All Matrix and Vector arguments must already be the correct dimensions.

bool EVD(const Matrix &A, const Vector& reValues, const Vector& imValues, const Matrix& L, const Matrix& R);
bool EVD(const Matrix &A, const Vector& reValues, const Vector& imValues, const Matrix& R);
bool EVD(const Matrix &A, const Vector& reValues, const Matrix& L, const Matrix& R);
bool EVD(const Matrix &A, const Vector& reValues, const Matrix& R);
bool EVD(const Matrix &A, const Matrix& L, const Matrix& R);
bool EVD(const Matrix &A, const Matrix& R);
bool EVD(const Matrix &A, const Vector& reValues, const Vector& imValues);
bool EVD(const Matrix &A, const Vector& reValues);

Eigen Value Decomposition. Returns the eigenvalues (real, imaginary) and the eigenvectors as columns of L, R. Complex eigenvectors are 2 consecutive entries (re,im).
From LAPACK documentation, the computed eigenvectors are normalized to have Euclidean norm equal to 1 and largest component real.

bool left_EVD(const Matrix &A, const Vector& reValues, const Vector& imValues, const Matrix& L);
bool left_EVD(const Matrix &A, const Vector& reValues, const Matrix& L);
bool left_EVD(const Matrix &A, const Matrix& L);

Left Eigen Value Decomposition.

bool symmetric_EVD(const Matrix &A, const Vector& eigenValues, const Matrix& eigenVectors);
bool symmetric_EVD(const Matrix &A, const Vector& eigenValues);
bool symmetric_EVD(const Matrix &A, const Matrix& eigenVectors);

EVD, optimised assuming the matrix A is symmetric. The results will be wrong if A isn't symmetric.

bool inverse(const Matrix &A);
Inverse a square matrix using a LU factorization.

bool LSE(const Matrix &A, const Matrix &B, const Matrix &X);
Least Squares Estimation. Solves the least squares problem for A * x = b. It will solve A * x1 = b1, A * x2 = b2... simultaneously by setting the 'b's as the columns of the matrix B. The data in the matrices A and B is destroyed by LAPACK.

bool SVD(const Matrix &A, const Matrix &U, const Vector& S, const Matrix &VT);
bool SVD(const Matrix &A, const Matrix &U, const Vector& S);

Singular Value Decomposition, find U, S, VT such that A = U * S * VT. Actually, S is diagonal so only the diagonal elements (singular values) are returned in a vector. Vectors are orthogonal, with norm 1. The data refered by the Matrix A is destroyed in the process.


Back Table of content Next

Nicolas Brodu, 2000-06-18