MaxDistance.cpp 722 B

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