```// @(#)root/tmva \$Id: MetricEuler.cxx 29122 2009-06-22 06:51:30Z brun \$
// Author: Andreas Hoecker, Peter Speckmayer

/**********************************************************************************
* Project: TMVA - a Root-integrated toolkit for multivariate data analysis       *
* Package: TMVA                                                                  *
* Class  : MetricEuler                                                         *
* Web    : http://tmva.sourceforge.net                                           *
*                                                                                *
* Description:                                                                   *
*      Implementation                                                            *
*                                                                                *
* Authors (alphabetical):                                                        *
*      Peter Speckmayer <speckmay@mail.cern.ch> - CERN, Switzerland              *
*                                                                                *
*      CERN, Switzerland                                                         *
*      MPI-K Heidelberg, Germany                                                 *
*                                                                                *
* Redistribution and use in source and binary forms, with or without             *
* modification, are permitted according to the terms listed in LICENSE           *
**********************************************************************************/

//_______________________________________________________________________
//
// interface for a metric
//
//_______________________________________________________________________

#include "TMVA/MetricEuler.h"
#include "TMath.h"

ClassImp(TMVA::MetricEuler)

//_______________________________________________________________________
TMVA::MetricEuler::MetricEuler()
: IMetric()
{
// constructor
}

//_______________________________________________________________________
Double_t TMVA::MetricEuler::Distance( std::vector<Double_t>& pointA, std::vector<Double_t>& pointB )
{
// the Euler distance between point A and B
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 += pow( 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 += pow( val, 2 );
itA++;
itPar++;
}
if( itA != pointA.end() ){
distance *= pow( (*itA),2 );
}
}
return sqrt( distance );
}

```
MetricEuler.cxx:1
MetricEuler.cxx:2
MetricEuler.cxx:3
MetricEuler.cxx:4
MetricEuler.cxx:5
MetricEuler.cxx:6
MetricEuler.cxx:7
MetricEuler.cxx:8
MetricEuler.cxx:9
MetricEuler.cxx:10
MetricEuler.cxx:11
MetricEuler.cxx:12
MetricEuler.cxx:13
MetricEuler.cxx:14
MetricEuler.cxx:15
MetricEuler.cxx:16
MetricEuler.cxx:17
MetricEuler.cxx:18
MetricEuler.cxx:19
MetricEuler.cxx:20
MetricEuler.cxx:21
MetricEuler.cxx:22
MetricEuler.cxx:23
MetricEuler.cxx:24
MetricEuler.cxx:25
MetricEuler.cxx:26
MetricEuler.cxx:27
MetricEuler.cxx:28
MetricEuler.cxx:29
MetricEuler.cxx:30
MetricEuler.cxx:31
MetricEuler.cxx:32
MetricEuler.cxx:33
MetricEuler.cxx:34
MetricEuler.cxx:35
MetricEuler.cxx:36
MetricEuler.cxx:37
MetricEuler.cxx:38
MetricEuler.cxx:39
MetricEuler.cxx:40
MetricEuler.cxx:41
MetricEuler.cxx:42
MetricEuler.cxx:43
MetricEuler.cxx:44
MetricEuler.cxx:45
MetricEuler.cxx:46
MetricEuler.cxx:47
MetricEuler.cxx:48
MetricEuler.cxx:49
MetricEuler.cxx:50
MetricEuler.cxx:51
MetricEuler.cxx:52
MetricEuler.cxx:53
MetricEuler.cxx:54
MetricEuler.cxx:55
MetricEuler.cxx:56
MetricEuler.cxx:57
MetricEuler.cxx:58
MetricEuler.cxx:59
MetricEuler.cxx:60
MetricEuler.cxx:61
MetricEuler.cxx:62
MetricEuler.cxx:63
MetricEuler.cxx:64
MetricEuler.cxx:65
MetricEuler.cxx:66
MetricEuler.cxx:67
MetricEuler.cxx:68
MetricEuler.cxx:69
MetricEuler.cxx:70
MetricEuler.cxx:71
MetricEuler.cxx:72
MetricEuler.cxx:73
MetricEuler.cxx:74
MetricEuler.cxx:75
MetricEuler.cxx:76
MetricEuler.cxx:77
MetricEuler.cxx:78
MetricEuler.cxx:79
MetricEuler.cxx:80
MetricEuler.cxx:81
MetricEuler.cxx:82
MetricEuler.cxx:83
MetricEuler.cxx:84
MetricEuler.cxx:85