OpenGM  2.3.x
Discrete Graphical Model Library
Public Types | Public Member Functions | List of all members
marray::Vector< T, A > Class Template Reference

One-dimensional Marray. More...

#include <marray.hxx>

+ Inheritance diagram for marray::Vector< T, A >:
+ Collaboration diagram for marray::Vector< T, A >:

Public Types

typedef Marray< T, 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 base::allocator_type allocator_type
 
- Public Types inherited from marray::Marray< T, A >
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 marray::View< T, false, A >
typedef T value_type
 
typedef T ValueType
 
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< iteratorreverse_iterator
 
typedef std::reverse_iterator< const_iteratorconst_reverse_iterator
 
typedef ViewExpression< View< T, isConst, A >, T > base
 
typedef A::template rebind< value_type >::other allocator_type
 
- Public Types inherited from marray::ViewExpression< View< T, isConst, A >, T >
typedef View< T, isConst, A > expression_type
 
typedef T value_type
 

Public Member Functions

 Vector (const allocator_type &=allocator_type())
 Empty constructor. More...
 
template<class TLocal , bool isConstLocal, class ALocal >
 Vector (const View< TLocal, isConstLocal, ALocal > &)
 Copy constructor. More...
 
 Vector (const size_t, const T &=T(), const allocator_type &=allocator_type())
 Construct Vector with initialization. More...
 
 Vector (const InitializationSkipping &, const size_t, const allocator_type &=allocator_type())
 Construct Vector without initialization. More...
 
template<class E , class Te >
 Vector (const ViewExpression< E, Te > &, const allocator_type &=allocator_type())
 Construct Vector from ViewExpression. More...
 
Vector< T, A > & operator= (const T &)
 Assignment. More...
 
Vector< T, A > & operator= (const Vector< T, A > &)
 Assignment. More...
 
template<class TLocal , bool isConstLocal, class ALocal >
Vector< T, A > & operator= (const View< TLocal, isConstLocal, ALocal > &)
 Assignment from View. More...
 
template<class E , class Te >
Vector< T, A > & operator= (const ViewExpression< E, Te > &)
 Assignment from ViewExpression. More...
 
T & operator[] (const size_t)
 Element access. More...
 
const T & operator[] (const size_t) const
 Element access. More...
 
void reshape (const size_t)
 Reshape. More...
 
void resize (const size_t, const T &=T())
 Resize (existing entries are preserved, new entries are initialized). More...
 
void resize (const InitializationSkipping &, const size_t)
 Resize (existing entries are preserved). More...
 
- Public Member Functions inherited from marray::Marray< T, A >
 Marray (const allocator_type &=allocator_type())
 Empty constructor. More...
 
 Marray (const T &, const CoordinateOrder &=defaultOrder, const allocator_type &=allocator_type())
 Construct 0-dimensional (scalar) array. More...
 
template<class ShapeIterator >
 Marray (ShapeIterator, ShapeIterator, const T &=T(), const CoordinateOrder &=defaultOrder, const allocator_type &=allocator_type())
 Construct Marray with initialization. More...
 
template<class ShapeIterator >
 Marray (const InitializationSkipping &, ShapeIterator, ShapeIterator, const CoordinateOrder &=defaultOrder, const allocator_type &=allocator_type())
 Construct Marray without initialization. More...
 
 Marray (const Marray< T, A > &)
 Copy from a Marray. More...
 
template<class E , class Te >
 Marray (const ViewExpression< E, Te > &, const allocator_type &=allocator_type())
 Construct Marray from ViewExpression. More...
 
template<class TLocal , bool isConstLocal, class ALocal >
 Marray (const View< TLocal, isConstLocal, ALocal > &)
 Copy from a View. More...
 
 ~Marray ()
 Destructor. More...
 
Marray< T, A > & operator= (const T &)
 Assignment. More...
 
Marray< T, A > & operator= (const Marray< T, A > &)
 Assignment. More...
 
template<class TLocal , bool isConstLocal, class ALocal >
Marray< T, A > & operator= (const View< TLocal, isConstLocal, ALocal > &)
 Assignment from View. More...
 
template<class E , class Te >
Marray< T, A > & operator= (const ViewExpression< E, Te > &)
 
void assign (const allocator_type &=allocator_type())
 Clear Marray. More...
 
template<class ShapeIterator >
void resize (ShapeIterator, ShapeIterator, const T &=T())
 Resize (existing entries are preserved, new entries are initialized). More...
 
template<class ShapeIterator >
void resize (const InitializationSkipping &, ShapeIterator, ShapeIterator)
 Resize (existing entries are preserved). More...
 
