| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

Functions
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 26 of file PFuncTest.cpp.

27 {
28 return 3 * x[0] * x[0] + 5 * x[1] * x[1] + 8;
29 }

int main | ( |  | ) |

Definition at line 31 of file PFuncTest.cpp.

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