Marray
Public Types | Public Member Functions | List of all members
andres::Marray< T, A > Class Template Reference

Runtime-Flexible multi-dimensional array. More...

#include <marray.hxx>

Inheritance diagram for andres::Marray< T, A >:
andres::View< T, false, A > andres::ViewExpression< View< T, isConst, A >, T >

Public Types

typedef View< T, false, A > base
typedef base::value_type value_type
typedef base::pointer pointer
typedef base::const_pointer const_pointer
typedef base::reference reference
typedef base::const_reference const_reference
typedef base::iterator iterator
typedef base::reverse_iterator reverse_iterator
typedef base::const_iterator const_iterator
typedef
base::const_reverse_iterator 
const_reverse_iterator
typedef A::template rebind
< value_type >::other 
allocator_type
- Public Types inherited from andres::View< T, false, A >
typedef T value_type
typedef marray_detail::IfBool
< isConst, const T *, T * >
::type 
pointer
typedef const T * const_pointer
typedef marray_detail::IfBool
< isConst, const T &, T & >
::type 
reference
typedef const T & const_reference
typedef Iterator< T, isConst, A > iterator
typedef Iterator< T, true, A > const_iterator
typedef std::reverse_iterator
< iterator
reverse_iterator
typedef std::reverse_iterator
< const_iterator
const_reverse_iterator
typedef ViewExpression< View
< T, isConst, A >, T > 
base
typedef A::template rebind
< value_type >::other 
allocator_type
- Public Types inherited from andres::ViewExpression< View< T, isConst, A >, T >
typedef View< T, isConst, A > expression_type
typedef T value_type

Public Member Functions

 Marray (const allocator_type &=allocator_type())
 Empty constructor.
 Marray (const T &, const CoordinateOrder &=defaultOrder, const allocator_type &=allocator_type())
 Construct 0-dimensional (scalar) array.
template<class ShapeIterator >
 Marray (ShapeIterator, ShapeIterator, const T &=T(), const CoordinateOrder &=defaultOrder, const allocator_type &=allocator_type())
 Construct Marray with initialization.
template<class ShapeIterator >
 Marray (const InitializationSkipping &, ShapeIterator, ShapeIterator, const CoordinateOrder &=defaultOrder, const allocator_type &=allocator_type())
 Construct Marray without initialization.
 Marray (const Marray< T, A > &)
 Copy from a Marray.
template<class E , class Te >
 Marray (const ViewExpression< E, Te > &, const allocator_type &=allocator_type())
 Construct Marray from ViewExpression.
template<class TLocal , bool isConstLocal, class ALocal >
 Marray (const View< TLocal, isConstLocal, ALocal > &)
 Copy from a View.
 ~Marray ()
 Destructor.
Marray< T, A > & operator= (const T &)
 Assignment.
Marray< T, A > & operator= (const Marray< T, A > &)
 Assignment.
template<class TLocal , bool isConstLocal, class ALocal >
Marray< T, A > & operator= (const View< TLocal, isConstLocal, ALocal > &)
 Assignment from View.
template<class E , class Te >
Marray< T, A > & operator= (const ViewExpression< E, Te > &)
void assign (const allocator_type &=allocator_type())
 Clear Marray.
template<class ShapeIterator >
void resize (ShapeIterator, ShapeIterator, const T &=T())
 Resize (existing entries are preserved, new entries are initialized).
template<class ShapeIterator >
void resize (const InitializationSkipping &, ShapeIterator, ShapeIterator)
 Resize (existing entries are preserved).
- Public Member Functions inherited from andres::View< T, false, A >
 View (const allocator_type &=allocator_type())
 View (pointer, const allocator_type &=allocator_type())
 View (const View< T, false, A > &)
 View (ShapeIterator, ShapeIterator, pointer, const CoordinateOrder &=defaultOrder, const CoordinateOrder &=defaultOrder, const allocator_type &=allocator_type())
 View (ShapeIterator, ShapeIterator, StrideIterator, pointer, const CoordinateOrder &, const allocator_type &=allocator_type())
