The Gaudi Framework  v30r3 (a5ef0a68)
3DoubleFuncTest.cpp
Go to the documentation of this file.
1 // ============================================================================
2 // Include files
3 // ============================================================================
4 // STD & STL
5 // ============================================================================
6 #include <cmath>
7 #include <cstdio>
8 // ============================================================================
9 // GaudiMath
10 // ============================================================================
11 #include "GaudiMath/Adapters.h"
12 #include "GaudiMath/GaudiMath.h"
13 // ============================================================================
14 
15 // ============================================================================
23 // ============================================================================
24 
25 double sum( double x, double y, double z ) { return 3 * x * x - 5 * y * y + 3 * z * z; }
26 
27 int main()
28 {
29  const GaudiMath::Function& mysum = GaudiMath::adapter( sum );
30  Genfun::Argument arg( 3 );
31 
32  std::string format( "x=%6.5f y=%6.5f z=%6.5f mysum=%+.10f" );
33  format += " sum=%+.10f sum-mysum=%+.10f \n";
34 
35  for ( double x = 0; x < 3; ++x ) {
36  for ( double y = 0; y < 3; ++y ) {
37  for ( double z = 0; z < 3; ++z ) {
38  arg[0] = x;
39  arg[1] = y;
40  arg[2] = z;
41  printf( format.c_str(), x, y, z, mysum( arg ), sum( x, y, z ), sum( x, y, z ) - mysum( arg ) );
42  }
43  }
44  }
45 
46  exit( 0 );
47 }
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:120
double sum(double x, double y, double z)
Genfun::AbsFunction Function
Definition: GaudiMath.h:24
STL class.
int main()
GAUDI_API AIDAFunction adapter(const AIDA::IFunction &function)
Definition: Adapters.cpp:25
T c_str(T...args)