Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

M9poCw.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Array_Trait_M9poCw_h
00002 #define Impala_Core_Array_Trait_M9poCw_h
00003 
00004 #include "Core/Array/Pattern/Categories.h"
00005 #include "Core/Array/Element/E1Sqrt.h"
00006 #include "Core/Array/Element/E1Log.h"
00007 
00008 namespace Impala
00009 {
00010 namespace Core
00011 {
00012 namespace Array
00013 {
00014 namespace Trait
00015 {
00016 
00017 
00020 template<class DstArrayT, class SrcArrayT>
00021 class M9poCw
00022 {
00023 public:
00025     typedef Pattern::TagTransInVar TransVarianceCategory;
00026 
00028     typedef Pattern::TagCallValue CallCategory;
00029 
00030     typedef typename DstArrayT::ArithType DstArithT;
00031     typedef typename SrcArrayT::ArithType SrcArithT;
00032 
00034     M9poCw(SrcArithT scale)
00035     {
00036         mScale = scale;
00037     }
00038 
00040     DstArithT
00041     DoIt(const SrcArithT& E, const SrcArithT& El, const SrcArithT& Ell,
00042          const SrcArithT& Ex, const SrcArithT& Elx, const SrcArithT& Ellx,
00043          const SrcArithT& Ey, const SrcArithT& Ely, const SrcArithT& Elly)
00044     {
00045         SrcArithT Clx_a = Elx*E - El*Ex;
00046         SrcArithT Cly_a = Ely*E - El*Ey;
00047         SrcArithT Clw_a = Clx_a*Clx_a + Cly_a*Cly_a;
00048         SrcArithT Cllx_a = Ellx*E - Ell*Ex;
00049         SrcArithT Clly_a = Elly*E - Ell*Ey;
00050         SrcArithT Cllw_a = Cllx_a*Cllx_a + Clly_a*Clly_a;
00051         SrcArithT Cw_a = Element::E1Sqrt(Clw_a + Cllw_a);
00052         SrcArithT norm = E*E/mScale;
00053         return Cw_a/norm;
00054         //return Element::E1Log(Cw_a/norm + 1);
00055         //return Element::E1Log(100000000*Cw_a+1) - Element::E1Log(100000000*norm+1); 
00056 }
00057 
00058 private:
00059     SrcArithT mScale;
00060 };
00061 
00062 template<class DstArrayT, class SrcArrayT>
00063 class M9poCw_log
00064 {
00065 public:
00067     typedef Pattern::TagTransInVar TransVarianceCategory;
00068 
00070     typedef Pattern::TagCallValue CallCategory;
00071 
00072     typedef typename DstArrayT::ArithType DstArithT;
00073     typedef typename SrcArrayT::ArithType SrcArithT;
00074 
00076     M9poCw_log(SrcArithT scale)
00077     {
00078         mScale = scale;
00079     }
00080 
00082     DstArithT
00083     DoIt(const SrcArithT& E, const SrcArithT& El, const SrcArithT& Ell,
00084          const SrcArithT& Ex, const SrcArithT& Elx, const SrcArithT& Ellx,
00085          const SrcArithT& Ey, const SrcArithT& Ely, const SrcArithT& Elly)
00086     {
00087         SrcArithT Clx_a = Elx*E - El*Ex;
00088         SrcArithT Cly_a = Ely*E - El*Ey;
00089         SrcArithT Clw_a = Clx_a*Clx_a + Cly_a*Cly_a;
00090         SrcArithT Cllx_a = Ellx*E - Ell*Ex;
00091         SrcArithT Clly_a = Elly*E - Ell*Ey;
00092         SrcArithT Cllw_a = Cllx_a*Cllx_a + Clly_a*Clly_a;
00093         SrcArithT Cw_a = Element::E1Sqrt(Clw_a + Cllw_a);
00094         SrcArithT norm = E*E/mScale;
00095         //return Cw_a/norm;
00096         return Element::E1Log(Cw_a/norm + 1);
00097         //return Element::E1Log(100000000*Cw_a+1) - Element::E1Log(100000000*norm+1); 
00098 }
00099 
00100 private:
00101     SrcArithT mScale;
00102 };
00103 
00104 } // namespace Trait
00105 } // namespace Array
00106 } // namespace Core
00107 } // namespace Impala
00108 
00109 #endif

Generated on Fri Mar 19 09:30:57 2010 for ImpalaSrc by  doxygen 1.5.1