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

Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MultiArray< N, T, A > Class Template Reference

Main MultiArray class containing the memory management. More...

#include <vigra/multi_array.hxx>

Inheritance diagram for MultiArray< N, T, A >:
MultiArrayView< N, T >

Public Types

typedef A allocator_type
typedef T * const_iterator
typedef view_type::const_pointer const_pointer
typedef view_type::const_reference const_reference
typedef
vigra::detail::MultiIteratorChooser
< UnstridedArrayTag >
::template Traverser< N, T, T
const &, T const * >::type 
const_traverser
typedef view_type::difference_type difference_type
typedef
view_type::difference_type_1 
difference_type_1
typedef T * iterator
typedef MultiArray< N, T, A > matrix_type
typedef view_type::pointer pointer
typedef view_type::reference reference
typedef view_type::size_type size_type
typedef
vigra::detail::MultiIteratorChooser
< UnstridedArrayTag >
::template Traverser< N, T, T
&, T * >::type 
traverser
typedef view_type::value_type value_type
typedef MultiArrayView< N, T > view_type
- Public Types inherited from MultiArrayView< N, T >
enum  ActualDimension
typedef
StridedScanOrderIterator
< actual_dimension, T, T const
&, T const * > 
const_iterator
typedef const value_typeconst_pointer
typedef const value_typeconst_reference
typedef
vigra::detail::MultiIteratorChooser
< StrideTag >::template
Traverser< actual_dimension, T,
T const &, T const * >::type 
const_traverser
typedef MultiArrayShape
< actual_dimension >::type 
difference_type
typedef MultiArrayIndex difference_type_1
typedef
StridedScanOrderIterator
< actual_dimension, T, T &, T * > 
iterator
typedef MultiArray< N, T > matrix_type
typedef value_typepointer
typedef value_typereference
typedef difference_type size_type
typedef
vigra::detail::MultiIteratorChooser
< StrideTag >::template
Traverser< actual_dimension, T,
T &, T * >::type 
traverser
typedef T value_type
typedef MultiArrayView< N, T,
StrideTag > 
view_type

Public Member Functions

allocator_type const & allocator () const
iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const
template<class U >
MultiArrayinit (const U &init)
 MultiArray ()
 MultiArray (allocator_type const &alloc)
 MultiArray (const difference_type &shape, allocator_type const &alloc=allocator_type())
 MultiArray (const difference_type &shape, const_reference init, allocator_type const &alloc=allocator_type())
 MultiArray (const difference_type &shape, const_pointer init, allocator_type const &alloc=allocator_type())
 MultiArray (const MultiArray &rhs)
template<class Expression >
 MultiArray (multi_math::MultiMathOperand< Expression > const &rhs, allocator_type const &alloc=allocator_type())
template<class U , class StrideTag >
 MultiArray (const MultiArrayView< N, U, StrideTag > &rhs, allocator_type const &alloc=allocator_type())
template<class U , class StrideTag >
MultiArrayoperator*= (const MultiArrayView< N, U, StrideTag > &rhs)
MultiArrayoperator*= (const T &rhs)
template<class Expression >
MultiArrayoperator*= (multi_math::MultiMathOperand< Expression > const &rhs)
template<class U , class StrideTag >
MultiArrayoperator+= (const MultiArrayView< N, U, StrideTag > &rhs)
MultiArrayoperator+= (const T &rhs)
template<class Expression >
MultiArrayoperator+= (multi_math::MultiMathOperand< Expression > const &rhs)
template<class U , class StrideTag >
MultiArrayoperator-= (const MultiArrayView< N, U, StrideTag > &rhs)
MultiArrayoperator-= (const T &rhs)
template<class Expression >
MultiArrayoperator-= (multi_math::MultiMathOperand< Expression > const &rhs)
template<class U , class StrideTag >
MultiArrayoperator/= (const MultiArrayView< N, U, StrideTag > &rhs)
MultiArrayoperator/= (const T &rhs)
template<class Expression >
MultiArrayoperator/= (multi_math::MultiMathOperand< Expression > const &rhs)
MultiArrayoperator= (const MultiArray &rhs)
template<class U , class StrideTag >
MultiArrayoperator= (const MultiArrayView< N, U, StrideTag > &rhs)
template<class Expression >
MultiArrayoperator= (multi_math::MultiMathOperand< Expression > const &rhs)
void reshape (const difference_type &shape)
void reshape (const difference_type &shape, const_reference init)
void swap (MultiArray &other)
 ~MultiArray ()
