OpenGM  2.3.x
Discrete Graphical Model Library
integrator.hxx
Go to the documentation of this file.
1 #pragma once
2 #ifndef OPENGM_OPERATIONS_INTEGRATOR_HXX
3 #define OPENGM_OPERATIONS_INTEGRATOR_HXX
4 
5 #include "adder.hxx"
6 
7 namespace opengm {
8 
12 struct Integrator
13 {
15  template<class T>
16  static T neutral()
17  { return static_cast<T>(0); }
18 
20  template<class T>
21  static void neutral(T& out)
22  { out = static_cast<T>(0); }
23 
25  template<class T>
26  static T ineutral()
27  { return std::numeric_limits<T>::infinity(); }
28 
30  template<class T>
31  static void ineutral(T& out)
32  { out = std::numeric_limits<T>::infinity(); }
33 
35  template<class T1, class T2>
36  static void op(const T1& in1, T2& out)
37  { out += in1; }
38 
40  template<class T1,class T2,class T3>
41  static void op(const T1 in1, const T2 in2, T3& out)
42  { out = in1, out += in2; }
43 
45  template<class T1, class T2>
46  static void iop(const T1& in1, T2& out)
47  { out - in1; }
48 
50  template<class T1,class T2,class T3>
51  static void iop(const T1 in1, const T2 in2, T3& out)
52  { out = in1, out -= in2; }
53 
55  static bool hasbop()
56  { return false; }
59  template<class T>
60  static bool bop(const T& in1, const T& in2)
61  { return false; }
64  template<class T>
65  static bool ibop(const T& in1, const T& in2)
66  { return false; }
67 };
68 
69 } // namespace opengm
70 
71 #endif // #ifndef OPENGM_OPERATIONS_INTEGRATOR_HXX
The OpenGM namespace.
Definition: config.hxx:43
static void op(const T1 &in1, T2 &out)
operation (in-place)
Definition: integrator.hxx:36
static void iop(const T1 in1, const T2 in2, T3 &out)
inverse operation (call by reference)
Definition: integrator.hxx:51
static void neutral(T &out)
neutral element (call by reference)
Definition: integrator.hxx:21
static T ineutral()
inverse neutral element (with return)
Definition: integrator.hxx:26
static void iop(const T1 &in1, T2 &out)
inverse operation (in-place)
Definition: integrator.hxx:46
static void ineutral(T &out)
inverse neutral element (call by reference)
Definition: integrator.hxx:31
static bool ibop(const T &in1, const T &in2)
inverse boolean operation inverse boolean operation (obsolete)
Definition: integrator.hxx:65
static void op(const T1 in1, const T2 in2, T3 &out)
operation (not in-place)
Definition: integrator.hxx:41
static T neutral()
neutral element (with return)
Definition: integrator.hxx:16
static bool hasbop()
bool operation flag
Definition: integrator.hxx:55
static bool bop(const T &in1, const T &in2)
inverse boolean operation boolean operation (obsolete)
Definition: integrator.hxx:60
Integration (addition) as a unary accumulation.
Definition: integrator.hxx:12