Ravelin
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Ravelin::LINALG Class Reference

Linear algebra routines. More...

#include <LinAlgd.h>

Public Types

enum  SVD { eSVD1, eSVD2, eSVD1, eSVD2 }
 
enum  SVD { eSVD1, eSVD2, eSVD1, eSVD2 }
 

Public Member Functions

void compress ()
 
void free_memory ()
 
MATRIXNpseudo_invert (MATRIXN &A, REAL tol=(REAL)-1.0)
 
void update_QR_rank1 (MATRIXN &Q, MATRIXN &R, const VECTORN &u, const VECTORN &v)
 
void update_QR_delete_cols (MATRIXN &Q, MATRIXN &R, unsigned k, unsigned p)
 
void update_QR_insert_cols (MATRIXN &Q, MATRIXN &R, MATRIXN &U, unsigned k)
 
void update_QR_insert_rows (MATRIXN &Q, MATRIXN &R, MATRIXN &U, unsigned k)
 
void update_QR_delete_rows (MATRIXN &Q, MATRIXN &R, unsigned k, unsigned p)
 
template<class X >
X & inverse_LU (X &M, const std::vector< int > &pivwork)
 Computes a matrix inverse using the factorization determined via factor_LU() More...
 
template<class X >
unsigned calc_rank (X &A, REAL tol=(REAL)-1.0)
 Calculates the rank of a matrix.
 
template<class Y >
MATRIXNnullspace (Y &A, MATRIXN &nullspace, REAL tol=-1.0)
 Computes the nullspace of a matrix. More...
 
template<class X >
REAL cond (X &A)
 Computes the condition number of a matrix.
 
template<class X >
bool is_SPSD (X &m, REAL tol)
 Determines whether a symmetric matrix is positive semi-definite.
 
template<class X >
bool is_SPD (X &m, REAL tol)
 Determines whether a matrix is positive-definite.
 
template<class X , class Y >
void eig_symm (X &A, Y &evals)
 Computes the eigenvalues of the matrix A. More...
 
template<class X , class Y >
void eig_symm_plus (X &A_evecs, Y &evals)
 Computes the eigenvalues and eigenvectors of the matrix A. More...
 
template<class X , class MatU , class VecS , class MatV >
void svd (X &A, MatU &U, VecS &S, MatV &V)
 
template<class X , class MatU , class VecS , class MatV >
void svd1 (X &A, MatU &U, VecS &S, MatV &V)
 Does an 'in place' SVD (destroying A) More...
 
template<class X , class MatU , class VecS , class MatV >
void svd2 (X &A, MatU &U, VecS &S, MatV &V)
 Does an 'in place' SVD (destroying A), using divide and conquer algorithm. More...
 
template<class X >
X & solve_symmetric_fast (MATRIXN &A, X &XB)
 Solves a symmetric, indefinite square matrix. More...
 
template<class X >
X & inverse_symmetric (X &A)
 Inverts the symmetric, indefinite matrix A. More...
 
template<class X >
X & invert (X &A)
 Inverts the matrix A using LU factorization. More...
 
template<class X , class Y , class Vec , class Z >
X & solve_LS_fast (const Y &U, const Vec &S, const Z &V, X &XB, REAL tol=(REAL)-1.0)
 Most robust system of linear equations solver (solves AX = B) More...
 
template<class X , class Y >
X & solve_LS_fast (Y &A, X &XB, SVD svd_algo, REAL tol)
 Most robust system of linear equations solver (solves AX = B) More...
 
template<class X , class Y >
Y & solve_fast (X &A, Y &XB)
 Solves the general system AX = B. More...
 
template<class X , class Y >
X & solve_LS_fast1 (Y &A, X &XB, REAL tol=(REAL)-1.0)
 
template<class X , class Y >
X & solve_LS_fast2 (Y &A, X &XB, REAL tol=(REAL)-1.0)
 
