[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

TinyVectorBase< VALUETYPE, SIZE, DATA, DERIVED > Class Template Reference

Base class for fixed size vectors. More...

#include <vigra/tinyvector.hxx>

Inheritance diagram for TinyVectorBase< VALUETYPE, SIZE, DATA, DERIVED >:
TinyVector< unsigned int, N > TinyVector< unsigned int, 1 > TinyVector< VALUETYPE, 3 > TinyVector< double, N > TinyVector< double, 7 > TinyVector< INDEX_TYPE, 3 > TinyVector< int, 2 > TinyVector< VALUETYPE, DIMENSION > TinyVector< double, 2 > TinyVector< PointValue, DIMENSION > TinyVector< ValueType, 3 > TinyVector< float, 3 > TinyVector< double, dimensions > TinyVector< double, BinCount > TinyVector< double, coordSize >

Public Types

enum  
 
typedef value_type constconst_iterator
 
typedef VALUETYPE constconst_pointer
 
typedef VALUETYPE constconst_reference
 
typedef std::ptrdiff_t difference_type
 
typedef value_typeiterator
 
typedef SquareRootTraits< SquaredNormType >::SquareRootResult NormType
 
typedef VALUETYPEpointer
 
typedef VALUETYPEreference
 
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 constmaximum () const
 
VALUETYPE constminimum () const
 
template<class T1 , class D1 , class D2 >
DERIVEDoperator%= (TinyVectorBase< T1, SIZE, D1, D2 > const &r)
 
DERIVEDoperator*= (double r)
 
template<class T1 , class D1 , class D2 >
DERIVEDoperator*= (TinyVectorBase< T1, SIZE, D1, D2 > const &r)
 
DERIVEDoperator+= (double r)
 
template<class T1 , class D1 , class D2 >
DERIVEDoperator+= (TinyVectorBase< T1, SIZE, D1, D2 > const &r)
 
DERIVEDoperator-= (double r)
 
template<class T1 , class D1 , class D2 >
DERIVEDoperator-= (TinyVectorBase< T1, SIZE, D1, D2 > const &r)
 
DERIVEDoperator/= (double r)
 
template<class T1 , class D1 , class D2 >
DERIVEDoperator/= (TinyVectorBase< T1, SIZE, D1, D2 > const &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-FROMsubarray () const
 

Static Public Member Functions

static TinyVector< VALUETYPE, SIZElinearSequence (VALUETYPE start=VALUETYPE(), VALUETYPE step=VALUETYPE(1))
 Factory function for a linear sequence.
 
static TinyVector< VALUETYPE, SIZEunitVector (int k)
 Factory function for a unit vector for dimension k.
 

Detailed Description

template<class VALUETYPE, int SIZE, class DATA, class DERIVED>
class vigra::TinyVectorBase< VALUETYPE, SIZE, DATA, DERIVED >

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

Member Typedef Documentation

◆ value_type

STL-compatible definition of valuetype

◆ reference

reference (return of operator[]).

◆ const_reference

const reference (return of operator[] const).

◆ pointer

pointer (return of operator->).

◆ const_pointer

const pointer (return of operator-> const).

◆ iterator

STL-compatible definition of iterator

◆ const_iterator

STL-compatible definition of const iterator

◆ size_type

STL-compatible definition of size_type

◆ difference_type

template<class VALUETYPE , int SIZE, class DATA , class DERIVED >
typedef std::ptrdiff_t difference_type

STL-compatible definition of difference_type

◆ scalar_multiplier

the scalar type for the outer product

◆ SquaredNormType

template<class VALUETYPE , int SIZE, class DATA , class DERIVED >
typedef NormTraits<VALUETYPE>::SquaredNormType SquaredNormType

the vector's squared norm type

◆ NormType

template<class VALUETYPE , int SIZE, class DATA , class DERIVED >
typedef SquareRootTraits<SquaredNormType>::SquareRootResult NormType

the vector's norm type

Member Enumeration Documentation

◆ anonymous enum

the vector's size

Member Function Documentation

◆ init() [1/2]

template<class VALUETYPE , int SIZE, class DATA , class DERIVED >
template<class Iterator >
void init ( Iterator  i,
Iterator  end 
)

Initialize from another sequence (must have length SIZE!)

◆ init() [2/2]

template<class VALUETYPE , int SIZE, class DATA , class DERIVED >
void init ( value_type  initial)

Initialize with constant value

◆ operator+=() [1/2]

template<class VALUETYPE , int SIZE, class DATA , class DERIVED >
template<class T1 , class D1 , class D2 >
DERIVED & operator+= ( TinyVectorBase< T1, SIZE, D1, D2 > const r)

Component-wise add-assignment

◆ operator-=() [1/2]

template<class VALUETYPE , int SIZE, class DATA , class DERIVED >
template<class T1 , class D1 , class D2 >
DERIVED & operator-= ( TinyVectorBase< T1, SIZE, D1, D2 > const r)

Component-wise subtract-assignment

◆ operator*=() [1/2]

template<class VALUETYPE , int SIZE, class DATA , class DERIVED >
template<class T1 , class D1 , class D2 >
DERIVED & operator*= ( TinyVectorBase< T1, SIZE, D1, D2 > const r)

Component-wise multiply-assignment

◆ operator/=() [1/2]

template<class VALUETYPE , int SIZE, class DATA , class DERIVED >
template<class T1 , class D1 , class D2 >
DERIVED & operator/= ( TinyVectorBase< T1, SIZE, D1, D2 > const r)

Component-wise divide-assignment

◆ operator%=()

template<class VALUETYPE , int SIZE, class DATA , class DERIVED >
template<class T1 , class D1 , class D2 >
DERIVED & operator%= ( TinyVectorBase< T1, SIZE, D1, D2 > const r)

Component-wise modulo-assignment

◆ operator+=() [2/2]

template<class VALUETYPE , int SIZE, class DATA , class DERIVED >
DERIVED & operator+= ( double  r)

Component-wise scalar multiply-assignment

◆ operator-=() [2/2]

template<class VALUETYPE , int SIZE, class DATA , class DERIVED >
DERIVED & operator-= ( double  r)

Component-wise scalar divide-assignment

◆ operator*=() [2/2]

template<class VALUETYPE , int SIZE, class DATA , class DERIVED >
DERIVED & operator*= ( double  r)

Component-wise scalar multiply-assignment

◆ operator/=() [2/2]

template<class VALUETYPE , int SIZE, class DATA , class DERIVED >
DERIVED & operator/= ( double  r)

Component-wise scalar divide-assignment

◆ magnitude()

template<class VALUETYPE , int SIZE, class DATA , class DERIVED >
NormType magnitude ( ) const

Calculate magnitude (i.e. 2-norm / Euclidean norm / length).

See also
squaredMagnitude()

◆ squaredMagnitude()

template<class VALUETYPE , int SIZE, class DATA , class DERIVED >
SquaredNormType squaredMagnitude ( ) const

Calculate squared magnitude (i.e. sum of squared elements).

◆ minimum()

template<class VALUETYPE , int SIZE, class DATA , class DERIVED >
VALUETYPE const & minimum ( ) const

Return the minimal element.

◆ maximum()

template<class VALUETYPE , int SIZE, class DATA , class DERIVED >
VALUETYPE const & maximum ( ) const

Return the maximal element.

◆ all()

template<class VALUETYPE , int SIZE, class DATA , class DERIVED >
bool all ( ) const

Check that all elements of this vector are non-zero (or 'true' if T is bool).

◆ any()

template<class VALUETYPE , int SIZE, class DATA , class DERIVED >
bool any ( ) const

Check that at least one element of this vector is non-zero (or 'true' if T is bool).

◆ operator[]() [1/2]

Access component by index.

◆ operator[]() [2/2]

Get component by index.

◆ begin() [1/2]

template<class VALUETYPE , int SIZE, class DATA , class DERIVED >
iterator begin ( )

Get random access iterator to begin of vector.

◆ end() [1/2]

template<class VALUETYPE , int SIZE, class DATA , class DERIVED >
iterator end ( )

Get random access iterator past-the-end of vector.

◆ begin() [2/2]

template<class VALUETYPE , int SIZE, class DATA , class DERIVED >
const_iterator begin ( ) const

Get const random access iterator to begin of vector.

◆ end() [2/2]

template<class VALUETYPE , int SIZE, class DATA , class DERIVED >
const_iterator end ( ) const

Get const random access iterator past-the-end of vector.

◆ cbegin()

template<class VALUETYPE , int SIZE, class DATA , class DERIVED >
const_iterator cbegin ( ) const

Get const random access iterator to begin of vector.

◆ cend()

template<class VALUETYPE , int SIZE, class DATA , class DERIVED >
const_iterator cend ( ) const

Get const random access iterator past-the-end of vector.

◆ subarray()

template<class VALUETYPE , int SIZE, class DATA , class DERIVED >
template<int FROM, int TO>
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.

Examples
composite.cxx, dissolve.cxx, smooth_explicitly.cxx, and subimage_tutorial.cxx.

◆ size()

template<class VALUETYPE , int SIZE, class DATA , class DERIVED >
size_type size ( ) const

Size of TinyVector vector always equals the template parameter SIZE.

Examples
graph_agglomerative_clustering.cxx, smooth_explicitly.cxx, and transpose.cxx.

◆ linearSequence()

template<class VALUETYPE , int SIZE, class DATA , class DERIVED >
static TinyVector< VALUETYPE, SIZE > linearSequence ( VALUETYPE  start = VALUETYPE(),
VALUETYPE  step = VALUETYPE(1) 
)
static

Factory function for a linear sequence.

The result will be initialized as res[k] = start + k*step.


The documentation for this class was generated from the following file:

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de)
Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany

html generated using doxygen and Python
vigra 1.11.1