cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
vctDynamicMatrixBase.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): Ofri Sadowsky, Anton Deguet
6  Created on: 2004-07-01
7 
8  (C) Copyright 2004-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 #pragma once
20 #ifndef _vctDynamicMatrixBase_h
21 #define _vctDynamicMatrixBase_h
22 
28 #include <cstdarg>
32 
41 template <class _matrixOwnerType, typename _elementType>
42 class vctDynamicMatrixBase : public vctDynamicConstMatrixBase<_matrixOwnerType, _elementType>
43 {
44 public:
45  /* define most types from vctContainerTraits */
46  VCT_CONTAINER_TRAITS_TYPEDEFS(_elementType);
47 
51 
52  typedef _matrixOwnerType OwnerType;
53 
54  typedef typename BaseType::iterator iterator;
58 
60  typedef typename BaseType::RowRefType RowRefType;
61 
64 
67 
70 
73 
74 
77  iterator begin(void) {
78  return this->Matrix.begin();
79  }
80 
83  iterator end(void) {
84  return this->Matrix.end();
85  }
86 
90  return this->Matrix.rbegin();
91  }
92 
96  return this->Matrix.rend();
97  }
98 
99  /* documented in base class */
100  const_iterator begin(void) const {
101  return BaseType::begin();
102  }
103 
104  /* documented in base class */
105  const_iterator end(void) const {
106  return BaseType::end();
107  }
108 
109  /* documented in base class */
111  return BaseType::rbegin();
112  }
113 
114  /* documented in base class */
116  return BaseType::rend();
117  }
118 
122  return RowRefType(this->cols(), Pointer(index, 0), this->col_stride());
123  }
124 
125  /* documented in base class */
127  return BaseType::operator[](index);
128  }
129 
130 
131  /* documented in base class */
132  const OwnerType & Owner(void) const {
133  return BaseType::Owner();
134  }
135  OwnerType & Owner(void) {
136  return this->Matrix;
137  }
138 
139 
143  pointer Pointer(size_type rowIndex, size_type colIndex) {
144  return this->Matrix.Pointer(rowIndex, colIndex);
145  }
146 
150  pointer Pointer(void) {
151  return this->Matrix.Pointer();
152  }
153 
154  /* documented in base class */
155  const_pointer Pointer(size_type rowIndex, size_type colIndex) const {
156  return BaseType::Pointer(rowIndex, colIndex);
157  }
158 
159  /* documented in base class */
160  const_pointer Pointer(void) const {
161  return BaseType::Pointer();
162  }
163 
164 
171  reference at(size_type index) throw(std::out_of_range) {
172  this->ThrowUnlessValidIndex(index);
173  return (begin())[index];
174  }
175 
176 
177  /* documented in base class */
178  const_reference at(size_type index) const throw(std::out_of_range) {
179  return BaseType::at(index);
180  }
181 
182 
187  reference at(size_type rowIndex, size_type colIndex) throw(std::out_of_range) {
188  this->ThrowUnlessValidIndex(rowIndex, colIndex);
189  return *(Pointer(rowIndex, colIndex));
190  }
191 
192  /* documented in base class */
193  const_reference at(size_type rowIndex, size_type colIndex) const throw(std::out_of_range) {
194  return BaseType::at(rowIndex, colIndex);
195  }
196 
197 
199  reference operator () (size_type rowIndex, size_type colIndex) throw(std::out_of_range) {
200  return this->at(rowIndex, colIndex);
201  }
202 
203  /* documented in base class */
204  const_reference operator () (size_type rowIndex, size_type colIndex) const throw(std::out_of_range) {
205  return BaseType::operator()(rowIndex, colIndex);
206  }
207 
208 
214  reference Element(size_type rowIndex, size_type colIndex) {
215  return *(Pointer(rowIndex, colIndex));
216  }
217 
218  /* documented in base class */
219  const_reference Element(size_type rowIndex, size_type colIndex) const {
220  return BaseType::Element(rowIndex, colIndex);
221  }
222 
223 
227  RowRefType Row(size_type index) throw(std::out_of_range) {
228  this->ThrowUnlessValidRowIndex(index);
229  return RowRefType(this->cols(), Pointer(index, 0), this->col_stride());
230  }
231 
233  ColumnRefType Column(size_type index) throw(std::out_of_range) {
234  this->ThrowUnlessValidColIndex(index);
235  return ColumnRefType(this->rows(), Pointer(0, index), this->row_stride());
236  }
237 
240  return DiagonalRefType( std::min(this->rows(), this->cols()), Pointer(0, 0), this->row_stride() + this->col_stride() );
241  }
242 
261  VectorPointerType & RowPointers(VectorPointerType & rowPointers) throw(std::runtime_error) {
262  if (! this->col_stride() == 1) {
263  cmnThrow(std::runtime_error("vctDynamicMatrix: RowPointers requires compact rows"));
264  }
265  const size_type rows = this->rows();
266  // resize the vector
267  rowPointers.SetSize(rows);
268  index_type index;
269  for (index = 0; index < rows; ++index) {
270  rowPointers[index] = this->Row(index).Pointer();
271  }
272  return rowPointers;
273  }
274 
275 
276  /* documented in base class */
277  ConstRowRefType Row(size_type index) const throw(std::out_of_range) {
278  return BaseType::Row(index);
279  }
280 
281  /* documented in base class */
282  ConstColumnRefType Column(size_type index) const throw(std::out_of_range) {
283  return BaseType::Column(index);
284  }
285 
286  /* documented in base class */
288  return BaseType::Diagonal();
289  }
290 
291  /* documented in base class */
292  ConstVectorPointerType RowPointers(ConstVectorPointerType & rowPointers) const throw(std::runtime_error) {
293  return BaseType::RowPointers(rowPointers);
294  }
295 
297 
302  const size_type startRow = 0, const size_type startCol = 0) throw (std::out_of_range) {
303  if (((startRow + rows) > this->rows())
304  || ((startCol + cols) > this->cols())) {
305  cmnThrow(std::out_of_range("vctDynamicMatrixBase::Ref: reference is out of range"));
306  }
308  this->row_stride(), this->col_stride(),
309  Pointer(startRow, startCol));
310  }
311 
314  const size_type startRow = 0, const size_type startCol = 0) const throw (std::out_of_range) {
315  return BaseType::Ref(rows, cols, startRow, startCol);
316  }
318 
320 
321  void ExchangeRows(const size_type row1Index, const size_type row2Index) {
322  RowRefType row1( Row(row1Index) );
323  RowRefType row2( Row(row2Index) );
324  row1.SwapElementsWith(row2);
325  }
326 
328  void ExchangeColumns(const size_type col1Index, const size_type col2Index) {
329  ColumnRefType col1( Column(col1Index) );
330  ColumnRefType col2( Column(col2Index) );
331  col1.SwapElementsWith(col2);
332  }
333 
335 
336  template <class __inputMatrixOwnerType, class __indexVectorOwnerType>
339  {
341  Run(*this, inputMatrix, rowIndexVector);
342  }
343 
345  template <class __inputMatrixOwnerType, class __indexVectorOwnerType>
348  {
349  this->TransposeRef().SelectRowsFrom(inputMatrix.TransposeRef(), colIndexVector);
350  }
352 
366  template <class __matrixOwnerType>
368  const index_type permutedRowIndexes[])
369  {
370  const size_type numRows = this->rows();
371  size_type thisRowIndex;
372  for (thisRowIndex = 0; thisRowIndex < numRows; ++thisRowIndex) {
373  Row(thisRowIndex).Assign( inputMatrix.Row(permutedRowIndexes[thisRowIndex]) );
374  }
375  }
376 
390  template <class __matrixOwnerType>
392  const index_type permutedRowIndexes[])
393  {
394  const size_type numRows = this->rows();
395  size_type thisRowIndex;
396  for (thisRowIndex = 0; thisRowIndex < numRows; ++thisRowIndex) {
397  Row(permutedRowIndexes[thisRowIndex]).Assign( inputMatrix.Row(thisRowIndex) );
398  }
399  }
400 
413  template <class __matrixOwnerType>
415  const index_type permutedColumnIndexes[])
416  {
417  const size_type numCols = this->cols();
418  size_type thisColumnIndex;
419  for (thisColumnIndex = 0; thisColumnIndex < numCols; ++thisColumnIndex) {
420  Column(thisColumnIndex).Assign( inputMatrix.Column(permutedColumnIndexes[thisColumnIndex]) );
421  }
422  }
423 
436  template <class __matrixOwnerType>
438  const index_type permutedColumnIndexes[])
439  {
440  const size_type numCols = this->cols();
441  size_type thisColumnIndex;
442  for (thisColumnIndex = 0; thisColumnIndex < numCols; ++thisColumnIndex) {
443  Column(permutedColumnIndexes[thisColumnIndex]).Assign( inputMatrix.Column(thisColumnIndex) );
444  }
445  }
447 
452  inline value_type SetAll(const value_type value) {
455  Run(*this, value);
456  return value;
457  }
458 
459 
468  inline bool Zeros(void) {
469  if (this->IsCompact()) {
470  memset(this->Pointer(), 0, this->size() * sizeof(value_type));
471  return true;
472  } else if (this->col_stride() == 1) {
473  /* memset row by row */
474  const size_type sizeOfRow = this->cols() * sizeof(value_type);
475  const stride_type rowStride = this->row_stride();
476  pointer currentPointer = this->Pointer();
477  const pointer endPointer = currentPointer + this->rows() * rowStride;
478  for (;
479  currentPointer != endPointer;
480  currentPointer += rowStride) {
481  memset(currentPointer, 0, sizeOfRow);
482  }
483  return true;
484  } else if (this->row_stride() == 1) {
485  /* memset col by col */
486  const size_type sizeOfCol = this->rows() * sizeof(value_type);
487  const stride_type colStride = this->col_stride();
488  pointer currentPointer = this->Pointer();
489  const pointer endPointer = currentPointer + this->cols() * colStride;
490  for (;
491  currentPointer != endPointer;
492  currentPointer += colStride) {
493  memset(currentPointer, 0, sizeOfCol);
494  }
495  return true;
496  } else {
497  this->SetAll(static_cast<value_type>(0));
498  return false;
499  }
500  }
501 
502 
508  template <class __matrixOwnerType>
510  if (this->FastCopyCompatible(other)) {
511  this->FastCopyOf(other, false);
512  } else {
514  MoMi<typename vctUnaryOperations<value_type,
515  typename __matrixOwnerType::value_type>::Identity>::
516  Run(*this, other);
517  }
518  return *this;
519  }
521 
522 
529  template <class __matrixOwnerType, typename __elementType>
532  MoMi<typename vctUnaryOperations<value_type,
533  typename __matrixOwnerType::value_type>::Identity>::
534  Run(*this, other);
535  return *this;
536  }
537 
538  template <class __matrixOwnerType, typename __elementType>
540  return this->Assign(other);
541  }
542 
543  template <size_type __rows, size_type __cols,
544  stride_type __rowStride, stride_type __colStride,
545  class __elementType, class __dataPtrType>
547  & other) {
550  Run(*this, vctDynamicConstMatrixRef<__elementType>(other));
551  return *this;
552  }
554 
555 
579  template <class __matrixOwnerType, typename __elementType>
581  return this->Assign(other);
582  }
583 
584  template <size_type __rows, size_type __cols,
585  stride_type __rowStride, stride_type __colStride,
586  class __elementType, class __dataPtrType>
587  inline ThisType & ForceAssign(const vctFixedSizeConstMatrixBase<__rows, __cols,
588  __rowStride, __colStride,
589  __elementType, __dataPtrType> & other) {
590  return this->Assign(other);
591  }
593 
594 
677  template <class __matrixOwnerType>
679  bool performSafetyChecks = vctFastCopy::PerformChecks)
680  throw(std::runtime_error)
681  {
682  return vctFastCopy::MatrixCopy(*this, source, performSafetyChecks);
683  }
684 
685  template <size_type __rows, size_type __cols, stride_type __rowStride, stride_type __colStride, class __dataPtrType>
687  bool performSafetyChecks = vctFastCopy::PerformChecks)
688  throw(std::runtime_error)
689  {
690  return vctFastCopy::MatrixCopy(*this, source, performSafetyChecks);
691  }
693 
694 
716  inline ThisType & Assign(const value_type * elements, bool inputIsRowMajor = true)
717  {
718  // The row stride is the difference between two rows. That is, in row-major
719  // storage it is equal to the number of columns, and in column-major it is
720  // equal to 1.
721  const difference_type inputRowStride = (inputIsRowMajor) ? this->cols() : 1;
722  const difference_type inputColStride = (inputIsRowMajor) ? 1 : this->rows();
723  const vctDynamicConstMatrixRef<value_type> tmpRef( this->rows(), this->cols(),
724  inputRowStride, inputColStride, elements );
725  this->Assign(tmpRef);
726  return *this;
727  }
728 
729 
746  inline ThisType & Assign(const value_type element0, ...)
747  {
748  iterator iter = begin();
749  (*iter) = element0;
750  ++iter;
751  va_list nextArg;
752  va_start(nextArg, element0);
753  for (; iter != end(); ++iter) {
754  (*iter) = static_cast<value_type>(va_arg(nextArg, typename cmnTypeTraits<value_type>::VaArgPromotion));
755  }
756  va_end(nextArg);
757  return *this;
758  }
759 
760 
761 
765  {
766  return RefTransposeType(this->cols(), this->rows(), this->col_stride(), this->row_stride(), Pointer());
767  }
768 
769  /* documented in base class */
771  return BaseType::TransposeRef();
772  }
773 
790  template <class __matrixOwnerType1, class __matrixOwnerType2>
795  ::Run(*this, matrix1, matrix2);
796  return *this;
797  }
798 
799  /* documented above */
800  template <class __matrixOwnerType1, class __matrixOwnerType2>
805  ::Run(*this, matrix1, matrix2);
806  return *this;
807  }
808 
809  /* documented above */
810  template <class __matrixOwnerType1, class __matrixOwnerType2>
815  ::Run(*this, matrix1, matrix2);
816  return *this;
817  }
818 
819  /* documented above */
820  template <class __matrixOwnerType1, class __matrixOwnerType2>
825  ::Run(*this, matrix1, matrix2);
826  return *this;
827  }
828 
829  /* documented above */
830  template <class __matrixOwnerType1, class __matrixOwnerType2>
835  ::Run(*this, matrix1, matrix2);
836  return *this;
837  }
838 
839  /* documented above */
840  template <class __matrixOwnerType1, class __matrixOwnerType2>
845  ::Run(*this, matrix1, matrix2);
846  return *this;
847  }
849 
850 
851 
868  template <class __matrixOwnerType>
872  Run(*this, otherMatrix);
873  return *this;
874  }
875 
876  /* documented above */
877  template <class __matrixOwnerType>
881  Run(*this, otherMatrix);
882  return *this;
883  }
884 
885  /* documented above */
886  template <class __matrixOwnerType>
890  Run(*this, otherMatrix);
891  return *this;
892  }
893 
894  /* documented above */
895  template <class __matrixOwnerType>
899  Run(*this, otherMatrix);
900  return *this;
901  }
902 
903  /* documented above */
904  template <class __matrixOwnerType>
908  Run(*this, otherMatrix);
909  return *this;
910  }
911 
912  /* documented above */
913  template <class __matrixOwnerType>
917  Run(*this, otherMatrix);
918  return *this;
919  }
920 
921  /* documented above */
922  template <class __matrixOwnerType>
924  return this->Add(otherMatrix);
925  }
926 
927  /* documented above */
928  template <class __matrixOwnerType>
930  return this->Subtract(otherMatrix);
931  }
933 
934 
950  template <class __matrixOwnerType>
952  const value_type scalar) {
955  Run(*this, matrix, scalar);
956  return *this;
957  }
958 
959  /* documented above */
960  template <class __matrixOwnerType>
962  const value_type scalar) {
965  Run(*this, matrix, scalar);
966  return *this;
967  }
968 
969  /* documented above */
970  template <class __matrixOwnerType>
972  const value_type scalar) {
975  Run(*this, matrix, scalar);
976  return *this;
977  }
978 
979  /* documented above */
980  template <class __matrixOwnerType>
982  const value_type scalar) {
985  Run(*this, matrix, scalar);
986  return *this;
987  }
988 
989  /* documented above */
990  template <class __matrixOwnerType>
992  const value_type lowerBound) {
995  Run(*this, matrix, lowerBound);
996  return *this;
997  }
998 
999  /* documented above */
1000  template <class __matrixOwnerType>
1002  const value_type upperBound) {
1005  Run(*this, matrix, upperBound);
1006  return *this;
1007  }
1009 
1010 
1011 
1027  template <class __matrixOwnerType>
1028  inline ThisType & SumOf(const value_type scalar,
1032  Run(*this, scalar, matrix);
1033  return *this;
1034  }
1035 
1036  /* documented above */
1037  template <class __matrixOwnerType>
1038  inline ThisType & DifferenceOf(const value_type scalar,
1042  Run(*this, scalar, matrix);
1043  return *this;
1044  }
1045 
1046  /* documented above */
1047  template <class __matrixOwnerType>
1048  inline ThisType & ProductOf(const value_type scalar,
1052  Run(*this, scalar, matrix);
1053  return *this;
1054  }
1055 
1056  /* documented above */
1057  template <class __matrixOwnerType>
1058  inline ThisType & RatioOf(const value_type scalar,
1062  Run(*this, scalar, matrix);
1063  return *this;
1064  }
1065 
1066  /* documented above */
1067  template <class __matrixOwnerType>
1068  inline ThisType & ClippedAboveOf(const value_type upperBound,
1072  Run(*this, upperBound, matrix);
1073  return *this;
1074  }
1075 
1076  /* documented above */
1077  template <class __matrixOwnerType>
1078  inline ThisType & ClippedBelowOf(const value_type lowerBound,
1082  Run(*this, lowerBound, matrix);
1083  return *this;
1084  }
1086 
1087 
1088 
1104  inline ThisType & Add(const value_type scalar) {
1107  Run(*this, scalar);
1108  return *this;
1109  }
1110 
1111  /* documented above */
1112  inline ThisType & Subtract(const value_type scalar) {
1115  Run(*this, scalar);
1116  return *this;
1117  }
1118 
1119  /* documented above */
1120  inline ThisType & Multiply(const value_type scalar) {
1123  Run(*this, scalar);
1124  return *this;
1125  }
1126 
1127  /* documented above */
1128  inline ThisType & Divide(const value_type scalar) {
1131  Run(*this, scalar);
1132  return *this;
1133  }
1134 
1135  /* documented above */
1136  inline ThisType & ClipAbove(const value_type upperBound) {
1139  Run(*this, upperBound);
1140  return *this;
1141  }
1142 
1143  /* documented above */
1144  inline ThisType & ClipBelow(const value_type lowerBound) {
1147  Run(*this, lowerBound);
1148  return *this;
1149  }
1150 
1151  /* documented above */
1152  inline ThisType & operator += (const value_type scalar) {
1153  return this->Add(scalar);
1154  }
1155 
1156  /* documented above */
1157  inline ThisType & operator -= (const value_type scalar) {
1158  return this->Subtract(scalar);
1159  }
1160 
1161  /* documented above */
1162  inline ThisType & operator *= (const value_type scalar) {
1163  return this->Multiply(scalar);
1164  }
1165 
1166  /* documented above */
1167  inline ThisType & operator /= (const value_type scalar) {
1168  return this->Divide(scalar);
1169  }
1171 
1172 
1173  template <class __matrixOwnerType>
1174  inline ThisType & AddProductOf(const value_type scalar,
1176  {
1178  MioSiMi<
1181  Run(*this, scalar, otherMatrix);
1182  return *this;
1183  }
1184 
1185 
1186  template <class __matrixOwnerType1, class __matrixOwnerType2>
1189  {
1191  MioMiMi<
1194  Run(*this, matrix1, matrix2);
1195  return *this;
1196  }
1197 
1198 
1212  template <class __matrixOwnerType>
1216  Run(*this, otherMatrix);
1217  return *this;
1218  }
1219 
1220  /* documented above */
1221  template <class __matrixOwnerType>
1225  Run(*this, otherMatrix);
1226  return *this;
1227  }
1228 
1229  /* documented above */
1230  template <class __matrixOwnerType>
1234  Run(*this, otherMatrix);
1235  return *this;
1236  }
1237 
1238  /* documented above */
1239  template <class __matrixOwnerType>
1243  Run(*this, otherMatrix);
1244  return *this;
1245  }
1246 
1247  template <class __matrixOwnerType>
1249  Assign(otherMatrix.TransposeRef());
1250  return *this;
1251  }
1252 
1254 
1265  inline ThisType & AbsSelf(void) {
1268  Run(*this);
1269  return *this;
1270  }
1271 
1272  /* documented above */
1273  inline ThisType & NegationSelf(void) {
1276  Run(*this);
1277  return *this;
1278  }
1279 
1280  /* documented above */
1281  inline ThisType & FloorSelf(void) {
1284  Run(*this);
1285  return *this;
1286  }
1287 
1288  /* documented above */
1289  inline ThisType & CeilSelf(void) {
1292  Run(*this);
1293  return *this;
1294  }
1296 
1297 
1306  template <class __matrixOwnerType1, class __matrixOwnerType2>
1311  typedef typename Input1MatrixType::ConstRowRefType Input1RowRefType;
1312  typedef typename Input2MatrixType::ConstColumnRefType Input2ColumnRefType;
1315  Run((*this), matrix1, matrix2);
1316  }
1317 
1318 
1321  template <class __vectorOwnerType1, class __vectorOwnerType2>
1324  {
1325  vctDynamicConstMatrixRef<_elementType> colMatrix, rowMatrix;
1326  colMatrix.SetRef(colVector.size(), 1, colVector.stride(), 1, colVector.Pointer(0));
1327  rowMatrix.SetRef(1, rowVector.size(), 1, rowVector.stride(), rowVector.Pointer(0));
1328  this->ProductOf(colMatrix, rowMatrix);
1329  }
1330 
1331 
1332 
1350 #ifndef SWIG
1352  {
1353  public:
1355  };
1356 #endif // SWIG
1357 
1358 };
1359 
1360 
1361 #endif // _vctDynamicMatrixBase_h
size_t index_type
Definition: vctContainerTraits.h:36
OwnerType & Owner(void)
Definition: vctDynamicMatrixBase.h:135
ConstDiagonalRefType Diagonal() const
Definition: vctDynamicConstMatrixBase.h:377
ThisType & CeilOf(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix)
Definition: vctDynamicMatrixBase.h:1240
ConstRowRefType Row(size_type index) const
Definition: vctDynamicMatrixBase.h:277
Definition: vctDynamicMatrixBase.h:1351
ThisType & operator/=(const value_type scalar)
Definition: vctDynamicMatrixBase.h:1167
A template for a fixed size matrix with fixed spacing in memory.
Definition: vctFixedSizeConstMatrixBase.h:103
BaseType::DiagonalRefType DiagonalRefType
Definition: vctDynamicMatrixBase.h:66
A vector object of dynamic size.
Definition: vctDynamicVector.h:127
ThisType & ClipAbove(const value_type upperBound)
Definition: vctDynamicMatrixBase.h:1136
ThisType & operator-=(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix)
Definition: vctDynamicMatrixBase.h:929
ConstRowRefType operator[](size_type index) const
Definition: vctDynamicConstMatrixBase.h:280
const_iterator begin(void) const
Definition: vctDynamicConstMatrixBase.h:203
ThisType & Subtract(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix)
Definition: vctDynamicMatrixBase.h:878
Definition: vctDynamicMatrixBase.h:42
ThisType & ClippedBelowOf(const value_type lowerBound, const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &matrix)
Definition: vctDynamicMatrixBase.h:1078
ConstVectorPointerType RowPointers(ConstVectorPointerType &rowPointers) const
Definition: vctDynamicMatrixBase.h:292
Dynamic vector referencing existing memory (const)
Definition: vctDynamicConstVectorRef.h:79
bool Zeros(void)
Definition: vctDynamicMatrixBase.h:468
Declaration of vctDynamicConstMatrixBase.
ThisType & RatioOf(const value_type scalar, const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &matrix)
Definition: vctDynamicMatrixBase.h:1058
ThisType & ForceAssign(const vctFixedSizeConstMatrixBase< __rows, __cols, __rowStride, __colStride, __elementType, __dataPtrType > &other)
Definition: vctDynamicMatrixBase.h:587
BaseType::VectorPointerType VectorPointerType
Definition: vctDynamicMatrixBase.h:72
Definition: vctDynamicMatrixLoopEngines.h:276
ConstColumnRefType Column(size_type index) const
Definition: vctDynamicMatrixBase.h:282
vctDynamicMatrixBase ThisType
Definition: vctDynamicMatrixBase.h:48
vctDynamicConstMatrixRef< _elementType > Ref(const size_type rows, const size_type cols, const size_type startRow=0, const size_type startCol=0) const
Definition: vctDynamicConstMatrixBase.h:415
ThisType & Assign(const vctDynamicConstMatrixBase< __matrixOwnerType, __elementType > &other)
Definition: vctDynamicMatrixBase.h:530
Definition: vctDynamicMatrixLoopEngines.h:168
const_reference Element(size_type rowIndex, size_type colIndex) const
Definition: vctDynamicMatrixBase.h:219
ThisType & Assign(const vctFixedSizeConstMatrixBase< __rows, __cols, __rowStride, __colStride, __elementType, __dataPtrType > &other)
Definition: vctDynamicMatrixBase.h:546
const_iterator end(void) const
Definition: vctDynamicMatrixBase.h:105
ThisType & ClipBelow(const value_type lowerBound)
Definition: vctDynamicMatrixBase.h:1144
bool FastCopyOf(const vctDynamicConstMatrixBase< __matrixOwnerType, value_type > &source, bool performSafetyChecks=vctFastCopy::PerformChecks)
Definition: vctDynamicMatrixBase.h:678
size_type size(void) const
Definition: vctDynamicConstMatrixBase.h:228
ThisType & ForceAssign(const vctDynamicConstMatrixBase< __matrixOwnerType, __elementType > &other)
Definition: vctDynamicMatrixBase.h:580
ThisType & Assign(const vctDynamicConstVectorBase< __vectorOwnerType, value_type > &other)
Definition: vctDynamicVectorBase.h:242
vctDynamicMatrixRef< value_type > Type
Definition: vctDynamicMatrixBase.h:1354
ConstRowRefType operator[](size_type index) const
Definition: vctDynamicMatrixBase.h:126
reverse_iterator rend(void)
Definition: vctDynamicMatrixBase.h:95
reference at(size_type rowIndex, size_type colIndex)
Definition: vctDynamicMatrixBase.h:187
bool IsCompact(void) const
Definition: vctDynamicConstMatrixBase.h:641
Dynamic vector referencing existing memory.
Definition: vctDynamicVectorRef.h:77
ThisType & NegationSelf(void)
Definition: vctDynamicMatrixBase.h:1273
const_pointer Pointer(size_type rowIndex, size_type colIndex) const
Definition: vctDynamicMatrixBase.h:155
const_iterator begin(void) const
Definition: vctDynamicMatrixBase.h:100
cmnVaArgPromotion< _elementType >::Type VaArgPromotion
Definition: cmnTypeTraits.h:167
vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > BaseType
Definition: vctDynamicMatrixBase.h:50
ThisType & Add(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix)
Definition: vctDynamicMatrixBase.h:869
OwnerType Matrix
Definition: vctDynamicConstMatrixBase.h:167
_matrixOwnerType OwnerType
Definition: vctDynamicMatrixBase.h:52
const_pointer Pointer(void) const
Definition: vctDynamicMatrixBase.h:160
size_t size_type
Definition: vctContainerTraits.h:35
void SelectColsFrom(const vctDynamicConstMatrixBase< __inputMatrixOwnerType, _elementType > &inputMatrix, const vctDynamicConstVectorBase< __indexVectorOwnerType, index_type > &colIndexVector)
Definition: vctDynamicMatrixBase.h:346
BaseType::reverse_iterator reverse_iterator
Definition: vctDynamicMatrixBase.h:55
BaseType::const_iterator const_iterator
Definition: vctDynamicMatrixBase.h:56
ThisType & AddProductOf(const value_type scalar, const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix)
Definition: vctDynamicMatrixBase.h:1174
ThisType & Assign(const value_type *elements, bool inputIsRowMajor=true)
Definition: vctDynamicMatrixBase.h:716
void ExchangeColumns(const size_type col1Index, const size_type col2Index)
Definition: vctDynamicMatrixBase.h:328
static const bool PerformChecks
Definition: vctFastCopy.h:123
ColumnRefType Column(size_type index)
Definition: vctDynamicMatrixBase.h:233
ThisType & ElementwiseProductOf(const vctDynamicConstMatrixBase< __matrixOwnerType1, _elementType > &matrix1, const vctDynamicConstMatrixBase< __matrixOwnerType2, _elementType > &matrix2)
Definition: vctDynamicMatrixBase.h:811
ThisType & ClippedAboveOf(const value_type upperBound, const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &matrix)
Definition: vctDynamicMatrixBase.h:1068
Dynamic matrix referencing existing memory.
Definition: vctDynamicMatrixRef.h:74
Returns the sum of the two InputType object.
Definition: vctStoreBackBinaryOperations.h:76
Declaration of vctStoreBackBinaryOperations.
bool FastCopyOf(const vctFixedSizeConstMatrixBase< __rows, __cols, __rowStride, __colStride, value_type, __dataPtrType > &source, bool performSafetyChecks=vctFastCopy::PerformChecks)
Definition: vctDynamicMatrixBase.h:686
ThisType & ProductOf(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &matrix, const value_type scalar)
Definition: vctDynamicMatrixBase.h:971
Definition: vctDynamicMatrixLoopEngines.h:406
Definition: vctDynamicConstMatrixBase.h:77
ThisType & Add(const value_type scalar)
Definition: vctDynamicMatrixBase.h:1104
RowRefType Row(size_type index)
Definition: vctDynamicMatrixBase.h:227
ThisType & ClippedBelowOf(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &matrix, const value_type upperBound)
Definition: vctDynamicMatrixBase.h:1001
iterator begin(void)
Definition: vctDynamicMatrixBase.h:77
Definition: vctDynamicMatrixLoopEngines.h:89
ThisType & AddElementwiseProductOf(const vctDynamicConstMatrixBase< __matrixOwnerType1, _elementType > &matrix1, const vctDynamicConstMatrixBase< __matrixOwnerType2, _elementType > &matrix2)
Definition: vctDynamicMatrixBase.h:1187
vctDynamicMatrixRef< _elementType > Ref(const size_type rows, const size_type cols, const size_type startRow=0, const size_type startCol=0)
Definition: vctDynamicMatrixBase.h:301
ConstVectorPointerType & RowPointers(ConstVectorPointerType &rowPointers) const
Definition: vctDynamicConstMatrixBase.h:399
Define unary operations on an object as classes.
Definition: vctUnaryOperations.h:55
ThisType & ElementwiseMultiply(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix)
Definition: vctDynamicMatrixBase.h:887
const_reverse_iterator rend(void) const
Definition: vctDynamicConstMatrixBase.h:221
RowRefType operator[](size_type index)
Definition: vctDynamicMatrixBase.h:121
size_type size(void) const
Definition: vctDynamicConstVectorBase.h:164
ptrdiff_t difference_type
Definition: vctContainerTraits.h:38
static bool MatrixCopy(_destinationMatrixType &destination, const _sourceMatrixType &source, bool performSafetyChecks)
Definition: vctFastCopy.h:212
void ColumnInversePermutationOf(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &inputMatrix, const index_type permutedColumnIndexes[])
Definition: vctDynamicMatrixBase.h:437
const_reference at(size_type index) const
Definition: vctDynamicConstMatrixBase.h:289
void RowInversePermutationOf(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &inputMatrix, const index_type permutedRowIndexes[])
Definition: vctDynamicMatrixBase.h:391
ThisType & operator+=(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix)
Definition: vctDynamicMatrixBase.h:923
void ColumnPermutationOf(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &inputMatrix, const index_type permutedColumnIndexes[])
Definition: vctDynamicMatrixBase.h:414
const_reference at(size_type index) const
Definition: vctDynamicMatrixBase.h:178
const OwnerType & Owner(void) const
Definition: vctDynamicMatrixBase.h:132
ThisType & SumOf(const vctDynamicConstMatrixBase< __matrixOwnerType1, _elementType > &matrix1, const vctDynamicConstMatrixBase< __matrixOwnerType2, _elementType > &matrix2)
Definition: vctDynamicMatrixBase.h:791
BaseType::ConstVectorPointerType ConstVectorPointerType
Definition: vctDynamicMatrixBase.h:71
ThisType & ElementwiseMin(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix)
Definition: vctDynamicMatrixBase.h:905
ConstRowRefType Row(size_type index) const
Definition: vctDynamicConstMatrixBase.h:367
pointer Pointer(size_type rowIndex, size_type colIndex)
Definition: vctDynamicMatrixBase.h:143
ThisType & CeilSelf(void)
Definition: vctDynamicMatrixBase.h:1289
Dynamic matrix referencing existing memory (const)
Definition: vctDynamicConstMatrixRef.h:79
value_type SetAll(const value_type value)
Definition: vctDynamicMatrixBase.h:452
void RowPermutationOf(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &inputMatrix, const index_type permutedRowIndexes[])
Definition: vctDynamicMatrixBase.h:367
size_type rows() const
Definition: vctDynamicConstMatrixBase.h:238
size_type cols() const
Definition: vctDynamicConstMatrixBase.h:243
BaseType::ConstDiagonalRefType ConstDiagonalRefType
Definition: vctDynamicMatrixBase.h:65
ThisType & operator=(const vctDynamicConstMatrixBase< __matrixOwnerType, __elementType > &other)
Definition: vctDynamicMatrixBase.h:539
ConstColumnRefType Column(size_type index) const
Definition: vctDynamicConstMatrixBase.h:372
reference operator()(size_type rowIndex, size_type colIndex)
Definition: vctDynamicMatrixBase.h:199
ThisType & operator*=(const value_type scalar)
Definition: vctDynamicMatrixBase.h:1162
const_iterator end(void) const
Definition: vctDynamicConstMatrixBase.h:209
difference_type stride() const
Definition: vctDynamicConstVectorBase.h:169
Definition: vctDynamicMatrixLoopEngines.h:472
ThisType & AbsSelf(void)
Definition: vctDynamicMatrixBase.h:1265
reference at(size_type index)
Definition: vctDynamicMatrixBase.h:171
ThisType & DifferenceOf(const vctDynamicConstMatrixBase< __matrixOwnerType1, _elementType > &matrix1, const vctDynamicConstMatrixBase< __matrixOwnerType2, _elementType > &matrix2)
Definition: vctDynamicMatrixBase.h:801
ThisType & SwapElementsWith(vctDynamicVectorBase< __vectorOwnerType, _elementType > &otherVector)
Definition: vctDynamicVectorBase.h:897
ConstRefTransposeType TransposeRef(void) const
Definition: vctDynamicMatrixBase.h:770
#define cmnThrow(a)
Definition: MinimalCmn.h:4
ThisType & Divide(const value_type scalar)
Definition: vctDynamicMatrixBase.h:1128
reference Element(size_type rowIndex, size_type colIndex)
Definition: vctDynamicMatrixBase.h:214
void ExchangeRows(const size_type row1Index, const size_type row2Index)
Definition: vctDynamicMatrixBase.h:321
ThisType & ElementwiseMaxOf(const vctDynamicConstMatrixBase< __matrixOwnerType1, _elementType > &matrix1, const vctDynamicConstMatrixBase< __matrixOwnerType2, _elementType > &matrix2)
Definition: vctDynamicMatrixBase.h:841
const_reverse_iterator rbegin(void) const
Definition: vctDynamicMatrixBase.h:110
Definition: vctDynamicMatrixLoopEngines.h:884
const_pointer Pointer(index_type index=0) const
Definition: vctDynamicConstVectorBase.h:221
Declaration of vctStoreBackUnaryOperations.
BaseType::const_reverse_iterator const_reverse_iterator
Definition: vctDynamicMatrixBase.h:57
Implement operation of the form for fixed size matrices.
Definition: vctDynamicMatrixLoopEngines.h:658
pointer Pointer(index_type index=0)
Definition: vctDynamicVectorBase.h:155
ThisType & TransposeOf(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix)
Definition: vctDynamicMatrixBase.h:1248
BaseType::ConstRefTransposeType ConstRefTransposeType
Definition: vctDynamicMatrixBase.h:68
ThisType & Assign(const value_type element0,...)
Definition: vctDynamicMatrixBase.h:746
ThisType & SumOf(const value_type scalar, const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &matrix)
Definition: vctDynamicMatrixBase.h:1028
Definition: vctDynamicMatrixRefOwner.h:39
ThisType & Assign(const vctDynamicConstMatrixBase< __matrixOwnerType, value_type > &other)
Definition: vctDynamicMatrixBase.h:509
BaseType::ConstColumnRefType ConstColumnRefType
Definition: vctDynamicMatrixBase.h:62
Definition: vctDynamicMatrixLoopEngines.h:340
ThisType & DifferenceOf(const value_type scalar, const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &matrix)
Definition: vctDynamicMatrixBase.h:1038
reverse_iterator rbegin(void)
Definition: vctDynamicMatrixBase.h:89
ThisType & RatioOf(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &matrix, const value_type scalar)
Definition: vctDynamicMatrixBase.h:981
ptrdiff_t stride_type
Definition: vctContainerTraits.h:37
ThisType & AbsOf(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix)
Definition: vctDynamicMatrixBase.h:1213
void ThrowUnlessValidRowIndex(size_type index) const
Definition: vctDynamicConstMatrixBase.h:187
ThisType & ProductOf(const value_type scalar, const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &matrix)
Definition: vctDynamicMatrixBase.h:1048
ThisType & ElementwiseMax(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix)
Definition: vctDynamicMatrixBase.h:914
VCT_CONTAINER_TRAITS_TYPEDEFS(_elementType)
Implement operation of the form for fixed size matrices.
Definition: vctDynamicMatrixLoopEngines.h:749
ConstRefTransposeType TransposeRef(void) const
Definition: vctDynamicConstMatrixBase.h:980
void SetRef(size_type rows, size_type cols, stride_type rowStride, stride_type colStride, pointer dataPointer)
Definition: vctDynamicConstMatrixRef.h:248
Definition: vctDynamicConstVectorBase.h:77
difference_type row_stride() const
Definition: vctDynamicConstMatrixBase.h:263
ThisType & ClippedAboveOf(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &matrix, const value_type lowerBound)
Definition: vctDynamicMatrixBase.h:991
ConstDiagonalRefType Diagonal(void) const
Definition: vctDynamicMatrixBase.h:287
void OuterProductOf(const vctDynamicConstVectorBase< __vectorOwnerType1, _elementType > &colVector, const vctDynamicConstVectorBase< __vectorOwnerType2, _elementType > &rowVector)
Definition: vctDynamicMatrixBase.h:1322
difference_type col_stride() const
Definition: vctDynamicConstMatrixBase.h:268
BaseType::RefTransposeType RefTransposeType
Definition: vctDynamicMatrixBase.h:69
ThisType & DifferenceOf(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &matrix, const value_type scalar)
Definition: vctDynamicMatrixBase.h:961
BaseType::RowRefType RowRefType
Definition: vctDynamicMatrixBase.h:60
Definition: vctDynamicMatrixLoopEngines.h:232
const_reference at(size_type rowIndex, size_type colIndex) const
Definition: vctDynamicMatrixBase.h:193
void ThrowUnlessValidIndex(size_type index) const
Definition: vctDynamicConstMatrixBase.h:171
ThisType & ElementwiseDivide(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix)
Definition: vctDynamicMatrixBase.h:896
void SelectRowsFrom(const vctDynamicConstMatrixBase< __inputMatrixOwnerType, _elementType > &inputMatrix, const vctDynamicConstVectorBase< __indexVectorOwnerType, index_type > &rowIndexVector)
Definition: vctDynamicMatrixBase.h:337
BaseType::ConstRowRefType ConstRowRefType
Definition: vctDynamicMatrixBase.h:59
const_reverse_iterator rend(void) const
Definition: vctDynamicMatrixBase.h:115
void ProductOf(const vctDynamicConstMatrixBase< __matrixOwnerType1, _elementType > &matrix1, const vctDynamicConstMatrixBase< __matrixOwnerType2, _elementType > &matrix2)
Definition: vctDynamicMatrixBase.h:1307
Returns the product of the two InputType object.
Definition: vctBinaryOperations.h:116
DiagonalRefType Diagonal(void)
Definition: vctDynamicMatrixBase.h:239
const_reverse_iterator rbegin(void) const
Definition: vctDynamicConstMatrixBase.h:215
ThisType & Multiply(const value_type scalar)
Definition: vctDynamicMatrixBase.h:1120
Definition: vctVarStrideMatrixIterator.h:40
ThisType & SumOf(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &matrix, const value_type scalar)
Definition: vctDynamicMatrixBase.h:951
vctDynamicConstMatrixRef< _elementType > Ref(const size_type rows, const size_type cols, const size_type startRow=0, const size_type startCol=0) const
Definition: vctDynamicMatrixBase.h:313
RefTransposeType TransposeRef(void)
Definition: vctDynamicMatrixBase.h:764
BaseType::ColumnRefType ColumnRefType
Definition: vctDynamicMatrixBase.h:63
ThisType & ElementwiseMinOf(const vctDynamicConstMatrixBase< __matrixOwnerType1, _elementType > &matrix1, const vctDynamicConstMatrixBase< __matrixOwnerType2, _elementType > &matrix2)
Definition: vctDynamicMatrixBase.h:831
const_reference operator()(size_type rowIndex, size_type colIndex) const
Definition: vctDynamicConstMatrixBase.h:352
bool FastCopyCompatible(const vctDynamicConstMatrixBase< __matrixOwnerType, value_type > &source) const
Definition: vctDynamicConstMatrixBase.h:677
ThisType & FloorSelf(void)
Definition: vctDynamicMatrixBase.h:1281
static void Run(_outputMatrixType &outputMatrix, const _inputMatrixType &inputMatrix, const _indexVectorType &indexVector)
Definition: vctDynamicMatrixLoopEngines.h:1024
const_reference Element(size_type rowIndex, size_type colIndex) const
Definition: vctDynamicConstMatrixBase.h:362
const OwnerType & Owner(void) const
Definition: vctDynamicConstMatrixBase.h:298
void ThrowUnlessValidColIndex(size_type index) const
Definition: vctDynamicConstMatrixBase.h:194
VectorPointerType & RowPointers(VectorPointerType &rowPointers)
Definition: vctDynamicMatrixBase.h:261
ThisType & Subtract(const value_type scalar)
Definition: vctDynamicMatrixBase.h:1112
ThisType & ElementwiseRatioOf(const vctDynamicConstMatrixBase< __matrixOwnerType1, _elementType > &matrix1, const vctDynamicConstMatrixBase< __matrixOwnerType2, _elementType > &matrix2)
Definition: vctDynamicMatrixBase.h:821
Definition: vctVarStrideMatrixIterator.h:287
pointer Pointer(void)
Definition: vctDynamicMatrixBase.h:150
ThisType & FloorOf(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix)
Definition: vctDynamicMatrixBase.h:1231
ThisType & NegationOf(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix)
Definition: vctDynamicMatrixBase.h:1222
iterator end(void)
Definition: vctDynamicMatrixBase.h:83
const_pointer Pointer(void) const
Definition: vctDynamicConstMatrixBase.h:313
BaseType::iterator iterator
Definition: vctDynamicMatrixBase.h:54