|
cisst-saw
|
Declaration of vctDynamicConstNArrayBase. More...
#include <cisstCommon/cmnTypeTraits.h>#include <cisstCommon/cmnThrow.h>#include <cisstCommon/cmnAssert.h>#include <cisstVector/vctContainerTraits.h>#include <cisstVector/vctDynamicNArrayLoopEngines.h>#include <cisstVector/vctFixedSizeVector.h>#include <cisstVector/vctForwardDeclarations.h>Go to the source code of this file.
Classes | |
| class | vctDynamicNArrayTypes< _dimension > |
| class | vctDynamicNArrayTypes< _dimension >::SlicesTypes< _elementType > |
| class | vctDynamicNArrayTypes< 1 > |
| class | vctDynamicNArrayTypes< 1 >::SlicesTypes |
Macros | |
| #define | _vctDynamicConstNArrayBase_h |
Typedefs | |
| typedef vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > | ThisType |
| typedef _nArrayOwnerType | OwnerType |
The type of the object representing a subarray of | |
this nArray. Access is by (const and non const) reference. | |
| typedef vctDynamicConstNArrayRef< value_type, DIMENSION > | ConstSubarrayRefType |
| typedef vctDynamicNArrayRef< value_type, DIMENSION > | SubarrayRefType |
The type of the object representing a permutation of | |
this nArray. Access is by (const and non const) reference. | |
| typedef vctDynamicConstNArrayRef< value_type, DIMENSION > | ConstPermutationRefType |
| typedef vctDynamicNArrayRef< value_type, DIMENSION > | PermutationRefType |
Enumerations | |
| enum | { DIMENSION = OwnerType::DIMENSION } |
Functions | |
| template<class _nArrayOwnerType, class __nArrayOwnerType, class _elementType, class _elementOperationType, vct::size_type _dimension> | |
| vctReturnDynamicNArray< bool, _dimension > | vctDynamicNArrayElementwiseCompareNArray (const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &nArray1, const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &nArray2) |
| template<class _nArrayOwnerType, class _elementType, class _elementOperationType, vct::size_type _dimension> | |
| vctReturnDynamicNArray< bool, _dimension > | vctDynamicNArrayElementwiseCompareScalar (const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &nArray, const _elementType &scalar) |
| template<class _nArrayOwnerType, class _elementType, vct::size_type _dimension> | |
| vctDynamicNArrayRef< _elementType, _dimension - 1 > | vctDynamicNArrayNArraySlice (vctDynamicNArrayBase< _nArrayOwnerType, _elementType, _dimension > &input, vct::size_type dimension, vct::index_type index) |
| template<class _nArrayOwnerType, class _elementType> | |
| _elementType & | vctDynamicNArrayElementSlice (vctDynamicNArrayBase< _nArrayOwnerType, _elementType, 1 > &input, vct::index_type index) |
| template<class _nArrayOwnerType, class _elementType, vct::size_type _dimension> | |
| vctDynamicConstNArrayRef< _elementType, _dimension - 1 > | vctDynamicNArrayConstNArraySlice (const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &input, vct::size_type dimension, vct::index_type index) |
| template<class _nArrayOwnerType, class _elementType> | |
| const _elementType & | vctDynamicNArrayConstElementSlice (const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, 1 > &input, vct::index_type index) |
| VCT_CONTAINER_TRAITS_TYPEDEFS (_elementType) | |
| VCT_NARRAY_TRAITS_TYPEDEFS (_dimension) | |
Incremental operations returning a scalar. | |
Compute a scalar from all the elements of the nArray. | |
| value_type | SumOfElements (void) const |
| value_type | ProductOfElements (void) const |
| value_type | NormSquare (void) const |
| NormType | Norm (void) const |
| value_type | L1Norm (void) const |
| value_type | LinfNorm (void) const |
| value_type | MaxElement (void) const |
| value_type | MinElement (void) const |
| value_type | MaxAbsElement (void) const |
| value_type | MinAbsElement (void) const |
| void | MinAndMaxElement (value_type &minElement, value_type &maxElement) const |
| bool | IsPositive (void) const |
| bool | IsNonNegative (void) const |
| bool | IsNonPositive (void) const |
| bool | IsNegative (void) const |
| bool | All (void) const |
| bool | Any (void) const |
| bool | IsFinite (void) const |
| bool | HasNaN (void) const |
Storage format. | |
| bool | IsCompact (void) const |
| template<class __nArrayOwnerType> | |
| bool | FastCopyCompatible (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &source) const |
Elementwise comparisons between nArray. | |
Returns the result of the comparison. | |
| template<class __nArrayOwnerType> | |
| bool | Equal (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const |
| template<class __nArrayOwnerType> | |
| bool | operator== (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const |
| template<class __nArrayOwnerType> | |
| bool | AlmostEqual (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray, value_type tolerance) const |
| template<class __nArrayOwnerType> | |
| bool | AlmostEqual (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const |
| template<class __nArrayOwnerType> | |
| bool | NotEqual (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const |
| template<class __nArrayOwnerType> | |
| bool | operator!= (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const |
| template<class __nArrayOwnerType> | |
| bool | Lesser (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const |
| template<class __nArrayOwnerType> | |
| bool | LesserOrEqual (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const |
| template<class __nArrayOwnerType> | |
| bool | Greater (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const |
| template<class __nArrayOwnerType> | |
| bool | GreaterOrEqual (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const |
Elementwise comparisons between nArrays. | |
Returns the nArray of comparison's results. | |
| template<class __nArrayOwnerType> | |
| BoolNArrayReturnType | ElementwiseEqual (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const |
| template<class __nArrayOwnerType> | |
| BoolNArrayReturnType | ElementwiseNotEqual (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const |
| template<class __nArrayOwnerType> | |
| BoolNArrayReturnType | ElementwiseLesser (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const |
| template<class __nArrayOwnerType> | |
| BoolNArrayReturnType | ElementwiseLesserOrEqual (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const |
| template<class __nArrayOwnerType> | |
| BoolNArrayReturnType | ElementwiseGreater (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const |
| template<class __nArrayOwnerType> | |
| BoolNArrayReturnType | ElementwiseGreaterOrEqual (const vctDynamicConstNArrayBase< __nArrayOwnerType, value_type, DIMENSION > &otherNArray) const |
Elementwise comparisons between an nArray and a scalar. | |
Returns the result of the comparison. | |
| bool | Equal (const value_type &scalar) const |
| bool | operator== (const value_type &scalar) const |
| bool | NotEqual (const value_type &scalar) const |
| bool | operator!= (const value_type &scalar) const |
| bool | Lesser (const value_type &scalar) const |
| bool | LesserOrEqual (const value_type &scalar) const |
| bool | Greater (const value_type &scalar) const |
| bool | GreaterOrEqual (const value_type &scalar) const |
| BoolNArrayReturnType | ElementwiseEqual (const value_type &scalar) const |
| BoolNArrayReturnType | ElementwiseNotEqual (const value_type &scalar) const |
| BoolNArrayReturnType | ElementwiseLesser (const value_type &scalar) const |
| BoolNArrayReturnType | ElementwiseLesserOrEqual (const value_type &scalar) const |
| BoolNArrayReturnType | ElementwiseGreater (const value_type &scalar) const |
| BoolNArrayReturnType | ElementwiseGreaterOrEqual (const value_type &scalar) const |
Unary elementwise operations. | |
Returns the result of nArray.op(). | |
| NArrayReturnType | Abs (void) const |
| NArrayReturnType | Negation (void) const |
| NArrayReturnType | Floor (void) const |
| NArrayReturnType | Ceil (void) const |
| std::string | ToString (void) |
| void | ToStream (std::ostream &outputStream) const |
| template<class _nArrayOwnerType, typename _elementType, vct::size_type _dimension> | |
| bool | vctAll (const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &nArray) |
| template<class _nArrayOwnerType, typename _elementType, vct::size_type _dimension> | |
| bool | vctAny (const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &nArray) |
| template<class _nArrayOwnerType, typename _elementType, vct::size_type _dimension> | |
| std::ostream & | operator<< (std::ostream &output, const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > &nArray) |
The type of the object representing a slice of this | |
nArray. Access is by (const and non const) reference. | |
| typedef vctDynamicNArrayTypes< DIMENSION >::template SlicesTypes< _elementType > | SlicesTypes |
| typedef SlicesTypes::ConstSliceRefType | ConstSliceRefType |
| typedef SlicesTypes::SliceRefType | SliceRefType |
| typedef vctReturnDynamicNArray< value_type, DIMENSION > | NArrayValueType |
| typedef vctDynamicNArray< value_type, DIMENSION > | NArrayReturnType |
| typedef cmnTypeTraits< value_type > | TypeTraits |
| typedef vctReturnDynamicNArray< BoolType, DIMENSION > | BoolNArrayReturnType |
| OwnerType | NArray |
| void | ThrowUnlessValidDimensionIndex (dimension_type dimensionIndex) const CISST_THROW(std |
| void | ThrowUnlessValidIndex (size_type index) const CISST_THROW(std |
| void | ThrowUnlessValidIndex (const nsize_type &indices) const CISST_THROW(std |
| void | ThrowUnlessValidIndex (dimension_type dimension, size_type index) const CISST_THROW(std |
| const_iterator | begin (void) const |
| const_iterator | end (void) const |
| const_reverse_iterator | rbegin (void) const |
| const_reverse_iterator | rend (void) const |
| size_type | size (void) const |
| const nsize_type & | sizes (void) const |
| size_type | size (dimension_type dimension) const |
| const nstride_type & | strides (void) const |
| difference_type | stride (dimension_type dimension) const |
| dimension_type | dimension (void) const |
| bool | empty (void) const |
| bool | ValidDimension (dimension_type dimension) const |
| bool | ValidDimensionIndex (dimension_type dimensionIndex) const |
| bool | ValidIndex (size_type index) const |
| bool | ValidIndex (const nsize_type &indices) const |
| bool | ValidIndex (dimension_type dimension, size_type index) const |
| const_reference | at (size_type metaIndex) const CISST_THROW(std |
| const_reference | at (const nsize_type &coordinates) const CISST_THROW(std |
| const_reference | operator() (const nsize_type &coordinates) const CISST_THROW(std |
| const OwnerType & | Owner (void) const |
| const_pointer | Pointer (void) const |
| const_pointer | Pointer (const nsize_type &indices) const |
| const_reference | Element (const nsize_type &coordinates) const |
| ConstSubarrayRefType | Subarray (const nsize_type &startPosition, const nsize_type &lengths) const |
| ConstPermutationRefType | Permutation (const ndimension_type &dimensions) const |
| ConstSliceRefType | Slice (dimension_type dimension, size_type index) const |
| ConstSliceRefType | operator[] (size_type index) const |
Declaration of vctDynamicConstNArrayBase.
| #define _vctDynamicConstNArrayBase_h |
The type of an nArray of booleans returned from operations on this object, e.g., ElementwiseEqual.
| typedef SlicesTypes::ConstSliceRefType ConstSliceRefType |
| typedef vctDynamicNArray<value_type, DIMENSION> NArrayReturnType |
The type of nArray returned by value from operations on this object
The type of nArray used to store by value results of the same type as this object.
| typedef SlicesTypes::SliceRefType SliceRefType |
| typedef vctDynamicNArrayTypes<DIMENSION>::template SlicesTypes<_elementType> SlicesTypes |
| typedef vctDynamicConstNArrayBase<_nArrayOwnerType, _elementType, _dimension> ThisType |
Type of the nArray itself.
| typedef cmnTypeTraits<value_type> TypeTraits |
|
inline |
Unary elementwise operations on an nArray. For each element of the nArray "this", performs \( this[i] \leftarrow op(otherNArray[i])\) where \(op\) can calculate the absolute value (Abs) or the opposite (Negation).
|
inline |
Return true if all the elements of this nArray are nonzero, false otherwise
|
inline |
|
inline |
|
inline |
Return true if any element of this nArray is nonzero, false otherwise
| const_reference at | ( | const nsize_type & | coordinates | ) | const |
Access an element by indices (const). Compare with std::vector::at(). This method can be a handy substitute for the overloaded operator () when operator overloading is unavailable or inconvenient.
| const_reference at | ( | size_type | metaIndex | ) | const |
Access an element by index (const). Compare with std::matrix::at(). This method can be a handy substitute for the overloaded operator [] when operator overloading is unavailable or inconvenient.
| const_iterator begin | ( | void | ) | const |
Returns a const iterator on the first element (STL compatibility).
|
inline |
| dimension_type dimension | ( | void | ) | const |
Not required by STL but provided for completeness
| const_reference Element | ( | const nsize_type & | coordinates | ) | const |
Access an element by indices (const). This method allows to access an element without any bounds checking. It doesn't create any temporary references as nArray[][]...[] would do.
| BoolNArrayReturnType ElementwiseEqual | ( | const value_type & | scalar | ) | const |
Comparison between an nArray and a scalar, containing the same type of elements. The comparison ( \( = \neq < \leq > \geq \)) for ElementwiseEqual(), ElementwiseNotEqual(), ElementwiseLesser(), ElementwiseLesserOrEqual(), ElementwiseGreater() or ElementwiseGreaterOrEqual() is performed elementwise between the nArray and the scalar and stored in a newly created nArray. There is no operator provided since the semantic would be ambiguous.
|
inline |
Comparison between two nArrays of the same size, containing the same type of elements. The strides and the internal representation (_nArrayOwnerType) can be different. The comparison ( \( = \neq < \leq > \geq \)) for ElementwiseEqual(), ElementwiseNotEqual(), ElementwiseLesser(), ElementwiseLesserOrEqual(), ElementwiseGreater() or ElementwiseGreaterOrEqual() is performed elementwise between the two nArrays and stored in a newly created nArray. There is no operator provided since the semantic would be ambiguous.
| BoolNArrayReturnType ElementwiseGreater | ( | const value_type & | scalar | ) | const |
|
inline |
| BoolNArrayReturnType ElementwiseGreaterOrEqual | ( | const value_type & | scalar | ) | const |
|
inline |
| BoolNArrayReturnType ElementwiseLesser | ( | const value_type & | scalar | ) | const |
|
inline |
| BoolNArrayReturnType ElementwiseLesserOrEqual | ( | const value_type & | scalar | ) | const |
|
inline |
| BoolNArrayReturnType ElementwiseNotEqual | ( | const value_type & | scalar | ) | const |
|
inline |
| bool empty | ( | void | ) | const |
Tell if the narray is empty (STL compatibility). False unless size is zero.
| const_iterator end | ( | void | ) | const |
Returns a const iterator on the last element (STL compatibility).
|
inline |
Comparison between an nArray and a scalar. The type of the elements of the nArray and the scalar must be the same. The comparison ( \( = \neq < \leq > \geq \)) for Equal(), NotEqual(), Lesser(), LesserOrEqual(), Greater() or GreaterOrEqual() is performed elementwise between the nArray and the scalar. A logical "and" is performed (except for NotEqual which uses a logical "or") to accumulate the elementwise results. The only operators provided are "==" and "!=" since the semantic is not ambiguous.
|
inline |
Comparison between two nArray of the same size, containing the same type of elements. The strides can be different. The comparaison ( \( = \neq < \leq > \geq \)) for Equal(), NotEqual(), Lesser(), LesserOrEqual(), Greater() or GreaterOrEqual() is performed elementwise between the two nArrays. A logical "and" is performed (except for NotEqual which uses a logical "or") to accumulate the elementwise results. The only operators provided are "==" and "!=" since the semantic is not ambiguous.
|
inline |
Test if the method FastCopyOf can be used instead of Assign. See FastCopyOf for more details.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Return true if any element of this nArray is NaN, false otherwise
|
inline |
Test if the nArray is compact, i.e. the nArray actually uses a contiguous block of memory.
|
inline |
Return true if all the elements of this nArray are finite, false otherwise
|
inline |
Return true if all the elements of this nArray are strictly negative, false otherwise
|
inline |
Return true if all the elements of this nArray are non-negative, false otherwise
|
inline |
Return true if all the elements of this nArray are non-positive, false otherwise
|
inline |
Return true if all the elements of this nArray are strictly positive, false otherwise
|
inline |
Return the L1 norm of the nArray, i.e. the sum of the absolute values of all the elements.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Return the Linf norm of the nArray, i.e. the maximum of the absolute values of all the elements.
|
inline |
Return the maximum of the absolute values of all the elements.
|
inline |
Return the maximum element of the nArray.
|
inline |
Return the minimum of the absolute values of all the elements.
|
inline |
Compute the minimum AND maximum elements of the nArray. This method is more runtime-efficient than computing them separately.
| minElement | reference to store the minimum element result. |
| maxElement | reference to store the maximum element result. |
|
inline |
Return the minimum element of the nArray.
|
inline |
|
inline |
Return the norm of the nArray.
|
inline |
Return the square of the norm of the nArray.
|
inline |
|
inline |
|
inline |
|
inline |
| const_reference operator() | ( | const nsize_type & | coordinates | ) | const |
Overloaded operator () for simplified (const) element access with bounds checking
| std::ostream & operator<< | ( | std::ostream & | output, |
| const vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension > & | nArray ) |
Stream out operator.
|
inline |
|
inline |
| ConstSliceRefType operator[] | ( | size_type | index | ) | const |
Reference an (n-1)-dimension slice of this nArray by index (const).
| const OwnerType & Owner | ( | void | ) | const |
Access the NArray owner. This method should be used only to access some extra information related to the memory layout. It is used by the engines (vctDynamicNArrayLoopEngines).
| ConstPermutationRefType Permutation | ( | const ndimension_type & | dimensions | ) | const |
Create a const reference to this nArray with the strides permuted.
| dimensions | a sequence of dimension numbers representing the permuted order of strides |
| const_pointer Pointer | ( | const nsize_type & | indices | ) | const |
Returns a const pointer to an element of the container, specified by its indices. Addition to the STL requirements.
| const_pointer Pointer | ( | void | ) | const |
Returns a const pointer to the first element of the container. Addition to the STL requirements.
|
inline |
Return the product of the elements of the nArray.
| const_reverse_iterator rbegin | ( | void | ) | const |
Returns a reverse const iterator on the last element (STL compatibility).
| const_reverse_iterator rend | ( | void | ) | const |
Returns a reverse const iterator on the element before first (STL compatibility).
| size_type size | ( | dimension_type | dimension | ) | const |
Not required by STL but provided for completeness
| size_type size | ( | void | ) | const |
Return the number of elements in the nArray. This is not equivalent to the difference between the end and the beginning.
| const nsize_type & sizes | ( | void | ) | const |
Not required by STL but provided for completeness
| ConstSliceRefType Slice | ( | dimension_type | dimension, |
| size_type | index ) const |
Create a const reference to a slice of dimension n-1, where n is the dimension of this nArray.
| dimension | the dimension number of the direction by which to reduce |
| slice | the index number in the dimension specified by which to set the reference |
| difference_type stride | ( | dimension_type | dimension | ) | const |
Not required by STL but provided for completeness
| const nstride_type & strides | ( | void | ) | const |
Not required by STL but provided for completeness
| ConstSubarrayRefType Subarray | ( | const nsize_type & | startPosition, |
| const nsize_type & | lengths ) const |
Create a const reference to a subarray of this nArray.
| startPosition | vector of indices of the element position where the reference will start |
| lengths | the number of elements to reference in each dimension |
|
inline |
Return the sum of the elements of the nArray.
|
inlineprotected |
Check the validity of the given dimension index
|
inlineprotected |
Check the validity of the nArray indices
|
inlineprotected |
Check the validity of the given index in the (dimension)th-dimension
|
inlineprotected |
Check the validity of an index
| void ToStream | ( | std::ostream & | outputStream | ) | const |
Print the nArray to a text stream
| std::string ToString | ( | void | ) |
Return a string representation of the nArray elements
|
inline |
Returns true if the given dimension value is equal to this nArray's dimension.
|
inline |
Returns true if the given dimension index is valid.
|
inline |
Returns true if all indices are valid indices.
|
inline |
Returns true if the given index is a valid index.
|
inline |
Returns true if the index is less than the number of elements of the nArray.
| VCT_CONTAINER_TRAITS_TYPEDEFS | ( | _elementType | ) |
This class is templated with the ``nArray owner type'', which may be a vctDynamicNArrayOwner or a vctDynamicNArrayRefOwner. It provides const operations on the nArray, such as SumOfElements etc.
nArray indexing is zero-based.
nArray dimensions are zero-based.
The method provided for the compatibility with the STL containers start with a lower case. Other methods start with a capitalilized letter (see CISST naming convention).
| _nArrayOwnerType | the type of nArray owner |
| _elementType | the type of elements of the nArray */ template <class _nArrayOwnerType, typename _elementType, vct::size_type _dimension> class vctDynamicConstNArrayBase { public: /* define most types from vctContainerTraits and vctNArrayTraits |
| VCT_NARRAY_TRAITS_TYPEDEFS | ( | _dimension | ) |
|
inline |
Return true if all the elements of the NArray are nonzero, false otherwise
|
inline |
Return true if any element of the NArray is nonzero, false otherwise
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
protected |
Declaration of the nArray-defining member object