CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RK4OneStepTempl.h
Go to the documentation of this file.
1 #ifndef RK4OneStepTempl_H
2 #define RK4OneStepTempl_H
3 
5 #include "RKSmallVector.h"
6 #include "RKDerivative.h"
7 
8 template <typename T, int N>
10  public:
11 
12  typedef T Scalar;
14 
15 
16  Vector operator()( Scalar startPar, const Vector& startState,
17  const RKDerivative<T,N>& deriv, Scalar step) const {
18 
19  // cout << "RK4OneStepTempl: starting from " << startPar << startState << endl;
20 
21  Vector k1 = step * deriv( startPar, startState);
22  Vector k2 = step * deriv( startPar+step/2, startState+k1/2);
23  Vector k3 = step * deriv( startPar+step/2, startState+k2/2);
24  Vector k4 = step * deriv( startPar+step, startState+k3);
25 
26  Vector result = startState + k1/6 + k2/3 + k3/3 + k4/6;
27 
28  // cout << "RK4OneStepTempl: result for step " << step << " is " << result << endl;
29 
30  return result;
31  }
32 };
33 
34 #endif
Vector operator()(Scalar startPar, const Vector &startState, const RKDerivative< T, N > &deriv, Scalar step) const
ROOT::Math::SVector< T, N > RKSmallVector
Definition: RKSmallVector.h:13
tuple result
Definition: mps_fire.py:95
Base class for derivative calculation.
Definition: RKDerivative.h:13
RKSmallVector< T, N > Vector
#define dso_internal
long double T