cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes | List of all members
nmrPInverseSolver Class Reference

#include <nmrPInverseSolver.h>

Public Member Functions

 nmrPInverseSolver (void)
 
 nmrPInverseSolver (CISSTNETLIB_INTEGER m, CISSTNETLIB_INTEGER n, bool storageOrder=VCT_COL_MAJOR)
 
void Allocate (CISSTNETLIB_INTEGER m, CISSTNETLIB_INTEGER n, bool storageOrder)
 
const vctDynamicMatrix
< CISSTNETLIB_DOUBLE > & 
GetS (void) const
 
const vctDynamicMatrix
< CISSTNETLIB_DOUBLE > & 
GetU (void) const
 
const vctDynamicMatrix
< CISSTNETLIB_DOUBLE > & 
GetV (void) const
 
const vctDynamicMatrix
< CISSTNETLIB_DOUBLE > & 
GetPInverse (void) const
 
 nmrPInverseSolver (const vctDynamicMatrix< CISSTNETLIB_DOUBLE > &A)
 
void Allocate (const vctDynamicMatrix< CISSTNETLIB_DOUBLE > &A)
 
template<class _matrixOwnerType >
void Solve (vctDynamicMatrixBase< _matrixOwnerType, CISSTNETLIB_DOUBLE > &A) throw (std::runtime_error)
 

Protected Attributes

CISSTNETLIB_INTEGER M
 
CISSTNETLIB_INTEGER N
 
CISSTNETLIB_INTEGER MaxMN
 
CISSTNETLIB_INTEGER MinMN
 
CISSTNETLIB_DOUBLE EPS
 
vctDynamicMatrix
< CISSTNETLIB_DOUBLE > 
S
 
vctDynamicMatrix
< CISSTNETLIB_DOUBLE > 
U
 
vctDynamicMatrix
< CISSTNETLIB_DOUBLE > 
V
 
vctDynamicMatrix
< CISSTNETLIB_DOUBLE > 
PInverseA
 
bool StorageOrder
 
nmrSVDSolver svd
 

Detailed Description

Algorithm P-Inverse: Moore-Penrose pseudo-inverse Calculates the Moore-Penrose pseudo-inverse of the M by N matrix A, and stores the result in PInverseA. The singular values of A are returned in S. The left singular vectors are returned in U, and the right singular vectors are returned in V.

$ A^{+} = V * \Sigma^{+} * U^{T} $

where $ \Sigma^{+} $ is a $ N \times M $ matrix which is zero except for its min(m,n) diagonal elements, U is a $ M \times M $ orthogonal matrix, and V is a $ N \times N $ orthogonal matrix. The diagonal elements of $ \Sigma^{+} $ are the reciprocal of non-zero singular values of A; they are real and non-negative, and are returned in descending order. The first $ \mbox{min}(m,n) $ columns of U and V are the left and right singular vectors of A.

The data members of this class are:

Note
The input matrix must be compact (see vctDynamicMatrix::IsCompact() or vctFixedSizeMatrix::IsCompact()).
This code relies on the ERC CISST cnetlib library. Since cnetlib is optional, make sure that CISST_HAS_CNETLIB has been turned ON during the configuration with CMake.
Deprecated:
This class has been replaced by nmrPInverse, nmrPInverseDynamicData and nmrPInverseFixedSizeData.

Constructor & Destructor Documentation

nmrPInverseSolver::nmrPInverseSolver ( void  )
inline

Default constructor. This constructor doesn't allocate any memory. If you use this constructor, you will need to use one of the Allocate() methods before you can use the Solve method.

nmrPInverseSolver::nmrPInverseSolver ( CISSTNETLIB_INTEGER  m,
CISSTNETLIB_INTEGER  n,
bool  storageOrder = VCT_COL_MAJOR 
)
inline

Constructor with memory allocation. This constructor allocates the memory based on M and N. It relies on the method Allocate(). The next call to the Solve() method will check that the parameters match the dimension.

Parameters
mNumber of rows of A
nNumber of columns of A
storageOrderStorage order used for the input matrix. This order will be used for the output as well.
nmrPInverseSolver::nmrPInverseSolver ( const vctDynamicMatrix< CISSTNETLIB_DOUBLE > &  A)
inline

Constructor with memory allocation. This constructor allocates the memory based on the actual input of the Solve() method. It relies on the method Allocate(). The next call to the Solve() method will check that the parameters match the dimension and storage order.

Member Function Documentation

void nmrPInverseSolver::Allocate ( CISSTNETLIB_INTEGER  m,
CISSTNETLIB_INTEGER  n,
bool  storageOrder 
)
inline

This method allocates the memory based on M and N. The next call to the Solve() method will check that the parameters match the dimension.

Parameters
mNumber of rows of A
nNumber of columns of A
storageOrderStorage order used for all the matrices
void nmrPInverseSolver::Allocate ( const vctDynamicMatrix< CISSTNETLIB_DOUBLE > &  A)
inline

Allocate memory to solve this problem. This method provides a convenient way to extract the required sizes from the input containers. The next call to the Solve() method will check that the parameters match the dimension.

const vctDynamicMatrix<CISSTNETLIB_DOUBLE>& nmrPInverseSolver::GetPInverse ( void  ) const
inline
const vctDynamicMatrix<CISSTNETLIB_DOUBLE>& nmrPInverseSolver::GetS ( void  ) const
inline
const vctDynamicMatrix<CISSTNETLIB_DOUBLE>& nmrPInverseSolver::GetU ( void  ) const
inline
const vctDynamicMatrix<CISSTNETLIB_DOUBLE>& nmrPInverseSolver::GetV ( void  ) const
inline
template<class _matrixOwnerType >
void nmrPInverseSolver::Solve ( vctDynamicMatrixBase< _matrixOwnerType, CISSTNETLIB_DOUBLE > &  A)
throw (std::runtime_error
)
inline

This computes the Moore-Penrose pseudo-inverse of a real $ M \times N $ matrix A, optionally computing the left and/or right singular vectors. The SVD is written:

$ A^{+} = V * \Sigma^{+} * U^{T} $

Note
This method requires a compact matrix with the same size and storage order used to Allocate. An std::runtime_error exception will be thrown if these conditions are not met.

Member Data Documentation

CISSTNETLIB_DOUBLE nmrPInverseSolver::EPS
protected
CISSTNETLIB_INTEGER nmrPInverseSolver::M
protected
CISSTNETLIB_INTEGER nmrPInverseSolver::MaxMN
protected
CISSTNETLIB_INTEGER nmrPInverseSolver::MinMN
protected
CISSTNETLIB_INTEGER nmrPInverseSolver::N
protected
vctDynamicMatrix<CISSTNETLIB_DOUBLE> nmrPInverseSolver::PInverseA
protected
vctDynamicMatrix<CISSTNETLIB_DOUBLE> nmrPInverseSolver::S
protected
bool nmrPInverseSolver::StorageOrder
protected
nmrSVDSolver nmrPInverseSolver::svd
protected
vctDynamicMatrix<CISSTNETLIB_DOUBLE> nmrPInverseSolver::U
protected
vctDynamicMatrix<CISSTNETLIB_DOUBLE> nmrPInverseSolver::V
protected

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