ERC CISST - cisst software

nmrPInverseEconomyDynamicData Class Reference
[Numerical Methods]

#include <nmrPInverseEconomy.h>

Collaboration diagram for nmrPInverseEconomyDynamicData:

Collaboration graph
[legend]
List of all members.

Detailed Description

This is the class for the composite data container of PInverse.

Definition at line 131 of file nmrPInverseEconomy.h.

Public Types

Public Member Functions

Retrieving results.
In order to get access to U, V^t and S, after the have been computed by calling nmrPInverseEconomy, use the following methods.

Static Public Member Functions

Protected Member Functions

Protected Attributes


Member Typedef Documentation

typedef unsigned int nmrPInverseEconomyDynamicData::size_type

Type used for sizes within nmrSVDEconomyDynamicData. This type is compatible with the cisstVector containers such as vctDynamicMatrix and vctDynamicVector (unsigned int). To call the Fortran based routines, these values must be cast to CISSTNETLIB_INTEGER.

Definition at line 139 of file nmrPInverseEconomy.h.


Constructor & Destructor Documentation

nmrPInverseEconomyDynamicData::nmrPInverseEconomyDynamicData (  )  [inline]

The default constuctor. For dynamic size, there are assigned default values, which MUST be changed by calling appropriate methods. (See nmrPInverseEconomyDynamicData::Allocate and nmrPInverseEconomyDynamicData::SetRef)

Definition at line 369 of file nmrPInverseEconomy.h.

References AllocateOutputWorkspace().

template<class _matrixOwnerTypeA>
nmrPInverseEconomyDynamicData::nmrPInverseEconomyDynamicData ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  A  )  [inline]

Constructor where user provides the input matrix to specify size, Memory allocation is done for output matrices and vectors as well as Workspace used by LAPACK. This case covers the scenario when user wants to make all system calls for memory allocation before entrying time critical code sections.

Parameters:
A Input matrix

Definition at line 387 of file nmrPInverseEconomy.h.

References Allocate(), vctDynamicConstMatrixBase< _matrixOwnerType, _elementType >::cols(), vctDynamicConstMatrixBase< _matrixOwnerType, _elementType >::rows(), and vctDynamicConstMatrixBase< _matrixOwnerType, _elementType >::StorageOrder().

template<class _matrixOwnerTypeA, class _vectorOwnerTypeWorkspace>
nmrPInverseEconomyDynamicData::nmrPInverseEconomyDynamicData ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  A,
vctDynamicVectorBase< _vectorOwnerTypeWorkspace, CISSTNETLIB_DOUBLE > &  workspace 
) [inline]

Constructor where user provides the input matrix to specify size, Memory allocation is done for output matrices and vectors. This case covers the scenario when user wants to make all system calls for memory allocation before entrying time critical code sections and might be using more than one numerical method in the *same* thread, allowing her to share the workspace for LAPACK.

Parameters:
A Input matrix
workspace Workspace for SVD

Definition at line 404 of file nmrPInverseEconomy.h.

References SetRefWorkspace().

template<class _matrixOwnerTypeA, class _matrixOwnerTypePInverse, class _vectorOwnerTypeWorkspace>
nmrPInverseEconomyDynamicData::nmrPInverseEconomyDynamicData ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  A,
vctDynamicMatrixBase< _matrixOwnerTypePInverse, CISSTNETLIB_DOUBLE > &  pInverse,
vctDynamicVectorBase< _vectorOwnerTypeWorkspace, CISSTNETLIB_DOUBLE > &  workspace 
) [inline]

Constructor where user provides the size and storage order of the input matrix, along with matrix AP and workspace. The data object now acts as a composite container to hold, pass and manipulate a convenitent storage for PInverse algorithm. Checks are made on the validity of the input and its consitency with the size of input matrix.

Parameters:
A The input matrix
pInverse The output matrices for PInverse
workspace The workspace for LAPACK.

Definition at line 424 of file nmrPInverseEconomy.h.

References SetRef().

template<class _matrixOwnerTypeA, class _matrixOwnerTypePInverse>
nmrPInverseEconomyDynamicData::nmrPInverseEconomyDynamicData ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  A,
vctDynamicMatrixBase< _matrixOwnerTypePInverse, CISSTNETLIB_DOUBLE > &  pInverse 
) [inline]

Constructor where user provides the size and storage order of the input matrix, along with matrix PInverse. The data object now acts as a composite container to hold, pass and manipulate a convenitent storage for SVD algorithm. Checks are made on thec validity of the input and its consitency with the size of input matrix. Memory allocation for workspace is done by the method. This case covers the scenario when user wants to make all system calls for memory allocation before entrying time critical code sections and might be using the PInverse matrix elsewhere in the same* thread.

