maximizer.hxx

Go to the documentation of this file.
00001 #pragma once
00002 #ifndef OPENGM_OPERATIONS_MAXIMIZER_HXX
00003 #define OPENGM_OPERATIONS_MAXIMIZER_HXX
00004 
00005 namespace opengm {
00006 
00010 struct Maximizer
00011 {
00013    template<class T>
00014    static T neutral()
00015       { return -std::numeric_limits<T>::infinity(); }
00016 
00018    template<class T>
00019    static void neutral(T& out)
00020       { out = -std::numeric_limits<T>::infinity(); }
00021 
00023    template<class T>
00024    static T ineutral()
00025       { return std::numeric_limits<T>::infinity(); }
00026 
00028    template<class T>
00029    static void ineutral(T& out)
00030       { out = std::numeric_limits<T>::infinity(); }
00031 
00033    template<class T1, class T2>
00034    static void op(const T1& in1,  T2& out)
00035       { out = out > in1 ? out : in1; }
00036 
00038    template<class T1,class T2,class T3>
00039    static void op(const T1& in1, const T2& in2, T3& out)
00040       { out = in1 > in2 ? in1 : in2; }
00041 
00043    template<class T1,class T2>
00044    static void iop(const T1& in1, T2& out)
00045       { out = out < in1 ? out : in1;}
00046 
00048    template<class T1,class T2,class T3>
00049    static void iop(const T1& in1, const T2& in2, T3& out)
00050       { out = in1 < in2 ? in1:in2; }
00051  
00053    static bool hasbop()
00054       {return true;}
00055 
00057    template<class T>
00058    static bool bop(const T& in1, const T& in2)
00059       { return in1 > in2; }
00060 
00062    template<class T>
00063    static bool ibop(const T& in1, const T& in2)
00064       { return in1 < in2; }
00065 };
00066 
00067 } // namespace opengm
00068 
00069 #endif // #ifndef OPENGM_OPERATIONS_MAXIMIZER_HXX
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Mon Jun 17 16:31:04 2013 for OpenGM by  doxygen 1.6.3