cisst-saw
|
A template for a fixed length vector with fixed spacing in memory. More...
#include <vctFixedSizeConstVectorBase.h>
Classes | |
class | ConstSubvector |
Public Types | |
enum | { SIZE = VectorTraits::SIZE } |
enum | { STRIDE = VectorTraits::STRIDE } |
typedef vctFixedSizeConstVectorBase < _size, _stride, _elementType, _dataPtrType > | ThisType |
typedef vctFixedSizeVectorTraits < _elementType, _size, _stride > | VectorTraits |
typedef VectorTraits::iterator | iterator |
typedef VectorTraits::const_iterator | const_iterator |
typedef VectorTraits::reverse_iterator | reverse_iterator |
typedef VectorTraits::const_reverse_iterator | const_reverse_iterator |
typedef vctFixedSizeVector < _elementType, _size > | VectorValueType |
typedef vctFixedSizeVector < _elementType, _size > | CopyType |
typedef vctFixedSizeVector < bool, _size > | BoolVectorValueType |
typedef vctFixedSizeConstMatrixRef < _elementType, 1, _size, _stride *_size, _stride > | RowConstMatrixRefType |
typedef vctFixedSizeMatrixRef < _elementType, 1, _size, _stride *_size, _stride > | RowMatrixRefType |
typedef vctFixedSizeConstMatrixRef < _elementType, _size, 1, _stride, _stride *_size > | ColConstMatrixRefType |
typedef vctFixedSizeMatrixRef < _elementType, _size, 1, _stride, _stride *_size > | ColMatrixRefType |
Public Member Functions | |
VCT_CONTAINER_TRAITS_TYPEDEFS (_elementType) | |
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 |
size_type | max_size (void) const |
difference_type | stride (void) const |
bool | empty (void) const |
const_reference | operator[] (size_type index) const |
const_reference | at (size_type index) const throw (std::out_of_range) |
const_reference | operator() (size_type index) const throw (std::out_of_range) |
const_reference | Element (size_type index) const |
const_pointer | Pointer (size_type index=0) const |
bool | ValidIndex (size_type index) const |
template<vct::size_type __subSize> | |
vctFixedSizeConstVectorRef < _elementType, __subSize, _stride > | Ref (const size_type startPosition=0) const throw (std::out_of_range) |
template<stride_type __stride, class __dataPtrType > | |
value_type | DotProduct (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const |
std::string | ToString (void) const |
void | ToStream (std::ostream &outputStream) const |
void | ToStreamRaw (std::ostream &outputStream, const char delimiter= ' ', bool headerOnly=false, const std::string &headerPrefix="") const |
void | SerializeRaw (std::ostream &outputStream) const |
Size dependant methods. | |
The following methods are size dependant, i.e. don't necessarily mean anything for all sizes of vector. For example, using the Z() method on a vector of size 2 shouldn't be allowed. It would have been possible to check these errors at compilation time, but this would require an overhead of code and therefore execution time which is not worth it. Therefore, we are using and CMN_ASSERT() to check that the template parameter _size is valid
| |
const value_type & | X (void) const |
const value_type & | Y (void) const |
const value_type & | Z (void) const |
const value_type & | W (void) const |
vctFixedSizeConstVectorRef < _elementType, 2, _stride > | XY (void) const |
vctFixedSizeConstVectorRef < _elementType, 2, 2 *_stride > | XZ (void) const |
vctFixedSizeConstVectorRef < _elementType, 2, 3 *_stride > | XW (void) const |
vctFixedSizeConstVectorRef < _elementType, 2, _stride > | YZ (void) const |
vctFixedSizeConstVectorRef < _elementType, 2, 2 *_stride > | YW (void) const |
vctFixedSizeConstVectorRef < _elementType, 2, _stride > | ZW (void) const |
vctFixedSizeConstVectorRef < _elementType, 3, _stride > | XYZ (void) const |
vctFixedSizeConstVectorRef < _elementType, 3, _stride > | YZW (void) const |
vctFixedSizeConstVectorRef < _elementType, 4, _stride > | XYZW (void) const |
RowConstMatrixRefType | AsRowMatrix (void) const |
ColConstMatrixRefType | AsColMatrix (void) const |
Incremental operations returning a scalar. | |
Compute a scalar from all the elements of the vector. | |
value_type | SumOfElements (void) const |
value_type | ProductOfElements (void) const |
value_type | NormSquare (void) const |
NormType | Norm (void) const |
bool | IsNormalized (_elementType tolerance=cmnTypeTraits< _elementType >::Tolerance()) 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 |
bool | IsFortran (void) const |
template<size_type __size, stride_type __stride, class __dataPtrType > | |
bool | FastCopyCompatible (const vctFixedSizeConstVectorBase< __size, __stride, value_type, __dataPtrType > &source) const |
template<class __vectorOwnerType > | |
bool | FastCopyCompatible (const vctDynamicConstVectorBase< __vectorOwnerType, value_type > &source) const |
Elementwise comparisons between vectors. | |
Returns the vector of comparison's results. | |
template<stride_type __stride, class __dataPtrType > | |
bool | Equal (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const |
template<stride_type __stride, class __dataPtrType > | |
bool | operator== (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const |
template<stride_type __stride, class __dataPtrType > | |
bool | AlmostEqual (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector, value_type tolerance) const |
template<stride_type __stride, class __dataPtrType > | |
bool | AlmostEqual (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const |
template<stride_type __stride, class __dataPtrType > | |
bool | NotEqual (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const |
template<stride_type __stride, class __dataPtrType > | |
bool | operator!= (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const |
template<stride_type __stride, class __dataPtrType > | |
bool | Lesser (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const |
template<stride_type __stride, class __dataPtrType > | |
bool | LesserOrEqual (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const |
template<stride_type __stride, class __dataPtrType > | |
bool | Greater (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const |
template<stride_type __stride, class __dataPtrType > | |
bool | GreaterOrEqual (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const |
template<stride_type __stride, class __dataPtrType > | |
BoolVectorValueType | ElementwiseEqual (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const |
template<stride_type __stride, class __dataPtrType > | |
BoolVectorValueType | ElementwiseNotEqual (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const |
template<stride_type __stride, class __dataPtrType > | |
BoolVectorValueType | ElementwiseLesser (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const |
template<stride_type __stride, class __dataPtrType > | |
BoolVectorValueType | ElementwiseLesserOrEqual (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const |
template<stride_type __stride, class __dataPtrType > | |
BoolVectorValueType | ElementwiseGreater (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const |
template<stride_type __stride, class __dataPtrType > | |
BoolVectorValueType | ElementwiseGreaterOrEqual (const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const |
Elementwise comparisons between a vector and a scalar. | |
Returns the vector of comparison's results. | |
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 |
BoolVectorValueType | ElementwiseEqual (const value_type &scalar) const |
BoolVectorValueType | ElementwiseNotEqual (const value_type &scalar) const |
BoolVectorValueType | ElementwiseLesser (const value_type &scalar) const |
BoolVectorValueType | ElementwiseLesserOrEqual (const value_type &scalar) const |
BoolVectorValueType | ElementwiseGreater (const value_type &scalar) const |
BoolVectorValueType | ElementwiseGreaterOrEqual (const value_type &scalar) const |
Unary elementwise operations. | |
Returns the result of vector.op(). | |
VectorValueType | Abs (void) const |
VectorValueType | Negation (void) const |
VectorValueType | Floor (void) const |
VectorValueType | Ceil (void) const |
VectorValueType | Normalized (void) const throw (std::runtime_error) |
Protected Member Functions | |
void | ThrowUnlessValidIndex (size_type index) const throw (std::out_of_range) |
Protected Attributes | |
_dataPtrType | Data |
A template for a fixed length vector with fixed spacing in memory.
The vector can be defined over an existing memory block, or define its own memory block. The class's methods follow the STL specifications for Random Access Container. It uses vctFixedSizeVectorTraits to define the types required by the STL interface.
This class defines a read-only memory vector. The read/write vector is derived from this class (compare with vctFixedStrideVectorConstIterator). Therefore, all the methods of this class are const. The non-const vector and methods are defined in vctFixedSizeVectorBase.
Vector indexing is 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).
_elementType | the type of element in the vector. |
_size | the number of elements that the vector provides access to. |
_stride | the spacing between the elements in the memory block. _stride=1 means that the elements are next to each other. _stride=2 means they are separated by one, and so on. |
_dataPtrType | the type of object that defines the vector. This may be an element pointer of an acutal fixed-size C-style array type. |
typedef vctFixedSizeVector<bool, _size> vctFixedSizeConstVectorBase< _size, _stride, _elementType, _dataPtrType >::BoolVectorValueType |
The type of a vector of booleans returned from operations on this object, e.g., ElementwiseEqual.
typedef vctFixedSizeConstMatrixRef<_elementType, _size, 1, _stride, _stride*_size> vctFixedSizeConstVectorBase< _size, _stride, _elementType, _dataPtrType >::ColConstMatrixRefType |
type of overlay column matrix over this sequence
typedef vctFixedSizeMatrixRef<_elementType, _size, 1, _stride, _stride*_size> vctFixedSizeConstVectorBase< _size, _stride, _elementType, _dataPtrType >::ColMatrixRefType |
typedef VectorTraits::const_iterator vctFixedSizeConstVectorBase< _size, _stride, _elementType, _dataPtrType >::const_iterator |
Const iterator on the elements of the vector.
typedef VectorTraits::const_reverse_iterator vctFixedSizeConstVectorBase< _size, _stride, _elementType, _dataPtrType >::const_reverse_iterator |
Const reverse iterator on the elements of the vector.
typedef vctFixedSizeVector<_elementType, _size> vctFixedSizeConstVectorBase< _size, _stride, _elementType, _dataPtrType >::CopyType |
The type used to create a copy.
typedef VectorTraits::iterator vctFixedSizeConstVectorBase< _size, _stride, _elementType, _dataPtrType >::iterator |
Iterator on the elements of the vector.
typedef VectorTraits::reverse_iterator vctFixedSizeConstVectorBase< _size, _stride, _elementType, _dataPtrType >::reverse_iterator |
Reverse iterator on the elements of the vector.
typedef vctFixedSizeConstMatrixRef<_elementType, 1, _size, _stride*_size,_stride> vctFixedSizeConstVectorBase< _size, _stride, _elementType, _dataPtrType >::RowConstMatrixRefType |
type of overlay row matrix over this sequence
typedef vctFixedSizeMatrixRef<_elementType, 1, _size, _stride*_size, _stride> vctFixedSizeConstVectorBase< _size, _stride, _elementType, _dataPtrType >::RowMatrixRefType |
typedef vctFixedSizeConstVectorBase<_size, _stride, _elementType, _dataPtrType> vctFixedSizeConstVectorBase< _size, _stride, _elementType, _dataPtrType >::ThisType |
Type of the vector itself.
typedef vctFixedSizeVectorTraits<_elementType, _size, _stride> vctFixedSizeConstVectorBase< _size, _stride, _elementType, _dataPtrType >::VectorTraits |
Traits used for all useful types related to a vctFixedSizeVector.
typedef vctFixedSizeVector<_elementType, _size> vctFixedSizeConstVectorBase< _size, _stride, _elementType, _dataPtrType >::VectorValueType |
The type of a vector returned by value from operations on this object
anonymous enum |
anonymous enum |
|
inline |
Unary elementwise operations on a vector. For each element of the vector "this", performs where
can calculate the absolute value (Abs), the opposite (Negation) or the normalized version (Normalized).
|
inline |
Return true if all the elements of this vector are nonzero, false otherwise
|
inline |
|
inline |
|
inline |
Return true if any element of this vector is nonzero, false otherwise
|
inline |
|
inline |
Create an overlay matrix (MatrixRef) on top of this vector and return it.
|
inline |
Access an element by index (const). Compare with std::vector::at(). This method can be a handy substitute for the overloaded operator [] when operator overloading is unavailable or inconvenient.
|
inline |
Returns a const iterator on the first element (STL compatibility).
|
inline |
|
inline |
Dot product with another vector of the same type and size
otherVector | second operand of the dot product ("this" is the first operand) |
|
inline |
Access an element by index (const). This method allows to access an element without any bounds checking.
|
inline |
Comparison between two vectors of the same size, containing the same type of elements. The strides and the internal representation (_dataPtrType) can be different. The comparaison ( ) for ElementwiseEqual(), ElementwiseNotEqual(), ElementwiseLesser(), ElementwiseLesserOrEqual(), ElementwiseGreater() or ElementwiseGreaterOrEqual() is performed elementwise between the two vectors and stored in a newly created vector. There is no operator provided since the semantic would be ambiguous.
|
inline |
Comparison between a vector and a scalar, containing the same type of elements. The comparaison ( ) for ElementwiseEqual(), ElementwiseNotEqual(), ElementwiseLesser(), ElementwiseLesserOrEqual(), ElementwiseGreater() or ElementwiseGreaterOrEqual() is performed elementwise between the vector and the scalar and stored in a newly created vector. There is no operator provided since the semantic would be ambiguous.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Tell is the vector is empty (STL compatibility). False unless SIZE is zero.
|
inline |
Returns a const iterator on the last element (STL compatibility).
|
inline |
Comparison between two vectors of the same size, containing the same type of elements. The stride and the internal representation (_dataPtrType) can be different. The comparaison ( ) for Equal(), NotEqual(), Lesser(), LesserOrEqual(), Greater() or GreaterOrEqual() is performed elementwise between the two vectors. 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 a vector and a scalar. The type of the elements of the vector and the scalar must be the same. The comparaison ( ) for Equal(), NotEqual(), Lesser(), LesserOrEqual(), Greater() or GreaterOrEqual() is performed elementwise between the vector 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 |
Test if the method FastCopyOf can be used instead of Assign. See FastCopyOf for more details.
|
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 vector is NaN, false otherwise
|
inline |
Test if the vector is compact, i.e. a vector of length l actually uses a contiguous block of memory or size l. A compact vector has a stride equal to 1.
|
inline |
Return true if all the elements of this vector are finite, false otherwise
|
inline |
Test if the vector is "Fortran" compatible, i.e. is compact.
|
inline |
Return true if all the elements of this vector are strictly negative, false otherwise
|
inline |
Return true if all the elements of this vector are non-negative, false otherwise
|
inline |
Return true if all the elements of this vector are non-positive, false otherwise
|
inline |
Test if this vector is normalized.
tolerance | The maximum difference between the norm and 1 to consider the vector normalized. |
|
inline |
Return true if all the elements of this vector are strictly positive, false otherwise
|
inline |
Return the L1 norm of the vector, i.e. the sum of the absolute values of all the elements.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Return the Linf norm of the vector, i.e. the maximum of the absolute values of all the elements.
|
inline |
Returns the maximum size of the vector (STL compatibility). For a fixed size vector, same as the size().
|
inline |
Return the maximum of the absolute values of all the elements.
|
inline |
Return the maximum element of the vector.
|
inline |
Return the minimum of the absolute values of all the elements.
|
inline |
Compute the minimum AND maximum elements of the vector. 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 vector.
|
inline |
|
inline |
Return the norm of the vector.
|
inline |
|
inline |
Return the square of the norm of the vector.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Access an element by index (const). See method at().
|
inline |
|
inline |
|
inline |
Access an element by index (const).
|
inline |
Returns a const pointer to an element of the container, specified by its index. Addition to the STL requirements.
|
inline |
Return the product of the elements of the vector.
|
inline |
Returns a reverse const iterator on the last element (STL compatibility).
|
inline |
Create a const reference to a sub vector
|
inline |
Returns a reverse const iterator on the element before first (STL compatibility).
|
inline |
Binary serialization
|
inline |
Returns the size of the vector (STL compatibility).
|
inline |
Not required by STL but provided for completeness
|
inline |
Return the sum of the elements of the vector.
|
inlineprotected |
Check the validity of an index.
|
inline |
Print the matrix in a human readable format
|
inline |
Print data only with optional separator
|
inline |
|
inline |
Returns true if this index is valid.
vctFixedSizeConstVectorBase< _size, _stride, _elementType, _dataPtrType >::VCT_CONTAINER_TRAITS_TYPEDEFS | ( | _elementType | ) |
|
inline |
Returns the fourth element of the vector. This method uses CMN_ASSERT to check that the size is at least 4.
|
inline |
Returns the first element of the vector. This method uses CMN_ASSERT to check that the size is at least 1.
|
inline |
Return a (const) vector reference for the first and fourth elements of this vector.
|
inline |
Return a (const) vector reference for the first two elements of this vector. May be used when switching from homogeneous coordinates to normal
|
inline |
Return a (const) vector reference for the first three elements of this vector. May be used when switching from homogeneous coordinates to normal, or when refering to a subvector of a row or a column inside a small matrix.
|
inline |
Return a (const) vector reference for the first four elements of this vector. May be used when switching from homogeneous coordinates to normal, or when refering to a subvector of a row or a column inside a small matrix.
|
inline |
Return a (const) vector reference for the first and third elements of this vector.
|
inline |
Returns the second element of the vector. This method uses CMN_ASSERT to check that the size is at least 2.
|
inline |
Return a (const) vector reference for the two elements of this vector beginning on the second.
|
inline |
Return a (const) vector reference for the two elements of this vector beginning on the second.
|
inline |
Return a (const) vector reference for the second, third and fourth elements of this vector.
|
inline |
Returns the third element of the vector. This method uses CMN_ASSERT to check that the size is at least 3.
|
inline |
Return a (const) vector reference for the two elements of this vector beginning on the third.
|
protected |
A declaration of the vector-defining member object