$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r64923 - in sandbox/odeint/branches/karsten/boost/numeric/odeint: algebra stepper
From: karsten.ahnert_at_[hidden]
Date: 2010-08-19 09:49:36
Author: karsten
Date: 2010-08-19 09:49:34 EDT (Thu, 19 Aug 2010)
New Revision: 64923
URL: http://svn.boost.org/trac/boost/changeset/64923
Log:
change the inplace transformation behaviour
Text files modified: 
   sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_operations.hpp   |    54 ++++++++++++++++++++--------------------
   sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_euler.hpp        |     4 +-                                      
   sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_rk4.hpp          |    13 +++++----                               
   sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_stepper_base.hpp |    21 ++++++++++++--                          
   4 files changed, 53 insertions(+), 39 deletions(-)
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_operations.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_operations.hpp	(original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_operations.hpp	2010-08-19 09:49:34 EDT (Thu, 19 Aug 2010)
@@ -28,33 +28,33 @@
 {
         typedef Time time_type;
 
-	struct increment1
-	{
-		time_type m_dt;
-
-		increment1( time_type dt ) : m_dt( dt ) { }
-
-		template< class T1 , class T2 >
-		void operator()( T1 &t1 , const T2 &t2 ) const
-		{
-			t1 += m_dt * t2;
-		}
-	};
-
-
-	struct increment4
-	{
-		time_type m_alpha1 , m_alpha2 , m_alpha3 , m_alpha4;
-
-		increment4( time_type alpha1 , time_type alpha2 , time_type alpha3 , time_type alpha4 )
-		: m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 )  , m_alpha4( alpha4 ) { }
-
-		template< class T1 , class T2 , class T3 , class T4 , class T5 >
-		void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 )
-		{
-			t1 += m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5;
-		}
-	};
+//	struct increment1
+//	{
+//		time_type m_dt;
+//
+//		increment1( time_type dt ) : m_dt( dt ) { }
+//
+//		template< class T1 , class T2 >
+//		void operator()( T1 &t1 , const T2 &t2 ) const
+//		{
+//			t1 += m_dt * t2;
+//		}
+//	};
+//
+//
+//	struct increment4
+//	{
+//		time_type m_alpha1 , m_alpha2 , m_alpha3 , m_alpha4;
+//
+//		increment4( time_type alpha1 , time_type alpha2 , time_type alpha3 , time_type alpha4 )
+//		: m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 )  , m_alpha4( alpha4 ) { }
+//
+//		template< class T1 , class T2 , class T3 , class T4 , class T5 >
+//		void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 )
+//		{
+//			t1 += m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5;
+//		}
+//	};
 
 
         struct scale_sum2
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_euler.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_euler.hpp	(original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_euler.hpp	2010-08-19 09:49:34 EDT (Thu, 19 Aug 2010)
@@ -41,9 +41,9 @@
         BOOST_ODEINT_EXPLICIT_STEPPERS_TYPEDEFS( explicit_euler , 1 );
 
         template< class System >
-	void do_step_impl( System system , state_type &x , const state_type &dxdt , time_type t , time_type dt )
+	void do_step_impl( System &system , const state_type &in , const state_type &dxdt , state_type & out , time_type t , time_type dt )
         {
-		algebra_type::for_each2( x , dxdt , typename operations_type::increment1( dt ) );
+		algebra_type::for_each3( out , in , dxdt , typename operations_type::scale_sum2( 1.0 , dt ) );
         }
 };
 
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_rk4.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_rk4.hpp	(original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_rk4.hpp	2010-08-19 09:49:34 EDT (Thu, 19 Aug 2010)
@@ -65,9 +65,10 @@
         }
 
         template< class System >