- Public Member Functions inherited from marray::View< T, false, A >
 View (const allocator_type &=allocator_type())
 Empty constructor. More...
 
 View (pointer, const allocator_type &=allocator_type())
 Construct View from a scalar. More...
 
 View (const View< T, false, A > &)
 Construct View from a View on mutable data. More...
 
 View (ShapeIterator, ShapeIterator, pointer, const CoordinateOrder &=defaultOrder, const CoordinateOrder &=defaultOrder, const allocator_type &=allocator_type())
 Construct unstrided View. More...
 
 View (ShapeIterator, ShapeIterator, StrideIterator, pointer, const CoordinateOrder &, const allocator_type &=allocator_type())
 Construct strided View. More...
 
View< T, isConst, A > & operator= (const T &)
 Assignment. More...
 
View< T, isConst, A > & operator= (const View< T, true, A > &)
 Assignment. More...
 
View< T, isConst, A > & operator= (const View< T, false, A > &)
 Assignment. More...
 
View< T, isConst, A > & operator= (const View< TLocal, isConstLocal, ALocal > &)
 Assignment. More...
 
View< T, isConst, A > & operator= (const ViewExpression< E, Te > &)
 
void assign (const allocator_type &=allocator_type())
 Clear View. More...
 
void assign (ShapeIterator, ShapeIterator, pointer, const CoordinateOrder &=defaultOrder, const CoordinateOrder &=defaultOrder, const allocator_type &=allocator_type())
 Initialize unstrided View. More...
 
void assign (ShapeIterator, ShapeIterator, StrideIterator, pointer, const CoordinateOrder &, const allocator_type &=allocator_type())
 Initialize strided View. More...
 
const size_t dimension () const
 Get the dimension. More...
 
const size_t size () const
 Get the number of data items. More...
 
const size_t shape (const size_t) const
 Get the shape in one dimension. More...
 
const size_tshapeBegin () const
 Get a constant iterator to the beginning of the shape vector. More...
 
const size_tshapeEnd () const
 Get a constant iterator to the end of the shape vector. More...
 
const size_t strides (const size_t) const
 Get the strides in one dimension. More...
 
const size_tstridesBegin () const
 Get a constant iterator to the beginning of the strides vector. More...
 
const size_tstridesEnd () const
 Get a constant iterator to the end of the strides vector. More...
 
const CoordinateOrdercoordinateOrder () const
 Get the coordinate order used for scalar indexing and iterators. More...
 
const bool isSimple () const
 Determine whether the shape strides equal the strides of the View. More...
 
bool overlaps (const View< TLocal, isConstLocal, ALocal > &) const
 Check whether two Views overlap. More...
 
reference operator() (U)
 Reference data. More...
 
reference operator() (U) const
 Reference data. More...
 
reference operator() (const size_t, const size_t)
 Reference data in a 2-dimensional View by coordinates. More...
 
reference operator() (const size_t, const size_t) const
 Reference data in a 2-dimensional View by coordinates. More...
 
reference operator() (const size_t, const size_t, const size_t)
 Reference data in a 3-dimensional View by coordinates. More...
 
reference operator() (const size_t, const size_t, const size_t) const
 Reference data in a 3-dimensional View by coordinates. More...
 
reference operator() (const size_t, const size_t, const size_t, const size_t)
 Reference data in a 4-dimensional View by coordinates. More...
 
reference operator() (const size_t, const size_t, const size_t, const size_t) const
 Reference data in a 4-dimensional View by coordinates. More...
 
reference operator() (const size_t, const size_t, const size_t, const size_t, const size_t)
 Reference data in a 5-dimensional View by coordinates. More...
 
reference operator() (const size_t, const size_t, const size_t, const size_t, const size_t) const
 Reference data in a 5-dimensional View by coordinates. More...
 
reference operator() (const size_t, const size_t, const size_t, const size_t, const size_t, const size_t, const size_t, const size_t, const size_t, const size_t)
 Reference data in a 10-dimensional View by coordinates. More...
 
reference operator() (const size_t, const size_t, const size_t, const size_t, const size_t, const size_t, const size_t, const size_t, const size_t, const size_t) const
 Reference data in a 10-dimensional View by coordinates. More...
 
void view (BaseIterator, ShapeIterator, View< T, isConst, A > &) const
 Get a sub-view with the same coordinate order. More...
 
void view (BaseIterator, ShapeIterator, const CoordinateOrder &, View< T, isConst, A > &) const
 Get a sub-view. More...
 
