// d = #sqrt{#sum_{i} (x_{i}-y_{i})^{2}}
// End_Latex
#include "TMVA/MetricEuler.h"
#include "TMath.h"
ClassImp(TMVA::MetricEuler)
TMVA::MetricEuler::MetricEuler()
: IMetric()
{
}
Double_t TMVA::MetricEuler::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::Power( val, 2 );
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::Power( val, 2 );
itA++;
itPar++;
}
if( itA != pointA.end() ){
distance *= TMath::Power( (*itA),2 );
}
}
return sqrt( distance );
}
Last change: Wed Jun 25 08:48:40 2008
Last generated: 2008-06-25 08:48
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.