template<class ARMat , class QMat >
void factor_QR (ARMat &AR, QMat &Q, std::vector< int > &PI)
 Performs the QR factorization of a matrix with column pivoting. More...
 
template<class ARMat , class QMat >
void factor_QR (ARMat &AR, QMat &Q)
 Performs the QR factorization of a matrix. More...
 
void compress ()
 
void free_memory ()
 
MATRIXNpseudo_invert (MATRIXN &A, REAL tol=(REAL)-1.0)
 
void update_QR_rank1 (MATRIXN &Q, MATRIXN &R, const VECTORN &u, const VECTORN &v)
 
void update_QR_delete_cols (MATRIXN &Q, MATRIXN &R, unsigned k, unsigned p)
 
void update_QR_insert_cols (MATRIXN &Q, MATRIXN &R, MATRIXN &U, unsigned k)
 
void update_QR_insert_rows (MATRIXN &Q, MATRIXN &R, MATRIXN &U, unsigned k)
 
void update_QR_delete_rows (MATRIXN &Q, MATRIXN &R, unsigned k, unsigned p)
 
template<class X >
X & inverse_LU (X &M, const std::vector< int > &pivwork)
 Computes a matrix inverse using the factorization determined via factor_LU() More...
 
template<class X >
unsigned calc_rank (X &A, REAL tol=(REAL)-1.0)
 Calculates the rank of a matrix.
 
template<class Y >
MATRIXNnullspace (Y &A, MATRIXN &nullspace, REAL tol=-1.0)
 Computes the nullspace of a matrix. More...
 
template<class X >
REAL cond (X &A)
 Computes the condition number of a matrix.
 
template<class X >
bool is_SPSD (X &m, REAL tol)
 Determines whether a symmetric matrix is positive semi-definite.
 
template<class X >
bool is_SPD (X &m, REAL tol)
 Determines whether a matrix is positive-definite.
 
template<class X , class Y >
void eig_symm (X &A, Y &evals)
 Computes the eigenvalues of the matrix A. More...
 
template<class X , class Y >
void eig_symm_plus (X &A_evecs, Y &evals)
 Computes the eigenvalues and eigenvectors of the matrix A. More...
 
template<class X , class MatU , class VecS , class MatV >
void svd (X &A, MatU &U, VecS &S, MatV &V)
 
template<class X , class MatU , class VecS , class MatV >
void svd1 (X &A, MatU &U, VecS &S, MatV &V)
 Does an 'in place' SVD (destroying A) More...
 
template<class X , class MatU , class VecS , class MatV >
void svd2 (X &A, MatU &U, VecS &S, MatV &V)
 Does an 'in place' SVD (destroying A), using divide and conquer algorithm. More...
 
template<class X >
X & solve_symmetric_fast (MATRIXN &A, X &XB)
 Solves a symmetric, indefinite square matrix. More...
 
template<class X >
X & inverse_symmetric (X &A)
 Inverts the symmetric, indefinite matrix A. More...
 
template<class X >
X & invert (X &A)
 Inverts the matrix A using LU factorization. More...
 
template<class X , class Y , class Vec , class Z >
X & solve_LS_fast (const Y &U, const Vec &S, const Z &V, X &XB, REAL tol=(REAL)-1.0)
 Most robust system of linear equations solver (solves AX = B) More...
 
template<class X , class Y >
X & solve_LS_fast (Y &A, X &XB, SVD svd_algo, REAL tol)
 Most robust system of linear equations solver (solves AX = B) More...
 
template<class X , class Y >
Y & solve_fast (X &A, Y &XB)
 Solves the general system AX = B. More...
 
template<class X , class Y >
X & solve_LS_fast1 (Y &A, X &XB, REAL tol=(REAL)-1.0)
 
template<class X , class Y >
X & solve_LS_fast2 (Y &A, X &XB, REAL tol=(REAL)-1.0)
 
