/** * @file KernelStd.cpp * @brief Standard kernel * @author Erik Rodner * @date 10/24/2007 */ #include #include "vislearning/math/distances/KernelStd.h" using namespace OBJREC; using namespace std; // refactor-nice.pl: check this substitution // old: using namespace ice; using namespace NICE; KernelStd::KernelStd() : Kernel(true) { } KernelStd::~KernelStd() { } double KernelStd::K (const NICE::Vector & x, const NICE::Vector & y) const { if ( x.size() != y.size() ) fthrow (Exception, "KernelStd::K: vectors must have the same dimension\n"); double sum = 0.0; for ( int i = 0 ; i < (int)x.size() ; i++ ) sum += x[i] * y[i]; return sum; }