#include "TMVA/MetricManhattan.h"
ClassImp(TMVA::MetricManhattan)
TMVA::MetricManhattan::MetricManhattan() 
   : IMetric()
{
   
}            
Double_t TMVA::MetricManhattan::Distance( std::vector<Double_t>& pointA, std::vector<Double_t>& pointB )
{
   
   
   Double_t distance = 0.0;
   Double_t val = 0.0;
   std::vector<Double_t>::iterator itA;
   std::vector<Double_t>::iterator itB;
   if( fParameters == NULL ){
      itA = pointA.begin();
      for( itB = pointB.begin(); itB != pointB.end(); itB++ ){
         if( itA == pointA.end() ){
            break;
         }
         val = (*itA)-(*itB);
         distance += TMath::Abs( val );
         itA++;
      }
   }else{
      std::vector<Double_t>::iterator itPar;
      itA   = pointA.begin();
      itPar = fParameters->begin();
      for( itB = pointB.begin(); itB != pointB.end(); itB++ ){
         if( itA == pointA.end() ){
            break;
         }
         if( itPar == fParameters->end() ){
            break;
         }
         val = (*itPar)*( (*itA)-(*itB) );
         distance += TMath::Abs( val );
         itA++;
         itPar++;
      }
      if( itA != pointA.end() ){
         distance *= (*itA);
      }
   }
   return distance;
}
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.