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

double Impala::Core::Training::Chi2Distance ( const Vector::VectorTem< double > &  v1,
const Vector::VectorTem< double > &  v2 
)

Definition at line 13 of file KernelFunctions.h.

References Impala::Core::Vector::VectorTem< ElemT >::Size().

Referenced by Impala::Application::ComputeMatrix(), Impala::Core::Training::ApplyConceptsHelperKernels::LoadFeatures(), and PrecomputeKernelMatrix().

00014 {
00015     int length=v1.Size();
00016     double accumulator = 0;
00017     for(int i=0 ; i<length ; ++i)
00018     {
00019         double sum = v1[i] + v2[i];
00020         if(sum)
00021             accumulator += (v1[i] - v2[i]) * (v1[i] - v2[i]) / sum;
00022     }
00023     // make it between 0..1, instead of 0..2 (this statement is only true if the input vectors sum to one)
00024     return accumulator / 2.0;
00025 }

Here is the call graph for this function:


Generated on Fri Mar 19 11:22:59 2010 for ImpalaSrc by  doxygen 1.5.1