View< T, isConst, A > & operator= (const View< T, true, A > &)
View< T, isConst, A > & operator= (const View< T, false, A > &)
void assign (ShapeIterator, ShapeIterator, pointer, const CoordinateOrder &=defaultOrder, const CoordinateOrder &=defaultOrder, const allocator_type &=allocator_type())
void assign (ShapeIterator, ShapeIterator, StrideIterator, pointer, const CoordinateOrder &, const allocator_type &=allocator_type())
const std::size_t dimension () const
const std::size_t size () const
const std::size_t shape (const std::size_t) const
const std::size_t * shapeBegin () const
const std::size_t * shapeEnd () const
const std::size_t strides (const std::size_t) const
const std::size_t * stridesBegin () const
const std::size_t * stridesEnd () const
const CoordinateOrdercoordinateOrder () const
const bool isSimple () const
bool overlaps (const View< TLocal, isConstLocal, ALocal > &) const
reference operator() (U)
reference operator() (U) const
reference operator() (const std::size_t, const std::size_t)
reference operator() (const std::size_t, const std::size_t) const
reference operator() (const std::size_t, const std::size_t, const std::size_t)
reference operator() (const std::size_t, const std::size_t, const std::size_t) const
reference operator() (const std::size_t, const std::size_t, const std::size_t, const std::size_t)
reference operator() (const std::size_t, const std::size_t, const std::size_t, const std::size_t) const
reference operator() (const std::size_t, const std::size_t, const std::size_t, const std::size_t, const std::size_t)
reference operator() (const std::size_t, const std::size_t, const std::size_t, const std::size_t, const std::size_t) const
reference operator() (const std::size_t, const std::size_t, const std::size_t, const std::size_t, const std::size_t, const std::size_t, const std::size_t, const std::size_t, const std::size_t, const std::size_t)
reference operator() (const std::size_t, const std::size_t, const std::size_t, const std::size_t, const std::size_t, const std::size_t, const std::size_t, const std::size_t, const std::size_t, const std::size_t) const
void view (BaseIterator, ShapeIterator, View< T, isConst, A > &) const
void view (BaseIterator, ShapeIterator, const CoordinateOrder &, View< T, isConst, A > &) const
View< T, isConst, A > view (BaseIterator, ShapeIterator) const
View< T, isConst, A > view (BaseIterator, ShapeIterator, const CoordinateOrder &) const
void constView (BaseIterator, ShapeIterator, View< T, true, A > &) const
void constView (BaseIterator, ShapeIterator, const CoordinateOrder &, View< T, true, A > &) const
View< T, true, A > constView (BaseIterator, ShapeIterator) const
View< T, true, A > constView (BaseIterator, ShapeIterator, const CoordinateOrder &) const
iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const
reverse_iterator rbegin ()
const_reverse_iterator rbegin () const
reverse_iterator rend ()
const_reverse_iterator rend () const
void reshape (ShapeIterator, ShapeIterator)
void permute (CoordinateIterator)
void transpose (const std::size_t, const std::size_t)
void transpose ()
void shift (const int)
void squeeze ()
View< T, isConst, A > reshapedView (ShapeIterator, ShapeIterator) const
View< T, isConst, A > permutedView (CoordinateIterator) const
View< T, isConst, A > transposedView (const std::size_t, const std::size_t) const
View< T, isConst, A > transposedView () const
View< T, isConst, A > shiftedView (const int) const
View< T, isConst, A > boundView (const std::size_t, const std::size_t=0) const
View< T, isConst, A > squeezedView () const
void coordinatesToIndex (CoordinateIterator, std::size_t &) const
void coordinatesToOffset (CoordinateIterator, std::size_t &) const
void indexToCoordinates (std::size_t, CoordinateIterator) const
void indexToOffset (std::size_t, std::size_t &) const
std::string asString (const StringStyle &=MatrixStyle) const
- Public Member Functions inherited from andres::ViewExpression< View< T, isConst, A >, T >
bool overlaps (const View< Tv, isConst, A > &v) const
const T & operator() (Accessor it) const
const T & operator[] (const std::size_t offset) const
 operator View< T, isConst, A > & ()
 operator View< T, isConst, A >const & () const

