cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
vctDynamicConstMatrixBase.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 _vctDynamicConstMatrixBase_h
21 #define _vctDynamicConstMatrixBase_h
22 
30 #include <cisstCommon/cmnThrow.h>
31 #include <cisstCommon/cmnAssert.h>
33 
40 
41 #include <iostream>
42 #include <iomanip>
43 
44 
45 /* Forward declarations */
46 #ifndef DOXYGEN
47 template <class _matrixOwnerType, class __matrixOwnerType, class _elementType,
48  class _elementOperationType>
52 
53 template <class _matrixOwnerType, class _elementType,
54  class _elementOperationType>
57  const _elementType & scalar);
58 #endif // DOXYGEN
59 
60 
76 template <class _matrixOwnerType, typename _elementType>
78 {
79 public:
80  /* define most types from vctContainerTraits */
81  VCT_CONTAINER_TRAITS_TYPEDEFS(_elementType);
82  enum {DIMENSION = 2};
84 
87 
89  typedef _matrixOwnerType OwnerType;
90 
92  typedef typename OwnerType::iterator iterator;
93 
96 
99 
102 
106 
110 
114 
118 
122 
126 
130 
134 
138 
142 
146 
148 
152  typedef typename TypeTraits::BoolType BoolType;
153 
157 
160 
163 
164 
165 protected:
168 
169 
171  inline void ThrowUnlessValidIndex(size_type index) const throw(std::out_of_range) {
172  if (! ValidIndex(index)) {
173  cmnThrow(std::out_of_range("vctDynamicMatrix: Invalid index"));
174  }
175  }
176 
177 
179  inline void ThrowUnlessValidIndex(size_type rowIndex, size_type colIndex) const throw(std::out_of_range) {
180  if (! ValidIndex(rowIndex, colIndex)) {
181  cmnThrow(std::out_of_range("vctDynamicMatrix: Invalid indices"));
182  }
183  }
184 
185 
187  inline void ThrowUnlessValidRowIndex(size_type index) const throw(std::out_of_range) {
188  if (! ValidRowIndex(index)) {
189  cmnThrow(std::out_of_range("vctDynamicMatrix: Invalid row index"));
190  }
191  }
192 
194  inline void ThrowUnlessValidColIndex(size_type index) const throw(std::out_of_range) {
195  if (! ValidColIndex(index)) {
196  cmnThrow(std::out_of_range("vctDynamicMatrix: Invalid column index"));
197  }
198  }
199 
200 public:
203  const_iterator begin(void) const {
204  return Matrix.begin();
205  }
206 
209  const_iterator end(void) const {
210  return Matrix.end();
211  }
212 
216  return Matrix.rbegin();
217  }
218 
222  return Matrix.rend();
223  }
224 
228  size_type size(void) const {
229  return Matrix.size();
230  }
231 
233  const nsize_type & sizes(void) const {
234  return Matrix.sizes();
235  }
236 
238  size_type rows() const {
239  return Matrix.rows();
240  }
241 
243  size_type cols() const {
244  return Matrix.cols();
245  }
246 
248  size_type height() const {
249  return Matrix.rows();
250  }
251 
253  size_type width() const {
254  return Matrix.cols();
255  }
256 
258  const nstride_type & strides(void) const {
259  return Matrix.strides();
260  }
261 
264  return Matrix.row_stride();
265  }
266 
269  return Matrix.col_stride();
270  }
271 
274  bool empty() const {
275  return (size() == 0);
276  }
277 
281  return ConstRowRefType(cols(), Pointer(index, 0), col_stride());
282  }
283 
289  const_reference at(size_type index) const throw(std::out_of_range) {
290  ThrowUnlessValidIndex(index);
291  return (begin())[index];
292  }
293 
294 
298  const OwnerType & Owner(void) const {
299  return this->Matrix;
300  }
301 
302 
306  const_pointer Pointer(index_type rowIndex, index_type colIndex) const {
307  return Matrix.Pointer(rowIndex, colIndex);
308  }
309 
313  const_pointer Pointer(void) const {
314  return Matrix.Pointer();
315  }
316 
317 
320  inline bool ValidIndex(size_type index) const {
321  return (index < size());
322  }
323 
326  inline bool ValidIndex(size_type rowIndex, size_type colIndex) const {
327  return ((rowIndex < rows())
328  && (colIndex < cols()));
329  }
330 
332  inline bool ValidRowIndex(size_type rowIndex) const {
333  return (rowIndex < rows());
334  }
335 
337  inline bool ValidColIndex(size_type colIndex) const {
338  return (colIndex < cols());
339  }
340 
341 
346  const_reference at(size_type rowIndex, size_type colIndex) const throw(std::out_of_range) {
347  ThrowUnlessValidIndex(rowIndex, colIndex);
348  return *(Pointer(rowIndex, colIndex));
349  }
350 
352  const_reference operator () (size_type rowIndex, size_type colIndex) const throw(std::out_of_range) {
353  return this->at(rowIndex, colIndex);
354  }
355 
356 
362  const_reference Element(size_type rowIndex, size_type colIndex) const {
363  return *(Pointer(rowIndex, colIndex));
364  }
365 
366 
367  ConstRowRefType Row(size_type index) const throw(std::out_of_range) {
369  return ConstRowRefType(cols(), Pointer(index, 0), col_stride());
370  }
371 
372  ConstColumnRefType Column(size_type index) const throw(std::out_of_range) {
374  return ConstColumnRefType(rows(), Pointer(0, index), row_stride());
375  }
376 
378  return ConstDiagonalRefType( std::min(rows(), cols()), Pointer(0, 0), row_stride() + col_stride() );
379  }
380 
399  ConstVectorPointerType & RowPointers(ConstVectorPointerType & rowPointers) const throw(std::runtime_error) {
400  if (! this->col_stride() == 1) {
401  cmnThrow(std::runtime_error("vctDynamicMatrix: RowPointers requires compact rows"));
402  }
403  const size_type rows = this->rows();
404  // resize the vector
405  rowPointers.SetSize(rows);
406  index_type index;
407  for (index = 0; index < rows; ++index) {
408  rowPointers[index] = this->Row(index).Pointer();
409  }
410  return rowPointers;
411  }
412 
416  const size_type startRow = 0, const size_type startCol = 0) const throw (std::out_of_range) {
417  if (((startRow + rows) > this->rows())
418  || ((startCol + cols) > this->cols())) {
419  cmnThrow(std::out_of_range("vctDynamicConstMatrixBase::Ref: reference is out of range"));
420  }
422  this->row_stride(), this->col_stride(),
423  Pointer(startRow, startCol));
424  }
425 
429 
432  inline value_type SumOfElements(void) const {
436  Run(*this);
437  }
438 
441  inline value_type ProductOfElements(void) const {
445  Run(*this);
446  }
447 
452  inline value_type Trace(void) const {
453  return this->Diagonal().SumOfElements();
454  }
455 
458  inline value_type NormSquare(void) const {
462  Run(*this);
463  }
464 
467  inline NormType Norm(void) const {
468  return sqrt(NormType(NormSquare()));
469  }
470 
475  inline value_type L1Norm(void) const {
479  Run(*this);
480  }
481 
488  inline value_type LinfNorm(void) const {
489  return this->MaxAbsElement();
490  }
491 
494  inline value_type MaxElement(void) const {
498  Run(*this);
499  }
500 
503  inline value_type MinElement(void) const {
507  Run(*this);
508  }
509 
516  inline value_type MaxAbsElement(void) const {
520  Run(*this);
521  }
522 
527  inline value_type MinAbsElement(void) const {
531  Run(*this);
532  }
533 
541  inline void MinAndMaxElement(value_type & minElement, value_type & maxElement) const
542  {
543  vctDynamicMatrixLoopEngines::MinAndMax::Run((*this), minElement, maxElement);
544  }
545 
548  inline bool IsPositive(void) const {
552  Run(*this);
553  }
554 
557  inline bool IsNonNegative(void) const {
561  Run(*this);
562  }
563 
566  inline bool IsNonPositive(void) const {
570  Run(*this);
571  }
572 
575  inline bool IsNegative (void) const {
579  Run(*this);
580  }
581 
584  inline bool All(void) const {
588  Run(*this);
589  }
590 
593  inline bool Any(void) const {
597  Run(*this);
598  }
599 
602  inline bool IsFinite(void) const {
606  Run(*this);
607  }
608 
611  inline bool HasNaN(void) const {
615  Run(*this);
616  }
618 
619 
622 
627  inline bool IsColMajor(void) const {
628  return Matrix.IsColMajor();
629  }
630 
635  inline bool IsRowMajor(void) const {
636  return Matrix.IsRowMajor();
637  }
638 
641  inline bool IsCompact(void) const {
642  return Matrix.IsCompact();
643  }
644 
650  inline bool IsFortran(void) const {
651  return (IsColMajor() && (row_stride() == 1) && (col_stride() == static_cast<stride_type>(rows())));
652  }
653 
656  inline bool StorageOrder(void) const {
657  return Matrix.StorageOrder();
658  }
659 
661  inline bool IsSquare(void) const {
662  return (this->rows() == this->cols());
663  }
664 
666  inline bool IsSquare(size_type size) const {
667  return ((this->rows() == size)
668  && (this->cols() == size));
669  }
671 
672 
676  template <class __matrixOwnerType>
678  {
679  return vctFastCopy::MatrixCopyCompatible(*this, source);
680  }
681 
682  template <size_type __rows, size_type __cols, stride_type __rowStride, stride_type __colStride, class __dataPtrType>
684  {
685  return vctFastCopy::MatrixCopyCompatible(*this, source);
686  }
688 
689 
705  template <class __matrixOwnerType>
706  inline bool Equal(const vctDynamicConstMatrixBase<__matrixOwnerType, _elementType> & otherMatrix) const {
710  Run(*this, otherMatrix);
711  }
712 
713  /* documented above */
714  template <class __matrixOwnerType>
716  return Equal(otherMatrix);
717  }
718 
719  /* documented above */
720  template <class __matrixOwnerType>
722  value_type tolerance) const {
723  return ((*this - otherMatrix).LinfNorm() <= tolerance);
724  }
725 
726  /* documented above */
727  template <class __matrixOwnerType>
729  return ((*this - otherMatrix).LinfNorm() <= TypeTraits::Tolerance());
730  }
731 
732  /* documented above */
733  template <class __matrixOwnerType>
738  Run(*this, otherMatrix);
739  }
740 
741  /* documented above */
742  template <class __matrixOwnerType>
744  return NotEqual(otherMatrix);
745  }
746 
747  /* documented above */
748  template <class __matrixOwnerType>
753  Run(*this, otherMatrix);
754  }
755 
756  /* documented above */
757  template <class __matrixOwnerType>
762  Run(*this, otherMatrix);
763  }
764 
765  /* documented above */
766  template <class __matrixOwnerType>
771  Run(*this, otherMatrix);
772  }
773 
774  /* documented above */
775  template <class __matrixOwnerType>
780  Run(*this, otherMatrix);
781  }
783 
799  template <class __matrixOwnerType>
800  inline BoolMatrixReturnType
802  return vctDynamicMatrixElementwiseCompareMatrix<_matrixOwnerType, __matrixOwnerType, value_type,
803  typename vctBinaryOperations<bool, value_type, value_type>::Equal>(*this, otherMatrix);
804  }
805 
806  /* documented above */
807  template <class __matrixOwnerType>
808  inline BoolMatrixReturnType
810  return vctDynamicMatrixElementwiseCompareMatrix<_matrixOwnerType, __matrixOwnerType, value_type,
812  }
813 
814  /* documented above */
815  template <class __matrixOwnerType>
816  inline BoolMatrixReturnType
818  return vctDynamicMatrixElementwiseCompareMatrix<_matrixOwnerType, __matrixOwnerType, value_type,
819  typename vctBinaryOperations<bool, value_type, value_type>::Lesser>(*this, otherMatrix);
820  }
821 
822  /* documented above */
823  template <class __matrixOwnerType>
824  inline BoolMatrixReturnType
826  return vctDynamicMatrixElementwiseCompareMatrix<_matrixOwnerType, __matrixOwnerType, value_type,
828  }
829 
830  /* documented above */
831  template <class __matrixOwnerType>
832  inline BoolMatrixReturnType
834  return vctDynamicMatrixElementwiseCompareMatrix<_matrixOwnerType, __matrixOwnerType, value_type,
836  }
837 
838  /* documented above */
839  template <class __matrixOwnerType>
840  inline BoolMatrixReturnType
842  return vctDynamicMatrixElementwiseCompareMatrix<_matrixOwnerType, __matrixOwnerType, value_type,
844  }
845 
847 
848 
864  inline bool Equal(const value_type & scalar) const {
868  Run(*this, scalar);
869  }
870 
871  /* documented above */
872  inline bool operator == (const value_type & scalar) const {
873  return Equal(scalar);
874  }
875 
876  /* documented above */
877  inline bool NotEqual(const value_type & scalar) const {
881  Run(*this, scalar);
882  }
883 
884  /* documented above */
885  inline bool operator != (const value_type & scalar) const {
886  return NotEqual(scalar);
887  }
888 
889  /* documented above */
890  inline bool Lesser(const value_type & scalar) const {
894  Run(*this, scalar);
895  }
896 
897  /* documented above */
898  inline bool LesserOrEqual(const value_type & scalar) const {
902  Run(*this, scalar);
903  }
904 
905  /* documented above */
906  inline bool Greater(const value_type & scalar) const {
910  Run(*this, scalar);
911  }
912 
913  /* documented above */
914  inline bool GreaterOrEqual(const value_type & scalar) const {
918  Run(*this, scalar);
919  }
921 
936  BoolMatrixReturnType ElementwiseEqual(const value_type & scalar) const;
937 
938  /* documented above */
939  BoolMatrixReturnType ElementwiseNotEqual(const value_type & scalar) const;
940 
941  /* documented above */
942  BoolMatrixReturnType ElementwiseLesser(const value_type & scalar) const;
943 
944  /* documented above */
945  BoolMatrixReturnType ElementwiseLesserOrEqual(const value_type & scalar) const;
946 
947  /* documented above */
948  BoolMatrixReturnType ElementwiseGreater(const value_type & scalar) const;
949 
950  /* documented above */
951  BoolMatrixReturnType ElementwiseGreaterOrEqual(const value_type & scalar) const;
952 
954 
965  inline MatrixReturnType Abs(void) const;
966 
967  /* documented above */
968  inline MatrixReturnType Negation(void) const;
969 
970  /* documented above */
971  inline MatrixReturnType Floor(void) const;
972 
973  /* documented above */
974  inline MatrixReturnType Ceil(void) const;
976 
981  {
983  }
984 
987  {
988  vctDynamicMatrix<value_type> result( this->TransposeRef() );
989  return vctReturnDynamicMatrix<value_type>(result);
990  }
991 
992 
1005 
1007  std::string ToString(void) {
1008  std::stringstream outputStream;
1009  ToStream(outputStream);
1010  return outputStream.str();
1011  }
1012 
1014  void ToStream(std::ostream & outputStream) const {
1015  const size_type myRows = rows();
1016  const size_type myCols = cols();
1017  // preserve the formatting flags as they were
1018  const std::streamsize width = outputStream.width(12);
1019  const std::streamsize precision = outputStream.precision(6);
1020  bool showpoint = ((outputStream.flags() & std::ios_base::showpoint) != 0);
1021  outputStream << std::setprecision(6) << std::showpoint;
1022  size_type indexRow, indexCol;
1023  for (indexRow = 0; indexRow < myRows; ++indexRow) {
1024  for (indexCol = 0; indexCol < myCols; ++indexCol) {
1025  outputStream << std::setw(12) << this->Element(indexRow, indexCol);
1026  if (indexCol < (myCols-1)) {
1027  outputStream << " ";
1028  }
1029  }
1030  // end of line between rows, not at the end
1031  if (indexRow != (myRows - 1)) {
1032  outputStream << std::endl;
1033  }
1034  }
1035  // resume the formatting flags
1036  outputStream << std::setprecision(precision) << std::setw(width);
1037  if (!showpoint) {
1038  outputStream << std::noshowpoint;
1039  }
1040  }
1041 
1042 
1043  void ToStreamRaw(std::ostream & outputStream, const char delimiter = ' ',
1044  bool headerOnly = false, const std::string & headerPrefix = "") const
1045  {
1046  const size_type myRows = rows();
1047  const size_type myCols = cols();
1048  size_type indexRow, indexCol;
1049 
1050  if (headerOnly) {
1051  for (indexRow = 0; indexRow < myRows; ++indexRow) {
1052  for (indexCol = 0; indexCol < myCols; ++indexCol) {
1053  outputStream << headerPrefix << "-m" << indexRow << "_" << indexCol;
1054  // delimiter between elements
1055  if (indexCol < (myCols - 1)) {
1056  outputStream << delimiter;
1057  }
1058  }
1059  // delimiter between rows, not at the end
1060  if (indexRow < (myRows - 1)) {
1061  outputStream << delimiter;
1062  }
1063  }
1064  } else {
1065  for (indexRow = 0; indexRow < myRows; ++indexRow) {
1066  for (indexCol = 0; indexCol < myCols; ++indexCol) {
1067  outputStream << this->Element(indexRow, indexCol);
1068  // delimiter between elements
1069  if (indexCol < (myCols - 1)) {
1070  outputStream << delimiter;
1071  }
1072  }
1073  // delimiter between rows, not at the end
1074  if (indexRow < (myRows - 1)) {
1075  outputStream << delimiter;
1076  }
1077  }
1078  }
1079  }
1080 
1098 #ifndef SWIG
1100  {
1101  public:
1103  };
1104 #endif // SWIG
1105 
1107  void SerializeRaw(std::ostream & outputStream) const
1108  {
1109  const size_type myRows = rows();
1110  const size_type myCols = cols();
1111  size_type indexRow, indexCol;
1112 
1113  cmnSerializeSizeRaw(outputStream, myRows);
1114  cmnSerializeSizeRaw(outputStream, myCols);
1115  for (indexRow = 0; indexRow < myRows; ++indexRow) {
1116  for (indexCol = 0; indexCol < myCols; ++indexCol) {
1117  cmnSerializeRaw(outputStream, this->Element(indexRow, indexCol));
1118  }
1119  }
1120  }
1121 
1122 };
1123 
1124 #ifndef DOXYGEN
1125 /* documented in class. Implementation moved here for .Net 2003 */
1126 template <class _matrixOwnerType, class _elementType>
1129  return vctDynamicMatrixElementwiseCompareScalar<_matrixOwnerType, _elementType,
1131 }
1132 
1133 /* documented in class. Implementation moved here for .Net 2003 */
1134 template <class _matrixOwnerType, class _elementType>
1137  return vctDynamicMatrixElementwiseCompareScalar<_matrixOwnerType, _elementType,
1139 }
1140 
1141 /* documented in class. Implementation moved here for .Net 2003 */
1142 template <class _matrixOwnerType, class _elementType>
1145  return vctDynamicMatrixElementwiseCompareScalar<_matrixOwnerType, _elementType,
1147 }
1148 
1149 /* documented in class. Implementation moved here for .Net 2003 */
1150 template <class _matrixOwnerType, class _elementType>
1153  return vctDynamicMatrixElementwiseCompareScalar<_matrixOwnerType, _elementType,
1155 }
1156 
1157 /* documented in class. Implementation moved here for .Net 2003 */
1158 template <class _matrixOwnerType, class _elementType>
1161  return vctDynamicMatrixElementwiseCompareScalar<_matrixOwnerType, _elementType,
1163 }
1164 
1165 /* documented in class. Implementation moved here for .Net 2003 */
1166 template <class _matrixOwnerType, class _elementType>
1169  return vctDynamicMatrixElementwiseCompareScalar<_matrixOwnerType, _elementType,
1171 }
1172 #endif // DOXYGEN
1173 
1175 template <class _matrixOwnerType, typename _elementType>
1177  return matrix.All();
1178 }
1179 
1181 template <class _matrixOwnerType, typename _elementType>
1183  return matrix.Any();
1184 }
1185 
1187 template <class _matrixOwnerType, typename _elementType>
1188 std::ostream & operator << (std::ostream & output,
1190  matrix.ToStream(output);
1191  return output;
1192 }
1193 
1194 
1195 // helper function declared and used in vctFixedSizeMatrixBase.h
1196 template <vct::size_type _rows, vct::size_type _cols,
1197  vct::stride_type _rowStride, vct::stride_type _colStride,
1198  class _elementType, class _dataPtrType, class _matrixOwnerType>
1202 {
1203  vctDynamicMatrixRef<_elementType> tempRef(fixedSizeMatrix);
1204  tempRef.Assign(dynamicMatrix);
1205 }
1206 
1207 
1208 #endif // _vctDynamicConstMatrixBase_h
bool IsNegative(void) const
Definition: vctDynamicConstMatrixBase.h:575
size_t index_type
Definition: vctContainerTraits.h:36
ConstDiagonalRefType Diagonal() const
Definition: vctDynamicConstMatrixBase.h:377
bool ValidIndex(size_type index) const
Definition: vctDynamicConstMatrixBase.h:320
A template for a fixed size matrix with fixed spacing in memory.
Definition: vctFixedSizeConstMatrixBase.h:103
vctReturnDynamicMatrix< _elementType > MatrixReturnType
Definition: vctDynamicConstMatrixBase.h:145
A vector object of dynamic size.
Definition: vctDynamicVector.h:127
Assert macros definitions.
cmnTypeTraits< value_type > TypeTraits
Definition: vctDynamicConstMatrixBase.h:147
OwnerType::reverse_iterator reverse_iterator
Definition: vctDynamicConstMatrixBase.h:98
vctDynamicVector< pointer > VectorPointerType
Definition: vctDynamicConstMatrixBase.h:162
bool vctAll(const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > &matrix)
Definition: vctDynamicConstMatrixBase.h:1176
value_type L1Norm(void) const
Definition: vctDynamicConstMatrixBase.h:475
ConstRowRefType operator[](size_type index) const
Definition: vctDynamicConstMatrixBase.h:280
bool IsColMajor(void) const
Definition: vctDynamicConstMatrixBase.h:627
vctDynamicVectorRef< _elementType > DiagonalRefType
Definition: vctDynamicConstMatrixBase.h:125
const_iterator begin(void) const
Definition: vctDynamicConstMatrixBase.h:203
Returns the absolute value of the input as an OutputType object.
Definition: vctUnaryOperations.h:80
Dynamic vector referencing existing memory (const)
Definition: vctDynamicConstVectorRef.h:79
value_type NormSquare(void) const
Definition: vctDynamicConstMatrixBase.h:458
bool vctAny(const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > &matrix)
Definition: vctDynamicConstMatrixBase.h:1182
size_type width() const
Definition: vctDynamicConstMatrixBase.h:253
vctDynamicMatrix< _elementType > MatrixValueType
Definition: vctDynamicConstMatrixBase.h:141
vctReturnDynamicMatrix< bool > vctDynamicMatrixElementwiseCompareMatrix(const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > &matrix1, const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > &matrix2)
Definition: vctDynamicMatrix.h:725
BoolMatrixReturnType ElementwiseNotEqual(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
Definition: vctDynamicConstMatrixBase.h:809
Portability across compilers and operating systems tools.
bool operator!=(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
Definition: vctDynamicConstMatrixBase.h:743
vctDynamicVectorRef< _elementType > ColumnRefType
Definition: vctDynamicConstMatrixBase.h:117
void vctFixedSizeMatrixBaseAssignDynamicConstMatrixBase(vctFixedSizeMatrixBase< _rows, _cols, _rowStride, _colStride, _elementType, _dataPtrType > &fixedSizeMatrix, const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > &dynamicMatrix)
Definition: vctDynamicConstMatrixBase.h:1199
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
Test if input1 is lesser than input2.
Definition: vctBinaryOperations.h:322
Declaration of vctDynamicMatrixLoopEngines.
Declaration of cmnSerializer and functions cmnSerializeRaw.
bool IsFinite(void) const
Definition: vctDynamicConstMatrixBase.h:602
vctDynamicConstMatrixRef< _elementType > ConstRefTransposeType
Definition: vctDynamicConstMatrixBase.h:129
MatrixReturnType Negation(void) const
Definition: vctDynamicMatrix.h:678
static Type Tolerance(void)
Definition: cmnTypeTraits.h:170
void ToStreamRaw(std::ostream &outputStream, const char delimiter= ' ', bool headerOnly=false, const std::string &headerPrefix="") const
Definition: vctDynamicConstMatrixBase.h:1043
size_type size(void) const
Definition: vctDynamicConstMatrixBase.h:228
bool IsFortran(void) const
Definition: vctDynamicConstMatrixBase.h:650
Test for non equality between input1 and input2.
Definition: vctBinaryOperations.h:302
VCT_CONTAINER_TRAITS_TYPEDEFS(_elementType)
std::string ToString(void)
Definition: vctDynamicConstMatrixBase.h:1007
bool IsCompact(void) const
Definition: vctDynamicConstMatrixBase.h:641
Dynamic vector referencing existing memory.
Definition: vctDynamicVectorRef.h:77
value_type MinAbsElement(void) const
Definition: vctDynamicConstMatrixBase.h:527
void cmnSerializeSizeRaw(std::ostream &outputStream, const size_t &data)
Definition: cmnSerializer.h:93
A matrix object of dynamic size.
Definition: vctDynamicMatrix.h:136
OwnerType Matrix
Definition: vctDynamicConstMatrixBase.h:167
OwnerType::const_reverse_iterator const_reverse_iterator
Definition: vctDynamicConstMatrixBase.h:101
size_t size_type
Definition: vctContainerTraits.h:35
value_type Trace(void) const
Definition: vctDynamicConstMatrixBase.h:452
bool GreaterOrEqual(const value_type &scalar) const
Definition: vctDynamicConstMatrixBase.h:914
bool Lesser(const value_type &scalar) const
Definition: vctDynamicConstMatrixBase.h:890
bool StorageOrder(void) const
Definition: vctDynamicConstMatrixBase.h:656
Definition: vctUnaryOperations.h:178
Test for equality between input1 and input2.
Definition: vctBinaryOperations.h:282
bool NotEqual(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
Definition: vctDynamicConstMatrixBase.h:734
bool operator==(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
Definition: vctDynamicConstMatrixBase.h:715
MatrixReturnType Transpose() const
Definition: vctDynamicConstMatrixBase.h:986
std::ostream & operator<<(std::ostream &output, const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > &matrix)
Definition: vctDynamicConstMatrixBase.h:1188
bool GreaterOrEqual(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
Definition: vctDynamicConstMatrixBase.h:776
vctDynamicMatrix< _elementType > TransposeValueType
Definition: vctDynamicConstMatrixBase.h:137
Returns the square of the input as an OutputType object.
Definition: vctUnaryOperations.h:119
Declaration of vctDynamicConstVectorRef.
const nstride_type & strides(void) const
Definition: vctDynamicConstMatrixBase.h:258
BoolMatrixReturnType ElementwiseGreaterOrEqual(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
Definition: vctDynamicConstMatrixBase.h:841
value_type MinElement(void) const
Definition: vctDynamicConstMatrixBase.h:503
Dynamic matrix referencing existing memory.
Definition: vctDynamicMatrixRef.h:74
vctDynamicConstVectorRef< _elementType > ConstRowRefType
Definition: vctDynamicConstMatrixBase.h:105
MatrixReturnType Ceil(void) const
Definition: vctDynamicMatrix.h:702
vctDynamicVector< const_pointer > ConstVectorPointerType
Definition: vctDynamicConstMatrixBase.h:159
Returns the input as an OutputType object.
Definition: vctUnaryOperations.h:65
OwnerType::iterator iterator
Definition: vctDynamicConstMatrixBase.h:92
value_type ProductOfElements(void) const
Definition: vctDynamicConstMatrixBase.h:441
Definition: vctDynamicConstMatrixBase.h:77
_matrixOwnerType OwnerType
Definition: vctDynamicConstMatrixBase.h:89
vctDynamicConstMatrixRef< value_type > Type
Definition: vctDynamicConstMatrixBase.h:1102
void SerializeRaw(std::ostream &outputStream) const
Definition: vctDynamicConstMatrixBase.h:1107
Declaration of vctDynamicVector.
Test if input1 is greater than input2.
Definition: vctBinaryOperations.h:363
Definition: vctDynamicMatrix.h:419
ConstVectorPointerType & RowPointers(ConstVectorPointerType &rowPointers) const
Definition: vctDynamicConstMatrixBase.h:399
static void Run(const _inputMatrixType &inputMatrix, typename _inputMatrixType::value_type &minValue, typename _inputMatrixType::value_type &maxValue)
Definition: vctDynamicMatrixLoopEngines.h:966
const_reverse_iterator rend(void) const
Definition: vctDynamicConstMatrixBase.h:221
TypeTraits::BoolType BoolType
Definition: vctDynamicConstMatrixBase.h:152
Definition: vctUnaryOperations.h:186
ptrdiff_t difference_type
Definition: vctContainerTraits.h:38
bool Lesser(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
Definition: vctDynamicConstMatrixBase.h:749
const_reference at(size_type index) const
Definition: vctDynamicConstMatrixBase.h:289
NormType Norm(void) const
Definition: vctDynamicConstMatrixBase.h:467
A template for a fixed size matrix with fixed spacings in memory.
Definition: vctFixedSizeMatrixBase.h:58
bool LesserOrEqual(const value_type &scalar) const
Definition: vctDynamicConstMatrixBase.h:898
vctReturnDynamicMatrix< bool > vctDynamicMatrixElementwiseCompareScalar(const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > &matrix, const _elementType &scalar)
Definition: vctDynamicMatrix.h:737
static bool MatrixCopyCompatible(const _matrix1Type &matrix1, const _matrix2Type &matrix2)
Definition: vctFastCopy.h:139
value_type SumOfElements(void) const
Definition: vctDynamicConstMatrixBase.h:432
bool Equal(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
Definition: vctDynamicConstMatrixBase.h:706
ConstRowRefType Row(size_type index) const
Definition: vctDynamicConstMatrixBase.h:367
Definition: vctDynamicConstMatrixBase.h:1099
Definition: vctDynamicMatrixLoopEngines.h:565
Test if input1 is greater than or equal to input2.
Definition: vctBinaryOperations.h:384
Dynamic matrix referencing existing memory (const)
Definition: vctDynamicConstMatrixRef.h:79
Declaration of vctFixedSizeVector.
Declaration of the class cmnTypeTraits.
size_type rows() const
Definition: vctDynamicConstMatrixBase.h:238
Basic traits for the cisstVector containers.
vctDynamicMatrixRef< _elementType > RefTransposeType
Definition: vctDynamicConstMatrixBase.h:133
Definition: vctUnaryOperations.h:154
size_type cols() const
Definition: vctDynamicConstMatrixBase.h:243
Definition: vctDynamicMatrixLoopEngines.h:516
bool AlmostEqual(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix, value_type tolerance) const
Definition: vctDynamicConstMatrixBase.h:721
ConstColumnRefType Column(size_type index) const
Definition: vctDynamicConstMatrixBase.h:372
void cmnSerializeRaw(std::ostream &outputStream, const _elementType &data)
Definition: cmnSerializer.h:78
VCT_NARRAY_TRAITS_TYPEDEFS(DIMENSION)
const_iterator end(void) const
Definition: vctDynamicConstMatrixBase.h:209
bool IsRowMajor(void) const
Definition: vctDynamicConstMatrixBase.h:635
const_pointer Pointer(index_type rowIndex, index_type colIndex) const
Definition: vctDynamicConstMatrixBase.h:306
bool LesserOrEqual(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
Definition: vctDynamicConstMatrixBase.h:758
Definition: vctUnaryOperations.h:170
vctDynamicVectorRef< _elementType > RowRefType
Definition: vctDynamicConstMatrixBase.h:109
Definition: vctDynamicConstMatrixBase.h:82
bool IsNonPositive(void) const
Definition: vctDynamicConstMatrixBase.h:566
bool Greater(const value_type &scalar) const
Definition: vctDynamicConstMatrixBase.h:906
#define cmnThrow(a)
Definition: MinimalCmn.h:4
void ThrowUnlessValidIndex(size_type rowIndex, size_type colIndex) const
Definition: vctDynamicConstMatrixBase.h:179
MatrixReturnType Floor(void) const
Definition: vctDynamicMatrix.h:690
void ToStream(std::ostream &outputStream) const
Definition: vctDynamicConstMatrixBase.h:1014
bool ValidRowIndex(size_type rowIndex) const
Definition: vctDynamicConstMatrixBase.h:332
const_pointer Pointer(index_type index=0) const
Definition: vctDynamicConstVectorBase.h:221
vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > ThisType
Definition: vctDynamicConstMatrixBase.h:86
BoolMatrixReturnType ElementwiseLesserOrEqual(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
Definition: vctDynamicConstMatrixBase.h:825
bool AlmostEqual(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
Definition: vctDynamicConstMatrixBase.h:728
Declaration of vctDynamicVectorRef.
Definition: vctUnaryOperations.h:146
Definition: vctDynamicMatrixRefOwner.h:39
ThisType & Assign(const vctDynamicConstMatrixBase< __matrixOwnerType, value_type > &other)
Definition: vctDynamicMatrixBase.h:509
value_type MaxAbsElement(void) const
Definition: vctDynamicConstMatrixBase.h:516
bool IsPositive(void) const
Definition: vctDynamicConstMatrixBase.h:548
Test if input1 is lesser than or equal to input2.
Definition: vctBinaryOperations.h:343
static MatrixReturnType Eye(size_type size)
Definition: vctDynamicMatrix.h:714
ptrdiff_t stride_type
Definition: vctContainerTraits.h:37
value_type SumOfElements(void) const
Definition: vctDynamicConstVectorBase.h:359
bool Any(void) const
Definition: vctDynamicConstMatrixBase.h:593
void MinAndMaxElement(value_type &minElement, value_type &maxElement) const
Definition: vctDynamicConstMatrixBase.h:541
bool IsSquare(size_type size) const
Definition: vctDynamicConstMatrixBase.h:666
void ThrowUnlessValidRowIndex(size_type index) const
Definition: vctDynamicConstMatrixBase.h:187
bool ValidIndex(size_type rowIndex, size_type colIndex) const
Definition: vctDynamicConstMatrixBase.h:326
ConstRefTransposeType TransposeRef(void) const
Definition: vctDynamicConstMatrixBase.h:980
bool Equal(const value_type &scalar) const
Definition: vctDynamicConstMatrixBase.h:864
difference_type row_stride() const
Definition: vctDynamicConstMatrixBase.h:263
bool ValidColIndex(size_type colIndex) const
Definition: vctDynamicConstMatrixBase.h:337
difference_type col_stride() const
Definition: vctDynamicConstMatrixBase.h:268
BoolMatrixReturnType ElementwiseGreater(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
Definition: vctDynamicConstMatrixBase.h:833
bool HasNaN(void) const
Definition: vctDynamicConstMatrixBase.h:611
MatrixReturnType Abs(void) const
Definition: vctDynamicMatrix.h:666
vctReturnDynamicMatrix< BoolType > BoolMatrixReturnType
Definition: vctDynamicConstMatrixBase.h:156
void ThrowUnlessValidIndex(size_type index) const
Definition: vctDynamicConstMatrixBase.h:171
Declaration of the template function cmnThrow.
A collection of useful information about the C++ basic types, represented in a generic programming wa...
Definition: cmnTypeTraits.h:155
Definition: vctUnaryOperations.h:194
bool FastCopyCompatible(const vctFixedSizeConstMatrixBase< __rows, __cols, __rowStride, __colStride, value_type, __dataPtrType > &source) const
Definition: vctDynamicConstMatrixBase.h:683
const_reverse_iterator rbegin(void) const
Definition: vctDynamicConstMatrixBase.h:215
Definition: vctVarStrideMatrixIterator.h:40
value_type LinfNorm(void) const
Definition: vctDynamicConstMatrixBase.h:488
bool All(void) const
Definition: vctDynamicConstMatrixBase.h:584
const_reference at(size_type rowIndex, size_type colIndex) const
Definition: vctDynamicConstMatrixBase.h:346
bool IsNonNegative(void) const
Definition: vctDynamicConstMatrixBase.h:557
BoolMatrixReturnType ElementwiseLesser(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
Definition: vctDynamicConstMatrixBase.h:817
OwnerType::const_iterator const_iterator
Definition: vctDynamicConstMatrixBase.h:95
const_reference operator()(size_type rowIndex, size_type colIndex) const
Definition: vctDynamicConstMatrixBase.h:352
const nsize_type & sizes(void) const
Definition: vctDynamicConstMatrixBase.h:233
bool IsSquare(void) const
Definition: vctDynamicConstMatrixBase.h:661
bool Greater(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
Definition: vctDynamicConstMatrixBase.h:767
bool FastCopyCompatible(const vctDynamicConstMatrixBase< __matrixOwnerType, value_type > &source) const
Definition: vctDynamicConstMatrixBase.h:677
bool empty() const
Definition: vctDynamicConstMatrixBase.h:274
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
bool NotEqual(const value_type &scalar) const
Definition: vctDynamicConstMatrixBase.h:877
Definition: vctVarStrideMatrixIterator.h:287
value_type MaxElement(void) const
Definition: vctDynamicConstMatrixBase.h:494
vctDynamicConstVectorRef< _elementType > ConstDiagonalRefType
Definition: vctDynamicConstMatrixBase.h:121
bool BoolType
Definition: cmnTypeTraits.h:164
BoolMatrixReturnType ElementwiseEqual(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
Definition: vctDynamicConstMatrixBase.h:801
Definition: vctDynamicMatrixLoopEngines.h:831
const_pointer Pointer(void) const
Definition: vctDynamicConstMatrixBase.h:313
Definition: vctUnaryOperations.h:162
vctDynamicConstVectorRef< _elementType > ConstColumnRefType
Definition: vctDynamicConstMatrixBase.h:113
size_type height() const
Definition: vctDynamicConstMatrixBase.h:248