KernelStd.cpp 582 B

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