Parameters:
A Input matrix
pInverse The output matrix for PInverse

Definition at line 445 of file nmrPInverseEconomy.h.

References SetRefOutput().


Member Function Documentation

void nmrPInverseEconomyDynamicData::SetDimension ( size_type  m,
size_type  n,
bool  storageOrder 
) [inline, protected]

Private method to set the data members MMember, NMember and StorageOrder. This method must be called before AllocateOutputWorkspace, ThrowUnlessOutputSizeIsCorrect or ThrowUnlessWorkspaceSizeIsCorrect.

Definition at line 177 of file nmrPInverseEconomy.h.

References MMember, NMember, and StorageOrderMember.

Referenced by Allocate(), SetRef(), SetRefOutput(), and SetRefWorkspace().

void nmrPInverseEconomyDynamicData::AllocateOutputWorkspace ( bool  allocateOutput,
bool  allocateWorkspace 
) [inline, protected]

Private method to allocate memory for the output and the workspace if needed. This method assumes that the dimension m and n as well as the storage order are already set. It is important to use this method in all the methods provided in the user API, even if all the memory is provided by the user since this method will ensure that the data (nmrPInverseEconomyDynamicData) does not keep any memory allocated. This is for the case where a single data is used first to allocate everything and, later on, used with user allocated memory (for either the workspace or the output).

Note:
The method SetDimension must have been called before.

Definition at line 197 of file nmrPInverseEconomy.h.

References MMember, NMember, OutputMemory, PInverseReference, vctDynamicVectorBase< _vectorOwnerType, _elementType >::Pointer(), vctDynamicMatrixRef< _elementType >::SetRef(), SetRefSVD(), vctDynamicVector< _elementType >::SetSize(), StorageOrderMember, WorkspaceMemory, and WorkspaceSize().

Referenced by Allocate(), nmrPInverseEconomyDynamicData(), SetRef(), SetRefOutput(), and SetRefWorkspace().

template<class _vectorOwnerTypeWorkspace>
void nmrPInverseEconomyDynamicData::SetRefSVD ( vctDynamicVectorBase< _vectorOwnerTypeWorkspace, CISSTNETLIB_DOUBLE > &  workspace  )  [inline, protected]

Set all internal references used for the SVD problem. This method requires a valid workspace but it doesn't check the size. It is the caller responsability to do so.

Note:
The method SetDimension must have been called before.

Definition at line 226 of file nmrPInverseEconomy.h.

References MMember, NMember, vctDynamicVectorBase< _vectorOwnerType, _elementType >::Pointer(), vctDynamicMatrixRef< _elementType >::SetRef(), vctDynamicVectorRef< _elementType >::SetRef(), SReference, StorageOrderMember, UReference, VtReference, WorkspaceReference, and nmrSVDEconomyDynamicData::WorkspaceSize().

Referenced by AllocateOutputWorkspace(), SetRef(), and SetRefWorkspace().

template<typename _matrixOwnerTypePInverse>
void nmrPInverseEconomyDynamicData::ThrowUnlessOutputSizeIsCorrect ( vctDynamicMatrixBase< _matrixOwnerTypePInverse, CISSTNETLIB_DOUBLE > &  pInverse  )  const throw (std::runtime_error) [inline, protected]

Verifies that the user provided reference for the output match the size of the data as set by SetDimension. This method also checks that the storage order is consistent.

Note:
The method SetDimension must have been called before.

Definition at line 258 of file nmrPInverseEconomy.h.

References cmnThrow(), MMember, NMember, and StorageOrderMember.

Referenced by SetRef(), and SetRefOutput().

template<typename _vectorOwnerTypeWorkspace>
void nmrPInverseEconomyDynamicData::ThrowUnlessWorkspaceSizeIsCorrect ( vctDynamicVectorBase< _vectorOwnerTypeWorkspace, CISSTNETLIB_DOUBLE > &  workspace  )  const throw (std::runtime_error) [inline, protected]

Verifies that the user provided references for the workspace match (or is greated than) the size of the data as set by SetDimension. This method also checks that the workspace is compact.

Note:
The method SetDimension must have been called before.

Definition at line 279 of file nmrPInverseEconomy.h.

References cmnThrow(), MMember, NMember, and nmrSVDEconomyDynamicData::WorkspaceSize().

Referenced by SetRef(), and SetRefWorkspace().

