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

Norm2Dist.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Vector_Norm2Dist_h
00002 #define Impala_Core_Vector_Norm2Dist_h
00003 
00004 #include "Core/Vector/VectorTem.h"
00005 
00006 namespace Impala
00007 {
00008 namespace Core
00009 {
00010 namespace Vector
00011 {
00012 
00013 
00014 template <class ElemT>
00015 inline Real64
00016 Norm2DistSqr(VectorTem<ElemT>& v1, VectorTem<ElemT>& v2)
00017 {
00018     Real64 sum = 0;
00019     for (int i=0 ; i<v1.Size() ; i++)
00020     {
00021         Real64 d = (Real64) v1[i] - (Real64) v2[i];
00022         sum += d * d;
00023     }
00024     return sum;
00025 }
00026 
00027 template <class ElemT>
00028 inline Real64
00029 Norm2Dist(VectorTem<ElemT>& v1, VectorTem<ElemT>& v2)
00030 {
00031     return sqrt(Norm2DistSqr(v1, v2));
00032 }
00033 
00034 } // namespace Vector
00035 } // namespace Core
00036 } // namespace Impala
00037 
00038 #endif

Generated on Fri Mar 19 09:31:28 2010 for ImpalaSrc by  doxygen 1.5.1