-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathem_stepper.cpp
More file actions
43 lines (30 loc) · 1.01 KB
/
Copy pathem_stepper.cpp
File metadata and controls
43 lines (30 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <vector>
#include <iostream>
#include <boost/random.hpp>
#include <boost/array.hpp>
#include <boost/numeric/odeint.hpp>
// PROGRAMM: Definition eines Euler-Maruyama-Steppers.
using namespace std;
using namespace boost::numeric::odeint;
typedef std::vector<double> state_type;
class em_stepper
{
public:
typedef std::vector<double> state_type;
typedef std::vector<double> deriv_type;
typedef double value_type;
typedef double time_type;
typedef unsigned short order_type;
typedef boost::numeric::odeint::stepper_tag stepper_category;
static order_type order(void){return 1;} // Gibt die Ordnung des Steppers an.
template<class System> // Der Stepper arbeitet mit Systemen.
void do_step(System system, state_type &x, time_type t, time_type dt) const
{
deriv_type det, stoch;
system.first(x , det);
system.second(x , stoch);
for(int i = 0; i < x.size(); i++){
x[i] = x[i] + det[i]*dt + sqrt(x[i])*stoch[i];
};
}
};