/usr/include/opengm/operations/weightedoperations.hxx is in libopengm-dev 2.3.6+20160905-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | #pragma once
#ifndef OPENGM_OPERATION_WEIGTED_OPERATIONS_HXX
#define OPENGM_OPERATION_WEIGTED_OPERATIONS_HXX
/// \cond HIDDEN_SYMBOLS
namespace opengm {
struct WeightedOperations{
///weighted mean (in-place)
template<class OP, class T1, class T2>
static inline void weightedMean(const T2& in1, const T2& in2, const T1& w, T2& out)
{
OPENGM_ASSERT(&out != &in2);
out = in1;
OP::iop(in2,out);
OP::hop(w,out);
OP::op(in2,out);
// equivalent to
// out = in1*w + in2*(1-w) = (in1-in2)*w+in2
// out = in1^w * in2^(1-w) = (in1/in2)^w*in2
}
/// weighted operation (not in-place)
template<class OP, class T1, class T2>
static inline void wop(const T2& in, const T1& w, T2& out)
{
T2 t = in;
OP::hop(w,t);
OP::op(t,out);
// equivalent to
// out = out + in*w
// out = out * in^w
}
/// inverse weighted operation (not in-place)
template<class OP, class T1, class T2>
static inline void iwop(const T2& in, const T1& w, T2& out)
{
T2 t = in;
T1 v = 1/w;
OP::hop(v,t);
OP::op(t,out);
// equivalent to
// out = out + in/w
// out = out * in^(1/w)
}
/// weighted inverse operation (not in-place)
template<class OP, class T1, class T2>
static inline void wiop(const T2& in, const T1& w, T2& out)
{
T2 t = in;
OP::hop(w,t);
OP::iop(t,out);
// equivalent to
// out = out - in*w
// out = out / in^(w)
}
/// inverse weighted inverse operation (not in-place)
template<class OP, class T1, class T2>
static inline void iwiop(const T2& in, const T1& w, T2& out)
{
T2 t = in;
T1 v = 1/w;
OP::hop(v,t);
OP::iop(t,out);
// equivalent to
// out = out - in/w
// out = out / in^(1/w)
}
};
} // namespace opengm
/// \endcond
#endif // #ifndef OPENGM_OPERATION_WEIGTED_OPERATIONS_HXX
|