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;
74 factors_.push_back(&factor);
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
#define OPENGM_ASSERT(expression)
IndexType dimension() const
ValueType operator()(ITERATOR begin) const
#define OPENGM_ASSERT_OP(a, op, b)
runtime assertion
AccumulatedViewFunction()
GM::FactorType FactorType
GM::OperatorType OperatorType