Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework
v31r0 (aeb156f0)
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
InterpTest.cpp
Go to the documentation of this file.
1
// ============================================================================
2
// Include files
3
// ============================================================================
4
// STD& STL
5
// ============================================================================
6
#include "
GaudiKernel/SystemOfUnits.h
"
7
#include "
GaudiMath/GaudiMath.h
"
8
#include <cmath>
9
#include <cstdio>
10
#include <iostream>
11
12
// ============================================================================
20
// ============================================================================
21
22
int
main
() {
23
24
const
GaudiMath::Function
& mysin =
GaudiMath::SimpleFun
( sin );
25
const
GaudiMath::Function
& mycos =
GaudiMath::SimpleFun
( cos );
26
27
std::vector<double>
vctx;
28
std::vector<double>
vcty;
29
30
for
(
int
i = 0; i <= 20; ++i ) {
31
double
x = i * 3.141592 / 20.0;
32
double
y = mysin( x );
33
vctx.
push_back
( x );
34
vcty.
push_back
( y );
35
}
36
37
using
GaudiMath::Interpolation::Cspline_Periodic
;
38
39
const
GaudiMath::Constant
minusOne( -1.0, 1 );
40
const
GaudiMath::Constant
plusOne( 1.0, 1 );
41
43
const
GaudiMath::Spline
i1( vctx, vcty,
Cspline_Periodic
);
44
46
const
GaudiMath::SplineDeriv
i2( vctx, vcty,
Cspline_Periodic
);
47
49
const
GaudiMath::Function
& i3 =
GaudiMath::SplineDeriv2
( vctx, vcty,
Cspline_Periodic
) * minusOne;
50
52
const
GaudiMath::Function
& i4 = plusOne +
GaudiMath::SplineInteg
( vctx, vcty,
Cspline_Periodic
, 0.0 ) * minusOne;
53
54
for
(
int
i = 0; i < 30; ++i ) {
55
double
x = i * 3.141592 / 30.0;
56
printf(
"x=%+7.1f; Sin-i1=%+14.9f; Cos-i2=%+14.9f; Sin-i3=%+14.9f; Cos-i4=%+14.9f;\n"
, x /
Gaudi::Units::degree
,
57
mysin( x ) - i1( x ), mycos( x ) - i2( x ), mysin( x ) - i3( x ), mycos( x ) - i4( x ) );
58
}
59
}
GaudiMath::SplineDeriv2
Genfun::GaudiMathImplementation::GSLSplineDeriv2 SplineDeriv2
Definition:
GaudiMath.h:34
Gaudi::Units::degree
constexpr double degree
Definition:
SystemOfUnits.h:107
GaudiMath::SimpleFun
Genfun::GaudiMathImplementation::SimpleFunction SimpleFun
Definition:
GaudiMath.h:27
Genfun::GaudiMathImplementation::Constant
Fixed constant function.
Definition:
Constant.h:30
main
int main()
Definition:
InterpTest.cpp:22
GaudiMath::Function
Genfun::AbsFunction Function
Definition:
GaudiMath.h:23
std::vector::push_back
T push_back(T...args)
GaudiMath::SplineInteg
Genfun::GaudiMathImplementation::GSLSplineInteg SplineInteg
Definition:
GaudiMath.h:35
std::vector< double >
Genfun::GaudiMathImplementation::GSLSplineDeriv
Definition:
Splines.h:256
Genfun::GaudiMathImplementation::GSLSpline
Definition:
Splines.h:136
GaudiMath::Interpolation::Cspline_Periodic
Definition:
Interpolation.h:17
SystemOfUnits.h
GaudiMath.h
GaudiGSL
src
Tests
InterpTest.cpp
Generated on Mon Feb 11 2019 17:48:13 for The Gaudi Framework by
1.8.11