The Gaudi Framework  v31r0 (aeb156f0)
PFuncTest.cpp File Reference

Test file for the class AdapterPFunction. More...

#include <cmath>
#include <cstdio>
#include <vector>
#include "GaudiMath/Adapters.h"
#include "GaudiMath/GaudiMath.h"
Include dependency graph for PFuncTest.cpp:

Go to the source code of this file.

Functions

double fun (const std::vector< double > &x)
 
int main ()
 

Detailed Description

Test file for the class AdapterPFunction.

Date
2003-09-03
Author
Kirill Miklyaev kiril.nosp@m.lm@i.nosp@m.ris1..nosp@m.itep.nosp@m..ru

Definition in file PFuncTest.cpp.

Function Documentation

double fun ( const std::vector< double > &  x)

Definition at line 26 of file PFuncTest.cpp.

26 { return 3 * x[0] * x[0] + 5 * x[1] * x[1] + 8; }
int main ( )

Definition at line 28 of file PFuncTest.cpp.

28  {
29  const GaudiMath::Function& myfun = GaudiMath::adapter( 2, &fun );
30  Genfun::Argument arg( myfun.dimensionality() );
31 
32  std::string format( "x[0]=%6.5f x[1]=%6.5f myfun=%+.10f" );
33  format += " fun=%+.10f fun-myfun=%+.10f \n";
34  std::vector<double> x( myfun.dimensionality() );
35 
36  for ( double a = 0; a < 3; ++a ) {
37  for ( double b = 0; b < 3; ++b ) {
38  arg[0] = x[0] = a;
39  arg[1] = x[1] = b;
40 
41  printf( format.c_str(), x[0], x[1], myfun( arg ), fun( x ), fun( x ) - myfun( arg ) );
42  }
43  }
44 }
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:109
Genfun::AbsFunction Function
Definition: GaudiMath.h:23
STL class.
GAUDI_API AIDAFunction adapter(const AIDA::IFunction &function)
Definition: Adapters.cpp:24
T c_str(T...args)
double fun(const std::vector< double > &x)
Definition: PFuncTest.cpp:26
T printf(T...args)