cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nmrPInverse.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */
3 
4 /*
5  Author(s): Ankur Kapoor
6  Created on: 2005-10-18
7 
8  (C) Copyright 2005-2015 Johns Hopkins University (JHU), All Rights Reserved.
9 
10 --- begin cisst license - do not edit ---
11 
12 This software is provided "as is" under an open source license, with
13 no warranty. The complete license can be found in license.txt and
14 http://www.cisst.org/cisst/license.txt.
15 
16 --- end cisst license ---
17 */
18 
19 
26 #ifndef _nmrPInverse_h
27 #define _nmrPInverse_h
28 
29 #include <cisstCommon/cmnThrow.h>
33 #include <cisstNumerical/nmrSVD.h>
34 
35 // Always include last
37 
38 /*
39  ****************************************************************************
40  DYNAMIC SIZE
41  ****************************************************************************
42  */
43 
47 
48 public:
55 
56 protected:
79 
87 
92  inline void SetDimension(size_type m, size_type n, bool storageOrder)
93  {
94  StorageOrderMember = storageOrder;
95  MMember = m;
96  NMember = n;
97  }
98 
112  inline void AllocateOutputWorkspace(bool allocateOutput, bool allocateWorkspace)
113  {
114  // allocate output
115  if (allocateOutput) {
118  (StorageOrderMember) ? MMember : 1,
119  (StorageOrderMember) ? 1 : NMember,
121  } else {
123  }
124  // allocate workspace
125  if (allocateWorkspace) {
127  this->SetRefSVD(this->WorkspaceMemory);
128  } else {
129  this->WorkspaceMemory.SetSize(0);
130  }
131  }
132 
133 
140  template <class _vectorOwnerTypeWorkspace>
142  {
143  const size_type minmn = (MMember < NMember) ? MMember : NMember;
144  size_type current = 0;
146  (StorageOrderMember) ? MMember : 1,
147  (StorageOrderMember) ? 1 : MMember,
148  workspace.Pointer(current));
149  current += (MMember * MMember);
151  (StorageOrderMember) ? NMember : 1,
152  (StorageOrderMember) ? 1 : NMember,
153  workspace.Pointer(current));
154  current += (NMember * NMember);
155  SReference.SetRef(minmn,
156  workspace.Pointer(current),
157  1);
158  current += minmn;
160  workspace.Pointer(current),
161  1);
162  }
163 
164 
165 
172  template <typename _matrixOwnerTypePInverse>
174  throw(std::runtime_error)
175  {
176  // check sizes and storage order
177  if ((MMember != pInverse.cols()) || (NMember != pInverse.rows())) {
178  cmnThrow(std::runtime_error("nmrPInverseDynamicData: Size of matrix pInverse is incorrect."));
179  }
180  if (pInverse.StorageOrder() != StorageOrderMember) {
181  cmnThrow(std::runtime_error("nmrPInverseDynamicData: Storage order of pInverse is incorrect."));
182  }
183  }
184 
192  template <typename _vectorOwnerTypeWorkspace>
193  inline void
195  throw(std::runtime_error)
196  {
198  if (lwork > workspace.size()) {
199  cmnThrow(std::runtime_error("nmrPInverseDynamicData: Workspace is too small."));
200  }
201  if (!workspace.IsCompact()) {
202  cmnThrow(std::runtime_error("nmrPInverseDynamicData: Workspace must be compact."));
203  }
204  }
205 
206 
207 public:
214  {
215  const size_type minmn = (m < n) ? m : n;
216  const size_type maxmn = (m > n) ? m : n;
217  const size_type lwork_1 = 3 * minmn + maxmn;
218  const size_type lwork_2 = 5 * minmn;
219  const size_type lwork = (lwork_1 > lwork_2) ? lwork_1 : lwork_2;
220  // u vt s workspace p = s^+ ut
221  return m * m + n * n + minmn + lwork + n * m;
222  }
223 
229  template <class _matrixOwnerTypeA>
231  {
233  }
234 
235 #ifndef SWIG
236 #ifndef DOXYGEN
237 
243  class Friend {
244  private:
245  nmrPInverseDynamicData & Data;
246  public:
247  Friend(nmrPInverseDynamicData &data): Data(data) {
248  }
250  return Data.SReference;
251  }
253  return Data.PInverseReference;
254  }
256  return Data.UReference;
257  }
259  return Data.VtReference;
260  }
262  return Data.WorkspaceReference;
263  }
264  inline size_type M(void) {
265  return Data.MMember;
266  }
267  inline size_type N(void) {
268  return Data.NMember;
269  }
270  inline bool StorageOrder(void) {
271  return Data.StorageOrderMember;
272  }
273  };
274  friend class Friend;
275 #endif // DOXYGEN
276 #endif // #ifndef SWIG
277 
285  MMember(static_cast<size_type>(0)),
286  NMember(static_cast<size_type>(0)),
288  {
289  AllocateOutputWorkspace(false, false);
290  };
291 
292 
300  template <class _matrixOwnerTypeA>
302  {
303  this->Allocate(A.rows(), A.cols(), A.StorageOrder());
304  }
305 
315  template <class _matrixOwnerTypeA, class _vectorOwnerTypeWorkspace>
318  {
319  this->SetRefWorkspace(A, workspace);
320  }
321 
331  template <class _matrixOwnerTypeA,
332  class _matrixOwnerTypePInverse,
333  class _vectorOwnerTypeWorkspace>
337  {
338  this->SetRef(pInverse, workspace);
339  }
352  template <class _matrixOwnerTypeA, class _matrixOwnerTypePInverse>
355  {
356  this->SetRefOutput(pInverse);
357  }
358 
359 
371  template <class _matrixOwnerTypeA>
373  {
374  this->SetDimension(A.rows(), A.cols(), A.StorageOrder());
375  this->AllocateOutputWorkspace(true, true);
376  }
377 
378 
397  template <class _matrixOwnerTypeA, class _vectorOwnerTypeWorkspace>
400  {
401  this->SetDimension(A.rows(), A.cols(), A.StorageOrder());
402  this->AllocateOutputWorkspace(true, false);
403  // call helper method to set references for SVD components
404  this->ThrowUnlessWorkspaceSizeIsCorrect(workspace);
405  this->SetRefSVD(workspace);
406  }
407 
418  template <class _matrixOwnerTypePInverse,
419  class _vectorOwnerTypeWorkspace>
422  {
423  this->SetDimension(pInverse.cols(), pInverse.rows(), pInverse.StorageOrder());
424  this->AllocateOutputWorkspace(false, false);
425  // set reference on output
426  this->ThrowUnlessOutputSizeIsCorrect(pInverse);
427  this->PInverseReference.SetRef(pInverse);
428  // set reference on workspace
429  this->ThrowUnlessWorkspaceSizeIsCorrect(workspace);
430  this->SetRefSVD(workspace);
431  }
432 
447  template <class _matrixOwnerTypePInverse>
449  {
450  this->SetDimension(pInverse.cols(), pInverse.rows(), pInverse.StorageOrder());
451  this->AllocateOutputWorkspace(false, true);
452  this->ThrowUnlessOutputSizeIsCorrect(pInverse);
453  this->PInverseReference.SetRef(pInverse);
454  }
455 
456 
457 
458 public:
467  inline const vctDynamicVectorRef<CISSTNETLIB_DOUBLE> &S(void) const {
468  return SReference;
469  }
470  inline const vctDynamicMatrixRef<CISSTNETLIB_DOUBLE> &U(void) const {
471  return UReference;
472  }
473  inline const vctDynamicMatrixRef<CISSTNETLIB_DOUBLE> &Vt(void) const {
474  return VtReference;
475  }
477  return PInverseReference;
478  }
480 };
481 
482 
483 #ifndef SWIG
484 /*
485  ****************************************************************************
486  FIXED SIZE
487  ****************************************************************************
488  */
489 
496 template <vct::size_type _rows, vct::size_type _cols, bool _storageOrder>
498 {
499 public:
501 #ifndef DOXYGEN
502  enum {MIN_MN = (_rows < _cols) ? _rows : _cols};
503  enum {LWORK_1 = (3 * MIN_MN + (_rows > _cols)) ? _rows : _cols};
504  enum {LWORK_2 = 5 * MIN_MN};
505  enum {LWORK_3 =
506  (static_cast<size_type>(LWORK_1) > static_cast<size_type>(LWORK_2))
507  ?
508  static_cast<size_type>(LWORK_1)
509  :
510  static_cast<size_type>(LWORK_2)};
511  enum {LWORK = _rows * _rows + _cols * _cols + static_cast<size_type>(MIN_MN) + static_cast<size_type>(LWORK_3) + _rows * _cols};
512 #endif // DOXYGEN
513 
529 private:
531  MatrixTypePInverse PInverseMember;
532 
536  VectorTypeWorkspace WorkspaceMember;
537 
540  MatrixTypeU UReference;
541  MatrixTypeVt VtReference;
542  VectorTypeS SReference;
543  VectorTypeSVDWorkspace SVDWorkspaceReference;
544  MatrixTypeP PReference;
545  //*}
546 
547 public:
548 
549 #ifndef DOXYGEN
550  /* This class is not intended to be a top-level API. It has been
551  provided to avoid making the templated PInverse function as a
552  friend of this class, which turns out to be not so easy with
553  Visual C++ 7. Instead the Friend class provides a cumbersome way
554  to get non-const references to the private data. In order to
555  get non-const references the user has to first create a object
556  of nmrPInverseFixedSizeData::Friend and then user get* method on
557  that object. Our philosophy here is that this should be deterent
558  for a general user and should ring alarm bells in a reasonable
559  programmer.
560  */
561  class Friend {
562  private:
564  public:
566  }
567  inline MatrixTypePInverse & PInverse(void) {
568  return Data.PInverseMember;
569  }
570  inline VectorTypeS & S(void) {
571  return Data.SReference;
572  }
573  inline MatrixTypeU & U(void) {
574  return Data.UReference;
575  }
576  inline MatrixTypeVt & Vt(void) {
577  return Data.VtReference;
578  }
579  inline VectorTypeWorkspace & Workspace(void) {
580  return Data.WorkspaceMember;
581  }
582  inline MatrixTypeP & P(void) {
583  return Data.PReference;
584  }
585  };
586  friend class Friend;
587 #endif
588 
594  UReference(WorkspaceMember.Pointer(0)),
595  VtReference(WorkspaceMember.Pointer(_rows * _rows)),
596  SReference(WorkspaceMember.Pointer(_rows * _rows + _cols * _cols)),
597  SVDWorkspaceReference(WorkspaceMember.Pointer(_rows * _rows + _cols * _cols + MIN_MN)),
598  PReference(WorkspaceMember.Pointer(_rows * _rows + _cols * _cols + MIN_MN + LWORK_3))
599  {};
600 
609  inline const MatrixTypePInverse & PInverse(void) const {
610  return PInverseMember;
611  }
612  inline const VectorTypeS & S(void) const {
613  return SReference;
614  }
615  inline const MatrixTypeU & U(void) const {
616  return UReference;
617  }
618  inline const MatrixTypeVt & Vt(void) const {
619  return VtReference;
620  }
621  inline const MatrixTypeP & P(void) const {
622  return PReference;
623  }
625 };
626 #endif // #ifndef SWIG
627 
628 
763 
783 template <class _matrixOwnerType>
784 inline CISSTNETLIB_INTEGER nmrPInverse(vctDynamicMatrixBase<_matrixOwnerType, CISSTNETLIB_DOUBLE> &A, nmrPInverseDynamicData &data) throw (std::runtime_error)
785 {
786  typedef vct::size_type size_type;
787 
788  typename nmrPInverseDynamicData::Friend dataFriend(data);
789  CISSTNETLIB_INTEGER ret_value;
790  /* check that the size and storage order matches with Allocate() */
791  if (A.StorageOrder() != dataFriend.StorageOrder()) {
792  cmnThrow(std::runtime_error("nmrPInverse Solve: Storage order used for Allocate was different"));
793  }
794  if ((A.rows() != dataFriend.M()) || (A.cols() != dataFriend.N())) {
795  cmnThrow(std::runtime_error("nmrPInverse Solve: Size used for Allocate was different"));
796  }
797  const size_type rows = A.rows();
798  const size_type cols = A.cols();
799  const size_type minmn = (rows < cols) ? rows : cols;
800  const size_type maxmn = (rows > cols) ? rows : cols;
801 
802  ret_value = nmrSVD(A, dataFriend.U(), dataFriend.S(),
803  dataFriend.Vt(), dataFriend.Workspace());
804  const CISSTNETLIB_DOUBLE eps = cmnTypeTraits<CISSTNETLIB_DOUBLE>::Tolerance() * dataFriend.S().at(0) * maxmn;
805 
806  dataFriend.PInverse().SetAll(0);
807  CISSTNETLIB_DOUBLE singularValue;
808  size_type irank, i, j;
809  for (irank = 0; irank < minmn; irank++) {
810  if ((singularValue = dataFriend.S().at(irank)) > eps) {
811  for (j = 0; j < rows; j++) {
812  for (i = 0; i < cols; i++) {
813  dataFriend.PInverse().at(i, j) = dataFriend.PInverse().at(i, j)
814  + dataFriend.Vt().at(irank, i) * dataFriend.U().at(j, irank) / singularValue;
815  }
816  }
817  }
818  }
819  return ret_value;
820 }
821 
822 
839 template <class _matrixOwnerTypeA, class _matrixOwnerTypePInverse, class _vectorOwnerTypeWorkspace>
842 {
843  nmrPInverseDynamicData svdData(A, PInverse, Workspace);
844  CISSTNETLIB_INTEGER ret_value = nmrPInverse(A, svdData);
845  return ret_value;
846 }
847 
848 
863 template <class _matrixOwnerTypeA, class _matrixOwnerTypePInverse>
866 {
867  nmrPInverseDynamicData svdData(A, PInverse);
868  CISSTNETLIB_INTEGER ret_value = nmrPInverse(A, svdData);
869  return ret_value;
870 }
871 
872 
873 #ifndef SWIG
874 
891 template <vct::size_type _rows, vct::size_type _cols, vct::size_type _work, bool _storageOrder, class _dataPtrType>
895 {
896  typedef vct::size_type size_type;
900  const size_type maxmn = (_rows > _cols) ? _rows : _cols;
901  //Assert if requirement is greater than size provided!
902  CMN_ASSERT(lwork <= _work);
903  // split Work into submatrices and vectors
904  // for this we simply use the nmrSVD with dynamic ref as parameters as we dont have
905  // nmrSVD with fixedsizeref as parameters
907  vctDynamicMatrixRef<CISSTNETLIB_DOUBLE> URef(_rows, _rows,
908  (_storageOrder) ? _rows : 1,
909  (_storageOrder) ? 1 : _rows,
910  workspace.Pointer(0));
911  vctDynamicMatrixRef<CISSTNETLIB_DOUBLE> VtRef(_cols, _cols,
912  (_storageOrder) ? _cols : 1,
913  (_storageOrder) ? 1 : _cols,
914  workspace.Pointer(_rows*_rows));
916  workspace.Pointer(_rows * _rows + _cols * _cols));
917  vctDynamicVectorRef<CISSTNETLIB_DOUBLE> SVDWorkspaceRef(lwork_3,
918  workspace.Pointer(_rows * _rows + _cols * _cols + minmn));
919  vctDynamicMatrixRef<CISSTNETLIB_DOUBLE> PRef(_cols, _rows, (_storageOrder) ? _rows : 1, (_storageOrder) ? 1 : _cols,
920  workspace.Pointer(_rows * _rows + _cols * _cols + minmn + lwork_3));
921  vctDynamicMatrixRef<CISSTNETLIB_DOUBLE> pInverseRef(pInverse);
922  CISSTNETLIB_INTEGER ret_value;
923  ret_value = nmrSVD(ARef, URef, SRef, VtRef, SVDWorkspaceRef);
924  const CISSTNETLIB_DOUBLE eps = cmnTypeTraits<CISSTNETLIB_DOUBLE>::Tolerance() * SRef(0) * maxmn;
925  /*
926  vctDynamicMatrix<CISSTNETLIB_DOUBLE> SM (_cols, _rows, _storageOrder);
927  SM.SetAll(0.);
928  for (size_type irank = 0; irank < minmn; irank++) {
929  if (SRef(irank) > eps) {
930  SM(irank, irank) = 1.0/SRef(irank);
931  }
932  }
933  PRef.ProductOf(SM, URef.Transpose());
934  */
935  size_type irank;
936  PRef.SetAll(0.);
937  for (irank = 0; irank < minmn; irank++) {
938  if (SRef(irank) > eps) {
939  PRef.Row(irank).ProductOf(URef.Transpose().Row(irank), 1.0/SRef(irank));
940  } else {
941  PRef.Row(irank).SetAll(0.);
942  }
943  }
944  pInverseRef.ProductOf(VtRef.Transpose(), PRef);
945 
946  return ret_value;
947 }
948 
964 template <vct::size_type _rows, vct::size_type _cols, bool _storageOrder>
967 {
969  CISSTNETLIB_INTEGER ret_value = nmrPInverse(A, pInverse, workspace);
970  return ret_value;
971 }
972 
993 template <vct::size_type _rows, vct::size_type _cols, bool _storageOrder>
996 {
998  /* all the checking is done by SVD */
999  CISSTNETLIB_INTEGER ret_value = nmrPInverse(A, dataFriend.PInverse(), dataFriend.Workspace());
1000  return ret_value;
1001 }
1002 #endif // #ifndef SWIG
1003 
1005 
1006 
1007 #endif
1008 
vctDynamicMatrixRef< CISSTNETLIB_DOUBLE > UReference
Definition: nmrPInverse.h:74
vct::size_type size_type
Definition: nmrPInverse.h:54
Declaration of vctDynamicMatrix.
CISSTNETLIB_INTEGER nmrPInverse(vctDynamicMatrixBase< _matrixOwnerType, CISSTNETLIB_DOUBLE > &A, nmrPInverseDynamicData &data)
Definition: nmrPInverse.h:784
#define CMN_ASSERT(expr)
Definition: cmnAssert.h:90
bool StorageOrderMember
Definition: nmrPInverse.h:85
Definition: vctDynamicMatrixBase.h:42
nmrPInverseDynamicData(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &CMN_UNUSED(A), vctDynamicMatrixBase< _matrixOwnerTypePInverse, CISSTNETLIB_DOUBLE > &pInverse, vctDynamicVectorBase< _vectorOwnerTypeWorkspace, CISSTNETLIB_DOUBLE > &workspace)
Definition: nmrPInverse.h:334
vctFixedSizeVectorRef< CISSTNETLIB_DOUBLE, LWORK_3, 1 > VectorTypeSVDWorkspace
Definition: nmrPInverse.h:527
nmrPInverseDynamicData(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A, vctDynamicVectorBase< _vectorOwnerTypeWorkspace, CISSTNETLIB_DOUBLE > &workspace)
Definition: nmrPInverse.h:316
#define CMN_UNUSED(argument)
Definition: cmnPortability.h:479
VectorTypeS & S(void)
Definition: nmrPInverse.h:570
vctFixedSizeMatrix< CISSTNETLIB_DOUBLE, _cols, _rows, _storageOrder > MatrixTypePInverse
Definition: nmrPInverse.h:517
size_type MMember
Definition: nmrPInverse.h:83
size_type M(void)
Definition: nmrPInverse.h:264
static Type Tolerance(void)
Definition: cmnTypeTraits.h:170
vctDynamicMatrixRef< CISSTNETLIB_DOUBLE > & U(void)
Definition: nmrPInverse.h:255
Declaration of vctFixedSizeMatrix.
const vctDynamicMatrixRef< CISSTNETLIB_DOUBLE > & U(void) const
Definition: nmrPInverse.h:470
void ThrowUnlessOutputSizeIsCorrect(vctDynamicMatrixBase< _matrixOwnerTypePInverse, CISSTNETLIB_DOUBLE > &pInverse) const
Definition: nmrPInverse.h:173
void ThrowUnlessWorkspaceSizeIsCorrect(vctDynamicVectorBase< _vectorOwnerTypeWorkspace, CISSTNETLIB_DOUBLE > &workspace) const
Definition: nmrPInverse.h:194
size_t size_type
Definition: vctContainerTraits.h:35
size_type N(void)
Definition: nmrPInverse.h:267
void SetRefSVD(vctDynamicVectorBase< _vectorOwnerTypeWorkspace, CISSTNETLIB_DOUBLE > &workspace)
Definition: nmrPInverse.h:141
nmrPInverseDynamicData(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &CMN_UNUSED(A), vctDynamicMatrixBase< _matrixOwnerTypePInverse, CISSTNETLIB_DOUBLE > &pInverse)
Definition: nmrPInverse.h:353
Definition: nmrPInverse.h:511
void AllocateOutputWorkspace(bool allocateOutput, bool allocateWorkspace)
Definition: nmrPInverse.h:112
bool StorageOrder(void) const
Definition: vctDynamicConstMatrixBase.h:656
Definition: nmrPInverse.h:46
vctFixedSizeMatrixRef< CISSTNETLIB_DOUBLE, _cols, _rows, _storageOrder?_cols:1, _storageOrder?1:_rows > MatrixTypeP
Definition: nmrPInverse.h:528
void SetRef(size_type size, pointer data, stride_type stride=1)
Definition: vctDynamicVectorRef.h:156
Definition: nmrPInverse.h:243
void SetRefWorkspace(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A, vctDynamicVectorBase< _vectorOwnerTypeWorkspace, CISSTNETLIB_DOUBLE > &workspace)
Definition: nmrPInverse.h:398
vctDynamicMatrixRef< CISSTNETLIB_DOUBLE > & Vt(void)
Definition: nmrPInverse.h:258
vctDynamicVector< CISSTNETLIB_DOUBLE > OutputMemory
Definition: nmrPInverse.h:68
void SetSize(size_type size)
Definition: vctDynamicVector.h:315
ThisType & ProductOf(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &matrix, const value_type scalar)
Definition: vctDynamicMatrixBase.h:971
Friend(nmrPInverseFixedSizeData< _rows, _cols, _storageOrder > &data)
Definition: nmrPInverse.h:565
const vctDynamicVectorRef< CISSTNETLIB_DOUBLE > & S(void) const
Definition: nmrPInverse.h:467
const VectorTypeS & S(void) const
Definition: nmrPInverse.h:612
vctDynamicVectorRef< CISSTNETLIB_DOUBLE > & S(void)
Definition: nmrPInverse.h:249
const MatrixTypeP & P(void) const
Definition: nmrPInverse.h:621
vctFixedSizeMatrix< CISSTNETLIB_DOUBLE, _rows, _cols, _storageOrder > MatrixTypeA
Definition: nmrPInverse.h:515
VectorTypeWorkspace & Workspace(void)
Definition: nmrPInverse.h:579
vctDynamicVector< CISSTNETLIB_DOUBLE > WorkspaceMemory
Definition: nmrPInverse.h:64
void SetRef(size_type rows, size_type cols, stride_type rowStride, stride_type colStride, pointer dataPointer)
Definition: vctDynamicMatrixRef.h:217
Definition: nmrPInverse.h:503
vctFixedSizeVectorRef< CISSTNETLIB_DOUBLE, MIN_MN, 1 > VectorTypeS
Definition: nmrPInverse.h:525
nmrPInverseFixedSizeData()
Definition: nmrPInverse.h:593
Declaration of nmrSVD.
reference at(index_type index)
Definition: vctDynamicVectorBase.h:170
static size_type WorkspaceSize(size_type m, size_type n)
Definition: nmrSVD.h:298
void SetDimension(size_type m, size_type n, bool storageOrder)
Definition: nmrPInverse.h:92
value_type SetAll(const value_type value)
Definition: vctDynamicMatrixBase.h:452
Definition: nmrPInverse.h:502
size_type rows() const
Definition: vctDynamicConstMatrixBase.h:238
vctDynamicVectorRef< CISSTNETLIB_DOUBLE > WorkspaceReference
Definition: nmrPInverse.h:77
size_type cols() const
Definition: vctDynamicConstMatrixBase.h:243
Definition: nmrPInverse.h:505
vctDynamicMatrixRef< CISSTNETLIB_DOUBLE > VtReference
Definition: nmrPInverse.h:75
nmrPInverseDynamicData()
Definition: nmrPInverse.h:284
MatrixTypeP & P(void)
Definition: nmrPInverse.h:582
const MatrixTypeVt & Vt(void) const
Definition: nmrPInverse.h:618
vctDynamicVectorRef< CISSTNETLIB_DOUBLE > & Workspace(void)
Definition: nmrPInverse.h:261
reference at(size_type index)
Definition: vctDynamicMatrixBase.h:171
vctDynamicMatrixRef< CISSTNETLIB_DOUBLE > & PInverse(void)
Definition: nmrPInverse.h:252
const MatrixTypeU & U(void) const
Definition: nmrPInverse.h:615
size_type NMember
Definition: nmrPInverse.h:84
#define cmnThrow(a)
Definition: MinimalCmn.h:4
Implementation of a fixed-size matrix using template metaprogramming.
Definition: vctFixedSizeMatrix.h:52
static size_type WorkspaceSize(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A)
Definition: nmrPInverse.h:230
Definition: nmrPInverse.h:561
pointer Pointer(index_type index=0)
Definition: vctDynamicVectorBase.h:155
const vctDynamicMatrixRef< CISSTNETLIB_DOUBLE > & PInverse(void) const
Definition: nmrPInverse.h:476
A template for a fixed length vector with fixed spacing in memory.
Definition: vctFixedSizeVectorBase.h:76
void Allocate(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A)
Definition: nmrPInverse.h:372
MatrixTypePInverse & PInverse(void)
Definition: nmrPInverse.h:567
vct::size_type size_type
Definition: nmrPInverse.h:500
MatrixTypeU & U(void)
Definition: nmrPInverse.h:573
vctFixedSizeMatrixRef< CISSTNETLIB_DOUBLE, _cols, _cols, _storageOrder?_cols:1, _storageOrder?1:_cols > MatrixTypeVt
Definition: nmrPInverse.h:523
const MatrixTypePInverse & PInverse(void) const
Definition: nmrPInverse.h:609
void SetRefOutput(vctDynamicMatrixBase< _matrixOwnerTypePInverse, CISSTNETLIB_DOUBLE > &pInverse)
Definition: nmrPInverse.h:448
pointer Pointer(size_type index=0)
Definition: vctFixedSizeVectorBase.h:226
vctDynamicVectorRef< CISSTNETLIB_DOUBLE > SReference
Definition: nmrPInverse.h:76
Definition: nmrPInverse.h:504
Declaration of the template function cmnThrow.
vctDynamicMatrixRef< CISSTNETLIB_DOUBLE > PInverseReference
Definition: nmrPInverse.h:73
MatrixTypeVt & Vt(void)
Definition: nmrPInverse.h:576
const bool VCT_COL_MAJOR
Definition: vctForwardDeclarations.h:46
Definition: nmrPInverse.h:497
CISSTNETLIB_INTEGER nmrSVD(vctDynamicMatrixBase< _matrixOwnerType, CISSTNETLIB_DOUBLE > &A, nmrSVDDynamicData &data)
Definition: nmrSVD.h:1000
bool StorageOrder(void)
Definition: nmrPInverse.h:270
static size_type WorkspaceSize(size_type m, size_type n)
Definition: nmrPInverse.h:213
const vctDynamicMatrixRef< CISSTNETLIB_DOUBLE > & Vt(void) const
Definition: nmrPInverse.h:473
Friend(nmrPInverseDynamicData &data)
Definition: nmrPInverse.h:247
Rules of exporting.
nmrPInverseDynamicData(vctDynamicMatrixBase< _matrixOwnerTypeA, CISSTNETLIB_DOUBLE > &A)
Definition: nmrPInverse.h:301
vctFixedSizeVector< CISSTNETLIB_DOUBLE, LWORK > VectorTypeWorkspace
Definition: nmrPInverse.h:519
Definition: vctDynamicVectorBase.h:61
void SetRef(vctDynamicMatrixBase< _matrixOwnerTypePInverse, CISSTNETLIB_DOUBLE > &pInverse, vctDynamicVectorBase< _vectorOwnerTypeWorkspace, CISSTNETLIB_DOUBLE > &workspace)
Definition: nmrPInverse.h:420
vctFixedSizeMatrixRef< CISSTNETLIB_DOUBLE, _rows, _rows, _storageOrder?_rows:1, _storageOrder?1:_rows > MatrixTypeU
Definition: nmrPInverse.h:521