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:
|