[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]
TinyVectorBase< V1, SIZE, D1, D2 > Class Template Reference |
Base class for fixed size vectors. More...
#include <vigra/tinyvector.hxx>
Public Types | |
enum | |
typedef value_type const * | const_iterator |
typedef VALUETYPE const * | const_pointer |
typedef VALUETYPE const & | const_reference |
typedef std::ptrdiff_t | difference_type |
typedef value_type * | iterator |
typedef SquareRootTraits < SquaredNormType > ::SquareRootResult | NormType |
typedef VALUETYPE * | pointer |
typedef VALUETYPE & | reference |
typedef double | scalar_multiplier |
typedef unsigned int | size_type |
typedef NormTraits< VALUETYPE > ::SquaredNormType | SquaredNormType |
typedef VALUETYPE | value_type |
Public Member Functions | |
bool | all () const |
bool | any () const |
iterator | begin () |
const_iterator | begin () const |
const_iterator | cbegin () const |
const_iterator | cend () const |
iterator | end () |
const_iterator | end () const |
template<class Iterator > | |
void | init (Iterator i, Iterator end) |
void | init (value_type initial) |
NormType | magnitude () const |
VALUETYPE const & | maximum () const |
VALUETYPE const & | minimum () const |
template<class T1 , class D1 , class D2 > | |
DERIVED & | operator%= (TinyVectorBase< T1, SIZE, D1, D2 > const &r) |
template<class T1 , class D1 , class D2 > | |
DERIVED & | operator*= (TinyVectorBase< T1, SIZE, D1, D2 > const &r) |
DERIVED & | operator*= (double r) |
template<class T1 , class D1 , class D2 > | |
DERIVED & | operator+= (TinyVectorBase< T1, SIZE, D1, D2 > const &r) |
DERIVED & | operator+= (double r) |
template<class T1 , class D1 , class D2 > | |
DERIVED & | operator-= (TinyVectorBase< T1, SIZE, D1, D2 > const &r) |
DERIVED & | operator-= (double r) |
template<class T1 , class D1 , class D2 > | |
DERIVED & | operator/= (TinyVectorBase< T1, SIZE, D1, D2 > const &r) |
DERIVED & | operator/= (double r) |
reference | operator[] (difference_type i) |
const_reference | operator[] (difference_type i) const |
size_type | size () const |
SquaredNormType | squaredMagnitude () const |
template<int FROM, int TO> | |
TinyVectorView< VALUETYPE, TO-FROM > | subarray () const |
Static Public Member Functions | |
static TinyVector< VALUETYPE, SIZE > | linearSequence (VALUETYPE start=VALUETYPE(), VALUETYPE step=VALUETYPE(1)) |
Factory function for a linear sequence. More... | |
static TinyVector< VALUETYPE, SIZE > | unitVector (int k) |
Factory function for a unit vector for dimension k. | |
Base class for fixed size vectors.
This class contains functionality shared by TinyVector and TinyVectorView, and enables these classes to be freely mixed within expressions. It is typically not used directly.
#include <vigra/tinyvector.hxx>
Namespace: vigra
typedef VALUETYPE value_type |
STL-compatible definition of valuetype
typedef VALUETYPE& reference |
reference (return of operator[]).
typedef VALUETYPE const& const_reference |
const reference (return of operator[] const).
typedef VALUETYPE* pointer |
pointer (return of operator->).
typedef VALUETYPE const* const_pointer |
const pointer (return of operator-> const).
typedef value_type* iterator |
STL-compatible definition of iterator
typedef value_type const* const_iterator |
STL-compatible definition of const iterator
typedef unsigned int size_type |
STL-compatible definition of size_type
typedef std::ptrdiff_t difference_type |
STL-compatible definition of difference_type
typedef double scalar_multiplier |
the scalar type for the outer product
typedef NormTraits<VALUETYPE>::SquaredNormType SquaredNormType |
the vector's squared norm type
typedef SquareRootTraits<SquaredNormType>::SquareRootResult NormType |
the vector's norm type
anonymous enum |
the vector's size
void init | ( | Iterator | i, |
Iterator | end | ||
) |
Initialize from another sequence (must have length SIZE!)
void init | ( | value_type | initial | ) |
Initialize with constant value
DERIVED& operator+= | ( | TinyVectorBase< T1, SIZE, D1, D2 > const & | r | ) |
Component-wise add-assignment
DERIVED& operator-= | ( | TinyVectorBase< T1, SIZE, D1, D2 > const & | r | ) |
Component-wise subtract-assignment
DERIVED& operator*= | ( | TinyVectorBase< T1, SIZE, D1, D2 > const & | r | ) |
Component-wise multiply-assignment
DERIVED& operator/= | ( | TinyVectorBase< T1, SIZE, D1, D2 > const & | r | ) |
Component-wise divide-assignment
DERIVED& operator%= | ( | TinyVectorBase< T1, SIZE, D1, D2 > const & | r | ) |
Component-wise modulo-assignment
DERIVED& operator+= | ( | double | r | ) |
Component-wise scalar multiply-assignment
DERIVED& operator-= | ( | double | r | ) |
Component-wise scalar divide-assignment
DERIVED& operator*= | ( | double | r | ) |
Component-wise scalar multiply-assignment
DERIVED& operator/= | ( | double | r | ) |
Component-wise scalar divide-assignment
NormType magnitude | ( | ) | const |
Calculate magnitude (i.e. 2-norm / Euclidean norm / length).
SquaredNormType squaredMagnitude | ( | ) | const |
Calculate squared magnitude (i.e. sum of squared elements).
VALUETYPE const& minimum | ( | ) | const |
Return the minimal element.
VALUETYPE const& maximum | ( | ) | const |
Return the maximal element.
bool all | ( | ) | const |
Check that all elements of this vector are non-zero (or 'true' if T is bool).
bool any | ( | ) | const |
Check that at least one element of this vector is non-zero (or 'true' if T is bool).
reference operator[] | ( | difference_type | i | ) |
Access component by index.
const_reference operator[] | ( | difference_type | i | ) | const |
Get component by index.
iterator begin | ( | ) |
Get random access iterator to begin of vector.
iterator end | ( | ) |
Get random access iterator past-the-end of vector.
const_iterator begin | ( | ) | const |
Get const random access iterator to begin of vector.
const_iterator end | ( | ) | const |
Get const random access iterator past-the-end of vector.
const_iterator cbegin | ( | ) | const |
Get const random access iterator to begin of vector.
const_iterator cend | ( | ) | const |
Get const random access iterator past-the-end of vector.
TinyVectorView<VALUETYPE, TO-FROM> subarray | ( | ) | const |
Get a view to the subarray with length (TO-FROM)
starting at FROM
. The bounds must fullfill 0 <= FROM < TO <= SIZE
, but this is only checked when VIGRA_CHECK_BOUNDS
is #define'd.
size_type size | ( | ) | const |
Size of TinyVector vector always equals the template parameter SIZE.
|
static |
Factory function for a linear sequence.
The result will be initialized as res[k] = start + k*step
.
© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) |
html generated using doxygen and Python
|