multiplier.hxx

Go to the documentation of this file.
00001 #pragma once
00002 #ifndef OPENGM_OPERATION_MULTIPLIER_HXX
00003 #define OPENGM_OPERATION_MULTIPLIER_HXX
00004 
00005 #include "opengm/graphicalmodel/graphicalmodel_factor_operator.hxx"
00006 
00007 namespace opengm {
00008 
00012 struct Multiplier
00013 {
00015    template<class T>
00016    static T neutral()
00017       { return static_cast<T>(1); }
00018 
00020    template<class T>
00021    static void neutral(T& out)
00022       { out = static_cast<T>(1); }
00023 
00025    template<class T>
00026    static T ineutral()
00027       { return static_cast<T>(1); }
00028 
00030    template<class T>
00031    static void ineutral(T& out)
00032       { out = static_cast<T>(1); }
00033 
00035    template<class T1, class T2>
00036    static void op(const T1& in, T2& out)
00037       { out *= in; }
00038 
00040    template<class T1,class T2,class T3>
00041    static void op(const T1& in1, const T2& in2, T3& out)
00042       { out = in1 * in2; }
00043 
00045    template<class T1, class T2>
00046    static void iop(const T1& in, T2& out)
00047       { out /= in; }
00048 
00050    template<class T1, class T2, class T3>
00051    static void iop(const T1& in1, const T2& in2, T3& out)
00052       { out = in1 / in2; }
00053 
00055    static bool hasbop()
00056       {return false;}
00057 
00059    template<class T1, class T2>
00060    static void hop(const T1& in1, T2& out)
00061       { 
00062          opengm::operateUnary(out,opengm::PowFunctor<T1>(in1) );
00063          //T2 temp = out;
00064          //opengm::operateUnary(temp,out,opengm::PowFunctor<T1>(in1));
00065          //out.operateUnary(out,opengm::PowFunctor<T2>(in1)) ;
00066          //out= pow(out, in1);
00067       }
00068 
00070    template<class T1, class T2, class T3>
00071    static void hop(const T1& in1, const T2& in2, T3& out)
00072       {
00073          opengm::operateUnary(in1,out,opengm::PowFunctor<T2>(in2) );
00074          //out.operateUnary(in1,opengm::PowFunctor<T2>(in2)) ;
00075          //out= pow(in1, in2);
00076       }
00077 
00079    template<class T1, class T2>
00080    static void ihop(const T1& in1, T2& out)
00081       {
00082          opengm::operateUnary(out,opengm::PowFunctor<T1>(1.0/in1) );
00083          //out= pow(out, in1);
00084       }
00085 
00087    template<class T1, class T2, class T3>
00088    static void ihop(const T1& in1, const T2& in2, T3& out)
00089       {
00090          //out = pow(in1, 1/in2);
00091          opengm::operateUnary(in1,out,opengm::PowFunctor<T2>(1.0/in2) );
00092       }
00093 };
00094 
00095 } // namespace opengm
00096 
00097 #endif // #ifndef OPENGM_OPERATION_MULTIPLIER_HXX
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Mon Jun 17 16:31:05 2013 for OpenGM by  doxygen 1.6.3