static size_type nmrPInverseEconomyDynamicData::WorkspaceSize ( size_type  m,
size_type  n 
) [inline, static]

Helper methods for user to set min working space required by LAPACK SVD routine plus memory needed for S, U & Vt matrices used to compute PInverse.

Parameters:
m,n The size of matrix whose SVD needs to be computed

Definition at line 298 of file nmrPInverseEconomy.h.

Referenced by AllocateOutputWorkspace(), and WorkspaceSize().

template<class _matrixOwnerTypeA>
static size_type nmrPInverseEconomyDynamicData::WorkspaceSize ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  A  )  [inline, static]

Helper method to determine the min working space required by LAPACK SVD routine plus memory needed for S, U & Vt matrices used to compute PInverse.

Parameters:
A The matrix whose SVD needs to be computed

Definition at line 315 of file nmrPInverseEconomy.h.

References vctDynamicConstMatrixBase< _matrixOwnerType, _elementType >::cols(), vctDynamicConstMatrixBase< _matrixOwnerType, _elementType >::rows(), and WorkspaceSize().

template<class _matrixOwnerTypeA>
void nmrPInverseEconomyDynamicData::Allocate ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  A  )  [inline]

This method allocates memory of output matrices and vector as well as the workspace. This method should be called before the nmrPInverseEconomyDynamicData object is passed on to nmrPInverseEconomy function, as the memory required for output matrices and workspace are allocated here or to reallocate memory previously allocated by constructor. Typically this method is called from a code segment where it is safe to allocate memory and use the data and workspace space later.

Parameters:
A The matrix for which SVD needs to be computed, size MxN

Definition at line 464 of file nmrPInverseEconomy.h.

References AllocateOutputWorkspace(), vctDynamicConstMatrixBase< _matrixOwnerType, _elementType >::cols(), vctDynamicConstMatrixBase< _matrixOwnerType, _elementType >::rows(), SetDimension(), and vctDynamicConstMatrixBase< _matrixOwnerType, _elementType >::StorageOrder().

Referenced by nmrPInverseEconomyDynamicData().

template<class _matrixOwnerTypeA, class _vectorOwnerTypeWorkspace>
void nmrPInverseEconomyDynamicData::SetRefWorkspace ( vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &  A,
vctDynamicVectorBase< _vectorOwnerTypeWorkspace, CISSTNETLIB_DOUBLE > &  workspace 
) [inline]

This method allocates memory of output matrices and vector and uses the memory provided by user for workspace. Check is made to ensure that memory provided by user is sufficient for SVD routine of LAPACK. This method should be called before the nmrPInverseEconomyDynamicData object is passed on to nmrPInverseEconomy function, as the memory required for output matrices and workspace are allocated here or to reallocate memory previously allocated by constructor. This case covers the scenario when user wants to make all system calls for memory allocation before entrying time critical code sections and might be using more than one numerical method in the *same* thread, allowing her to share the workspace for LAPACK. Typically this method is called from a code segment where it is safe to allocate memory and use the data and workspace space later.

Parameters:
A The matrix for which SVD needs to be computed, size MxN
workspace The vector used for workspace by LAPACK.

Definition at line 490 of file nmrPInverseEconomy.h.

References AllocateOutputWorkspace(), vctDynamicConstMatrixBase< _matrixOwnerType, _elementType >::cols(), vctDynamicConstMatrixBase< _matrixOwnerType, _elementType >::rows(), SetDimension(), SetRefSVD(), vctDynamicConstMatrixBase< _matrixOwnerType, _elementType >::StorageOrder(), and ThrowUnlessWorkspaceSizeIsCorrect().

Referenced by nmrPInverseEconomyDynamicData().

template<class _matrixOwnerTypePInverse, class _vectorOwnerTypeWorkspace>
void nmrPInverseEconomyDynamicData::SetRef ( vctDynamicMatrixBase< _matrixOwnerTypePInverse, CISSTNETLIB_DOUBLE > &  pInverse,
vctDynamicVectorBase< _vectorOwnerTypeWorkspace, CISSTNETLIB_DOUBLE > &  workspace 
) [inline]

This method must be called before the data object is passed to nmrPInverseEconomy function. The user provides the PInverse matrix to specify size, along with the workspace. The data object now acts as a composite container to hold, pass and manipulate a convenitent storage for PInverse algorithm. Checks are made on the validity of the input and its consitency with the size of input matrix.

Parameters:
pInverse The output matrix for PInverse
workspace The workspace for LAPACK.

Definition at line 513 of file nmrPInverseEconomy.h.

