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

BpoEqual.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Array_Trait_BpoEqual_h
00002 #define Impala_Core_Array_Trait_BpoEqual_h
00003 
00004 #include "Core/Array/Pattern/Categories.h"
00005 #include "Core/Array/Element/E1Cast.h"
00006 #include "Core/Array/Element/E1Abs.h"
00007 #include "Core/Array/Element/E1Sum.h"
00008 
00009 namespace Impala
00010 {
00011 namespace Core
00012 {
00013 namespace Array
00014 {
00015 namespace Trait
00016 {
00017 
00018 
00019 template<class DstArrayT, class Src1ArrayT, class Src2ArrayT>
00020 class BpoEqual
00021 {
00022 public:
00024     typedef Pattern::TagTransInVar TransVarianceCategory;
00025 
00027     typedef Pattern::TagCallValue CallCategory;
00028 
00029     typedef typename DstArrayT::ArithType DstArithT;
00030     typedef typename Src1ArrayT::ArithType Src1ArithT;
00031     typedef typename Src2ArrayT::ArithType Src2ArithT;
00032 
00033     BpoEqual(Real64 epsilon = 0.0)
00034     { 
00035         mEpsilon = epsilon;
00036     }
00037 
00038     DstArithT
00039     DoIt(const Src1ArithT& x, const Src2ArithT& y)
00040     {
00041         Real64 d = Element::E1Sum(Element::E1Abs(x - y));
00042         return (d > mEpsilon) ? Element::E1Cast(0, DstArithT())
00043                               : Element::E1Cast(1, DstArithT());
00044     }
00045 
00046     //private:
00047     Real64 mEpsilon;
00048 };
00049 
00050 } // namespace Trait
00051 } // namespace Array
00052 } // namespace Core
00053 } // namespace Impala
00054 
00055 #endif

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