15 #ifndef __defined_libdai_fo_h
16 #define __defined_libdai_fo_h
23 template<
typename T>
struct fo_id :
public std::unary_function<T, T> {
32 template<
typename T>
struct fo_abs :
public std::unary_function<T, T> {
44 template<
typename T>
struct fo_exp :
public std::unary_function<T, T> {
53 template<
typename T>
struct fo_log :
public std::unary_function<T, T> {
62 template<
typename T>
struct fo_log0 :
public std::unary_function<T, T> {
74 template<
typename T>
struct fo_inv :
public std::unary_function<T, T> {
83 template<
typename T>
struct fo_inv0 :
public std::unary_function<T, T> {
95 template<
typename T>
struct fo_plog0p :
public std::unary_function<T, T> {
104 template<
typename T>
struct fo_divides0 :
public std::binary_function<T, T, T> {
116 template<
typename T>
struct fo_KL :
public std::binary_function<T, T, T> {
122 return p * (
log(p) -
log(q));
128 template<
typename T>
struct fo_Hellinger :
public std::binary_function<T, T, T> {
131 T x = sqrt(p) - sqrt(q);
138 template<
typename T>
struct fo_pow :
public std::binary_function<T, T, T> {
150 template<
typename T>
struct fo_max :
public std::binary_function<T, T, T> {
153 return (x > y) ? x : y;
159 template<
typename T>
struct fo_min :
public std::binary_function<T, T, T> {
162 return (x > y) ? y : x;
168 template<
typename T>
struct fo_absdiff :
public std::binary_function<T, T, T> {