cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
vctDynamicConstNArrayBase.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 
6  Author(s): Anton Deguet, Daniel Li, Ofri Sadowsky
7  Created on: 2006-06-23
8 
9  (C) Copyright 2006-2012 Johns Hopkins University (JHU), All Rights
10  Reserved.
11 
12 --- begin cisst license - do not edit ---
13 
14 This software is provided "as is" under an open source license, with
15 no warranty. The complete license can be found in license.txt and
16 http://www.cisst.org/cisst/license.txt.
17 
18 --- end cisst license ---
19 */
20 
21 #pragma once
22 #ifndef _vctDynamicConstNArrayBase_h
23 #define _vctDynamicConstNArrayBase_h
24 
31 #include <cisstCommon/cmnThrow.h>
32 #include <cisstCommon/cmnAssert.h>
33 
38 
39 
40 template <class _nArrayOwnerType, class __nArrayOwnerType, class _elementType,
41  class _elementOperationType, vct::size_type _dimension>
45 
46 template <class _nArrayOwnerType, class _elementType, class _elementOperationType, vct::size_type _dimension>
49  const _elementType & scalar);
50 
51 
52 /* Functions used to generate slices based on dimension, i.e. if
53  dimension is 1 return an element, otherwise return an NArray of
54  lesser dimension. The class below is used to specify which
55  function is used. */
56 template <class _nArrayOwnerType, class _elementType, vct::size_type _dimension>
57 inline vctDynamicNArrayRef<_elementType, _dimension - 1>
59  vct::size_type dimension,
60  vct::index_type index);
61 
62 template <class _nArrayOwnerType, class _elementType>
63 inline _elementType &
65  vct::index_type index);
66 
67 template <class _nArrayOwnerType, class _elementType, vct::size_type _dimension>
68 inline vctDynamicConstNArrayRef<_elementType, _dimension - 1>
70  vct::size_type dimension,
71  vct::index_type index);
72 
73 template <class _nArrayOwnerType, class _elementType>
74 inline const _elementType &
76  vct::index_type index);
77 
78 #ifndef SWIG
79 /* Class used to specify the type of a slice based on the dimension.
80  The class also provides a static method to select the right
81  function to call. Code couldn't be inline since it requires a full
82  definition of vctDynamicNArrayRef and vctDynamicConstNArrayRef.
83  This can't be solved just with forward declarations. */
84 template <vct::size_type _dimension>
86 {
87 public:
88  template <class _elementType>
90  {
91  public:
92  typedef vctDynamicConstNArrayRef<_elementType, _dimension - 1> ConstSliceRefType;
93  typedef vctDynamicNArrayRef<_elementType, _dimension - 1> SliceRefType;
94 
95  template <class _nArrayOwnerType>
97  vct::size_type dimension, vct::index_type index) {
98  return vctDynamicNArrayConstNArraySlice(input, dimension, index);
99  }
100 
101  template <class _nArrayOwnerType>
103  vct::size_type dimension, vct::index_type index) {
104  return vctDynamicNArrayNArraySlice(input, dimension, index);
105  }
106  };
107 };
108 
109 /* Specialisation of class for dimension 1. In this case, a slice is
110  a single element. */
111 template <>
113 {
114 public:
115  template <class _elementType>
116  class SlicesTypes
117  {
118  public:
119  typedef const _elementType & ConstSliceRefType;
120  typedef _elementType & SliceRefType;
121 
122  template <class _nArrayOwnerType>
124  vct::size_type CMN_UNUSED(dimension), vct::index_type index) {
125  return vctDynamicNArrayConstElementSlice(input, index);
126  }
127 
128  template <class _nArrayOwnerType>
130  vct::size_type CMN_UNUSED(dimension), vct::index_type index) {
131  return vctDynamicNArrayElementSlice(input, index);
132  }
133  };
134 };
135 #endif // SWIG
136 
137 
154 template <class _nArrayOwnerType, typename _elementType, vct::size_type _dimension>
156 {
157 public:
158  /* define most types from vctContainerTraits and vctNArrayTraits */
159  VCT_CONTAINER_TRAITS_TYPEDEFS(_elementType);
160  VCT_NARRAY_TRAITS_TYPEDEFS(_dimension);
161 
164 
166  typedef _nArrayOwnerType OwnerType;
167 
168  enum {DIMENSION = OwnerType::DIMENSION};
169 
172  typedef typename OwnerType::iterator iterator;
177 
184 
191 
195 #ifndef SWIG
197 #endif // SWIG
198  typedef typename SlicesTypes::ConstSliceRefType ConstSliceRefType;
199  typedef typename SlicesTypes::SliceRefType SliceRefType;
201 
202 
206 
210 
212 
216  typedef typename TypeTraits::BoolType BoolType;
217 
221 
223 
224 
225 protected:
228 
230  inline void ThrowUnlessValidDimensionIndex(dimension_type dimensionIndex) const
231  throw(std::out_of_range)
232  {
233  if (! ValidDimensionIndex(dimensionIndex))
234  {
235  cmnThrow(std::out_of_range("vctDynamicNArray: Invalid index"));
236  }
237  }
238 
240  inline void ThrowUnlessValidIndex(size_type index) const
241  throw(std::out_of_range)
242  {
243  if (! ValidIndex(index))
244  {
245  cmnThrow(std::out_of_range("vctDynamicNArray: Invalid index"));
246  }
247  }
248 
250  inline void ThrowUnlessValidIndex(const nsize_type & indices) const
251  throw(std::out_of_range)
252  {
253  if (! ValidIndex(indices))
254  {
255  cmnThrow(std::out_of_range("vctDynamicNArray: Invalid indices"));
256  }
257  }
258 
260  inline void ThrowUnlessValidIndex(dimension_type dimension, size_type index) const
261  throw(std::out_of_range)
262  {
263  if (! ValidIndex(dimension, index))
264  {
265  cmnThrow(std::out_of_range("vctDynamicNArray: Invalid index"));
266  }
267  }
268 
269 
270 public:
273  const_iterator begin(void) const
274  {
275  return NArray.begin();
276  }
277 
280  const_iterator end(void) const
281  {
282  return NArray.end();
283  }
284 
288  {
289  return NArray.rbegin();
290  }
291 
295  {
296  return NArray.rend();
297  }
298 
302  size_type size(void) const
303  {
304  return NArray.size();
305  }
306 
308  const nsize_type & sizes(void) const
309  {
310  return NArray.sizes();
311  }
312 
314  size_type size(dimension_type dimension) const
315  {
316  return NArray.size(dimension);
317  }
318 
320  const nstride_type & strides(void) const
321  {
322  return NArray.strides();
323  }
324 
326  difference_type stride(dimension_type dimension) const
327  {
328  return NArray.stride(dimension);
329  }
330 
332  dimension_type dimension(void) const
333  {
334  return NArray.dimension();
335  }
336 
339  bool empty(void) const
340  {
341  return (size() == 0);
342  }
343 
344 
347  inline bool ValidDimension(dimension_type dimension) const
348  {
349  return (dimension == this->dimension());
350  }
351 
353  inline bool ValidDimensionIndex(dimension_type dimensionIndex) const
354  {
355  return (dimensionIndex < this->dimension());
356  }
357 
360  inline bool ValidIndex(size_type index) const
361  {
362  return (index < size());
363  }
364 
366  inline bool ValidIndex(const nsize_type & indices) const
367  {
368  nsize_type sizes = this->NArray.sizes();
369  typename nsize_type::const_iterator sizesIter;
370  typename nsize_type::const_iterator indicesIter;
371 
372  if (indices.size() != sizes.size())
373  return false;
374 
375  for (sizesIter = sizes.begin(), indicesIter = indices.begin();
376  sizesIter != sizes.end();
377  sizesIter++, indicesIter++)
378  {
379  if (*indicesIter >= *sizesIter)
380  return false;
381  }
382 
383  return true;
384  }
385 
387  inline bool ValidIndex(dimension_type dimension, size_type index) const
388  {
389  return ( index < this->size(dimension) );
390  }
391 
392 
399  const_reference at(size_type metaIndex) const
400  throw(std::out_of_range)
401  {
402  ThrowUnlessValidIndex(metaIndex);
403  return (begin())[metaIndex];
404  }
405 
410  const_reference at(const nsize_type & coordinates) const
411  throw(std::out_of_range)
412  {
413  ThrowUnlessValidIndex(coordinates);
414  return *(Pointer(coordinates));
415  }
416 
418  const_reference operator () (const nsize_type & coordinates) const
419  throw(std::out_of_range)
420  {
421  return this->at(coordinates);
422  }
423 
424 
428  const OwnerType & Owner(void) const {
429  return this->NArray;
430  }
431 
432 
436  const_pointer Pointer(void) const
437  {
438  return NArray.Pointer();
439  }
440 
444  const_pointer Pointer(const nsize_type & indices) const
445  {
446  return NArray.Pointer(indices);
447  }
448 
449 
455  const_reference Element(const nsize_type & coordinates) const
456  {
457  return *(Pointer(coordinates));
458  }
459 
460 
467  ConstSubarrayRefType Subarray(const nsize_type & startPosition,
468  const nsize_type & lengths) const
469  {
470  ConstSubarrayRefType subarray;
471  subarray.SubarrayOf(*this, startPosition, lengths);
472  return subarray;
473  }
474 
475 
482  ConstPermutationRefType Permutation(const ndimension_type & dimensions) const
483  {
484  ConstPermutationRefType permutation;
485  permutation.PermutationOf(*this, dimensions);
486  return permutation;
487  }
488 
489 
498  ConstSliceRefType Slice(dimension_type dimension, size_type index) const
499  throw(std::runtime_error, std::out_of_range)
500  {
501  return SlicesTypes::ConstSliceOf(*this, dimension, index);
502  }
503 
504 
510  {
511  return this->Slice(0, index);
512  }
513 
514 
518 
521  inline value_type SumOfElements(void) const
522  {
524  SoNi<typename vctBinaryOperations<value_type>::Addition,
526  Run(*this);
527  }
528 
531  inline value_type ProductOfElements(void) const
532  {
534  SoNi<typename vctBinaryOperations<value_type>::Multiplication,
536  Run(*this);
537  }
538 
541  inline value_type NormSquare(void) const
542  {
544  SoNi<typename vctBinaryOperations<value_type>::Addition,
546  Run(*this);
547  }
548 
551  inline NormType Norm(void) const
552  {
553  return sqrt(NormType(NormSquare()));
554  }
555 
560  inline value_type L1Norm(void) const
561  {
563  SoNi<typename vctBinaryOperations<value_type>::Addition,
565  Run(*this);
566  }
567 
572  inline value_type LinfNorm(void) const
573  {
574  return this->MaxAbsElement();
575  }
576 
579  inline value_type MaxElement(void) const
580  {
582  SoNi<typename vctBinaryOperations<value_type>::Maximum,
584  Run(*this);
585  }
586 
589  inline value_type MinElement(void) const
590  {
592  SoNi<typename vctBinaryOperations<value_type>::Minimum,
594  Run(*this);
595  }
596 
603  inline value_type MaxAbsElement(void) const
604  {
606  SoNi<typename vctBinaryOperations<value_type>::Maximum,
608  Run(*this);
609  }
610 
615  inline value_type MinAbsElement(void) const
616  {
618  SoNi<typename vctBinaryOperations<value_type>::Minimum,
620  Run(*this);
621  }
622 
623 
631  inline void MinAndMaxElement(value_type & minElement, value_type & maxElement) const
632  {
633  vctDynamicNArrayLoopEngines<DIMENSION>::MinAndMax::Run((*this), minElement, maxElement);
634  }
635 
636 
639  inline bool IsPositive(void) const
640  {
642  SoNi<typename vctBinaryOperations<bool>::And,
644  Run(*this);
645  }
646 
649  inline bool IsNonNegative(void) const
650  {
652  SoNi<typename vctBinaryOperations<bool>::And,
654  Run(*this);
655  }
656 
659  inline bool IsNonPositive(void) const
660  {
662  SoNi<typename vctBinaryOperations<bool>::And,
664  Run(*this);
665  }
666 
669  inline bool IsNegative (void) const
670  {
672  SoNi< typename vctBinaryOperations<bool>::And,
674  Run(*this);
675  }
676 
679  inline bool All(void) const
680  {
682  SoNi< typename vctBinaryOperations<bool>::And,
684  Run(*this);
685  }
686 
689  inline bool Any(void) const
690  {
692  SoNi< typename vctBinaryOperations<bool>::Or,
694  Run(*this);
695  }
696 
699  inline bool IsFinite(void) const {
701  SoNi< typename vctBinaryOperations<bool>::And,
703  Run(*this);
704  }
705 
708  inline bool HasNaN(void) const {
710  SoNi< typename vctBinaryOperations<bool>::Or,
712  Run(*this);
713  }
715 
716 
719 
725  inline bool IsCompact(void) const
726  {
727  return NArray.IsCompact();
728  }
730 
731 
734  template <class __nArrayOwnerType>
736  {
737  return vctFastCopy::NArrayCopyCompatible(*this, source);
738  }
739 
740 
756  template <class __nArrayOwnerType>
758  {
760  SoNiNi<typename vctBinaryOperations<bool>::And,
762  Run(*this, otherNArray);
763  }
764 
765  /* documented above */
766  template <class __nArrayOwnerType>
768  {
769  return Equal(otherNArray);
770  }
771 
772  /* documented above */
773  template <class __nArrayOwnerType>
775  value_type tolerance) const
776  {
777  return ((*this - otherNArray).LinfNorm() <= tolerance);
778  }
779 
780  /* documented above */
781  template <class __nArrayOwnerType>
783  {
784  return ((*this - otherNArray).LinfNorm() <= TypeTraits::Tolerance());
785  }
786 
787  /* documented above */
788  template <class __nArrayOwnerType>
790  {
792  SoNiNi<typename vctBinaryOperations<bool>::Or,
794  Run(*this, otherNArray);
795  }
796 
797  /* documented above */
798  template <class __nArrayOwnerType>
800  {
801  return NotEqual(otherNArray);
802  }
803 
804  /* documented above */
805  template <class __nArrayOwnerType>
807  {
809  SoNiNi<typename vctBinaryOperations<bool>::And,
811  Run(*this, otherNArray);
812  }
813 
814  /* documented above */
815  template <class __nArrayOwnerType>
817  {
819  SoNiNi<typename vctBinaryOperations<bool>::And,
821  Run(*this, otherNArray);
822  }
823 
824  /* documented above */
825  template <class __nArrayOwnerType>
827  {
829  SoNiNi<typename vctBinaryOperations<bool>::And,
831  Run(*this, otherNArray);
832  }
833 
834  /* documented above */
835  template <class __nArrayOwnerType>
837  {
839  SoNiNi<typename vctBinaryOperations<bool>::And,
841  Run(*this, otherNArray);
842  }
844 
845 
861  template <class __nArrayOwnerType>
862  inline BoolNArrayReturnType
864  {
865  return vctDynamicNArrayElementwiseCompareNArray<_nArrayOwnerType, __nArrayOwnerType, value_type,
866  typename vctBinaryOperations<bool, value_type, value_type>::Equal>(*this, otherNArray);
867  }
868 
869  /* documented above */
870  template <class __nArrayOwnerType>
871  inline BoolNArrayReturnType
873  {
874  return vctDynamicNArrayElementwiseCompareNArray<_nArrayOwnerType, __nArrayOwnerType, value_type,
876  }
877 
878  /* documented above */
879  template <class __nArrayOwnerType>
880  inline BoolNArrayReturnType
882  {
883  return vctDynamicNArrayElementwiseCompareNArray<_nArrayOwnerType, __nArrayOwnerType, value_type,
884  typename vctBinaryOperations<bool, value_type, value_type>::Lesser>(*this, otherNArray);
885  }
886 
887  /* documented above */
888  template <class __nArrayOwnerType>
889  inline BoolNArrayReturnType
891  {
892  return vctDynamicNArrayElementwiseCompareNArray<_nArrayOwnerType, __nArrayOwnerType, value_type,
894  }
895 
896  /* documented above */
897  template <class __nArrayOwnerType>
898  inline BoolNArrayReturnType
900  {
901  return vctDynamicNArrayElementwiseCompareNArray<_nArrayOwnerType, __nArrayOwnerType, value_type,
903  }
904 
905  /* documented above */
906  template <class __nArrayOwnerType>
907  inline BoolNArrayReturnType
909  {
910  return vctDynamicNArrayElementwiseCompareNArray<_nArrayOwnerType, __nArrayOwnerType, value_type,
912  }
913 
915 
916 
932  inline bool Equal(const value_type & scalar) const
933  {
935  SoNiSi<typename vctBinaryOperations<bool>::And,
937  Run(*this, scalar);
938  }
939 
940  /* documented above */
941  inline bool operator == (const value_type & scalar) const
942  {
943  return Equal(scalar);
944  }
945 
946  /* documented above */
947  inline bool NotEqual(const value_type & scalar) const
948  {
950  SoNiSi<typename vctBinaryOperations<bool>::Or,
952  Run(*this, scalar);
953  }
954 
955  /* documented above */
956  inline bool operator != (const value_type & scalar) const
957  {
958  return NotEqual(scalar);
959  }
960 
961  /* documented above */
962  inline bool Lesser(const value_type & scalar) const
963  {
965  SoNiSi<typename vctBinaryOperations<bool>::And,
967  Run(*this, scalar);
968  }
969 
970  /* documented above */
971  inline bool LesserOrEqual(const value_type & scalar) const
972  {
974  SoNiSi<typename vctBinaryOperations<bool>::And,
976  Run(*this, scalar);
977  }
978 
979  /* documented above */
980  inline bool Greater(const value_type & scalar) const
981  {
983  SoNiSi<typename vctBinaryOperations<bool>::And,
985  Run(*this, scalar);
986  }
987 
988  /* documented above */
989  inline bool GreaterOrEqual(const value_type & scalar) const
990  {
992  SoNiSi<typename vctBinaryOperations<bool>::And,
994  Run(*this, scalar);
995  }
997 
998 
1013  BoolNArrayReturnType ElementwiseEqual(const value_type & scalar) const;
1014 
1015  /* documented above */
1016  BoolNArrayReturnType ElementwiseNotEqual(const value_type & scalar) const;
1017 
1018  /* documented above */
1019  BoolNArrayReturnType ElementwiseLesser(const value_type & scalar) const;
1020 
1021  /* documented above */
1022  BoolNArrayReturnType ElementwiseLesserOrEqual(const value_type & scalar) const;
1023 
1024  /* documented above */
1025  BoolNArrayReturnType ElementwiseGreater(const value_type & scalar) const;
1026 
1027  /* documented above */
1028  BoolNArrayReturnType ElementwiseGreaterOrEqual(const value_type & scalar) const;
1029 
1031 
1042  inline NArrayReturnType Abs(void) const;
1043 
1044  /* documented above */
1045  inline NArrayReturnType Negation(void) const;
1046 
1047  /* documented above */
1048  inline NArrayReturnType Floor(void) const;
1049 
1050  /* documented above */
1051  inline NArrayReturnType Ceil(void) const;
1053 
1054 
1056  std::string ToString(void)
1057  {
1058  std::stringstream outputStream;
1059  ToStream(outputStream);
1060  return outputStream.str();
1061  }
1062 
1063 
1065  void ToStream(std::ostream & outputStream) const {
1066  // preserve the formatting flags as they were
1067  const size_t width = outputStream.width(12);
1068  const size_t precision = outputStream.precision(6);
1069  bool showpoint = ((outputStream.flags() & std::ios_base::showpoint) != 0);
1070  outputStream << std::setprecision(6) << std::showpoint;
1071 #if 0
1072  // this needs to be implemented using template based recursion on dimension, See [] operator implementation.
1073  this->ToStreamInternal(outputStream);
1074 #endif
1075  // resume the formatting flags
1076  outputStream << std::setprecision(precision) << std::setw(width);
1077  if (!showpoint) {
1078  outputStream << std::noshowpoint;
1079  }
1080  }
1081 };
1082 
1083 #ifndef DOXYGEN
1084 /* documented in class. Implementation moved here for .Net 2003 */
1085 template <class _nArrayOwnerType, class _elementType, vct::size_type _dimension>
1088 {
1089  return vctDynamicNArrayElementwiseCompareScalar<_nArrayOwnerType, _elementType,
1091 }
1092 
1093 /* documented in class. Implementation moved here for .Net 2003 */
1094 template <class _nArrayOwnerType, class _elementType, vct::size_type _dimension>
1097 {
1098  return vctDynamicNArrayElementwiseCompareScalar<_nArrayOwnerType, _elementType,
1100 }
1101 
1102 /* documented in class. Implementation moved here for .Net 2003 */
1103 template <class _nArrayOwnerType, class _elementType, vct::size_type _dimension>
1106 {
1107  return vctDynamicNArrayElementwiseCompareScalar<_nArrayOwnerType, _elementType,
1109 }
1110 
1111 /* documented in class. Implementation moved here for .Net 2003 */
1112 template <class _nArrayOwnerType, class _elementType, vct::size_type _dimension>
1115 {
1116  return vctDynamicNArrayElementwiseCompareScalar<_nArrayOwnerType, _elementType,
1118 }
1119 
1120 /* documented in class. Implementation moved here for .Net 2003 */
1121 template <class _nArrayOwnerType, class _elementType, vct::size_type _dimension>
1124 {
1125  return vctDynamicNArrayElementwiseCompareScalar<_nArrayOwnerType, _elementType,
1127 }
1128 
1129 /* documented in class. Implementation moved here for .Net 2003 */
1130 template <class _nArrayOwnerType, class _elementType, vct::size_type _dimension>
1133 {
1134  return vctDynamicNArrayElementwiseCompareScalar<_nArrayOwnerType, _elementType,
1136 }
1137 #endif // DOXYGEN
1138 
1140 template <class _nArrayOwnerType, typename _elementType, vct::size_type _dimension>
1142 {
1143  return nArray.All();
1144 }
1145 
1147 template <class _nArrayOwnerType, typename _elementType, vct::size_type _dimension>
1149  return nArray.Any();
1150 }
1151 
1153 template <class _nArrayOwnerType, typename _elementType, vct::size_type _dimension>
1154 std::ostream & operator << (std::ostream & output,
1156  nArray.ToStream(output);
1157  return output;
1158 }
1159 
1160 
1161 #endif // _vctDynamicConstNArrayBase_h
1162 
bool GreaterOrEqual(const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const
Definition: vctDynamicConstNArrayBase.h:836
size_t index_type
Definition: vctContainerTraits.h:36
ConstPermutationRefType Permutation(const ndimension_type &dimensions) const
Definition: vctDynamicConstNArrayBase.h:482
VCT_CONTAINER_TRAITS_TYPEDEFS(_elementType)
vctDynamicNArray< value_type, DIMENSION > NArrayReturnType
Definition: vctDynamicConstNArrayBase.h:209
Assert macros definitions.
bool AlmostEqual(const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray, value_type tolerance) const
Definition: vctDynamicConstNArrayBase.h:774
const _elementType & vctDynamicNArrayConstElementSlice(const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, 1 > &input, vct::index_type index)
Definition: vctDynamicNArray.h:618
_elementType & vctDynamicNArrayElementSlice(vctDynamicNArrayBase< _nArrayOwnerType, _elementType, 1 > &input, vct::index_type index)
Definition: vctDynamicNArray.h:597
bool ValidDimensionIndex(dimension_type dimensionIndex) const
Definition: vctDynamicConstNArrayBase.h:353
void ToStream(std::ostream &outputStream) const
Definition: vctDynamicConstNArrayBase.h:1065
void ThrowUnlessValidIndex(size_type index) const
Definition: vctDynamicConstNArrayBase.h:240
OwnerType::reverse_iterator reverse_iterator
Definition: vctDynamicConstNArrayBase.h:174
Definition: vctDynamicNArray.h:271
dimension_type dimension(void) const
Definition: vctDynamicConstNArrayBase.h:332
void ThrowUnlessValidIndex(dimension_type dimension, size_type index) const
Definition: vctDynamicConstNArrayBase.h:260
const_reverse_iterator rbegin(void) const
Definition: vctDynamicConstNArrayBase.h:287
An nArray object of dynamic size.
Definition: vctDynamicNArray.h:122
const_pointer Pointer(const nsize_type &indices) const
Definition: vctDynamicConstNArrayBase.h:444
Returns the absolute value of the input as an OutputType object.
Definition: vctUnaryOperations.h:80
const nsize_type & sizes(void) const
Definition: vctDynamicConstNArrayBase.h:308
vctDynamicConstNArrayRef< _elementType, _dimension-1 > ConstSliceRefType
Definition: vctDynamicConstNArrayBase.h:92
value_type NormSquare(void) const
Definition: vctDynamicConstNArrayBase.h:541
vctReturnDynamicNArray< BoolType, DIMENSION > BoolNArrayReturnType
Definition: vctDynamicConstNArrayBase.h:220
bool NotEqual(const value_type &scalar) const
Definition: vctDynamicConstNArrayBase.h:947
BoolNArrayReturnType ElementwiseEqual(const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const
Definition: vctDynamicConstNArrayBase.h:863
bool Greater(const value_type &scalar) const
Definition: vctDynamicConstNArrayBase.h:980
#define CMN_UNUSED(argument)
Definition: cmnPortability.h:479
bool IsNonPositive(void) const
Definition: vctDynamicConstNArrayBase.h:659
vctDynamicNArrayRef< value_type, DIMENSION > PermutationRefType
Definition: vctDynamicConstNArrayBase.h:189
bool vctAll(const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &nArray)
Definition: vctDynamicConstNArrayBase.h:1141
const_pointer Pointer(void) const
Definition: vctDynamicConstNArrayBase.h:436
bool vctAny(const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &nArray)
Definition: vctDynamicConstNArrayBase.h:1148
OwnerType::iterator iterator
Definition: vctDynamicConstNArrayBase.h:172
bool empty(void) const
Definition: vctDynamicConstNArrayBase.h:339
Test if input1 is lesser than input2.
Definition: vctBinaryOperations.h:322
bool Greater(const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const
Definition: vctDynamicConstNArrayBase.h:826
Container class for the dynamic nArray engines.
Definition: vctDynamicNArrayLoopEngines.h:43
bool ValidIndex(size_type index) const
Definition: vctDynamicConstNArrayBase.h:360
static Type Tolerance(void)
Definition: cmnTypeTraits.h:170
static bool NArrayCopyCompatible(const _nArray1Type &nArray1, const _nArray2Type &nArray2)
Definition: vctFastCopy.h:149
bool Lesser(const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const
Definition: vctDynamicConstNArrayBase.h:806
Definition: vctDynamicConstNArrayBase.h:155
Forward declarations and #define for cisstVector.
Test for non equality between input1 and input2.
Definition: vctBinaryOperations.h:302
NArrayReturnType Abs(void) const
Definition: vctDynamicNArray.h:507
value_type SumOfElements(void) const
Definition: vctDynamicConstNArrayBase.h:521
bool Equal(const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const
Definition: vctDynamicConstNArrayBase.h:757
bool GreaterOrEqual(const value_type &scalar) const
Definition: vctDynamicConstNArrayBase.h:989
void ThrowUnlessValidDimensionIndex(dimension_type dimensionIndex) const
Definition: vctDynamicConstNArrayBase.h:230
size_t size_type
Definition: vctContainerTraits.h:35
vctDynamicNArrayRef< _elementType, _dimension-1 > vctDynamicNArrayNArraySlice(vctDynamicNArrayBase< _nArrayOwnerType, _elementType, _dimension > &input, vct::size_type dimension, vct::index_type index)
Definition: vctDynamicNArray.h:585
vctDynamicNArrayRef< _elementType, _dimension-1 > SliceRefType
Definition: vctDynamicConstNArrayBase.h:93
const_reference at(size_type metaIndex) const
Definition: vctDynamicConstNArrayBase.h:399
bool LesserOrEqual(const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const
Definition: vctDynamicConstNArrayBase.h:816
Definition: vctUnaryOperations.h:178
Test for equality between input1 and input2.
Definition: vctBinaryOperations.h:282
_nArrayOwnerType OwnerType
Definition: vctDynamicConstNArrayBase.h:166
vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > ThisType
Definition: vctDynamicConstNArrayBase.h:163
value_type LinfNorm(void) const
Definition: vctDynamicConstNArrayBase.h:572
Returns the square of the input as an OutputType object.
Definition: vctUnaryOperations.h:119
ConstSliceRefType Slice(dimension_type dimension, size_type index) const
Definition: vctDynamicConstNArrayBase.h:498
const_reverse_iterator rend(void) const
Definition: vctDynamicConstNArrayBase.h:294
Dynamic nArray referencing existing memory (const)
Definition: vctDynamicConstNArrayRef.h:89
cmnTypeTraits< value_type > TypeTraits
Definition: vctDynamicConstNArrayBase.h:211
Returns the input as an OutputType object.
Definition: vctUnaryOperations.h:65
bool IsNegative(void) const
Definition: vctDynamicConstNArrayBase.h:669
bool ValidDimension(dimension_type dimension) const
Definition: vctDynamicConstNArrayBase.h:347
Definition: vctDynamicConstNArrayBase.h:85
bool All(void) const
Definition: vctDynamicConstNArrayBase.h:679
Test if input1 is greater than input2.
Definition: vctBinaryOperations.h:363
vctDynamicConstNArrayRef< _elementType, _dimension-1 > vctDynamicNArrayConstNArraySlice(const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &input, vct::size_type dimension, vct::index_type index)
Definition: vctDynamicNArray.h:606
bool ValidIndex(dimension_type dimension, size_type index) const
Definition: vctDynamicConstNArrayBase.h:387
Definition: vctDynamicNArrayRefOwner.h:36
_elementType & SliceRefType
Definition: vctDynamicConstNArrayBase.h:120
vctReturnDynamicNArray< value_type, DIMENSION > NArrayValueType
Definition: vctDynamicConstNArrayBase.h:205
vctReturnDynamicNArray< bool, _dimension > vctDynamicNArrayElementwiseCompareScalar(const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &nArray, const _elementType &scalar)
Definition: vctDynamicNArray.h:572
Definition: vctUnaryOperations.h:186
ptrdiff_t difference_type
Definition: vctContainerTraits.h:38
value_type MinAbsElement(void) const
Definition: vctDynamicConstNArrayBase.h:615
value_type ProductOfElements(void) const
Definition: vctDynamicConstNArrayBase.h:531
static SliceRefType SliceOf(vctDynamicNArrayBase< _nArrayOwnerType, _elementType, 1 > &input, vct::size_type CMN_UNUSED(dimension), vct::index_type index)
Definition: vctDynamicConstNArrayBase.h:129
Definition: vctForwardDeclarations.h:77
Test if input1 is greater than or equal to input2.
Definition: vctBinaryOperations.h:384
NArrayReturnType Ceil(void) const
Definition: vctDynamicNArray.h:546
bool Equal(const value_type &scalar) const
Definition: vctDynamicConstNArrayBase.h:932
bool FastCopyCompatible(const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &source) const
Definition: vctDynamicConstNArrayBase.h:735
bool IsPositive(void) const
Definition: vctDynamicConstNArrayBase.h:639
Declaration of vctFixedSizeVector.
bool IsFinite(void) const
Definition: vctDynamicConstNArrayBase.h:699
BoolNArrayReturnType ElementwiseGreater(const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const
Definition: vctDynamicConstNArrayBase.h:899
Declaration of the class cmnTypeTraits.
Basic traits for the cisstVector containers.
Definition: vctUnaryOperations.h:154
BoolNArrayReturnType ElementwiseLesserOrEqual(const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const
Definition: vctDynamicConstNArrayBase.h:890
const_reference operator()(const nsize_type &coordinates) const
Definition: vctDynamicConstNArrayBase.h:418
bool HasNaN(void) const
Definition: vctDynamicConstNArrayBase.h:708
bool AlmostEqual(const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const
Definition: vctDynamicConstNArrayBase.h:782
value_type L1Norm(void) const
Definition: vctDynamicConstNArrayBase.h:560
Dynamic nArray referencing existing memory.
Definition: vctDynamicNArrayRef.h:87
bool ValidIndex(const nsize_type &indices) const
Definition: vctDynamicConstNArrayBase.h:366
const OwnerType & Owner(void) const
Definition: vctDynamicConstNArrayBase.h:428
Definition: vctUnaryOperations.h:170
TypeTraits::BoolType BoolType
Definition: vctDynamicConstNArrayBase.h:216
BoolNArrayReturnType ElementwiseLesser(const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const
Definition: vctDynamicConstNArrayBase.h:881
SlicesTypes::SliceRefType SliceRefType
Definition: vctDynamicConstNArrayBase.h:199
#define cmnThrow(a)
Definition: MinimalCmn.h:4
value_type MaxElement(void) const
Definition: vctDynamicConstNArrayBase.h:579
const_reference at(const nsize_type &coordinates) const
Definition: vctDynamicConstNArrayBase.h:410
const_reference Element(const nsize_type &coordinates) const
Definition: vctDynamicConstNArrayBase.h:455
value_type MinElement(void) const
Definition: vctDynamicConstNArrayBase.h:589
std::ostream & operator<<(std::ostream &output, const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &nArray)
Definition: vctDynamicConstNArrayBase.h:1154
SlicesTypes::ConstSliceRefType ConstSliceRefType
Definition: vctDynamicConstNArrayBase.h:198
void PermutationOf(const vctDynamicConstNArrayBase< __ownerType, value_type, DIMENSION > &otherNArray, const ndimension_type &dimensions)
Definition: vctDynamicConstNArrayRef.h:226
BoolNArrayReturnType ElementwiseNotEqual(const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const
Definition: vctDynamicConstNArrayBase.h:872
vctReturnDynamicNArray< bool, _dimension > vctDynamicNArrayElementwiseCompareNArray(const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &nArray1, const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &nArray2)
Definition: vctDynamicNArray.h:560
std::string ToString(void)
Definition: vctDynamicConstNArrayBase.h:1056
ConstSliceRefType operator[](size_type index) const
Definition: vctDynamicConstNArrayBase.h:509
vctDynamicNArrayTypes< DIMENSION >::template SlicesTypes< _elementType > SlicesTypes
Definition: vctDynamicConstNArrayBase.h:196
bool operator!=(const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const
Definition: vctDynamicConstNArrayBase.h:799
Definition: vctUnaryOperations.h:146
static SliceRefType SliceOf(vctDynamicNArrayBase< _nArrayOwnerType, _elementType, _dimension > &input, vct::size_type dimension, vct::index_type index)
Definition: vctDynamicConstNArrayBase.h:102
void SubarrayOf(const vctDynamicConstNArrayBase< __ownerType, value_type, DIMENSION > &otherNArray, const nsize_type &startPosition, const nsize_type &lengths)
Definition: vctDynamicConstNArrayRef.h:210
value_type MaxAbsElement(void) const
Definition: vctDynamicConstNArrayBase.h:603
static void Run(const _inputNArrayType &inputNArray, typename _inputNArrayType::value_type &minValue, typename _inputNArrayType::value_type &maxValue)
Definition: vctDynamicNArrayLoopEngines.h:1007
bool operator==(const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const
Definition: vctDynamicConstNArrayBase.h:767
Definition: vctDynamicNArrayBase.h:42
Test if input1 is lesser than or equal to input2.
Definition: vctBinaryOperations.h:343
OwnerType::const_iterator const_iterator
Definition: vctDynamicConstNArrayBase.h:173
vctDynamicNArrayRef< value_type, DIMENSION > SubarrayRefType
Definition: vctDynamicConstNArrayBase.h:182
Definition: vctDynamicConstNArrayBase.h:89
Definition: vctForwardDeclarations.h:74
void MinAndMaxElement(value_type &minElement, value_type &maxElement) const
Definition: vctDynamicConstNArrayBase.h:631
size_type size(void) const
Definition: vctDynamicConstNArrayBase.h:302
NArrayReturnType Floor(void) const
Definition: vctDynamicNArray.h:533
vctDynamicConstNArrayRef< value_type, DIMENSION > ConstSubarrayRefType
Definition: vctDynamicConstNArrayBase.h:181
Declaration of vctDynamicNArrayLoopEngines.
bool Lesser(const value_type &scalar) const
Definition: vctDynamicConstNArrayBase.h:962
bool IsCompact(void) const
Definition: vctDynamicConstNArrayBase.h:725
const nstride_type & strides(void) const
Definition: vctDynamicConstNArrayBase.h:320
VCT_NARRAY_TRAITS_TYPEDEFS(_dimension)
vctDynamicConstNArrayRef< value_type, DIMENSION > ConstPermutationRefType
Definition: vctDynamicConstNArrayBase.h:188
static ConstSliceRefType ConstSliceOf(const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, 1 > &input, vct::size_type CMN_UNUSED(dimension), vct::index_type index)
Definition: vctDynamicConstNArrayBase.h:123
OwnerType NArray
Definition: vctDynamicConstNArrayBase.h:227
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
void ThrowUnlessValidIndex(const nsize_type &indices) const
Definition: vctDynamicConstNArrayBase.h:250
Definition: vctUnaryOperations.h:194
difference_type stride(dimension_type dimension) const
Definition: vctDynamicConstNArrayBase.h:326
bool Any(void) const
Definition: vctDynamicConstNArrayBase.h:689
NArrayReturnType Negation(void) const
Definition: vctDynamicNArray.h:520
bool IsNonNegative(void) const
Definition: vctDynamicConstNArrayBase.h:649
static ConstSliceRefType ConstSliceOf(const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &input, vct::size_type dimension, vct::index_type index)
Definition: vctDynamicConstNArrayBase.h:96
ConstSubarrayRefType Subarray(const nsize_type &startPosition, const nsize_type &lengths) const
Definition: vctDynamicConstNArrayBase.h:467
NormType Norm(void) const
Definition: vctDynamicConstNArrayBase.h:551
const _elementType & ConstSliceRefType
Definition: vctDynamicConstNArrayBase.h:119
const_iterator end(void) const
Definition: vctDynamicConstNArrayBase.h:280
OwnerType::const_reverse_iterator const_reverse_iterator
Definition: vctDynamicConstNArrayBase.h:175
bool LesserOrEqual(const value_type &scalar) const
Definition: vctDynamicConstNArrayBase.h:971
bool NotEqual(const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const
Definition: vctDynamicConstNArrayBase.h:789
size_type size(dimension_type dimension) const
Definition: vctDynamicConstNArrayBase.h:314
bool BoolType
Definition: cmnTypeTraits.h:164
Definition: vctDynamicConstNArrayBase.h:168
const_iterator begin(void) const
Definition: vctDynamicConstNArrayBase.h:273
Definition: vctUnaryOperations.h:162
BoolNArrayReturnType ElementwiseGreaterOrEqual(const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const
Definition: vctDynamicConstNArrayBase.h:908