KernelStd.cpp 535 B

123456789101112131415161718192021222324252627282930
  1. /**
  2. * @file KernelStd.cpp
  3. * @brief Standard kernel
  4. * @author Erik Rodner
  5. * @date 10/24/2007
  6. */
  7. #include "KernelStd.h"
  8. using namespace OBJREC;
  9. KernelStd::KernelStd() : Kernel(true)
  10. {
  11. }
  12. KernelStd::~KernelStd()
  13. {
  14. }
  15. double KernelStd::K (const NICE::Vector & x, const NICE::Vector & y) const
  16. {
  17. if ( x.size() != y.size() )
  18. fthrow (NICE::Exception, "KernelStd::K: vectors must have the same dimension\n");
  19. double sum = 0.0;
  20. for ( int i = 0 ; i < (int)x.size() ; i++ )
  21. sum += x[i] * y[i];
  22. return sum;
  23. }