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

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

Definition at line 22 of file Chi2Distance.h.

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

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

00024 {
00025     int length = v1.Size();
00026     double accumulator = 0;
00027     for (int i=0 ; i<length ; i++)
00028     {
00029         double sum = v1[i] + v2[i];
00030         if (sum)
00031             accumulator += (v1[i] - v2[i]) * (v1[i] - v2[i]) / sum;
00032     }
00033     // make it between 0..1, instead of 0..2 (this statement is only true if
00034     // the input vectors sum to one)
00035     return accumulator / 2.0;
00036 }

Here is the call graph for this function:


Generated on Thu Jan 13 09:21:35 2011 for ImpalaSrc by  doxygen 1.5.1