OpenGM  2.3.x
Discrete Graphical Model Library
Public Types | Public Member Functions | List of all members
opengm::ExplicitFunction< T, I, L > Class Template Reference

Function encoded as a dense multi-dimensional array, marray::Marray. More...

#include <explicit_function.hxx>

+ Inheritance diagram for opengm::ExplicitFunction< T, I, L >:
+ Collaboration diagram for opengm::ExplicitFunction< T, I, L >:

Public Types

typedef T ValueType
 
typedef L LabelType
 
typedef I IndexType
 
- Public Types inherited from marray::Marray< T >
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 Types inherited from opengm::FunctionBase< ExplicitFunction< T, I, L >, T, I, L >
typedef AccessorIterator< FunctionShapeAccessorType, true > FunctionShapeIteratorType
 

Public Member Functions

 ExplicitFunction ()
 
 ExplicitFunction (const T &value)
 construct a constant explicit function of order 0 More...
 
 ExplicitFunction (const ExplicitFunction &other)
 
ExplicitFunctionoperator= (const ExplicitFunction &other)
 
template<class SHAPE_ITERATOR >
 ExplicitFunction (SHAPE_ITERATOR shapeBegin, SHAPE_ITERATOR shapeEnd)
 construct a function encoded by a value table (whose entries are initialized as 0) More...
 
template<class SHAPE_ITERATOR >
 ExplicitFunction (SHAPE_ITERATOR shapeBegin, SHAPE_ITERATOR shapeEnd, const T &value)
 construct a function encoded by a value table (whose entries are initialized with the same value) More...
 
- Public Member Functions inherited from marray::Marray< T >
 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...
 
 Marray (ShapeIterator, ShapeIterator, const T &=T(), const CoordinateOrder &=defaultOrder, const allocator_type &=allocator_type())
 Construct Marray with initialization. More...
 
 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...
 
 Marray (const ViewExpression< E, Te > &, const allocator_type &=allocator_type())
 Construct Marray from ViewExpression. More...
 
 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...
 
Marray< T, A > & operator= (const View< TLocal, isConstLocal, ALocal > &)
 Assignment from View. More...
 
Marray< T, A > & operator= (const ViewExpression< E, Te > &)
 
void assign (const allocator_type &=allocator_type())
 Clear Marray. More...
 
void resize (ShapeIterator, ShapeIterator, const T &=T())
 Resize (existing entries are preserved, new entries are initialized). More...
 
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
 
- Public Member Functions inherited from opengm::FunctionBase< ExplicitFunction< T, I, L >, T, I, L >
bool isPotts () const
 
bool isGeneralizedPotts () const
 
bool isSubmodular () const
 
bool isSquaredDifference () const
 
bool isTruncatedSquaredDifference () const
 
bool isAbsoluteDifference () const
 
bool isTruncatedAbsoluteDifference () const
 
bool isLinearConstraint () const
 
MinMaxFunctor< T > minMax () const
 find minimum and maximum of the function in a single sweep More...
 
ReturnType min () const
 
ReturnType max () const
 
ReturnType sum () const
 
ReturnType product () const
 
ReturnType accumulate () const
 accumulate all values of the function More...
 
void forAllValuesInOrder (FUNCTOR &functor) const
 call a functor for each value of the function (in lexicographical order of the variable indices) More...
 
void forAllValuesInSwitchedOrder (FUNCTOR &functor) const
 
void forAllValuesInAnyOrder (FUNCTOR &functor) const
 call a functor for each value of the function (in un-specified order) More...
 
void forAtLeastAllUniqueValues (FUNCTOR &functor) const
 call a functor for at least all unique values of the function More...
 
void forAllValuesInOrderWithCoordinate (COORDINATE_FUNCTOR &functor) const
 
void forAllValuesInAnyOrderWithCoordinate (COORDINATE_FUNCTOR &functor) const
 
void forAtLeastAllUniqueValuesWithCoordinate (COORDINATE_FUNCTOR &functor) const
 
bool operator== (const ExplicitFunction< T, I, L > &) const
 
FunctionShapeIteratorType functionShapeBegin () const
 
FunctionShapeIteratorType functionShapeEnd () const
 
size_t numberOfParameters () const
 
parameterIndex (const size_t paramNumber) const
 

Detailed Description

template<class T, class I = size_t, class L = size_t>
class opengm::ExplicitFunction< T, I, L >

Function encoded as a dense multi-dimensional array, marray::Marray.

Examples:
gibbs.cxx, grid_potts.cxx, interpixel_boundary_segmentation.cxx, io_graphical_model.cxx, markov-chain.cxx, one_to_one_matching.cxx, opengmBuild.cxx, quick_start.cxx, space_types.cxx, and swendsenwang.cxx.

Definition at line 15 of file explicit_function.hxx.

Member Typedef Documentation

template<class T, class I = size_t, class L = size_t>
typedef I opengm::ExplicitFunction< T, I, L >::IndexType

Definition at line 22 of file explicit_function.hxx.

template<class T, class I = size_t, class L = size_t>
typedef L opengm::ExplicitFunction< T, I, L >::LabelType

Definition at line 21 of file explicit_function.hxx.

template<class T, class I = size_t, class L = size_t>
typedef T opengm::ExplicitFunction< T, I, L >::ValueType

Definition at line 20 of file explicit_function.hxx.

Constructor & Destructor Documentation

template<class T, class I = size_t, class L = size_t>
opengm::ExplicitFunction< T, I, L >::ExplicitFunction ( )
inline

Definition at line 24 of file explicit_function.hxx.

template<class T, class I = size_t, class L = size_t>
opengm::ExplicitFunction< T, I, L >::ExplicitFunction ( const T &  value)
inline

construct a constant explicit function of order 0

Definition at line 29 of file explicit_function.hxx.

template<class T, class I = size_t, class L = size_t>
opengm::ExplicitFunction< T, I, L >::ExplicitFunction ( const ExplicitFunction< T, I, L > &  other)
inline

Definition at line 33 of file explicit_function.hxx.

template<class T, class I = size_t, class L = size_t>
template<class SHAPE_ITERATOR >
opengm::ExplicitFunction< T, I, L >::ExplicitFunction ( SHAPE_ITERATOR  shapeBegin,
SHAPE_ITERATOR  shapeEnd 
)
inline

construct a function encoded by a value table (whose entries are initialized as 0)

Example: A function depending on two variables with 3 and 4 labels, respectively.

size_t shape[] = {3, 4};
ExplicitFunction f(shape, shape + 2};

Definition at line 52 of file explicit_function.hxx.

template<class T, class I = size_t, class L = size_t>
template<class SHAPE_ITERATOR >
opengm::ExplicitFunction< T, I, L >::ExplicitFunction ( SHAPE_ITERATOR  shapeBegin,
SHAPE_ITERATOR  shapeEnd,
const T &  value 
)
inline

construct a function encoded by a value table (whose entries are initialized with the same value)

Definition at line 58 of file explicit_function.hxx.

Member Function Documentation

template<class T, class I = size_t, class L = size_t>
ExplicitFunction& opengm::ExplicitFunction< T, I, L >::operator= ( const ExplicitFunction< T, I, L > &  other)
inline

Definition at line 37 of file explicit_function.hxx.