template<class ARMat , class QMat >
void factor_QR (ARMat &AR, QMat &Q, std::vector< int > &PI)
 Performs the QR factorization of a matrix with column pivoting. More...
 
template<class ARMat , class QMat >
void factor_QR (ARMat &AR, QMat &Q)
 Performs the QR factorization of a matrix. More...
 

Static Public Member Functions

static void factor_LDL (MATRIXN &M, std::vector< int > &IPIV)
 
static void givens (REAL a, REAL b, REAL &c, REAL &s)
 
static MATRIX2 givens (REAL c, REAL s)
 
static void householder (REAL alpha, const VECTORN &x, REAL &tau, VECTORN &v)
 
static VECTORNsolve_sparse_direct (const SPARSEMATRIXN &A, const VECTORN &b, Transposition trans, VECTORN &x)
 
static MATRIXNsolve_sparse_direct (const SPARSEMATRIXN &A, const MATRIXN &B, Transposition trans, MATRIXN &X)
 
template<class X >
static X & solve_tridiagonal_fast (VECTORN &dl, VECTORN &d, VECTORN &du, X &XB)
 Solves a tridiagonal system. More...
 
template<class X >
static bool factor_chol (X &A)
 Performs the Cholesky factorization of a matrix. More...
 
template<class X >
static bool factor_LU (X &A, std::vector< int > &pivwork)
 Performs the LU factorization of a matrix. More...
 
template<class X , class Y >
static X & solve_tri_fast (Y &A, bool utri, bool transpose_A, X &XB)
 Solves a triangular system of linear equations. More...
 
template<class X >
static X & solve_LDL_fast (const MATRIXN &M, const std::vector< int > &pivwork, X &XB)
 Solves systems of linear equations using the factorization determined via factor_LDL() More...
 
template<class X , class Y >
static X & solve_chol_fast (const Y &M, X &XB)
 Solves a system of linear equations using the factorization determined via factor_chol() More...
 
template<class Y , class X >
static X & solve_LU_fast (const Y &M, bool transpose, const std::vector< int > &pivwork, X &XB)
 Solves a system of linear equations using the factorization determined via factor_LU() More...
 
template<class Y , class X >
static X & solve_SPD_fast (Y &A, X &XB)
 Solves a system of equations A*X = B using a symmetric, positive-definite square matrix. More...
 
template<class X >
static X & inverse_chol (X &A)
 Inverts the symmetric, positive-definite matrix A using Cholesky factorization. More...
 
template<class X >
static X & inverse_SPD (X &A)
 Inverts the symmetric, positive-definite matrix A using Cholesky factorization. More...
 
static void factor_LDL (MATRIXN &M, std::vector< int > &IPIV)
 
static void givens (REAL a, REAL b, REAL &c, REAL &s)
 
static MATRIX2 givens (REAL c, REAL s)
 
static void householder (REAL alpha, const VECTORN &x, REAL &tau, VECTORN &v)
 
static VECTORNsolve_sparse_direct (const SPARSEMATRIXN &A, const VECTORN &b, Transposition trans, VECTORN &x)
 
static MATRIXNsolve_sparse_direct (const SPARSEMATRIXN &A, const MATRIXN &B, Transposition trans, MATRIXN &X)
 
template<class X >
static X & solve_tridiagonal_fast (VECTORN &dl, VECTORN &d, VECTORN &du, X &XB)
 Solves a tridiagonal system. More...
 
template<class X >
static bool factor_chol (X &A)
 Performs the Cholesky factorization of a matrix. More...
 
template<class X >
static bool factor_LU (X &A, std::vector< int > &pivwork)
 Performs the LU factorization of a matrix. More...
 
template<class X , class Y >
static X & solve_tri_fast (Y &A, bool utri, bool transpose_A, X &XB)
 Solves a triangular system of linear equations. More...
 
