MaxDistance.cpp 819 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /**
  2. * @file MaxDistance.cpp
  3. * @brief maximum distance measure
  4. * @author Erik Rodner
  5. * @date 02/19/2008
  6. */
  7. #ifdef NOVISUAL
  8. #include <vislearning/nice_nonvis.h>
  9. #else
  10. #include <vislearning/nice.h>
  11. #endif
  12. #include <iostream>
  13. #include "vislearning/math/distances/MaxDistance.h"
  14. using namespace OBJREC;
  15. using namespace std;
  16. // refactor-nice.pl: check this substitution
  17. // old: using namespace ice;
  18. using namespace NICE;
  19. MaxDistance::MaxDistance()
  20. {
  21. }
  22. MaxDistance::~MaxDistance()
  23. {
  24. }
  25. double MaxDistance::doCalculate (const NICE::Vector & x, const NICE::Vector & y) const
  26. {
  27. double dist = 0.0;
  28. for ( int i = 0 ; i < (int)x.size() ; i++ )
  29. {
  30. double u = x[i];
  31. double v = y[i];
  32. double disttmp= fabs(u-v);
  33. if (disttmp>dist)
  34. {
  35. dist=disttmp;
  36. }
  37. }
  38. return dist;
  39. }