summaryrefslogtreecommitdiff
path: root/libs/numeric/odeint/examples/stochastic_euler.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2015-04-08 03:09:47 +0000
committer <>2015-05-05 14:37:32 +0000
commitf2541bb90af059680aa7036f315f052175999355 (patch)
treea5b214744b256f07e1dc2bd7273035a7808c659f /libs/numeric/odeint/examples/stochastic_euler.cpp
parented232fdd34968697a68783b3195b1da4226915b5 (diff)
downloadboost-tarball-master.tar.gz
Imported from /home/lorry/working-area/delta_boost-tarball/boost_1_58_0.tar.bz2.HEADboost_1_58_0master
Diffstat (limited to 'libs/numeric/odeint/examples/stochastic_euler.cpp')
-rw-r--r--libs/numeric/odeint/examples/stochastic_euler.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/libs/numeric/odeint/examples/stochastic_euler.cpp b/libs/numeric/odeint/examples/stochastic_euler.cpp
index 23474255b..c98d27b09 100644
--- a/libs/numeric/odeint/examples/stochastic_euler.cpp
+++ b/libs/numeric/odeint/examples/stochastic_euler.cpp
@@ -109,10 +109,10 @@ struct ornstein_det
struct ornstein_stoch
{
- boost::mt19937 m_rng;
+ boost::mt19937 &m_rng;
boost::normal_distribution<> m_dist;
- ornstein_stoch( double sigma ) : m_rng() , m_dist( 0.0 , sigma ) { }
+ ornstein_stoch( boost::mt19937 &rng , double sigma ) : m_rng( rng ) , m_dist( 0.0 , sigma ) { }
void operator()( const state_type &x , state_type &dxdt )
{
@@ -137,9 +137,10 @@ int main( int argc , char **argv )
using namespace boost::numeric::odeint;
//[ ornstein_uhlenbeck_main
+ boost::mt19937 rng;
double dt = 0.1;
state_type x = {{ 1.0 }};
- integrate_const( stochastic_euler< N >() , make_pair( ornstein_det() , ornstein_stoch( 1.0 ) ) ,
+ integrate_const( stochastic_euler< N >() , make_pair( ornstein_det() , ornstein_stoch( rng , 1.0 ) ),
x , 0.0 , 10.0 , dt , streaming_observer() );
//]
return 0;