template<class X >
static X & solve_LDL_fast (const MATRIXN &M, const std::vector< int > &pivwork, X &XB)
 Solves systems of linear equations using the factorization determined via factor_LDL() More...
 
template<class X , class Y >
static X & solve_chol_fast (const Y &M, X &XB)
 Solves a system of linear equations using the factorization determined via factor_chol() More...
 
template<class Y , class X >
static X & solve_LU_fast (const Y &M, bool transpose, const std::vector< int > &pivwork, X &XB)
 Solves a system of linear equations using the factorization determined via factor_LU() More...
 
template<class Y , class X >
static X & solve_SPD_fast (Y &A, X &XB)
 Solves a system of equations A*X = B using a symmetric, positive-definite square matrix. More...
 
template<class X >
static X & inverse_chol (X &A)
 Inverts the symmetric, positive-definite matrix A using Cholesky factorization. More...
 
template<class X >
static X & inverse_SPD (X &A)
 Inverts the symmetric, positive-definite matrix A using Cholesky factorization. More...
 

Public Attributes

FastThreadable< MATRIXNworkM
 work matrices
 
FastThreadable< MATRIXNworkM2
 
FastThreadable< MATRIXNU
 work matrix (for SVD)
 
FastThreadable< std::vector
< INTEGER > > 
pivwork
 work STL integer vector (pivoting)
 
FastThreadable< MATRIXNV
 work matrix (for SVD)
 
FastThreadable< VECTORNS
 work vector (for SVD/eigenvalues)
 
FastThreadable< VECTORNworkv
 work vectors (LAPACK routines)
 
FastThreadable< VECTORNworkv2
 
FastThreadable< std::vector
< INTEGER > > 
iworkv
 work STL integer vector (LAPACK routines)
 

Detailed Description

Linear algebra routines.

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.

Member Function Documentation

template<class X , class Y >
void Ravelin::LINALG::eig_symm ( X &  A,
Y &  evals 
)
inline

Computes the eigenvalues of the matrix A.

Parameters
Aa matrix
evalson return, the eigenvalues will be stored here in ascending order
template<class X , class Y >
void Ravelin::LINALG::eig_symm ( X &  A,
Y &  evals 
)
inline

Computes the eigenvalues of the matrix A.

Parameters
Aa matrix
evalson return, the eigenvalues will be stored here in ascending order
template<class X , class Y >
void Ravelin::LINALG::eig_symm_plus ( X &  A_evecs,
Y &  evals 
)
inline

Computes the eigenvalues and eigenvectors of the matrix A.

Parameters
Aa square symmetric matrix on input, eigenvectors corresponding to eigenvalues on return
evalson return, the eigenvalues will be stored here in ascending order
template<class X , class Y >
void Ravelin::LINALG::eig_symm_plus ( X &  A_evecs,
Y &  evals 
)
inline

Computes the eigenvalues and eigenvectors of the matrix A.

Parameters
Aa square symmetric matrix on input, eigenvectors corresponding to eigenvalues on return
evalson return, the eigenvalues will be stored here in ascending order
template<class X >
static bool Ravelin::LINALG::factor_chol ( X &  A)
inlinestatic

Performs the Cholesky factorization of a matrix.

Parameters
Athe matrix A on input; the factorized (upper triangular) matrix on output
Returns
true if matrix factored successfully, false otherwise
template<class X >
static bool Ravelin::LINALG::factor_chol ( X &  A)
inlinestatic

Performs the Cholesky factorization of a matrix.

Parameters
Athe matrix A on input; the factorized (upper triangular) matrix on output
Returns
true if matrix factored successfully, false otherwise
template<class X >
static bool Ravelin::LINALG::factor_LU ( X &  A,
std::vector< int > &  pivwork 
)
inlinestatic

Performs the LU factorization of a matrix.

