21#ifndef _vctDynamicConstNArrayBase_h
22#define _vctDynamicConstNArrayBase_h
39template <
class _nArrayOwnerType,
class __nArrayOwnerType,
class _elementType,
45template <
class _nArrayOwnerType,
class _elementType,
class _elementOperationType, vct::
size_type _dimension>
48 const _elementType & scalar);
55template <
class _nArrayOwnerType,
class _elementType, vct::
size_type _dimension>
61template <
class _nArrayOwnerType,
class _elementType>
66template <
class _nArrayOwnerType,
class _elementType, vct::
size_type _dimension>
72template <
class _nArrayOwnerType,
class _elementType>
73inline const _elementType &
83template <vct::
size_type _dimension>
87 template <
class _elementType>
94 template <
class _nArrayOwnerType>
100 template <
class _nArrayOwnerType>
114 template <
class _elementType>
121 template <
class _nArrayOwnerType>
127 template <
class _nArrayOwnerType>
153template <
class _nArrayOwnerType,
typename _elementType, vct::
size_type _dimension>
171 typedef typename OwnerType::iterator
iterator;
234 cmnThrow(std::out_of_range(
"vctDynamicNArray: Invalid index"));
244 cmnThrow(std::out_of_range(
"vctDynamicNArray: Invalid index"));
254 cmnThrow(std::out_of_range(
"vctDynamicNArray: Invalid indices"));
264 cmnThrow(std::out_of_range(
"vctDynamicNArray: Invalid index"));
307 const nsize_type &
sizes(
void)
const
333 return NArray.dimension();
340 return (
size() == 0);
354 return (dimensionIndex < this->
dimension());
361 return (index <
size());
367 nsize_type
sizes = this->NArray.sizes();
368 typename nsize_type::const_iterator sizesIter;
369 typename nsize_type::const_iterator indicesIter;
371 if (indices.size() !=
sizes.size())
374 for (sizesIter =
sizes.begin(), indicesIter = indices.begin();
375 sizesIter !=
sizes.end();
376 sizesIter++, indicesIter++)
378 if (*indicesIter >= *sizesIter)
398 const_reference
at(size_type metaIndex)
const
402 return (
begin())[metaIndex];
409 const_reference
at(
const nsize_type & coordinates)
const
413 return *(
Pointer(coordinates));
417 const_reference
operator () (
const nsize_type & coordinates)
const
420 return this->
at(coordinates);
443 const_pointer
Pointer(
const nsize_type & indices)
const
445 return NArray.Pointer(indices);
454 const_reference
Element(
const nsize_type & coordinates)
const
456 return *(
Pointer(coordinates));
467 const nsize_type & lengths)
const
470 subarray.
SubarrayOf(*
this, startPosition, lengths);
499 return SlicesTypes::ConstSliceOf(*
this,
dimension, index);
509 return this->
Slice(0, index);
522 SoNi<typename vctBinaryOperations<value_type>::Addition,
532 SoNi<typename vctBinaryOperations<value_type>::Multiplication,
542 SoNi<typename vctBinaryOperations<value_type>::Addition,
549 inline NormType
Norm(
void)
const
561 SoNi<typename vctBinaryOperations<value_type>::Addition,
580 SoNi<typename vctBinaryOperations<value_type>::Maximum,
590 SoNi<typename vctBinaryOperations<value_type>::Minimum,
604 SoNi<typename vctBinaryOperations<value_type>::Maximum,
616 SoNi<typename vctBinaryOperations<value_type>::Minimum,
640 SoNi<typename vctBinaryOperations<bool>::And,
650 SoNi<typename vctBinaryOperations<bool>::And,
660 SoNi<typename vctBinaryOperations<bool>::And,
670 SoNi< typename vctBinaryOperations<bool>::And,
677 inline bool All(
void)
const
680 SoNi< typename vctBinaryOperations<bool>::And,
687 inline bool Any(
void)
const
690 SoNi< typename vctBinaryOperations<bool>::Or,
699 SoNi< typename vctBinaryOperations<bool>::And,
708 SoNi< typename vctBinaryOperations<bool>::Or,
725 return NArray.IsCompact();
732 template <
class __nArrayOwnerType>
754 template <
class __nArrayOwnerType>
758 SoNiNi<typename vctBinaryOperations<bool>::And,
760 Run(*
this, otherNArray);
764 template <
class __nArrayOwnerType>
767 return Equal(otherNArray);
771 template <
class __nArrayOwnerType>
775 return ((*
this - otherNArray).
LinfNorm() <= tolerance);
779 template <
class __nArrayOwnerType>
786 template <
class __nArrayOwnerType>
790 SoNiNi<typename vctBinaryOperations<bool>::Or,
792 Run(*
this, otherNArray);
796 template <
class __nArrayOwnerType>
803 template <
class __nArrayOwnerType>
807 SoNiNi<typename vctBinaryOperations<bool>::And,
809 Run(*
this, otherNArray);
813 template <
class __nArrayOwnerType>
817 SoNiNi<typename vctBinaryOperations<bool>::And,
819 Run(*
this, otherNArray);
823 template <
class __nArrayOwnerType>
827 SoNiNi<typename vctBinaryOperations<bool>::And,
829 Run(*
this, otherNArray);
833 template <
class __nArrayOwnerType>
837 SoNiNi<typename vctBinaryOperations<bool>::And,
839 Run(*
this, otherNArray);
859 template <
class __nArrayOwnerType>
868 template <
class __nArrayOwnerType>
877 template <
class __nArrayOwnerType>
886 template <
class __nArrayOwnerType>
895 template <
class __nArrayOwnerType>
904 template <
class __nArrayOwnerType>
933 SoNiSi<typename vctBinaryOperations<bool>::And,
941 return Equal(scalar);
948 SoNiSi<typename vctBinaryOperations<bool>::Or,
963 SoNiSi<typename vctBinaryOperations<bool>::And,
972 SoNiSi<typename vctBinaryOperations<bool>::And,
981 SoNiSi<typename vctBinaryOperations<bool>::And,
990 SoNiSi<typename vctBinaryOperations<bool>::And,
1056 std::stringstream outputStream;
1058 return outputStream.str();
1065 const size_t width = outputStream.width(12);
1066 const size_t precision = outputStream.precision(6);
1067 bool showpoint = ((outputStream.flags() & std::ios_base::showpoint) != 0);
1068 outputStream << std::setprecision(6) << std::showpoint;
1071 this->ToStreamInternal(outputStream);
1074 outputStream << std::setprecision(precision) << std::setw(
width);
1076 outputStream << std::noshowpoint;
1083template <
class _nArrayOwnerType,
class _elementType, vct::
size_type _dimension>
1092template <
class _nArrayOwnerType,
class _elementType, vct::
size_type _dimension>
1101template <
class _nArrayOwnerType,
class _elementType, vct::
size_type _dimension>
1110template <
class _nArrayOwnerType,
class _elementType, vct::
size_type _dimension>
1119template <
class _nArrayOwnerType,
class _elementType, vct::
size_type _dimension>
1128template <
class _nArrayOwnerType,
class _elementType, vct::
size_type _dimension>
1138template <
class _nArrayOwnerType,
typename _elementType, vct::
size_type _dimension>
1141 return nArray.All();
1145template <
class _nArrayOwnerType,
typename _elementType, vct::
size_type _dimension>
1147 return nArray.Any();
1151template <
class _nArrayOwnerType,
typename _elementType, vct::
size_type _dimension>
1154 nArray.ToStream(output);
A collection of useful information about the C++ basic types, represented in a generic programming wa...
Definition cmnTypeTraits.h:155
bool BoolType
Definition cmnTypeTraits.h:164
static Type Tolerance(void)
Definition cmnTypeTraits.h:170
Test for equality between input1 and input2.
Definition vctBinaryOperations.h:282
Test if input1 is greater than input2.
Definition vctBinaryOperations.h:363
Test if input1 is greater than or equal to input2.
Definition vctBinaryOperations.h:384
Test if input1 is lesser than input2.
Definition vctBinaryOperations.h:322
Test if input1 is lesser than or equal to input2.
Definition vctBinaryOperations.h:343
Test for non equality between input1 and input2.
Definition vctBinaryOperations.h:302
Definition vctForwardDeclarations.h:171
Dynamic nArray referencing existing memory (const).
Definition vctDynamicConstNArrayRef.h:91
void SubarrayOf(const vctDynamicConstNArrayBase< __ownerType, value_type, DIMENSION > &otherNArray, const nsize_type &startPosition, const nsize_type &lengths)
Definition vctDynamicConstNArrayRef.h:210
void PermutationOf(const vctDynamicConstNArrayBase< __ownerType, value_type, DIMENSION > &otherNArray, const ndimension_type &dimensions)
Definition vctDynamicConstNArrayRef.h:226
Definition vctDynamicNArrayBase.h:41
Definition vctForwardDeclarations.h:183
static void Run(const _inputNArrayType &inputNArray, typename _inputNArrayType::value_type &minValue, typename _inputNArrayType::value_type &maxValue)
Definition vctDynamicNArrayLoopEngines.h:1005
Container class for the dynamic nArray engines.
Definition vctDynamicNArrayLoopEngines.h:42
Dynamic nArray referencing existing memory.
Definition vctDynamicNArrayRef.h:89
Definition vctDynamicConstNArrayBase.h:89
vctDynamicNArrayRef< _elementType, _dimension - 1 > SliceRefType
Definition vctDynamicConstNArrayBase.h:92
static SliceRefType SliceOf(vctDynamicNArrayBase< _nArrayOwnerType, _elementType, _dimension > &input, vct::size_type dimension, vct::index_type index)
Definition vctDynamicConstNArrayBase.h:101
static ConstSliceRefType ConstSliceOf(const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &input, vct::size_type dimension, vct::index_type index)
Definition vctDynamicConstNArrayBase.h:95
vctDynamicConstNArrayRef< _elementType, _dimension - 1 > ConstSliceRefType
Definition vctDynamicConstNArrayBase.h:91
Definition vctDynamicConstNArrayBase.h:116
const _elementType & ConstSliceRefType
Definition vctDynamicConstNArrayBase.h:118
_elementType & SliceRefType
Definition vctDynamicConstNArrayBase.h:119
static SliceRefType SliceOf(vctDynamicNArrayBase< _nArrayOwnerType, _elementType, 1 > &input, vct::size_type CMN_UNUSED(dimension), vct::index_type index)
Definition vctDynamicConstNArrayBase.h:128
static ConstSliceRefType ConstSliceOf(const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, 1 > &input, vct::size_type CMN_UNUSED(dimension), vct::index_type index)
Definition vctDynamicConstNArrayBase.h:122
Definition vctDynamicConstNArrayBase.h:85
static bool NArrayCopyCompatible(const _nArray1Type &nArray1, const _nArray2Type &nArray2)
Definition vctFastCopy.h:145
Definition vctDynamicNArray.h:272
Returns the absolute value of the input as an OutputType object.
Definition vctUnaryOperations.h:80
Returns the input as an OutputType object.
Definition vctUnaryOperations.h:65
Definition vctUnaryOperations.h:186
Definition vctUnaryOperations.h:194
Definition vctUnaryOperations.h:170
Definition vctUnaryOperations.h:154
Definition vctUnaryOperations.h:162
Definition vctUnaryOperations.h:178
Definition vctUnaryOperations.h:146
Returns the square of the input as an OutputType object.
Definition vctUnaryOperations.h:119
Assert macros definitions.
#define CMN_UNUSED(argument)
Definition cmnPortability.h:497
#define CISST_THROW(exceptionParameter)
Somewhat portable compilation warning message. This works with very recent versions of gcc (4....
Definition cmnPortability.h:559
Declaration of the template function cmnThrow.
Declaration of the class cmnTypeTraits.
void cmnThrow(const _exceptionType &except, cmnLogLevel lod=CMN_LOG_LEVEL_INIT_ERROR)
Definition cmnThrow.h:76
size_t size_type
Definition vctContainerTraits.h:35
size_t index_type
Definition vctContainerTraits.h:36
Basic traits for the cisstVector containers.
#define VCT_CONTAINER_TRAITS_TYPEDEFS(type)
Definition vctContainerTraits.h:50
#define VCT_NARRAY_TRAITS_TYPEDEFS(dimension)
Definition vctContainerTraits.h:68
value_type MaxElement(void) const
Definition vctDynamicConstMatrixBase.h:494
const_iterator end(void) const
Definition vctDynamicConstMatrixBase.h:209
bool AlmostEqual(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix, value_type tolerance) const
Definition vctDynamicConstMatrixBase.h:721
MatrixReturnType Negation(void) const
BoolMatrixReturnType ElementwiseEqual(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
Definition vctDynamicConstMatrixBase.h:801
MatrixReturnType Ceil(void) const
OwnerType::const_iterator const_iterator
Definition vctDynamicConstMatrixBase.h:95
bool GreaterOrEqual(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
Definition vctDynamicConstMatrixBase.h:776
const_reference at(size_type index) const CISST_THROW(std
Definition vctDynamicConstMatrixBase.h:289
bool vctAll(const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > &matrix)
Definition vctDynamicConstMatrixBase.h:1176
cmnTypeTraits< value_type > TypeTraits
Definition vctDynamicConstMatrixBase.h:147
bool IsNonPositive(void) const
Definition vctDynamicConstMatrixBase.h:566
@ DIMENSION
Definition vctDynamicConstMatrixBase.h:82
value_type MaxAbsElement(void) const
Definition vctDynamicConstMatrixBase.h:516
const OwnerType & Owner(void) const
Definition vctDynamicConstMatrixBase.h:298
bool IsNonNegative(void) const
Definition vctDynamicConstMatrixBase.h:557
value_type MinElement(void) const
Definition vctDynamicConstMatrixBase.h:503
OwnerType::iterator iterator
Definition vctDynamicConstMatrixBase.h:92
void MinAndMaxElement(value_type &minElement, value_type &maxElement) const
Definition vctDynamicConstMatrixBase.h:541
bool NotEqual(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
Definition vctDynamicConstMatrixBase.h:734
size_type size(void) const
Definition vctDynamicConstMatrixBase.h:228
bool IsCompact(void) const
Definition vctDynamicConstMatrixBase.h:641
value_type MinAbsElement(void) const
Definition vctDynamicConstMatrixBase.h:527
bool IsNegative(void) const
Definition vctDynamicConstMatrixBase.h:575
BoolMatrixReturnType ElementwiseGreater(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
Definition vctDynamicConstMatrixBase.h:833
void ToStream(std::ostream &outputStream) const
Definition vctDynamicConstMatrixBase.h:1014
bool empty() const
Definition vctDynamicConstMatrixBase.h:274
const_reverse_iterator rbegin(void) const
Definition vctDynamicConstMatrixBase.h:215
bool Any(void) const
Definition vctDynamicConstMatrixBase.h:593
MatrixReturnType Floor(void) const
std::string ToString(void)
Definition vctDynamicConstMatrixBase.h:1007
TypeTraits::BoolType BoolType
Definition vctDynamicConstMatrixBase.h:152
const nsize_type & sizes(void) const
Definition vctDynamicConstMatrixBase.h:233
ConstRowRefType operator[](size_type index) const
Definition vctDynamicConstMatrixBase.h:280
MatrixReturnType Abs(void) const
const_reverse_iterator rend(void) const
Definition vctDynamicConstMatrixBase.h:221
bool vctAny(const vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > &matrix)
Definition vctDynamicConstMatrixBase.h:1182
size_type width() const
Definition vctDynamicConstMatrixBase.h:253
value_type L1Norm(void) const
Definition vctDynamicConstMatrixBase.h:475
bool All(void) const
Definition vctDynamicConstMatrixBase.h:584
const_reference Element(size_type rowIndex, size_type colIndex) const
Definition vctDynamicConstMatrixBase.h:362
_matrixOwnerType OwnerType
Definition vctDynamicConstMatrixBase.h:89
bool LesserOrEqual(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
Definition vctDynamicConstMatrixBase.h:758
const nstride_type & strides(void) const
Definition vctDynamicConstMatrixBase.h:258
bool Equal(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
Definition vctDynamicConstMatrixBase.h:706
const_pointer Pointer(index_type rowIndex, index_type colIndex) const
Definition vctDynamicConstMatrixBase.h:306
value_type LinfNorm(void) const
Definition vctDynamicConstMatrixBase.h:488
BoolMatrixReturnType ElementwiseLesser(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
Definition vctDynamicConstMatrixBase.h:817
bool HasNaN(void) const
Definition vctDynamicConstMatrixBase.h:611
value_type SumOfElements(void) const
Definition vctDynamicConstMatrixBase.h:432
value_type ProductOfElements(void) const
Definition vctDynamicConstMatrixBase.h:441
NormType Norm(void) const
Definition vctDynamicConstMatrixBase.h:467
const_iterator begin(void) const
Definition vctDynamicConstMatrixBase.h:203
value_type NormSquare(void) const
Definition vctDynamicConstMatrixBase.h:458
bool operator==(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
Definition vctDynamicConstMatrixBase.h:715
BoolMatrixReturnType ElementwiseNotEqual(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
Definition vctDynamicConstMatrixBase.h:809
void ThrowUnlessValidIndex(size_type index) const CISST_THROW(std
Definition vctDynamicConstMatrixBase.h:171
OwnerType::const_reverse_iterator const_reverse_iterator
Definition vctDynamicConstMatrixBase.h:101
bool Lesser(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
Definition vctDynamicConstMatrixBase.h:749
bool IsFinite(void) const
Definition vctDynamicConstMatrixBase.h:602
bool Greater(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
Definition vctDynamicConstMatrixBase.h:767
bool operator!=(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
Definition vctDynamicConstMatrixBase.h:743
vctDynamicConstMatrixBase< _matrixOwnerType, _elementType > ThisType
Definition vctDynamicConstMatrixBase.h:86
BoolMatrixReturnType ElementwiseLesserOrEqual(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
Definition vctDynamicConstMatrixBase.h:825
bool ValidIndex(size_type index) const
Definition vctDynamicConstMatrixBase.h:320
bool FastCopyCompatible(const vctDynamicConstMatrixBase< __matrixOwnerType, value_type > &source) const
Definition vctDynamicConstMatrixBase.h:677
bool IsPositive(void) const
Definition vctDynamicConstMatrixBase.h:548
const_reference operator()(size_type rowIndex, size_type colIndex) const CISST_THROW(std
Definition vctDynamicConstMatrixBase.h:352
BoolMatrixReturnType ElementwiseGreaterOrEqual(const vctDynamicConstMatrixBase< __matrixOwnerType, _elementType > &otherMatrix) const
Definition vctDynamicConstMatrixBase.h:841
OwnerType::reverse_iterator reverse_iterator
Definition vctDynamicConstMatrixBase.h:98
vctDynamicNArray< value_type, DIMENSION > NArrayReturnType
Definition vctDynamicConstNArrayBase.h:208
bool ValidDimensionIndex(dimension_type dimensionIndex) const
Definition vctDynamicConstNArrayBase.h:352
vctDynamicConstNArrayRef< value_type, DIMENSION > ConstSubarrayRefType
Definition vctDynamicConstNArrayBase.h:180
_elementType & vctDynamicNArrayElementSlice(vctDynamicNArrayBase< _nArrayOwnerType, _elementType, 1 > &input, vct::index_type index)
Definition vctDynamicNArray.h:597
bool ValidDimension(dimension_type dimension) const
Definition vctDynamicConstNArrayBase.h:346
const _elementType & vctDynamicNArrayConstElementSlice(const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, 1 > &input, vct::index_type index)
Definition vctDynamicNArray.h:618
vctDynamicConstNArrayRef< _elementType, _dimension - 1 > vctDynamicNArrayConstNArraySlice(const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &input, vct::size_type dimension, vct::index_type index)
Definition vctDynamicNArray.h:606
vctDynamicNArrayTypes< DIMENSION >::template SlicesTypes< _elementType > SlicesTypes
Definition vctDynamicConstNArrayBase.h:195
void ThrowUnlessValidDimensionIndex(dimension_type dimensionIndex) const CISST_THROW(std
Definition vctDynamicConstNArrayBase.h:229
ConstSliceRefType Slice(dimension_type dimension, size_type index) const
Definition vctDynamicConstNArrayBase.h:497
std::ostream & operator<<(std::ostream &output, const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &nArray)
Definition vctDynamicConstNArrayBase.h:1152
SlicesTypes::ConstSliceRefType ConstSliceRefType
Definition vctDynamicConstNArrayBase.h:197
vctReturnDynamicNArray< BoolType, DIMENSION > BoolNArrayReturnType
Definition vctDynamicConstNArrayBase.h:219
vctReturnDynamicNArray< bool, _dimension > vctDynamicNArrayElementwiseCompareNArray(const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &nArray1, const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &nArray2)
Definition vctDynamicNArray.h:560
vctReturnDynamicNArray< value_type, DIMENSION > NArrayValueType
Definition vctDynamicConstNArrayBase.h:204
vctDynamicConstNArrayRef< value_type, DIMENSION > ConstPermutationRefType
Definition vctDynamicConstNArrayBase.h:187
ConstPermutationRefType Permutation(const ndimension_type &dimensions) const
Definition vctDynamicConstNArrayBase.h:481
SlicesTypes::SliceRefType SliceRefType
Definition vctDynamicConstNArrayBase.h:198
vctDynamicNArrayRef< _elementType, _dimension - 1 > vctDynamicNArrayNArraySlice(vctDynamicNArrayBase< _nArrayOwnerType, _elementType, _dimension > &input, vct::size_type dimension, vct::index_type index)
Definition vctDynamicNArray.h:585
dimension_type dimension(void) const
Definition vctDynamicConstNArrayBase.h:331
ConstSubarrayRefType Subarray(const nsize_type &startPosition, const nsize_type &lengths) const
Definition vctDynamicConstNArrayBase.h:466
difference_type stride(dimension_type dimension) const
Definition vctDynamicConstNArrayBase.h:325
vctReturnDynamicNArray< bool, _dimension > vctDynamicNArrayElementwiseCompareScalar(const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &nArray, const _elementType &scalar)
Definition vctDynamicNArray.h:572
vctDynamicNArrayRef< value_type, DIMENSION > SubarrayRefType
Definition vctDynamicConstNArrayBase.h:181
vctDynamicNArrayRef< value_type, DIMENSION > PermutationRefType
Definition vctDynamicConstNArrayBase.h:188
OwnerType NArray
Definition vctDynamicConstNArrayBase.h:226
Declaration of vctDynamicNArrayLoopEngines.
Declaration of vctFixedSizeVector.
Forward declarations and #define for cisstVector.