ERC CISST - cisst software

nmrPInverseDynamicData Class Reference

#include <nmrPInverse.h>

Collaboration diagram for nmrPInverseDynamicData:

Collaboration graph
[legend]
List of all members.

Detailed Description

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

Definition at line 49 of file nmrPInverse.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 nmrPInverse function, use the following methods.

Static Public Member Functions

Protected Member Functions

Protected Attributes


Member Typedef Documentation

typedef vct::size_type nmrPInverseDynamicData::size_type

Type used for sizes within nmrSVDDynamicData. 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 57 of file nmrPInverse.h.


Constructor & Destructor Documentation

nmrPInverseDynamicData::nmrPInverseDynamicData (  )  [inline]

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

Definition at line 287 of file nmrPInverse.h.

References AllocateOutputWorkspace().

template<class _matrixOwnerTypeA>
nmrPInverseDynamicData::nmrPInverseDynamicData ( 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 304 of file nmrPInverse.h.

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

template<class _matrixOwnerTypeA, class _vectorOwnerTypeWorkspace>
nmrPInverseDynamicData::nmrPInverseDynamicData ( 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 319 of file nmrPInverse.h.

References SetRefWorkspace().

template<class _matrixOwnerTypeA, class _matrixOwnerTypePInverse, class _vectorOwnerTypeWorkspace>
nmrPInverseDynamicData::nmrPInverseDynamicData ( 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 matrix for PInverse
workspace The workspace for LAPACK.

Definition at line 337 of file nmrPInverse.h.

References SetRef().

template<class _matrixOwnerTypeA, class _matrixOwnerTypePInverse>
nmrPInverseDynamicData::nmrPInverseDynamicData ( 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 The input matrix
pInverse The output matrix for PInverse

Definition at line 356 of file nmrPInverse.h.

References SetRefOutput().


Member Function Documentation

void nmrPInverseDynamicData::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 95 of file nmrPInverse.h.

References MMember, NMember, and StorageOrderMember.

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

void nmrPInverseDynamicData::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 (nmrPInverseDynamicData) 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 115 of file nmrPInverse.h.

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

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

template<class _vectorOwnerTypeWorkspace>
void nmrPInverseDynamicData::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 144 of file nmrPInverse.h.

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

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

template<typename _matrixOwnerTypePInverse>
void nmrPInverseDynamicData::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 176 of file nmrPInverse.h.

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

Referenced by SetRef(), and SetRefOutput().

template<typename _vectorOwnerTypeWorkspace>
void nmrPInverseDynamicData::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 197 of file nmrPInverse.h.

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

Referenced by SetRef(), and SetRefWorkspace().

static size_type nmrPInverseDynamicData::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 216 of file nmrPInverse.h.

Referenced by AllocateOutputWorkspace(), and WorkspaceSize().

template<class _matrixOwnerTypeA>
static size_type nmrPInverseDynamicData::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 233 of file nmrPInverse.h.

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

template<class _matrixOwnerTypeA>
void nmrPInverseDynamicData::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 nmrPInverseDynamicData object is passed on to nmrPInverse 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 375 of file nmrPInverse.h.

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

Referenced by nmrPInverseDynamicData().

template<class _matrixOwnerTypeA, class _vectorOwnerTypeWorkspace>
void nmrPInverseDynamicData::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 nmrPInverseDynamicData object is passed on to nmrPInverse 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 401 of file nmrPInverse.h.

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

Referenced by nmrPInverseDynamicData().

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

This method must be called before the data object is passed to nmrPInverse function. The user provides the input matrix to specify size, along with matrix PInverse 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:
pInverse The output matrix for PInverse
workspace The workspace for LAPACK.

Definition at line 423 of file nmrPInverse.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 nmrPInverseDynamicData().

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

This method must be called before the data object is passed to nmrPInverse function. The user provides the input matrix to specify size, along with matrix PInverse. 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 451 of file nmrPInverse.h.

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

Referenced by nmrPInverseDynamicData().


Member Data Documentation

vctDynamicVector<CISSTNETLIB_DOUBLE> nmrPInverseDynamicData::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 67 of file nmrPInverse.h.

Referenced by AllocateOutputWorkspace().

vctDynamicVector<CISSTNETLIB_DOUBLE> nmrPInverseDynamicData::OutputMemory [protected]

Memory allocated for PInverse if needed.

Definition at line 71 of file nmrPInverse.h.

Referenced by AllocateOutputWorkspace().

vctDynamicMatrixRef<CISSTNETLIB_DOUBLE> nmrPInverseDynamicData::PInverseReference [protected]

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

Definition at line 76 of file nmrPInverse.h.

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

vctDynamicMatrixRef<CISSTNETLIB_DOUBLE> nmrPInverseDynamicData::UReference [protected]

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

Definition at line 77 of file nmrPInverse.h.

Referenced by SetRefSVD(), and U().

vctDynamicMatrixRef<CISSTNETLIB_DOUBLE> nmrPInverseDynamicData::VtReference [protected]

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

Definition at line 78 of file nmrPInverse.h.

Referenced by SetRefSVD(), and Vt().

vctDynamicVectorRef<CISSTNETLIB_DOUBLE> nmrPInverseDynamicData::SReference [protected]

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

Definition at line 79 of file nmrPInverse.h.

Referenced by S(), and SetRefSVD().

vctDynamicVectorRef<CISSTNETLIB_DOUBLE> nmrPInverseDynamicData::WorkspaceReference [protected]

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

Definition at line 80 of file nmrPInverse.h.

Referenced by SetRefSVD().

size_type nmrPInverseDynamicData::MMember [protected]

Stores M, N, and StorageOrder which are needed to check if A matrix passed to solve method matches the allocated size.

Definition at line 86 of file nmrPInverse.h.

Referenced by AllocateOutputWorkspace(), SetDimension(), SetRefSVD(), ThrowUnlessOutputSizeIsCorrect(), and ThrowUnlessWorkspaceSizeIsCorrect().

size_type nmrPInverseDynamicData::NMember [protected]

Stores M, N, and StorageOrder which are needed to check if A matrix passed to solve method matches the allocated size.

Definition at line 87 of file nmrPInverse.h.

Referenced by AllocateOutputWorkspace(), SetDimension(), SetRefSVD(), ThrowUnlessOutputSizeIsCorrect(), and ThrowUnlessWorkspaceSizeIsCorrect().

bool nmrPInverseDynamicData::StorageOrderMember [protected]

Stores M, N, and StorageOrder which are needed to check if A matrix passed to solve method matches the allocated size.

Definition at line 88 of file nmrPInverse.h.

Referenced by AllocateOutputWorkspace(), SetDimension(), SetRefSVD(), and ThrowUnlessOutputSizeIsCorrect().


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