Detailed Description

template<class T, class A>
class andres::Marray< T, A >

Runtime-Flexible multi-dimensional array.

Definition at line 545 of file marray.hxx.

Member Typedef Documentation

template<class T, class A>
typedef A::template rebind<value_type>::other andres::Marray< T, A >::allocator_type

Definition at line 559 of file marray.hxx.

template<class T, class A>
typedef View<T, false, A> andres::Marray< T, A >::base

Definition at line 549 of file marray.hxx.

template<class T, class A>
typedef base::const_iterator andres::Marray< T, A >::const_iterator

Definition at line 557 of file marray.hxx.

template<class T, class A>
typedef base::const_pointer andres::Marray< T, A >::const_pointer

Definition at line 552 of file marray.hxx.

template<class T, class A>
typedef base::const_reference andres::Marray< T, A >::const_reference

Definition at line 554 of file marray.hxx.

template<class T, class A>
typedef base::const_reverse_iterator andres::Marray< T, A >::const_reverse_iterator

Definition at line 558 of file marray.hxx.

template<class T, class A>
typedef base::iterator andres::Marray< T, A >::iterator

Definition at line 555 of file marray.hxx.

template<class T, class A>
typedef base::pointer andres::Marray< T, A >::pointer

Definition at line 551 of file marray.hxx.

template<class T, class A>
typedef base::reference andres::Marray< T, A >::reference

Definition at line 553 of file marray.hxx.

template<class T, class A>
typedef base::reverse_iterator andres::Marray< T, A >::reverse_iterator

Definition at line 556 of file marray.hxx.

template<class T, class A>
typedef base::value_type andres::Marray< T, A >::value_type

Definition at line 550 of file marray.hxx.

Constructor & Destructor Documentation

template<class T , class A >
andres::Marray< T, A >::Marray ( const allocator_type allocator = allocator_type())
inline

Empty constructor.

Parameters
allocatorAllocator.

Definition at line 3249 of file marray.hxx.

template<class T , class A >
andres::Marray< T, A >::Marray ( const T &  value,
const CoordinateOrder coordinateOrder = defaultOrder,
const allocator_type allocator = allocator_type() 
)
inline

Construct 0-dimensional (scalar) array.

Parameters
valueValue of the single data item.
coordinateOrderFlag specifying whether FirstMajorOrder or LastMajorOrder is to be used. As the Marray can be resized after construction, the coordinate order has to be set even for a 0-dimensional Marray.
allocatorAllocator.

Definition at line 3270 of file marray.hxx.

template<class T , class A >
template<class ShapeIterator >
andres::Marray< T, A >::Marray ( ShapeIterator  begin,
ShapeIterator  end,
const T &  value = T(),
const CoordinateOrder coordinateOrder = defaultOrder,
const allocator_type allocator = allocator_type() 
)
inline

Construct Marray with initialization.

Parameters
beginIterator to the beginning of a sequence that determines the shape.
endIterator to the end of that sequence.
valueValue with which all entries are initialized.
coordinateOrderFlag specifying whether FirstMajorOrder or LastMajorOrder is to be used.
allocatorAllocator.

Definition at line 3409 of file marray.hxx.

template<class T , class A >
template<class ShapeIterator >
andres::Marray< T, A >::Marray ( const InitializationSkipping is,
ShapeIterator  begin,
ShapeIterator  end,
const CoordinateOrder coordinateOrder = defaultOrder,
const allocator_type allocator = allocator_type() 
)
inline

Construct Marray without initialization.

Parameters
isFlag to be set to SkipInitialization.
beginIterator to the beginning of a sequence that determines the shape.
endIterator to the end of that sequence.
coordinateOrderFlag specifying whether FirstMajorOrder or LastMajorOrder is to be used.
allocatorAllocator.

Definition at line 3443 of file marray.hxx.

template<class T , class A >
andres::Marray< T, A >::Marray ( const Marray< T, A > &  in)
inline