View< T, isConst, A > view (BaseIterator, ShapeIterator) const
 Get a sub-view with the same coordinate order. More...
 
View< T, isConst, A > view (BaseIterator, ShapeIterator, const CoordinateOrder &) const
 Get a sub-view. More...
 
void constView (BaseIterator, ShapeIterator, View< T, true, A > &) const
 Get a sub-view to constant data with the same coordinate order. More...
 
void constView (BaseIterator, ShapeIterator, const CoordinateOrder &, View< T, true, A > &) const
 Get a sub-view to constant data. More...
 
View< T, true, A > constView (BaseIterator, ShapeIterator) const
 Get a sub-view to constant data with the same coordinate order. More...
 
View< T, true, A > constView (BaseIterator, ShapeIterator, const CoordinateOrder &) const
 Get a sub-view to constant data. More...
 
iterator begin ()
 Get an iterator to the beginning. More...
 
const_iterator begin () const
 Get an iterator to the beginning. More...
 
iterator end ()
 Get the end-iterator. More...
 
const_iterator end () const
 Get the end-iterator. More...
 
reverse_iterator rbegin ()
 Get a reserve iterator to the beginning. More...
 
const_reverse_iterator rbegin () const
 Get a reserve iterator to the beginning. More...
 
reverse_iterator rend ()
 Get the reverse end-iterator. More...
 
const_reverse_iterator rend () const
 Get the reverse end-iterator. More...
 
void reshape (ShapeIterator, ShapeIterator)
 Reshape the View. More...
 
void permute (CoordinateIterator)
 Permute dimensions. More...
 
void transpose (const size_t, const size_t)
 Exchange two dimensions. More...
 
void transpose ()
 Reverse dimensions. More...
 
void shift (const int)
 Cycle shift dimensions. More...
 
void squeeze ()
 Remove singleton dimensions by setting their coordinates to zero. More...
 
View< T, isConst, A > reshapedView (ShapeIterator, ShapeIterator) const
 Get a reshaped View. More...
 
View< T, isConst, A > permutedView (CoordinateIterator) const
 Get a View with permuted dimensions. More...
 
View< T, isConst, A > transposedView (const size_t, const size_t) const
 Get a View with two dimensions exchanged. More...
 
View< T, isConst, A > transposedView () const
 Get a View with dimensions reversed. More...
 
View< T, isConst, A > shiftedView (const int) const
 Get a View which dimensions cycle shifted. More...
 
View< T, isConst, A > boundView (const size_t, const size_t=0) const
 Get a View where one coordinate is bound to a value. More...
 
View< T, isConst, A > squeezedView () const
 Get a View where all singleton dimensions have been removed by setting their coordinates to zero. More...
 
void coordinatesToIndex (CoordinateIterator, size_t &) const
 Compute the index that corresponds to a sequence of coordinates. More...
 
void coordinatesToOffset (CoordinateIterator, size_t &) const
 Compute the offset that corresponds to a sequence of coordinates. More...
 
void indexToCoordinates (size_t, CoordinateIterator) const
 Compute the coordinate sequence that corresponds to an index. More...
 
void indexToOffset (size_t, size_t &) const
 Compute the offset that corresponds to an index. More...
 
std::string asString (const StringStyle &=MatrixStyle) const
 Output as string. More...
 
- Public Member Functions inherited from marray::ViewExpression< View< T, isConst, A >, T >
const size_t dimension () const
 
const size_t size () const
 
const size_t shape (const size_t j) const
 
const size_tshapeBegin () const
 
const size_tshapeEnd () const
 
bool overlaps (const View< Tv, isConst, A > &v) const
 
const CoordinateOrdercoordinateOrder () const
 
const bool isSimple () const
 
const T & operator() (Accessor it) const
 
const T & operator() (const size_t c0, const size_t c1) const
 
const T & operator() (const size_t c0, const size_t c1, const size_t c2) const
 
const T & operator() (const size_t c0, const size_t c1, const size_t c2, const size_t c3) const
 
const T & operator() (const size_t c0, const size_t c1, const size_t c2, const size_t c3, const size_t c4) const
 
const T & operator[] (const size_t offset) const
 
 operator View< T, isConst, A > & ()
 
 operator View< T, isConst, A >const & () const
 

Detailed Description

template<class T, class A>
class marray::Vector< T, A >

One-dimensional Marray.

Definition at line 50 of file marray.hxx.

Member Typedef Documentation

template<class T, class A>
typedef base::allocator_type marray::Vector< T, A >::allocator_type

Definition at line 643 of file marray.hxx.