-	void do_step_impl( System system , state_type &x , const state_type &dxdt , time_type t , time_type dt )
+	void do_step_impl( System &system , const state_type &in , const state_type &dxdt , state_type &out , time_type t , time_type dt )
         {
-		m_size_adjuster.adjust_size_by_policy( x , adjust_size_policy() );
+		m_size_adjuster.adjust_size_by_policy( in , adjust_size_policy() );
+		// ToDo : check if size of in,dxdt,out are equal?
 
         const time_type val1 = static_cast<time_type>( 1.0 );
 
@@ -76,20 +77,20 @@
 
         // dt * dxdt = k1
         // m_xt = x + dh*dxdt
-        algebra_type::for_each3( m_xt , x , dxdt , typename operations_type::scale_sum2( val1 , dh ) );
+        algebra_type::for_each3( m_xt , in , dxdt , typename operations_type::scale_sum2( val1 , dh ) );
 
 
         // dt * m_dxt = k2
         system( m_xt , m_dxt , th );
 
         // m_xt = x + dh*m_dxt
-        algebra_type::for_each3( m_xt , x , m_dxt , typename operations_type::scale_sum2( val1 , dh ) );
+        algebra_type::for_each3( m_xt , in , m_dxt , typename operations_type::scale_sum2( val1 , dh ) );
 
 
         // dt * m_dxm = k3
         system( m_xt , m_dxm , th );
         //m_xt = x + dt*m_dxm
-        algebra_type::for_each3( m_xt , x , m_dxm , typename operations_type::scale_sum2( val1 , dt ) );
+        algebra_type::for_each3( m_xt , in , m_dxm , typename operations_type::scale_sum2( val1 , dt ) );
 
 
         // dt * m_dxh = k4
@@ -97,7 +98,7 @@
         //x += dt/6 * ( m_dxdt + m_dxt + val2*m_dxm )
         time_type dt6 = dt / static_cast<time_type>( 6.0 );
         time_type dt3 = dt / static_cast<time_type>( 3.0 );
-        algebra_type::for_each5( x , dxdt , m_dxt , m_dxm , m_dxh , typename operations_type::increment4( dt6 , dt3 , dt3 , dt6 ) );
+        algebra_type::for_each6( out , in , dxdt , m_dxt , m_dxm , m_dxh , typename operations_type::scale_sum5( 1.0 , dt6 , dt3 , dt3 , dt6 ) );
         }
 
 
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_stepper_base.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_stepper_base.hpp	(original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_stepper_base.hpp	2010-08-19 09:49:34 EDT (Thu, 19 Aug 2010)
@@ -84,19 +84,32 @@
 
 
         template< class System >
-	void do_step( System system , state_type &x , time_type t , time_type dt )
+	void do_step( System &system , state_type &x , time_type t , time_type dt )
         {
                 m_size_adjuster.adjust_size_by_policy( x , adjust_size_policy() );
                 system( x , m_dxdt ,t );
-		this->stepper().do_step_impl( system , x , m_dxdt , t , dt );
+		this->stepper().do_step_impl( system , x , m_dxdt , x , t , dt );
         }
 
         template< class System >
-	void do_step( System system , state_type &x , const state_type dxdt , time_type t , time_type dt )
+	void do_step( System &system , state_type &x , const state_type dxdt , time_type t , time_type dt )
         {
-		this->stepper().do_step_impl( system , x , dxdt , t , dt );
+		this->stepper().do_step_impl( system , x , dxdt , x , t , dt );
+	}
+
+	template< class System >
+	void do_step( System &system , const state_type &in , state_type &out , time_type t , time_type dt )
+	{
+		m_size_adjuster.adjust_size_by_policy( in , adjust_size_policy() );
+		system( in , m_dxdt ,t );
+		this->stepper().do_step_impl( system , in , m_dxdt , out , t , dt );
         }
 
+	template< class System >
+	void do_step( System &system , const state_type &in , const state_type &dxdt , state_type &out , time_type t , time_type dt )
+	{
+		this->stepper().do_step_impl( system , in , dxdt , out , t , dt );
+	}
 
 
         void adjust_size( const state_type &x )