142 if (allocatePivotIndices) {
143 this->PivotIndicesMemory.SetSize(maxSize1);
144 this->PivotIndicesReference.
SetRef(this->PivotIndicesMemory);
146 this->PivotIndicesMemory.SetSize(0);
150 if (allocateWorkspace) {
151 this->WorkspaceMemory.SetSize(maxSize1 *
NB);
152 this->WorkspaceReference.
SetRef(this->WorkspaceMemory);
154 this->WorkspaceMemory.SetSize(0);
166 template <
class _vectorOwnerTypePivotIndices>
172 if (maxSize1 > pivotIndices.size()) {
173 cmnThrow(std::runtime_error(
"nmrInverseDynamicData: Size of vector pivotIndices is incorrect."));
175 if (!pivotIndices.IsCompact()) {
176 cmnThrow(std::runtime_error(
"nmrInverseDynamicData: Vector pivotIndices must be compact."));
187 template <
class _vectorOwnerTypeWorkspace>
193 if (maxSize1 *
NB > workspace.size()) {
194 cmnThrow(std::runtime_error(
"nmrInverseDynamicData: Size of vector workspace is incorrect."));
196 if (!workspace.IsCompact()) {
197 cmnThrow(std::runtime_error(
"nmrInverseDynamicData: Vector workspace must be compact."));
209 template <
class _matrixOwnerTypeA>
213 return ((A.rows() > 1) ? A.rows() : 1);
222 template <
class _matrixOwnerTypeA>
226 return ((A.rows() > 1) ? A.rows() : 1) *
NB;
245 return Data.PivotIndicesReference;
248 return Data.WorkspaceReference;
251 return Data.SizeMember;
254 return Data.StorageOrderMember;
299 template <
class _matrixOwnerTypeA>
317 template <
class _matrixOwnerTypeA,
318 class _vectorOwnerTypePivotIndices,
319 class _vectorOwnerTypeWorkspace>
324 this->
SetRef(A, pivotIndices, workspace);
337 template <
class _matrixOwnerTypeA>
340 this->
Allocate(A.rows(), A.StorageOrder());
368 template <
class _matrixOwnerTypeA,
369 class _vectorOwnerTypePivotIndices,
370 class _vectorOwnerTypeWorkspace>
379 this->PivotIndicesReference.
SetRef(pivotIndices);
381 this->WorkspaceReference.
SetRef(workspace);
413template <vct::
size_type _size,
bool _storageOrder>
453 return Data.PivotIndicesMember;
456 return Data.WorkspaceMember;
571template <
class _matrixOwnerType>
577 CISSTNETLIB_INTEGER info;
581 cmnThrow(std::runtime_error(
"nmrInverse: Input must be a square matrix."));
584 if (dataFriend.
Size() != A.rows()) {
585 cmnThrow(std::runtime_error(
"nmrInverse: Size used for Allocate was different."));
588 if (! A.IsCompact()) {
589 cmnThrow(std::runtime_error(
"nmrInverse: Requires a compact matrix."));
592 CISSTNETLIB_INTEGER
size = dataFriend.
Size();
593 CISSTNETLIB_INTEGER lda = (
size > 1) ?
size : 1;
594 CISSTNETLIB_INTEGER lwork = dataFriend.
Workspace().size();
596#if defined(CISSTNETLIB_VERSION_MAJOR)
597#if (CISSTNETLIB_VERSION_MAJOR >= 3)
602 cisstNetlib_dgetri_(&
size,
641template <
class _matrixOwnerTypeA,
642 class _vectorOwnerTypePivotIndices,
643 class _vectorOwnerTypeWorkspace>
661template <
class _matrixOwnerTypeA>
693template <vct::
size_type _size, vct::
size_type _maxSize1, vct::
size_type _lWork,
bool _storageOrder>
698#if CMN_ASSERT_IS_DEFINED
703 CMN_ASSERT(maxSize1 ==
static_cast<CISSTNETLIB_INTEGER
>(_maxSize1));
704 CMN_ASSERT(lWork <=
static_cast<CISSTNETLIB_INTEGER
>(_lWork));
706 CISSTNETLIB_INTEGER info;
707 CISSTNETLIB_INTEGER lda = _maxSize1;
708 CISSTNETLIB_INTEGER
size = _size;
709 CISSTNETLIB_INTEGER lwork = lWork;
712#if defined(CISSTNETLIB_VERSION_MAJOR)
713#if (CISSTNETLIB_VERSION_MAJOR >= 3)
718 cisstNetlib_dgetri_(&
size,
758template <vct::
size_type _size,
bool _storageOrder>
775template <vct::
size_type _size,
bool _storageOrder>
Definition nmrInverse.h:238
vctDynamicVectorRef< CISSTNETLIB_INTEGER > & PivotIndices(void)
Definition nmrInverse.h:244
vctDynamicVectorRef< CISSTNETLIB_DOUBLE > & Workspace(void)
Definition nmrInverse.h:247
Friend(nmrInverseDynamicData &data)
Definition nmrInverse.h:242
size_type StorageOrder(void)
Definition nmrInverse.h:253
size_type Size(void)
Definition nmrInverse.h:250
Data for Inverse problem (Dynamic).
Definition nmrInverse.h:80
vctDynamicVector< CISSTNETLIB_INTEGER > PivotIndicesMemory
Definition nmrInverse.h:94
void SetDimension(size_type size, bool storageOrder)
Definition nmrInverse.h:118
nmrInverseDynamicData(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A)
Definition nmrInverse.h:300
void ThrowUnlessWorkspaceSizeIsCorrect(vctDynamicVectorBase< _vectorOwnerTypeWorkspace, CISSTNETLIB_DOUBLE > &workspace) CISST_THROW(std
Definition nmrInverse.h:188
void Allocate(size_type size, bool storageOrder)
Definition nmrInverse.h:350
bool StorageOrderMember
Definition nmrInverse.h:111
nmrInverseDynamicData(size_type size, bool storageOrder)
Definition nmrInverse.h:285
vctDynamicVectorRef< CISSTNETLIB_DOUBLE > WorkspaceReference
Definition nmrInverse.h:104
void SetRef(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A, vctDynamicVectorBase< _vectorOwnerTypePivotIndices, CISSTNETLIB_INTEGER > &pivotIndices, vctDynamicVectorBase< _vectorOwnerTypeWorkspace, CISSTNETLIB_DOUBLE > &workspace) CISST_THROW(std
Definition nmrInverse.h:371
nmrInverseDynamicData(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A, vctDynamicVectorBase< _vectorOwnerTypePivotIndices, CISSTNETLIB_INTEGER > &pivotIndices, vctDynamicVectorBase< _vectorOwnerTypeWorkspace, CISSTNETLIB_DOUBLE > &workspace)
Definition nmrInverse.h:320
nmrInverseDynamicData()
Definition nmrInverse.h:268
void ThrowUnlessPivotIndicesSizeIsCorrect(vctDynamicVectorBase< _vectorOwnerTypePivotIndices, CISSTNETLIB_INTEGER > &pivotIndices) CISST_THROW(std
Definition nmrInverse.h:167
static size_type PivotIndicesSize(const vctDynamicConstMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A)
Definition nmrInverse.h:211
void AllocatePivotIndicesWorkspace(bool allocatePivotIndices, bool allocateWorkspace)
Definition nmrInverse.h:137
@ NB
Definition nmrInverse.h:90
vctDynamicVectorRef< CISSTNETLIB_INTEGER > PivotIndicesReference
Definition nmrInverse.h:103
static size_type WorkspaceSize(const vctDynamicConstMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A)
Definition nmrInverse.h:224
size_type SizeMember
Definition nmrInverse.h:110
vctDynamicVector< CISSTNETLIB_DOUBLE > WorkspaceMemory
Definition nmrInverse.h:97
vct::size_type size_type
Definition nmrInverse.h:88
void Allocate(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A)
Definition nmrInverse.h:338
Definition nmrInverse.h:446
VectorTypeWorkspace & Workspace(void)
Definition nmrInverse.h:455
Friend(nmrInverseFixedSizeData< _size, _storageOrder > &data)
Definition nmrInverse.h:450
VectorTypePivotIndices & PivotIndices(void)
Definition nmrInverse.h:452
Data for Inverse problem (Fixed size).
Definition nmrInverse.h:415
vctFixedSizeMatrix< CISSTNETLIB_DOUBLE, _size, _size, _storageOrder > MatrixTypeA
Definition nmrInverse.h:426
vct::size_type size_type
Definition nmrInverse.h:418
@ LWORK
Definition nmrInverse.h:421
VectorTypeWorkspace WorkspaceMember
Definition nmrInverse.h:436
nmrInverseFixedSizeData()
Definition nmrInverse.h:464
VectorTypePivotIndices PivotIndicesMember
Definition nmrInverse.h:435
vctFixedSizeVector< CISSTNETLIB_DOUBLE, LWORK > VectorTypeWorkspace
Definition nmrInverse.h:432
vctFixedSizeVector< CISSTNETLIB_INTEGER, MAX_SIZE_1 > VectorTypePivotIndices
Definition nmrInverse.h:429
@ NB
Definition nmrInverse.h:420
@ MAX_SIZE_1
Definition nmrInverse.h:419
Definition vctForwardDeclarations.h:145
Definition vctDynamicMatrixBase.h:43
Definition vctDynamicVectorBase.h:62
pointer Pointer(index_type index=0)
Definition vctDynamicVectorBase.h:155
Definition vctForwardDeclarations.h:131
Dynamic vector referencing existing memory.
Definition vctDynamicVectorRef.h:78
void SetRef(size_type size, pointer data, stride_type stride=1)
Definition vctDynamicVectorRef.h:156
pointer Pointer(size_type rowIndex, size_type colIndex)
Definition vctFixedSizeMatrixBase.h:161
Implementation of a fixed-size matrix using template metaprogramming.
Definition vctFixedSizeMatrix.h:54
pointer Pointer(size_type index=0)
Definition vctFixedSizeVectorBase.h:226
Implementation of a fixed-size vector using template metaprogramming.
Definition vctFixedSizeVector.h:54
#define CMN_ASSERT(expr)
Definition cmnAssert.h:97
#define CISST_THROW(exceptionParameter)
Somewhat portable compilation warning message. This works with very recent versions of gcc (4....
Definition cmnPortability.h:559
Declaration of the template function cmnThrow.
void cmnThrow(const _exceptionType &except, cmnLogLevel lod=CMN_LOG_LEVEL_INIT_ERROR)
Definition cmnThrow.h:76
size_t size_type
Definition vctContainerTraits.h:35
CISSTNETLIB_INTEGER nmrInverse(vctDynamicMatrixBase< _matrixOwnerType, CISSTNETLIB_DOUBLE > &A, nmrInverseDynamicData &data) CISST_THROW(std
Definition nmrInverse.h:572
size_type size(void) const
Definition vctDynamicConstMatrixBase.h:228
Declaration of vctDynamicMatrix.
Declaration of vctFixedSizeMatrix.
const bool VCT_ROW_MAJOR
Definition vctForwardDeclarations.h:41