normalize.hxx

Go to the documentation of this file.
00001 #pragma once
00002 #ifndef OPENGM_OPERATION_NORMALIZE_HXX
00003 #define OPENGM_OPERATION_NORMALIZE_HXX
00004 
00005 #include <typeinfo>
00006 
00007 #include "opengm/opengm.hxx"
00008 #include "opengm/operations/multiplier.hxx"
00009 
00010 namespace opengm
00011 {
00012 
00014 struct Normalization {
00015    template<class ACC, class OP, class T>
00016    static void normalize(T& out) {
00017       typename T::ValueType v;
00018       out.template accumulate<ACC>(v);
00019       if(typeid(OP) == typeid(opengm::Multiplier) && v <= 0.00001) {
00020          return;
00021       }
00022       if(typeid(OP) == typeid(opengm::Multiplier)) {
00023          OPENGM_ASSERT(v > 0.00001); 
00024       }
00025       OP::iop(v,out);
00026    }
00027 };
00028 
00029 } // namespace opengm
00030 
00031 #endif // #ifndef OPENGM_OPERATION_NORMAIZE_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