References AllocateOutputWorkspace(), vctDynamicConstMatrixBase< _matrixOwnerType, _elementType >::cols(), PInverseReference, vctDynamicConstMatrixBase< _matrixOwnerType, _elementType >::rows(), SetDimension(), vctDynamicMatrixRef< _elementType >::SetRef(), SetRefSVD(), vctDynamicConstMatrixBase< _matrixOwnerType, _elementType >::StorageOrder(), ThrowUnlessOutputSizeIsCorrect(), and ThrowUnlessWorkspaceSizeIsCorrect().

Referenced by nmrPInverseEconomyDynamicData().

template<class _matrixOwnerTypePInverse>
void nmrPInverseEconomyDynamicData::SetRefOutput ( vctDynamicMatrixBase< _matrixOwnerTypePInverse, CISSTNETLIB_DOUBLE > &  pInverse  )  [inline]

This method must be called before the data object is passed to nmrPInverseEconomy function. The user provides the PInverse matrix to specify size. The data object now acts as a composite container to hold, pass and manipulate a convenitent storage for PInverse algorithm. Checks are made on thec validity of the input and its consitency with the size of input matrix. Memory allocation for workspace is done by the method. This case covers the scenario when user wants to make all system calls for memory allocation before entrying time critical code sections and might be using the PInverse matrix elsewhere in the *same* thread.

Parameters:
pInverse The output matrix for PInverse

Definition at line 541 of file nmrPInverseEconomy.h.

References AllocateOutputWorkspace(), vctDynamicConstMatrixBase< _matrixOwnerType, _elementType >::cols(), PInverseReference, vctDynamicConstMatrixBase< _matrixOwnerType, _elementType >::rows(), SetDimension(), vctDynamicMatrixRef< _elementType >::SetRef(), vctDynamicConstMatrixBase< _matrixOwnerType, _elementType >::StorageOrder(), and ThrowUnlessOutputSizeIsCorrect().

Referenced by nmrPInverseEconomyDynamicData().


Member Data Documentation

vctDynamicVector<CISSTNETLIB_DOUBLE> nmrPInverseEconomyDynamicData::WorkspaceMemory [protected]

Memory allocated for Workspace matrices if needed This includes memory needed for SVD as well. Order of storage is m x m elements of U followed by n x n elements of Vt followed by min (m, n) elements of S, followed by memory for LAPACK workspace.

Definition at line 149 of file nmrPInverseEconomy.h.

Referenced by AllocateOutputWorkspace().

vctDynamicVector<CISSTNETLIB_DOUBLE> nmrPInverseEconomyDynamicData::OutputMemory [protected]

Memory allocated for PInverse if needed.

Definition at line 153 of file nmrPInverseEconomy.h.

Referenced by AllocateOutputWorkspace().

vctDynamicMatrixRef<CISSTNETLIB_DOUBLE> nmrPInverseEconomyDynamicData::PInverseReference [protected]

References to workspace or return types, these point either to user allocated memory or our memory chunks if needed

Definition at line 158 of file nmrPInverseEconomy.h.

Referenced by AllocateOutputWorkspace(), PInverse(), SetRef(), and SetRefOutput().

vctDynamicMatrixRef<CISSTNETLIB_DOUBLE> nmrPInverseEconomyDynamicData::UReference [protected]

References to workspace or return types, these point either to user allocated memory or our memory chunks if needed

Definition at line 159 of file nmrPInverseEconomy.h.

Referenced by SetRefSVD(), and U().

vctDynamicMatrixRef<CISSTNETLIB_DOUBLE> nmrPInverseEconomyDynamicData::VtReference [protected]

References to workspace or return types, these point either to user allocated memory or our memory chunks if needed

Definition at line 160 of file nmrPInverseEconomy.h.

Referenced by SetRefSVD(), and Vt().

vctDynamicVectorRef<CISSTNETLIB_DOUBLE> nmrPInverseEconomyDynamicData::SReference [protected]

References to workspace or return types, these point either to user allocated memory or our memory chunks if needed

Definition at line 161 of file nmrPInverseEconomy.h.

Referenced by S(), and SetRefSVD().

vctDynamicVectorRef<CISSTNETLIB_DOUBLE> nmrPInverseEconomyDynamicData::WorkspaceReference [protected]

References to workspace or return types, these point either to user allocated memory or our memory chunks if needed

Definition at line 162 of file nmrPInverseEconomy.h.

Referenced by SetRefSVD().


The documentation for this class was generated from the following file:
erc-cisst-devel<at>lists.johnshopkins.edu