Parameters
Athe m x n matrix to be factored; on exit, the factors L and U from the factorization M = P*L*U (unit diagonal elements of L are not stored)
pivworkon output, contains the pivot indices (for 1 <= i <= min(m,n), row i of A was interchanged with row pivwork[i])
Returns
false if A is singular, true otherwise
template<class X >
static bool Ravelin::LINALG::factor_LU ( X &  A,
std::vector< int > &  pivwork 
)
inlinestatic

Performs the LU factorization of a matrix.

Parameters
Athe m x n matrix to be factored; on exit, the factors L and U from the factorization M = P*L*U (unit diagonal elements of L are not stored)
pivworkon output, contains the pivot indices (for 1 <= i <= min(m,n), row i of A was interchanged with row pivwork[i])
Returns
false if A is singular, true otherwise
template<class ARMat , class QMat >
void Ravelin::LINALG::factor_QR ( ARMat &  AR,
QMat &  Q,
std::vector< int > &  PI 
)
inline

Performs the QR factorization of a matrix with column pivoting.

Factorizes A*P = Q*R

Parameters
AQthe matrix A on input; the matrix R on output
Qthe matrix Q on output
PIthe column pivots on output
template<class ARMat , class QMat >
void Ravelin::LINALG::factor_QR ( ARMat &  AR,
QMat &  Q,
std::vector< int > &  PI 
)
inline

Performs the QR factorization of a matrix with column pivoting.

Factorizes A*P = Q*R

Parameters
AQthe matrix A on input; the matrix R on output
Qthe matrix Q on output
PIthe column pivots on output
template<class ARMat , class QMat >
void Ravelin::LINALG::factor_QR ( ARMat &  AR,
QMat &  Q 
)
inline

Performs the QR factorization of a matrix.

Parameters
AQthe m x n matrix A on input; the matrix min(m,n) x n R on output
Qthe m x min(m,n) matrix Q on output
template<class ARMat , class QMat >
void Ravelin::LINALG::factor_QR ( ARMat &  AR,
QMat &  Q 
)
inline

Performs the QR factorization of a matrix.

Parameters
AQthe m x n matrix A on input; the matrix min(m,n) x n R on output
Qthe m x min(m,n) matrix Q on output
template<class X >
static X& Ravelin::LINALG::inverse_chol ( X &  A)
inlinestatic

Inverts the symmetric, positive-definite matrix A using Cholesky factorization.

Parameters
Athe Cholesky factorization of a matrix; contains the inverse on return
template<class X >
static X& Ravelin::LINALG::inverse_chol ( X &  A)
inlinestatic

Inverts the symmetric, positive-definite matrix A using Cholesky factorization.

Parameters
Athe Cholesky factorization of a matrix; contains the inverse on return
template<class X >
X& Ravelin::LINALG::inverse_LU ( X &  M,
const std::vector< int > &  pivwork 
)
inline

Computes a matrix inverse using the factorization determined via factor_LU()

Parameters
Mthe LU-factored matrix
pivworkthe pivots determined by factor_LU()
Note
throws SingularException if matrix is singular
template<class X >
X& Ravelin::LINALG::inverse_LU ( X &  M,
const std::vector< int > &  pivwork 
)
inline

Computes a matrix inverse using the factorization determined via factor_LU()

Parameters
Mthe LU-factored matrix
pivworkthe pivots determined by factor_LU()
Note
throws SingularException if matrix is singular
template<class X >
static X& Ravelin::LINALG::inverse_SPD ( X &  A)
inlinestatic

Inverts the symmetric, positive-definite matrix A using Cholesky factorization.

Parameters
Aa square, symmetric positive-definite matrix; contains the inverse on return
template<class X >
static X& Ravelin::LINALG::inverse_SPD ( X &  A)
inlinestatic

Inverts the symmetric, positive-definite matrix A using Cholesky factorization.

Parameters
Aa square, symmetric positive-definite matrix; contains the inverse on return
template<class X >
X& Ravelin::LINALG::inverse_symmetric ( X &  A)
inline

