OpenGM  2.3.x
Discrete Graphical Model Library
maximizer.hxx
Go to the documentation of this file.
1 #pragma once
2 #ifndef OPENGM_OPERATIONS_MAXIMIZER_HXX
3 #define OPENGM_OPERATIONS_MAXIMIZER_HXX
4 
5 namespace opengm {
6 
10 struct Maximizer
11 {
13  template<class T>
14  static T neutral()
15  { return -std::numeric_limits<T>::infinity(); }
16 
18  template<class T>
19  static void neutral(T& out)
20  { out = -std::numeric_limits<T>::infinity(); }
21 
23  template<class T>
24  static T ineutral()
25  { return std::numeric_limits<T>::infinity(); }
26 
28  template<class T>
29  static void ineutral(T& out)
30  { out = std::numeric_limits<T>::infinity(); }
31 
33  template<class T1, class T2>
34  static void op(const T1& in1, T2& out)
35  { out = out > in1 ? out : in1; }
36 
38  template<class T1,class T2,class T3>
39  static void op(const T1& in1, const T2& in2, T3& out)
40  { out = in1 > in2 ? in1 : in2; }
41 
43  template<class T1,class T2>
44  static void iop(const T1& in1, T2& out)
45  { out = out < in1 ? out : in1;}
46 
48  template<class T1,class T2,class T3>
49  static void iop(const T1& in1, const T2& in2, T3& out)
50  { out = in1 < in2 ? in1:in2; }
51 
53  static bool hasbop()
54  {return true;}
55 
57  template<class T>
58  static bool bop(const T& in1, const T& in2)
59  { return in1 > in2; }
60 
62  template<class T>
63  static bool ibop(const T& in1, const T& in2)
64  { return in1 < in2; }
65 };
66 
67 } // namespace opengm
68 
69 #endif // #ifndef OPENGM_OPERATIONS_MAXIMIZER_HXX
static bool bop(const T &in1, const T &in2)
boolean operation
Definition: maximizer.hxx:58
The OpenGM namespace.
Definition: config.hxx:43
static T ineutral()
inverse neutral element (with return)
Definition: maximizer.hxx:24
static void iop(const T1 &in1, T2 &out)
inverse operation (in-place)
Definition: maximizer.hxx:44
static void iop(const T1 &in1, const T2 &in2, T3 &out)
inverse operation (not in-place)
Definition: maximizer.hxx:49
static bool hasbop()
bool operation flag
Definition: maximizer.hxx:53
static void ineutral(T &out)
inverse neutral element (call by reference)
Definition: maximizer.hxx:29
static T neutral()
neutral element (with return)
Definition: maximizer.hxx:14
static void op(const T1 &in1, const T2 &in2, T3 &out)
operation (not in-place)
Definition: maximizer.hxx:39
static bool ibop(const T &in1, const T &in2)
inverse boolean operation
Definition: maximizer.hxx:63
static void neutral(T &out)
neutral element (call by reference)
Definition: maximizer.hxx:19
Maximization as a unary accumulation.
Definition: maximizer.hxx:10
static void op(const T1 &in1, T2 &out)
operation (in-place)
Definition: maximizer.hxx:34