minimizer.hxx
Go to the documentation of this file.00001 #pragma once
00002 #ifndef OPENGM_OPERATIONS_MINIMIZER_HXX
00003 #define OPENGM_OPERATIONS_MINIMIZER_HXX
00004
00005 namespace opengm {
00006
00010 struct Minimizer
00011 {
00013 template<class T>
00014 static T neutral()
00015 { return std::numeric_limits<T>::infinity(); }
00017 template<class T>
00018 static void neutral(T& out)
00019 { out = std::numeric_limits<T>::infinity(); }
00020
00022 template<class T>
00023 static T ineutral()
00024 { return -std::numeric_limits<T>::infinity(); }
00026 template<class T>
00027 static void ineutral(T& out)
00028 { out = -std::numeric_limits<T>::infinity(); }
00029
00031 template<class T1, class T2>
00032 static void op(const T1& in1, T2& out)
00033 { out = out < in1 ? out : in1; }
00035 template<class T1,class T2,class T3>
00036 static void op(const T1& in1, const T2& in2, T3& out)
00037 { out = in1 < in2 ? in1 : in2; }
00038
00040 template<class T1, class T2>
00041 static void iop(const T1& in1, T2& out)
00042 { out -= out > in1 ? out : in1; }
00044 template<class T1,class T2,class T3>
00045 static void iop(const T1& in1, const T2& in2, T3& out)
00046 { out = in1 > in2 ? in1:in2; }
00047
00049 static bool hasbop()
00050 {return true;}
00051
00053 template<class T>
00054 static bool bop(const T& in1, const T& in2)
00055 { return (in1 < in2); }
00056
00058 template<class T>
00059 static bool ibop(const T& in1, const T& in2)
00060 { return (in1 > in2); }
00061 };
00062
00063 }
00064
00065 #endif // #ifndef OPENGM_OPERATIONS_MINIMIZER_HXX