Copy from a Marray.

Parameters
inMarray (source).

Definition at line 3290 of file marray.hxx.

template<class T , class A >
template<class E , class Te >
andres::Marray< T, A >::Marray ( const ViewExpression< E, Te > &  expression,
const allocator_type allocator = allocator_type() 
)
inline

Construct Marray from ViewExpression.

Parameters
expressionViewExpression.
allocatorAllocator.

Definition at line 3362 of file marray.hxx.

template<class T , class A >
template<class TLocal , bool isConstLocal, class ALocal >
andres::Marray< T, A >::Marray ( const View< TLocal, isConstLocal, ALocal > &  in)
inline

Copy from a View.

Parameters
inView (source).

Definition at line 3317 of file marray.hxx.

template<class T , class A >
andres::Marray< T, A >::~Marray ( )
inline

Destructor.

Definition at line 3495 of file marray.hxx.

Member Function Documentation

template<class T , class A >
void andres::Marray< T, A >::assign ( const allocator_type allocator = allocator_type())
inline

Clear Marray.

Leaves the Marray in the same state as if the empty constructor had been called. Previously allocated memory is de-allocated.

Parameters
allocatorAllocator.
See Also
Marray()

Reimplemented from andres::View< T, false, A >.

Definition at line 3230 of file marray.hxx.

template<class T , class A >
Marray< T, A > & andres::Marray< T, A >::operator= ( const T &  value)
inline

Assignment.

Parameters
valueValue.

All entries are set to value.

Reimplemented from andres::View< T, false, A >.

Definition at line 3644 of file marray.hxx.

template<class T , class A >
Marray< T, A > & andres::Marray< T, A >::operator= ( const Marray< T, A > &  in)

Assignment.

This operator works as follows:

  • It always attempts to copy the data from 'in'.
  • If 'in' and *this have the same size, already allocated memory is re-used. Otherwise, the memory allocated for *this is freed, and new memory is allocated to take the copy of 'in'.
  • If 'in' is un-initialized, memory allocated for *this is freed.
Parameters
inMarray (source).

Definition at line 3516 of file marray.hxx.

template<class T , class A >
template<class TLocal , bool isConstLocal, class ALocal >
Marray< T, A > & andres::Marray< T, A >::operator= ( const View< TLocal, isConstLocal, ALocal > &  in)

Assignment from View.

This operator works as follows:

  • It always attempts to copy the data from 'in'.
  • If 'in' and *this have overlap, a copy of 'in' is made and assigned to *this.
  • If 'in' and *this have the same size, already allocated memory is re-used. Otherwise, the memory allocated for *this is freed, and new memory is allocated to take the copy of 'in'.
  • If 'in' is un-initialized, memory allocated for *this is freed.
Parameters
inView (source).

Reimplemented from andres::View< T, false, A >.

Definition at line 3564 of file marray.hxx.

template<class T , class A >
template<class E , class Te>
Marray< T, A > & andres::Marray< T, A >::operator= ( const ViewExpression< E, Te > &  expression)
inline

Reimplemented from andres::View< T, false, A >.

Definition at line 3659 of file marray.hxx.

template<class T , class A >
template<class ShapeIterator >
void andres::Marray< T, A >::resize ( ShapeIterator  begin,
ShapeIterator  end,
const T &  value = T() 
)

Resize (existing entries are preserved, new entries are initialized).

Parameters
beginIterator to the beginning of a sequence that determines the new shape.
endIterator to the end of that sequence.
valueInitial value to be assigned to newly allocated entries.

Definition at line 3766 of file marray.hxx.

template<class T , class A >
template<class ShapeIterator >
void andres::Marray< T, A >::resize ( const InitializationSkipping is,
ShapeIterator  begin,
ShapeIterator  end 
)

Resize (existing entries are preserved).

Parameters
isFlag to be set to SkipInitialization.
beginIterator to the beginning of a sequence that determines the new shape.
endIterator to the end of that sequence.

Definition at line 3786 of file marray.hxx.