2 #ifndef OPENGM_FUNCTION_PROPERTIES_HXX
3 #define OPENGM_FUNCTION_PROPERTIES_HXX
22 #define OPENGM_FUNCTION_TYPEDEF_MACRO typedef typename FunctionType::ValueType ValueType;\
23 typedef typename FunctionType::IndexType IndexType;\
24 typedef typename FunctionType::LabelType LabelType;\
25 typedef typename FunctionType::FunctionShapeIteratorType FunctionShapeIteratorType
47 template<
int PROPERTY_ID,
class FUNCTION>
50 template<
int PROPERTY_ID,
class FUNCTION>
53 namespace detail_properties{
54 template<
class FUNCTION,
class ACCUMULATOR>
56 template<
class FUNCTION,
class ACCUMULATOR>
61 template<
class FUNCTION>
63 typedef FUNCTION FunctionType;
66 static bool op(
const FunctionType & f) {
67 ShapeWalker<FunctionShapeIteratorType> shapeWalker(f.functionShapeBegin(), f.dimension());
68 ValueType vEqual = f(shapeWalker.coordinateTuple().begin());
70 ValueType vNotEqual = f(shapeWalker.coordinateTuple().begin());
72 for (IndexType i = 2; i < f.size(); ++i, ++shapeWalker) {
74 if (isEqualValueVector(shapeWalker.coordinateTuple())) {
75 if (vEqual != f(shapeWalker.coordinateTuple().begin()))
79 if (vNotEqual != f(shapeWalker.coordinateTuple().begin()))
92 template<
class FUNCTION>
97 template<
class FUNCTION>
102 template<
class FUNCTION>
107 template<
class FUNCTION>
113 namespace detail_properties{
114 template<
class FUNCTION,
class ACCUMULATOR>
115 class AllValuesInAnyOrderFunctionProperties{
116 typedef FUNCTION FunctionType;
119 static ValueType
op(
const FunctionType & f) {
120 opengm::AccumulationFunctor<ACCUMULATOR,ValueType> functor;
121 f.forAllValuesInAnyOrder(functor);
122 return functor.value();
125 template<
class FUNCTION,
class ACCUMULATOR>
126 class AtLeastAllUniqueValuesFunctionProperties{
127 typedef FUNCTION FunctionType;
130 static ValueType
op(
const FunctionType & f) {
131 opengm::AccumulationFunctor<ACCUMULATOR,ValueType> functor;
132 f.forAllValuesInAnyOrder(functor);
133 return functor.value();
140 #endif //OPENGM_FUNCTION_PROPERTIES_HXX
#define OPENGM_FUNCTION_TYPEDEF_MACRO
static ValueType op(const FunctionType &f)
static ValueType op(const FunctionType &f)
static bool op(const FunctionType &f)