Inverts the symmetric, indefinite matrix A.

Parameters
Aa square, symmetric indefinite matrix; inverse will be contained here on return
template<class X >
X& Ravelin::LINALG::inverse_symmetric ( X &  A)
inline

Inverts the symmetric, indefinite matrix A.

Parameters
Aa square, symmetric indefinite matrix; inverse will be contained here on return
template<class X >
X& Ravelin::LINALG::invert ( X &  A)
inline

Inverts the matrix A using LU factorization.

Parameters
Aa square matrix; contains the inverse on return
template<class X >
X& Ravelin::LINALG::invert ( X &  A)
inline

Inverts the matrix A using LU factorization.

Parameters
Aa square matrix; contains the inverse on return
template<class Y >
MATRIXN& Ravelin::LINALG::nullspace ( Y &  A,
MATRIXN nullspace,
REAL  tol = -1.0 
)
inline

Computes the nullspace of a matrix.

Note
A is destroyed on return
template<class Y >
MATRIXN& Ravelin::LINALG::nullspace ( Y &  A,
MATRIXN nullspace,
REAL  tol = -1.0 
)
inline

Computes the nullspace of a matrix.

Note
A is destroyed on return
template<class X , class Y >
static X& Ravelin::LINALG::solve_chol_fast ( const Y &  M,
X &  XB 
)
inlinestatic

Solves a system of linear equations using the factorization determined via factor_chol()

Parameters
Mthe Cholesky decomposition performed by factor_chol()
XBthe right hand sides on input, the vectors X on return
template<class X , class Y >
static X& Ravelin::LINALG::solve_chol_fast ( const Y &  M,
X &  XB 
)
inlinestatic

Solves a system of linear equations using the factorization determined via factor_chol()

Parameters
Mthe Cholesky decomposition performed by factor_chol()
XBthe right hand sides on input, the vectors X on return
template<class X , class Y >
Y& Ravelin::LINALG::solve_fast ( X &  A,
Y &  XB 
)
inline

Solves the general system AX = B.

Parameters
Aa square matrix (destroyed on return)
XBthe matrix B on input, the matrix X on return
template<class X , class Y >
Y& Ravelin::LINALG::solve_fast ( X &  A,
Y &  XB 
)
inline

Solves the general system AX = B.

Parameters
Aa square matrix (destroyed on return)
XBthe matrix B on input, the matrix X on return
template<class X >
static X& Ravelin::LINALG::solve_LDL_fast ( const MATRIXN M,
const std::vector< int > &  pivwork,
X &  XB 
)
inlinestatic

Solves systems of linear equations using the factorization determined via factor_LDL()

Parameters
Mthe factorization performed by factor_LDL()
XBthe right hand sides on input, the vectors X on return
template<class X >
static X& Ravelin::LINALG::solve_LDL_fast ( const MATRIXN M,
const std::vector< int > &  pivwork,
X &  XB 
)
inlinestatic

Solves systems of linear equations using the factorization determined via factor_LDL()

Parameters
Mthe factorization performed by factor_LDL()
XBthe right hand sides on input, the vectors X on return
template<class X , class Y , class Vec , class Z >
X& Ravelin::LINALG::solve_LS_fast ( const Y &  U,
const Vec &  S,
const Z &  V,
X &  XB,
REAL  tol = (REAL) -1.0 
)
inline

Most robust system of linear equations solver (solves AX = B)

Solves rank-deficient and underdetermined (minimum norm solution) systems. Computes least-squares solution to overdetermined systems.

Parameters
Athe coefficient matrix (destroyed on return)
XBthe matrix B on input, the matrix X on return
tolthe tolerance for determining the rank of A; if tol < 0.0, tol is computed using machine epsilon
template<class X , class Y , class Vec , class Z >
X& Ravelin::LINALG::solve_LS_fast ( const Y &  U,
const Vec &  S,
const Z &  V,
X &  XB,
REAL  tol = (REAL) -1.0 
)
inline

