cisst-saw
Loading...
Searching...
No Matches
nmrPInverseSolver Class Reference

#include <nmrPInverseSolver.h>

Public Member Functions

 nmrPInverseSolver (void)
 nmrPInverseSolver (CISSTNETLIB_INTEGER m, CISSTNETLIB_INTEGER n, bool storageOrder=VCT_COL_MAJOR)
 nmrPInverseSolver (const vctDynamicMatrix< CISSTNETLIB_DOUBLE > &A)
void Allocate (CISSTNETLIB_INTEGER m, CISSTNETLIB_INTEGER n, bool storageOrder)
void Allocate (const vctDynamicMatrix< CISSTNETLIB_DOUBLE > &A)
template<class _matrixOwnerType>
void Solve (vctDynamicMatrixBase< _matrixOwnerType, CISSTNETLIB_DOUBLE > &A) throw (std::runtime_error)
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

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:

  • M: The number of rows of the input matrix A. M >= 0.
  • N: The number of columns of the input matrix A. N >= 0.
  • MaxMN: leading dimension of all 2-dim. arrays. MaxMN must be greater than or equal to max(N,M).
  • MinMN: min(N,M);
  • A: On entry, the \( M \times N \) matrix A. On exit, the content of A is altered.
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() [1/3]

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() [2/3]

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() [3/3]

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

◆ Allocate() [1/2]

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

◆ Allocate() [2/2]

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.

◆ GetPInverse()

const vctDynamicMatrix< CISSTNETLIB_DOUBLE > & nmrPInverseSolver::GetPInverse ( void ) const
inline

◆ GetS()

const vctDynamicMatrix< CISSTNETLIB_DOUBLE > & nmrPInverseSolver::GetS ( void ) const
inline

◆ GetU()

const vctDynamicMatrix< CISSTNETLIB_DOUBLE > & nmrPInverseSolver::GetU ( void ) const
inline

◆ GetV()

const vctDynamicMatrix< CISSTNETLIB_DOUBLE > & nmrPInverseSolver::GetV ( void ) const
inline

◆ Solve()

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

◆ EPS

CISSTNETLIB_DOUBLE nmrPInverseSolver::EPS
protected

◆ M

CISSTNETLIB_INTEGER nmrPInverseSolver::M
protected

◆ MaxMN

CISSTNETLIB_INTEGER nmrPInverseSolver::MaxMN
protected

◆ MinMN

CISSTNETLIB_INTEGER nmrPInverseSolver::MinMN
protected

◆ N

CISSTNETLIB_INTEGER nmrPInverseSolver::N
protected

◆ PInverseA

vctDynamicMatrix<CISSTNETLIB_DOUBLE> nmrPInverseSolver::PInverseA
protected

◆ S

vctDynamicMatrix<CISSTNETLIB_DOUBLE> nmrPInverseSolver::S
protected

◆ StorageOrder

bool nmrPInverseSolver::StorageOrder
protected

◆ svd

nmrSVDSolver nmrPInverseSolver::svd
protected

◆ U

vctDynamicMatrix<CISSTNETLIB_DOUBLE> nmrPInverseSolver::U
protected

◆ V

vctDynamicMatrix<CISSTNETLIB_DOUBLE> nmrPInverseSolver::V
protected

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