2 #ifndef OPENGM_SCALEDVIEWFUNCTION_HXX
3 #define OPENGM_SCALEDVIEWFUNCTION_HXX
14 typename GM::ValueType,
15 typename GM::IndexType,
16 typename GM::LabelType>
26 template<
class Iterator> ValueType
operator()(Iterator begin)
const;
28 size_t shape(
const size_t)
const;
33 IndexType factorIndex_;
35 std::vector<IndexType> shape_;
52 factorIndex_(factorIndex),
56 shape_.resize(gm[factorIndex].numberOfVariables());
57 for(
size_t i=0; i<gm[factorIndex].numberOfVariables();++i) {
58 shape_[i] = gm[factorIndex].numberOfLabels(i);
59 size_*=gm[factorIndex].numberOfLabels(i);
68 const std::vector<IndexType>& shape
76 for(
size_t i=0; i<shape_.size();++i) {
89 template<
class Iterator>
97 return OperatorType::template neutral<ValueType>();
100 return scale_*gm_->operator[](factorIndex_)(begin);
115 return shape_.size();
120 #endif // #ifndef OPENGM_SCALEDVIEWFUNCTION_HXX
Fallback implementation of member functions of OpenGM functions.
Function that scales a factor of another graphical model.
GM::OperatorType OperatorType
ValueType operator()(Iterator begin) const
ScaledViewFunction(const std::vector< IndexType > &)
Constructor.
size_t shape(const size_t) const