Most robust system of linear equations solver (solves AX = B)

Solves rank-deficient and underdetermined (minimum norm solution) systems. Computes least-squares solution to overdetermined systems.

Parameters
Athe coefficient matrix (destroyed on return)
XBthe matrix B on input, the matrix X on return
tolthe tolerance for determining the rank of A; if tol < 0.0, tol is computed using machine epsilon
template<class X , class Y >
X& Ravelin::LINALG::solve_LS_fast ( Y &  A,
X &  XB,
SVD  svd_algo,
REAL  tol 
)
inline

Most robust system of linear equations solver (solves AX = B)

Solves rank-deficient and underdetermined (minimum norm solution) systems. Computes least-squares solution to overdetermined systems.

Parameters
Athe coefficient matrix (destroyed on return)
XBthe matrix B on input, the matrix X on return
tolthe tolerance for determining the rank of A; if tol < 0.0, tol is computed using machine epsilon
template<class X , class Y >
X& Ravelin::LINALG::solve_LS_fast ( Y &  A,
X &  XB,
SVD  svd_algo,
REAL  tol 
)
inline

Most robust system of linear equations solver (solves AX = B)

Solves rank-deficient and underdetermined (minimum norm solution) systems. Computes least-squares solution to overdetermined systems.

Parameters
Athe coefficient matrix (destroyed on return)
XBthe matrix B on input, the matrix X on return
tolthe tolerance for determining the rank of A; if tol < 0.0, tol is computed using machine epsilon
template<class Y , class X >
static X& Ravelin::LINALG::solve_LU_fast ( const Y &  M,
bool  transpose,
const std::vector< int > &  pivwork,
X &  XB 
)
inlinestatic

Solves a system of linear equations using the factorization determined via factor_LU()

Parameters
Mthe LU factorization performed by factor_LU()
XBthe right hand side on input, the matrix X on return
transposeif true, solves M'X = B
pivworkpivots computed by factor_LU()
template<class Y , class X >
static X& Ravelin::LINALG::solve_LU_fast ( const Y &  M,
bool  transpose,
const std::vector< int > &  pivwork,
X &  XB 
)
inlinestatic

Solves a system of linear equations using the factorization determined via factor_LU()

Parameters
Mthe LU factorization performed by factor_LU()
XBthe right hand side on input, the matrix X on return
transposeif true, solves M'X = B
pivworkpivots computed by factor_LU()
template<class Y , class X >
static X& Ravelin::LINALG::solve_SPD_fast ( Y &  A,
X &  XB 
)
inlinestatic

Solves a system of equations A*X = B using a symmetric, positive-definite square matrix.

Parameters
Athe matrix coefficients; this matrix will be destroyed on return
XBon input B, on output X
template<class Y , class X >
static X& Ravelin::LINALG::solve_SPD_fast ( Y &  A,
X &  XB 
)
inlinestatic

Solves a system of equations A*X = B using a symmetric, positive-definite square matrix.

Parameters
Athe matrix coefficients; this matrix will be destroyed on return
XBon input B, on output X
template<class X >
X& Ravelin::LINALG::solve_symmetric_fast ( MATRIXN A,
X &  XB 
)
inline

Solves a symmetric, indefinite square matrix.

Parameters
Athe matrix to be solved; the matrix is destroyed on return
XBthe RHS B (A*X = B) on input; the solution, X, on return
template<class X >
X& Ravelin::LINALG::solve_symmetric_fast ( MATRIXN A,
X &  XB 
)
inline

Solves a symmetric, indefinite square matrix.

Parameters
Athe matrix to be solved; the matrix is destroyed on return
XBthe RHS B (A*X = B) on input; the solution, X, on return
template<class X , class Y >
static X& Ravelin::LINALG::solve_tri_fast ( Y &  A,
bool  utri,
bool  transpose_A,
X &  XB 
)
inlinestatic