template<class T, class A>
typedef Marray<T, A> marray::Vector< T, A >::base

Definition at line 633 of file marray.hxx.

template<class T, class A>
typedef base::const_iterator marray::Vector< T, A >::const_iterator

Definition at line 641 of file marray.hxx.

template<class T, class A>
typedef base::const_pointer marray::Vector< T, A >::const_pointer

Definition at line 636 of file marray.hxx.

template<class T, class A>
typedef base::const_reference marray::Vector< T, A >::const_reference

Definition at line 638 of file marray.hxx.

template<class T, class A>
typedef base::const_reverse_iterator marray::Vector< T, A >::const_reverse_iterator

Definition at line 642 of file marray.hxx.

template<class T, class A>
typedef base::iterator marray::Vector< T, A >::iterator

Definition at line 639 of file marray.hxx.

template<class T, class A>
typedef base::pointer marray::Vector< T, A >::pointer

Definition at line 635 of file marray.hxx.

template<class T, class A>
typedef base::reference marray::Vector< T, A >::reference

Definition at line 637 of file marray.hxx.

template<class T, class A>
typedef base::reverse_iterator marray::Vector< T, A >::reverse_iterator

Definition at line 640 of file marray.hxx.

template<class T, class A>
typedef base::value_type marray::Vector< T, A >::value_type

Definition at line 634 of file marray.hxx.

Constructor & Destructor Documentation

template<class T , class A >
marray::Vector< T, A >::Vector ( const allocator_type allocator = allocator_type())
inline

Empty constructor.

Parameters
allocatorAllocator.

Definition at line 4637 of file marray.hxx.

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

Copy constructor.

Parameters
inVector (source).

Definition at line 4653 of file marray.hxx.

template<class T , class A >
marray::Vector< T, A >::Vector ( const size_t  size,
const T &  value = T(),
const allocator_type allocator = allocator_type() 
)
inline

Construct Vector with initialization.

Parameters
sizeSize.
valueInitial value of entries.
allocatorAllocator.

Definition at line 4697 of file marray.hxx.

template<class T , class A >
marray::Vector< T, A >::Vector ( const InitializationSkipping is,
const size_t  size,
const allocator_type allocator = allocator_type() 
)
inline

Construct Vector without initialization.

Parameters
isFlag to be set to SkipInitialization.
sizeSize.
allocatorAllocator.

Definition at line 4724 of file marray.hxx.

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

Construct Vector from ViewExpression.

Parameters
expressionViewExpression.
allocatorAllocator.

Definition at line 4748 of file marray.hxx.

+ Here is the call graph for this function:

Member Function Documentation

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

Assignment.

Parameters
valueValue.

All entries are set to value.

Definition at line 4796 of file marray.hxx.

template<class T , class A >
Vector< T, A > & marray::Vector< T, A >::operator= ( const Vector< T, A > &  in)
inline

Assignment.

Parameters
inVector

The entries of 'in' are copied.

Definition at line 4816 of file marray.hxx.

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

Assignment from View.

Parameters
inView.

The entries of 'in' are copied in the coordinate order of 'in'.

Definition at line 4836 of file marray.hxx.

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

Assignment from ViewExpression.

Parameters
expressionViewExpression.

Definition at line 4875 of file marray.hxx.

+ Here is the call graph for this function:

template<class T , class A >
T & marray::Vector< T, A >::operator[] ( const size_t  index)
inline

Element access.

Definition at line 4955 of file marray.hxx.

template<class T , class A >
const T & marray::Vector< T, A >::operator[] ( const size_t  index) const
inline

Element access.

Definition at line 4968 of file marray.hxx.

template<class T , class A >
void marray::Vector< T, A >::reshape ( const size_t  size)
inline

Reshape.

A Vector can only be reshaped into a Vector which has the same size and thus the same shape. The main pupose of this function is to hide the function reshape inherited from View in a way that is C++ standard complient.

Parameters
sizeNew size (which has to equal the current size).

Definition at line 4897 of file marray.hxx.

template<class T , class A >
void marray::Vector< T, A >::resize ( const size_t  size,
const T &  value = T() 
)
inline

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

Parameters
sizeNew size.
valueValue to be assigned to newly allocated entries.

Definition at line 4912 of file marray.hxx.

+ Here is the caller graph for this function:

template<class T , class A >
void marray::Vector< T, A >::resize ( const InitializationSkipping is,
const size_t  size 
)
inline

Resize (existing entries are preserved).

Parameters
isFlag to be set to SkipInitialization.
sizeNew size.

Definition at line 4935 of file marray.hxx.