- Public Member Functions inherited from MultiArrayView< N, T >
bool all () const
bool any () const
MultiArrayView< N-1, T,
typename
vigra::detail::MaybeStrided
< StrideTag, M >::type > 
bind (difference_type_1 d) const
MultiArrayView< N-1, T,
StridedArrayTag
bindAt (difference_type_1 m, difference_type_1 d) const
MultiArrayView< N, typename
ExpandElementResult< T >::type,
StridedArrayTag
bindElementChannel (difference_type_1 i) const
MultiArrayView< N-M, T,
StridedArrayTag
bindInner (const TinyVector< MultiArrayIndex, M > &d) const
MultiArrayView< N-1, T,
StridedArrayTag
bindInner (difference_type_1 d) const
MultiArrayView< N-M, T, StrideTag > bindOuter (const TinyVector< MultiArrayIndex, M > &d) const
MultiArrayView< N-1, T, StrideTag > bindOuter (difference_type_1 d) const
difference_type_1 coordinateToScanOrderIndex (const difference_type &d) const
void copy (const MultiArrayView &rhs)
void copy (const MultiArrayView< N, U, CN > &rhs)
pointer data () const
difference_type_1 elementCount () const
MultiArrayView< N+1, typename
ExpandElementResult< T >::type,
StridedArrayTag
expandElements (difference_type_1 d) const
bool hasData () const
MultiArrayView< N+1, T, StrideTag > insertSingletonDimension (difference_type_1 i) const
bool isInside (difference_type const &p) const
bool isUnstrided (unsigned int dimension=N-1) const
void meanVariance (U *mean, U *variance) const
void minmax (T *minimum, T *maximum) const
 MultiArrayView ()
 MultiArrayView (const difference_type &shape, pointer ptr)
 MultiArrayView (const difference_type &shape, const difference_type &stride, pointer ptr)
NormTraits< MultiArrayView >
::NormType 
norm (int type=2, bool useSquaredNorm=true) const
 operator MultiArrayView< N, T, StridedArrayTag > () const
bool operator!= (MultiArrayView< N, U, C1 > const &rhs) const
reference operator() (difference_type_1 x)
reference operator() (difference_type_1 x, difference_type_1 y)
reference operator() (difference_type_1 x, difference_type_1 y, difference_type_1 z)
reference operator() (difference_type_1 x, difference_type_1 y, difference_type_1 z, difference_type_1 u)
reference operator() (difference_type_1 x, difference_type_1 y, difference_type_1 z, difference_type_1 u, difference_type_1 v)
const_reference operator() (difference_type_1 x) const
const_reference operator() (difference_type_1 x, difference_type_1 y) const
const_reference operator() (difference_type_1 x, difference_type_1 y, difference_type_1 z) const
const_reference operator() (difference_type_1 x, difference_type_1 y, difference_type_1 z, difference_type_1 u) const
const_reference operator() (difference_type_1 x, difference_type_1 y, difference_type_1 z, difference_type_1 u, difference_type_1 v) const
MultiArrayViewoperator*= (MultiArrayView< N, U, C1 > const &rhs)
MultiArrayViewoperator+= (MultiArrayView< N, U, C1 > const &rhs)
MultiArrayViewoperator-= (MultiArrayView< N, U, C1 > const &rhs)
MultiArrayViewoperator/= (MultiArrayView< N, U, C1 > const &rhs)
MultiArrayViewoperator= (MultiArrayView const &rhs)
MultiArrayViewoperator= (MultiArrayView< N, U, C1 > const &rhs)
bool operator== (MultiArrayView< N, U, C1 > const &rhs) const
reference operator[] (const difference_type &d)
const_reference operator[] (const difference_type &d) const
MultiArrayView< N-M, T,
StridedArrayTag
operator[] (const TinyVector< MultiArrayIndex, M > &d) const
reference operator[] (difference_type_1 d)
const_reference operator[] (difference_type_1 d) const
MultiArrayView< N, T,
StridedArrayTag
permuteDimensions (const difference_type &s) const
MultiArrayView< N, T,
StridedArrayTag
permuteStridesAscending () const
MultiArrayView< N, T,
StridedArrayTag
permuteStridesDescending () const
product () const
difference_type scanOrderIndexToCoordinate (difference_type_1 d) const
const difference_typeshape () const
difference_type_1 shape (difference_type_1 n) const
difference_type_1 size () const
difference_type_1 size (difference_type_1 n) const
NormTraits< MultiArrayView >
::SquaredNormType 
squaredNorm () const
const difference_typestride () const
difference_type_1 stride (int n) const
MultiArrayView< N, T,
StridedArrayTag
stridearray (const difference_type &s) const
difference_type strideOrdering () const
MultiArrayView subarray (const difference_type &p, const difference_type &q) const
sum () const
void sum (MultiArrayView< N, U, S > sums) const
void swapData (MultiArrayView rhs)
void swapData (MultiArrayView< N, T2, C2 > rhs)
MultiArrayView< N, T,
StridedArrayTag
transpose () const
traverser traverser_begin ()
const_traverser traverser_begin () const
traverser traverser_end ()
const_traverser traverser_end () const

Protected Member Functions

void allocate (pointer &ptr, difference_type_1 s, const_reference init)
template<class U >
void allocate (pointer &ptr, difference_type_1 s, U const *init)
template<class U , class StrideTag >
void allocate (pointer &ptr, MultiArrayView< N, U, StrideTag > const &init)
void deallocate (pointer &ptr, difference_type_1 s)

Protected Attributes

allocator_type m_alloc
- Protected Attributes inherited from MultiArrayView< N, T >
pointer m_ptr
difference_type m_shape
difference_type m_stride

Additional Inherited Members

- Static Public Member Functions inherited from MultiArrayView< N, T >
static difference_type strideOrdering (difference_type strides)

Detailed Description

template<unsigned int N, class T, class A>
class vigra::MultiArray< N, T, A >

Main MultiArray class containing the memory management.

This class inherits the interface of MultiArrayView, and implements the memory ownership. MultiArray's are always unstrided, striding them creates a MultiArrayView.

The template parameters are as follows

N: the array dimension
T: the type of the array elements
A: the allocator used for internal storage management
(default: std::allocator<T>)

#include <vigra/multi_array.hxx>

Namespace: vigra

Member Typedef Documentation

typedef A allocator_type

the allocator type used to allocate the memory

typedef MultiArrayView<N, T> view_type

the view type associated with this array.

typedef MultiArray<N, T, A> matrix_type

the matrix type associated with this array.

the array's value type

pointer type

const pointer type

reference type (result of operator[])

const reference type (result of operator[] const)

size type

difference type (used for multi-dimensional offsets and indices)

difference and index type for a single dimension

typedef vigra::detail::MultiIteratorChooser< UnstridedArrayTag>::template Traverser<N, T, T &, T *>::type traverser

traverser type

typedef vigra::detail::MultiIteratorChooser< UnstridedArrayTag>::template Traverser<N, T, T const &, T const *>::type const_traverser

traverser type to const data

typedef T* iterator

sequential (random access) iterator type

typedef T* const_iterator

sequential (random access) const iterator type

Constructor & Destructor Documentation

default constructor

MultiArray ( allocator_type const &  alloc)

construct with given allocator

MultiArray ( const difference_type shape,
allocator_type const &  alloc = allocator_type() 
)
explicit

construct with given shape

MultiArray ( const difference_type shape,
const_reference  init,
allocator_type const &  alloc = allocator_type() 
)

construct from shape with an initial value

MultiArray ( const difference_type shape,
const_pointer  init,
allocator_type const &  alloc = allocator_type() 
)

construct from shape and copy values from the given array

MultiArray ( const MultiArray< N, T, A > &  rhs)

copy constructor

MultiArray ( multi_math::MultiMathOperand< Expression > const &  rhs,
allocator_type const &  alloc = allocator_type() 
)

constructor from an array expression

MultiArray ( const MultiArrayView< N, U, StrideTag > &  rhs,
allocator_type const &  alloc = allocator_type() 
)

construct by copying from a MultiArrayView

~MultiArray ( )

destructor

Member Function Documentation

void allocate ( pointer ptr,
difference_type_1  s,
const_reference  init 
)
protected

allocate memory for s pixels, write its address into the given pointer and initialize the pixels with init.

void allocate ( pointer ptr,
difference_type_1  s,
U const *  init 
)
protected

allocate memory for s pixels, write its address into the given pointer and initialize the linearized pixels to the values of init.

void allocate ( pointer ptr,
MultiArrayView< N, U, StrideTag > const &  init 
)
protected

allocate memory, write its address into the given pointer and initialize it by copying the data from the given MultiArrayView.

void deallocate ( pointer ptr,
difference_type_1  s 
)
protected

deallocate the memory (of length s) starting at the given address.

MultiArray& operator= ( const MultiArray< N, T, A > &  rhs)

assignment.
If the size of rhs is the same as the left-hand side arrays's old size, only the data are copied. Otherwise, new storage is allocated, which invalidates all objects (array views, iterators) depending on the lhs array.

MultiArray& operator= ( const MultiArrayView< N, U, StrideTag > &  rhs)

assignment from arbitrary MultiArrayView.
If the size of rhs is the same as the left-hand side arrays's old size, only the data are copied. Otherwise, new storage is allocated, which invalidates all objects (array views, iterators) depending on the lhs array.

MultiArray& operator+= ( const MultiArrayView< N, U, StrideTag > &  rhs)

Add-assignment from arbitrary MultiArrayView. Fails with PreconditionViolation exception when the shapes do not match.

MultiArray& operator-= ( const MultiArrayView< N, U, StrideTag > &  rhs)

Subtract-assignment from arbitrary MultiArrayView. Fails with PreconditionViolation exception when the shapes do not match.

MultiArray& operator*= ( const MultiArrayView< N, U, StrideTag > &  rhs)

Multiply-assignment from arbitrary MultiArrayView. Fails with PreconditionViolation exception when the shapes do not match.

MultiArray& operator/= ( const MultiArrayView< N, U, StrideTag > &  rhs)

Divide-assignment from arbitrary MultiArrayView. Fails with PreconditionViolation exception when the shapes do not match.

MultiArray& operator+= ( const T &  rhs)

Add-assignment of a scalar.

Reimplemented from MultiArrayView< N, T >.

MultiArray& operator-= ( const T &  rhs)

Subtract-assignment of a scalar.

Reimplemented from MultiArrayView< N, T >.

MultiArray& operator*= ( const T &  rhs)

Multiply-assignment of a scalar.

Reimplemented from MultiArrayView< N, T >.

MultiArray& operator/= ( const T &  rhs)

Divide-assignment of a scalar.

Reimplemented from MultiArrayView< N, T >.

MultiArray& operator= ( multi_math::MultiMathOperand< Expression > const &  rhs)

Assignment of an array expression. Fails with PreconditionViolation exception when the shapes do not match.

Reimplemented from MultiArrayView< N, T >.

MultiArray& operator+= ( multi_math::MultiMathOperand< Expression > const &  rhs)

Add-assignment of an array expression. Fails with PreconditionViolation exception when the shapes do not match.

Reimplemented from MultiArrayView< N, T >.

MultiArray& operator-= ( multi_math::MultiMathOperand< Expression > const &  rhs)

Subtract-assignment of an array expression. Fails with PreconditionViolation exception when the shapes do not match.

Reimplemented from MultiArrayView< N, T >.

MultiArray& operator*= ( multi_math::MultiMathOperand< Expression > const &  rhs)

Multiply-assignment of an array expression. Fails with PreconditionViolation exception when the shapes do not match.

Reimplemented from MultiArrayView< N, T >.

MultiArray& operator/= ( multi_math::MultiMathOperand< Expression > const &  rhs)

Divide-assignment of an array expression. Fails with PreconditionViolation exception when the shapes do not match.

Reimplemented from MultiArrayView< N, T >.

MultiArray& init ( const U &  init)

init elements with a constant

Reimplemented from MultiArrayView< N, T >.

Reimplemented in Matrix< T, ALLOC >, and Matrix< T >.

void reshape ( const difference_type shape)

Allocate new memory with the given shape and initialize with zeros.
Note: this operation invalidates all dependent objects (array views and iterators)

Reimplemented in Matrix< T, ALLOC >, and Matrix< T >.

void reshape ( const difference_type shape,
const_reference  init 
)

Allocate new memory with the given shape and initialize it with the given value.
Note: this operation invalidates all dependent objects (array views and iterators)

Reimplemented in Matrix< T, ALLOC >, and Matrix< T >.

void swap ( MultiArray< N, T, A > &  other)

Swap the contents with another MultiArray. This is fast, because no data are copied, but only pointers and shapes swapped. Note: this operation invalidates all dependent objects (array views and iterators)

iterator begin ( )

sequential iterator pointing to the first array element.

Reimplemented from MultiArrayView< N, T >.

iterator end ( )

sequential iterator pointing beyond the last array element.

Reimplemented from MultiArrayView< N, T >.

const_iterator begin ( ) const

sequential const iterator pointing to the first array element.

Reimplemented from MultiArrayView< N, T >.

const_iterator end ( ) const

sequential const iterator pointing beyond the last array element.

Reimplemented from MultiArrayView< N, T >.

allocator_type const& allocator ( ) const

get the allocator.

Member Data Documentation

allocator_type m_alloc
protected

the allocator used to allocate the memory


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.8.0 (Wed Sep 26 2012)