Solves a triangular system of linear equations.

Parameters
Athe matrix
utriif true A is upper triangular (lower triangular otherwise)
transpose_Aif true, solves A'*x = b
XBcontains b on entry, x on return
Returns
reference to XB
template<class X , class Y >
static X& Ravelin::LINALG::solve_tri_fast ( Y &  A,
bool  utri,
bool  transpose_A,
X &  XB 
)
inlinestatic

Solves a triangular system of linear equations.

Parameters
Athe matrix
utriif true A is upper triangular (lower triangular otherwise)
transpose_Aif true, solves A'*x = b
XBcontains b on entry, x on return
Returns
reference to XB
template<class X >
static X& Ravelin::LINALG::solve_tridiagonal_fast ( VECTORN dl,
VECTORN d,
VECTORN du,
X &  XB 
)
inlinestatic

Solves a tridiagonal system.

Parameters
dlthe (n-1) elements on the subdiagonal (destroyed on return)
dthe n elements on the diagonal (destroyed on return)
duthe n elements on the superdiagonal (destroyed on return)
XBthe right hand side on input, the solution on return
Returns
the solution throws SingularException if the matrix is singular
template<class X >
static X& Ravelin::LINALG::solve_tridiagonal_fast ( VECTORN dl,
VECTORN d,
VECTORN du,
X &  XB 
)
inlinestatic

Solves a tridiagonal system.

Parameters
dlthe (n-1) elements on the subdiagonal (destroyed on return)
dthe n elements on the diagonal (destroyed on return)
duthe n elements on the superdiagonal (destroyed on return)
XBthe right hand side on input, the solution on return
Returns
the solution throws SingularException if the matrix is singular
template<class X , class MatU , class VecS , class MatV >
void Ravelin::LINALG::svd1 ( X &  A,
MatU &  U,
VecS &  S,
MatV &  V 
)
inline

Does an 'in place' SVD (destroying 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.

Parameters
Athe matrix on which the SVD will be performed (destroyed on return)
Uon output, a A.rows() x A.rows() orthogonal matrix
Son output, a min(A.rows(), A.columns()) length vector of singular values
Von output, a A.columns() x A.columns() orthogonal matrix
template<class X , class MatU , class VecS , class MatV >
void Ravelin::LINALG::svd1 ( X &  A,
MatU &  U,
VecS &  S,
MatV &  V 
)
inline

Does an 'in place' SVD (destroying 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.

Parameters
Athe matrix on which the SVD will be performed (destroyed on return)
Uon output, a A.rows() x A.rows() orthogonal matrix
Son output, a min(A.rows(), A.columns()) length vector of singular values
Von output, a A.columns() x A.columns() orthogonal matrix
template<class X , class MatU , class VecS , class MatV >
void Ravelin::LINALG::svd2 ( X &  A,
MatU &  U,
VecS &  S,
MatV &  V 
)
inline

Does an 'in place' SVD (destroying A), using divide and conquer algorithm.

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.

Parameters
Athe matrix on which the SVD will be performed (destroyed on return)
Uon output, a A.rows() x A.rows() orthogonal matrix
Son output, a min(A.rows(), A.columns()) length vector of singular values
Von output, a A.columns() x A.columns() orthogonal matrix
template<class X , class MatU , class VecS , class MatV >
void Ravelin::LINALG::svd2 ( X &  A,
MatU &  U,
VecS &  S,
MatV &  V 
)
inline

Does an 'in place' SVD (destroying A), using divide and conquer algorithm.

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.

Parameters
Athe matrix on which the SVD will be performed (destroyed on return)
Uon output, a A.rows() x A.rows() orthogonal matrix
Son output, a min(A.rows(), A.columns()) length vector of singular values
Von output, a A.columns() x A.columns() orthogonal matrix

The documentation for this class was generated from the following files: