Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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  const GaudiMath::Function& mysum = GaudiMath::adapter( sum );
29  Genfun::Argument arg( 3 );
30 
31  std::string format( "x=%6.5f y=%6.5f z=%6.5f mysum=%+.10f" );
32  format += " sum=%+.10f sum-mysum=%+.10f \n";
33 
34  for ( double x = 0; x < 3; ++x ) {
35  for ( double y = 0; y < 3; ++y ) {
36  for ( double z = 0; z < 3; ++z ) {
37  arg[0] = x;
38  arg[1] = y;
39  arg[2] = z;
40  printf( format.c_str(), x, y, z, mysum( arg ), sum( x, y, z ), sum( x, y, z ) - mysum( arg ) );
41  }
42  }
43  }
44 
45  exit( 0 );
46 }
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:109
double sum(double x, double y, double z)
Genfun::AbsFunction Function
Definition: GaudiMath.h:23
STL class.
int main()
GAUDI_API AIDAFunction adapter(const AIDA::IFunction &function)
Definition: Adapters.cpp:24
T c_str(T...args)