144 if (allocatePivotIndices) {
152 if (allocateWorkspace) {
168 template <
class _vectorOwnerTypePivotIndices>
170 throw(std::runtime_error)
174 if (maxSize1 > pivotIndices.size()) {
175 cmnThrow(std::runtime_error(
"nmrInverseDynamicData: Size of vector pivotIndices is incorrect."));
177 if (!pivotIndices.IsCompact()) {
178 cmnThrow(std::runtime_error(
"nmrInverseDynamicData: Vector pivotIndices must be compact."));
189 template <
class _vectorOwnerTypeWorkspace>
191 throw(std::runtime_error)
195 if (maxSize1 *
NB > workspace.size()) {
196 cmnThrow(std::runtime_error(
"nmrInverseDynamicData: Size of vector workspace is incorrect."));
198 if (!workspace.IsCompact()) {
199 cmnThrow(std::runtime_error(
"nmrInverseDynamicData: Vector workspace must be compact."));
211 template <
class _matrixOwnerTypeA>
215 return ((A.
rows() > 1) ? A.
rows() : 1);
224 template <
class _matrixOwnerTypeA>
301 template <
class _matrixOwnerTypeA>
319 template <
class _matrixOwnerTypeA,
320 class _vectorOwnerTypePivotIndices,
321 class _vectorOwnerTypeWorkspace>
326 this->
SetRef(A, pivotIndices, workspace);
339 template <
class _matrixOwnerTypeA>
370 template <
class _matrixOwnerTypeA,
371 class _vectorOwnerTypePivotIndices,
372 class _vectorOwnerTypeWorkspace>
376 throw(std::runtime_error)
415 template <vct::
size_type _size,
bool _storageOrder>
455 return Data.PivotIndicesMember;
458 return Data.WorkspaceMember;
573 template <
class _matrixOwnerType>
576 throw (std::runtime_error)
579 CISSTNETLIB_INTEGER info;
583 cmnThrow(std::runtime_error(
"nmrInverse: Input must be a square matrix."));
586 if (dataFriend.
Size() != A.rows()) {
587 cmnThrow(std::runtime_error(
"nmrInverse: Size used for Allocate was different."));
590 if (! A.IsCompact()) {
591 cmnThrow(std::runtime_error(
"nmrInverse: Requires a compact matrix."));
594 CISSTNETLIB_INTEGER size = dataFriend.
Size();
595 CISSTNETLIB_INTEGER lda = (size > 1) ? size : 1;
598 #if defined(CISSTNETLIB_VERSION_MAJOR)
599 #if (CISSTNETLIB_VERSION_MAJOR >= 3)
600 cisstNetlib_dgetrf_(&size, &size,
604 cisstNetlib_dgetri_(&size,
611 #else // no major version
612 dgetrf_(&size, &size,
622 #endif // CISSTNETLIB_VERSION
643 template <
class _matrixOwnerTypeA,
644 class _vectorOwnerTypePivotIndices,
645 class _vectorOwnerTypeWorkspace>
663 template <
class _matrixOwnerTypeA>
671 #ifndef SWIG // don't have fixed size containers in Python
695 template <vct::
size_type _size, vct::
size_type _maxSize1, vct::
size_type _lWork,
bool _storageOrder>
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)
714 cisstNetlib_dgetrf_(&size, &size,
718 cisstNetlib_dgetri_(&size,
725 #else // no major version
726 dgetrf_(&size, &size,
736 #endif // CISSTNETLIB_VERSION
758 template <vct::
size_type _size,
bool _storageOrder>
775 template <vct::
size_type _size,
bool _storageOrder>
787 #endif // _nmrInverse_h
vctDynamicVectorRef< CISSTNETLIB_DOUBLE > & Workspace(void)
Definition: nmrInverse.h:249
VectorTypeWorkspace & Workspace(void)
Definition: nmrInverse.h:457
nmrInverseFixedSizeData()
Definition: nmrInverse.h:466
Friend(nmrInverseFixedSizeData< _size, _storageOrder > &data)
Definition: nmrInverse.h:452
void SetDimension(size_type size, bool storageOrder)
Definition: nmrInverse.h:120
Declaration of vctDynamicMatrix.
#define CMN_ASSERT(expr)
Definition: cmnAssert.h:90
bool StorageOrderMember
Definition: nmrInverse.h:113
nmrInverseDynamicData()
Definition: nmrInverse.h:270
Definition: vctDynamicMatrixBase.h:42
VectorTypeWorkspace WorkspaceMember
Definition: nmrInverse.h:438
const bool VCT_ROW_MAJOR
Definition: vctForwardDeclarations.h:43
void Allocate(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A)
Definition: nmrInverse.h:340
vctDynamicVector< CISSTNETLIB_DOUBLE > WorkspaceMemory
Definition: nmrInverse.h:99
vctFixedSizeVector< CISSTNETLIB_INTEGER, MAX_SIZE_1 > VectorTypePivotIndices
Definition: nmrInverse.h:431
Definition: nmrInverse.h:423
vctDynamicVector< CISSTNETLIB_INTEGER > PivotIndicesMemory
Definition: nmrInverse.h:96
Declaration of vctFixedSizeMatrix.
vctFixedSizeVector< CISSTNETLIB_DOUBLE, LWORK > VectorTypeWorkspace
Definition: nmrInverse.h:434
void AllocatePivotIndicesWorkspace(bool allocatePivotIndices, bool allocateWorkspace)
Definition: nmrInverse.h:139
size_type SizeMember
Definition: nmrInverse.h:112
size_t size_type
Definition: vctContainerTraits.h:35
nmrInverseDynamicData(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A)
Definition: nmrInverse.h:302
bool StorageOrder(void) const
Definition: vctDynamicConstMatrixBase.h:656
VectorTypePivotIndices & PivotIndices(void)
Definition: nmrInverse.h:454
VectorTypePivotIndices PivotIndicesMember
Definition: nmrInverse.h:437
Data for Inverse problem (Fixed size).
Definition: nmrInverse.h:416
Friend(nmrInverseDynamicData &data)
Definition: nmrInverse.h:244
void SetRef(size_type size, pointer data, stride_type stride=1)
Definition: vctDynamicVectorRef.h:156
void SetSize(size_type size)
Definition: vctDynamicVector.h:315
Definition: nmrInverse.h:422
Definition: vctDynamicConstMatrixBase.h:77
static size_type WorkspaceSize(const vctDynamicConstMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A)
Definition: nmrInverse.h:226
void SetRef(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A, vctDynamicVectorBase< _vectorOwnerTypePivotIndices, CISSTNETLIB_INTEGER > &pivotIndices, vctDynamicVectorBase< _vectorOwnerTypeWorkspace, CISSTNETLIB_DOUBLE > &workspace)
Definition: nmrInverse.h:373
void Allocate(size_type size, bool storageOrder)
Definition: nmrInverse.h:352
void ThrowUnlessWorkspaceSizeIsCorrect(vctDynamicVectorBase< _vectorOwnerTypeWorkspace, CISSTNETLIB_DOUBLE > &workspace)
Definition: nmrInverse.h:190
size_type size(void) const
Definition: vctDynamicConstVectorBase.h:164
CISSTNETLIB_INTEGER nmrInverse(vctDynamicMatrixBase< _matrixOwnerType, CISSTNETLIB_DOUBLE > &A, nmrInverseDynamicData &data)
Definition: nmrInverse.h:574
Definition: nmrInverse.h:240
size_type Size(void)
Definition: nmrInverse.h:252
vctDynamicVectorRef< CISSTNETLIB_INTEGER > & PivotIndices(void)
Definition: nmrInverse.h:246
size_type StorageOrder(void)
Definition: nmrInverse.h:255
vctDynamicVectorRef< CISSTNETLIB_INTEGER > PivotIndicesReference
Definition: nmrInverse.h:105
size_type rows() const
Definition: vctDynamicConstMatrixBase.h:238
vctFixedSizeMatrix< CISSTNETLIB_DOUBLE, _size, _size, _storageOrder > MatrixTypeA
Definition: nmrInverse.h:428
vct::size_type size_type
Definition: nmrInverse.h:420
#define cmnThrow(a)
Definition: MinimalCmn.h:4
Implementation of a fixed-size matrix using template metaprogramming.
Definition: vctFixedSizeMatrix.h:52
nmrInverseDynamicData(size_type size, bool storageOrder)
Definition: nmrInverse.h:287
pointer Pointer(index_type index=0)
Definition: vctDynamicVectorBase.h:155
Data for Inverse problem (Dynamic).
Definition: nmrInverse.h:82
nmrInverseDynamicData(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A, vctDynamicVectorBase< _vectorOwnerTypePivotIndices, CISSTNETLIB_INTEGER > &pivotIndices, vctDynamicVectorBase< _vectorOwnerTypeWorkspace, CISSTNETLIB_DOUBLE > &workspace)
Definition: nmrInverse.h:322
Definition: nmrInverse.h:92
Definition: nmrInverse.h:448
static size_type PivotIndicesSize(const vctDynamicConstMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A)
Definition: nmrInverse.h:213
pointer Pointer(size_type index=0)
Definition: vctFixedSizeVectorBase.h:226
Declaration of the template function cmnThrow.
Definition: nmrInverse.h:421
vct::size_type size_type
Definition: nmrInverse.h:90
void ThrowUnlessPivotIndicesSizeIsCorrect(vctDynamicVectorBase< _vectorOwnerTypePivotIndices, CISSTNETLIB_INTEGER > &pivotIndices)
Definition: nmrInverse.h:169
pointer Pointer(size_type rowIndex, size_type colIndex)
Definition: vctFixedSizeMatrixBase.h:161
Definition: vctDynamicVectorBase.h:61
vctDynamicVectorRef< CISSTNETLIB_DOUBLE > WorkspaceReference
Definition: nmrInverse.h:106