Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67965 - sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/external
From: karsten.ahnert_at_[hidden]
Date: 2011-01-11 12:48:33


Author: karsten
Date: 2011-01-11 12:48:19 EST (Tue, 11 Jan 2011)
New Revision: 67965
URL: http://svn.boost.org/trac/boost/changeset/67965

Log:
* thrust algebra update
Text files modified:
   sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/external/thrust_algebra.hpp | 8 ++++++++
   sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/external/thrust_operations.hpp | 17 +++++++++++++++++
   2 files changed, 25 insertions(+), 0 deletions(-)

Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/external/thrust_algebra.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/external/thrust_algebra.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/external/thrust_algebra.hpp 2011-01-11 12:48:19 EST (Tue, 11 Jan 2011)
@@ -38,6 +38,14 @@
                                                   thrust::make_zip_iterator( thrust::make_tuple( boost::end(s1) , boost::end(s2) ) ) ,
                                                   op);
         }
+
+ template< class StateType1 , class StateType2 , class StateType3 , class Operation >
+ static void for_each3( StateType1 &s1 , StateType2 &s2 , StateType3 &s3 , Operation op )
+ {
+ thrust::for_each( thrust::make_zip_iterator( thrust::make_tuple( boost::begin(s1) , boost::begin(s2) , boost::begin(s3) ) ) ,
+ thrust::make_zip_iterator( thrust::make_tuple( boost::end(s1) , boost::end(s2) , boost::begin(s3) ) ) ,
+ op);
+ }
 };
 
 

Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/external/thrust_operations.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/external/thrust_operations.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/external/thrust_operations.hpp 2011-01-11 12:48:19 EST (Tue, 11 Jan 2011)
@@ -37,6 +37,23 @@
                         thrust::get<0>(t) += m_dt * thrust::get<1>(t);
                 }
         };
+
+ struct scale_sum2
+ {
+ const time_type m_alpha1;
+ const time_type m_alpha2;
+
+ scale_sum2( const time_type alpha1 , const time_type alpha2 ) : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) { }
+
+ template< class Tuple >
+ __host__ __device__
+ void operator()( Tuple t ) const
+ {
+ thrust::get<0>(t) = m_alpha1 * thrust::get<1>(t) + m_alpha2 * thrust::get<2>(t);
+ }
+ };
+
+
 };
 
 } // odeint


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk