All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PFuncTest.cpp File Reference

Test file for the class AdapterPFunction. More...

#include <math.h>
#include <stdio.h>
#include <vector>
#include "GaudiMath/GaudiMath.h"
#include "GaudiMath/Adapters.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 27 of file PFuncTest.cpp.

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

Definition at line 32 of file PFuncTest.cpp.

{
const GaudiMath::Function& myfun = GaudiMath::adapter( 2 , &fun ) ;
Genfun::Argument arg(myfun.dimensionality());
std::string format( "x[0]=%6.5f x[1]=%6.5f myfun=%+.10f");
format +=" fun=%+.10f fun-myfun=%+.10f \n" ;
std::vector<double> x =
std::vector<double>(myfun.dimensionality());
for ( double a = 0; a < 3; ++a)
{
for (double b = 0; b < 3; ++b)
{
arg[0] = x[0] = a;
arg[1] = x[1] = b;
printf ( format.c_str() ,
x[0], x[1], myfun(arg), fun(x),
fun(x) - myfun(arg) );
}
}
exit(0);
}