28 #ifndef OPENGM_FUNCTIONS_ACCUMULATED_VIEW_HXX 29 #define OPENGM_FUNCTIONS_ACCUMULATED_VIEW_HXX 38 typename GM::ValueType,
39 typename GM::IndexType,
40 typename GM::LabelType > {
52 template<
class ITERATOR> ValueType
operator()(ITERATOR begin)
const;
53 LabelType
shape(
const IndexType)
const;
55 IndexType
size()
const;
78 template<
class ITERATOR>
85 factors_.
resize(end - begin);
86 std::copy(begin, end, factors_.
begin());
92 template<
class Iterator>
101 ValueType result = GM::OperatorType::template neutral<ValueType>();
102 for (
size_t i = 0; i < factors_.
size(); ++i)
103 GM::OperatorType::op(factors_[i]->
operator()(begin), result);
116 return factors_[0]->numberOfLabels(index);
124 return factors_[0]->numberOfVariables();
132 return factors_[0]->
size();
142 for (
size_t i = 0; i < factors_.
size(); ++i)
145 for (
size_t i = 1; i < factors_.
size(); ++i) {
147 OPENGM_ASSERT_OP(factors_[0]->numberOfVariables(), ==, factors_[i]->numberOfVariables());
149 for (
IndexType j = 0; j < factors_[0]->numberOfVariables(); ++j) {
150 OPENGM_ASSERT_OP(factors_[0]->numberOfLabels(j), ==, factors_[i]->numberOfLabels(j));
151 OPENGM_ASSERT_OP(factors_[0]->variableIndex(j), ==, factors_[i]->variableIndex(j));
Fallback implementation of member functions of OpenGM functions.
LabelType shape(const IndexType) const
T const * begin() const
begin iterator
ValueType operator()(ITERATOR begin) const
void push_back(const T &)
append a value
Vector that stores values on the stack if size is smaller than MAX_STACK.
#define OPENGM_ASSERT(expression)
IndexType dimension() const
#define OPENGM_ASSERT_OP(a, op, b)
runtime assertion
AccumulatedViewFunction()
void resize(const size_t)
resize the sequence
GM::FactorType FactorType
GM::OperatorType OperatorType