Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67972 - in sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra: . external
From: karsten.ahnert_at_[hidden]
Date: 2011-01-11 15:14:57


Author: karsten
Date: 2011-01-11 15:14:54 EST (Tue, 11 Jan 2011)
New Revision: 67972
URL: http://svn.boost.org/trac/boost/changeset/67972

Log:
* updated algebras, included const versions for boost.range
Text files modified:
   sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/external/thrust_algebra.hpp | 40 +++++++++++++
   sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_algebra.hpp | 120 ++++++++++++++++++++++++++++++++++++++++
   sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/vector_space_algebra.hpp | 7 ++
   3 files changed, 167 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 15:14:54 EST (Tue, 11 Jan 2011)
@@ -23,6 +23,13 @@
 namespace odeint {
 
 
+
+/*
+ * The const versions are needed for boost.range to work, i.e.
+ * it allows you to do
+ * for_each1( make_pair( vec1.begin() , vec1.begin() + 10 ) , op );
+ */
+
 struct thrust_algebra
 {
         template< class StateType , class Operation >
@@ -31,6 +38,18 @@
                 thrust::for_each( boost::begin(s) , boost::begin(s) , op );
         }
 
+ template< class StateType , class Operation >
+ static void for_each1( const StateType &s , Operation op )
+ {
+ thrust::for_each( boost::begin(s) , boost::begin(s) , op );
+ }
+
+
+
+
+
+
+
         template< class StateType1 , class StateType2 , class Operation >
         static void for_each2( StateType1 &s1 , StateType2 &s2 , Operation op )
         {
@@ -39,6 +58,19 @@
                                                   op);
         }
 
+ template< class StateType1 , class StateType2 , class Operation >
+ static void for_each2( const StateType1 &s1 , const StateType2 &s2 , Operation op )
+ {
+ thrust::for_each( thrust::make_zip_iterator( thrust::make_tuple( boost::begin(s1) , boost::begin(s2) ) ) ,
+ 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 )
         {
@@ -46,6 +78,14 @@
                                                   thrust::make_zip_iterator( thrust::make_tuple( boost::end(s1) , boost::end(s2) , boost::begin(s3) ) ) ,
                                                   op);
         }
+
+ template< class StateType1 , class StateType2 , class StateType3 , class Operation >
+ static void for_each3( const StateType1 &s1 , const StateType2 &s2 , const 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/standard_algebra.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_algebra.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_algebra.hpp 2011-01-11 15:14:54 EST (Tue, 11 Jan 2011)
@@ -24,6 +24,11 @@
 namespace numeric {
 namespace odeint {
 
+/*
+ * The const versions are needed for boost.range to work, i.e.
+ * it allows you to do
+ * for_each1( make_pair( vec1.begin() , vec1.begin() + 10 ) , op );
+ */
 struct standard_algebra
 {
         template< class StateType1 , class Operation >
@@ -33,6 +38,16 @@
                                    op );
         }
 
+ template< class StateType1 , class Operation >
+ static void for_each1( const StateType1 &s1 , Operation op )
+ {
+ detail::for_each1( boost::begin( s1 ) , boost::end( s1 ) ,
+ op );
+ }
+
+
+
+
 
         template< class StateType1 , class StateType2 , class Operation >
         static void for_each2( StateType1 &s1 , StateType2 &s2 , Operation op )
@@ -41,6 +56,15 @@
                                    boost::begin( s2 ) , op );
         }
 
+ template< class StateType1 , class StateType2 , class Operation >
+ static void for_each2( const StateType1 &s1 , const StateType2 &s2 , Operation op )
+ {
+ detail::for_each2( boost::begin( s1 ) , boost::end( s1 ) ,
+ boost::begin( s2 ) , op );
+ }
+
+
+
 
 
         template< class StateType1 , class StateType2 , class StateType3 , class Operation >
@@ -52,6 +76,17 @@
                                                    op );
         }
 
+ template< class StateType1 , class StateType2 , class StateType3 , class Operation >
+ static void for_each3( const StateType1 &s1 , const StateType2 &s2 , const StateType3 &s3 , Operation op )
+ {
+ detail::for_each3( boost::begin( s1 ) , boost::end( s1 ) ,
+ boost::begin( s2 ) ,
+ boost::begin( s3 ) ,
+ op );
+ }
+
+
+
 
 
 
@@ -65,6 +100,17 @@
                                                    op );
         }
 
+ template< class StateType1 , class StateType2 , class StateType3 , class StateType4 , class Operation >
+ static void for_each4( const StateType1 &s1 , const StateType2 &s2 , const StateType3 &s3 , const StateType4 &s4 , Operation op )
+ {
+ detail::for_each4( boost::begin( s1 ) , boost::end( s1 ) ,
+ boost::begin( s2 ) ,
+ boost::begin( s3 ) ,
+ boost::begin( s4 ) ,
+ op );
+ }
+
+
 
 
 
@@ -79,6 +125,20 @@
                                                    op );
         }
 
+ template< class StateType1 , class StateType2 , class StateType3 , class StateType4 , class StateType5 , class Operation >
+ static void for_each5( const StateType1 &s1 , const StateType2 &s2 , const StateType3 &s3 , const StateType4 &s4 , const StateType5 &s5 , Operation op )
+ {
+ detail::for_each5( boost::begin( s1 ) , boost::end( s1 ) ,
+ boost::begin( s2 ) ,
+ boost::begin( s3 ) ,
+ boost::begin( s4 ) ,
+ boost::begin( s5 ) ,
+ op );
+ }
+
+
+
+
 
 
 
@@ -94,6 +154,22 @@
                                                    op );
         }
 
+ template< class StateType1 , class StateType2 , class StateType3 , class StateType4 , class StateType5 , class StateType6 , class Operation >
+ static void for_each6( const StateType1 &s1 , const StateType2 &s2 , const StateType3 &s3 , const StateType4 &s4 , const StateType5 &s5 , const StateType6 &s6 , Operation op )
+ {
+ detail::for_each6( boost::begin( s1 ) , boost::end( s1 ) ,
+ boost::begin( s2 ) ,
+ boost::begin( s3 ) ,
+ boost::begin( s4 ) ,
+ boost::begin( s5 ) ,
+ boost::begin( s6 ) ,
+ op );
+ }
+
+
+
+
+
 
 
         template< class StateType1 , class StateType2 , class StateType3 , class StateType4 , class StateType5 , class StateType6 ,class StateType7 , class Operation >
@@ -109,6 +185,26 @@
                                                    op );
         }
 
+ template< class StateType1 , class StateType2 , class StateType3 , class StateType4 , class StateType5 , class StateType6 ,class StateType7 , class Operation >
+ static void for_each7( const StateType1 &s1 , const StateType2 &s2 , const StateType3 &s3 , const StateType4 &s4 , const StateType5 &s5 , const StateType6 &s6 , const StateType7 &s7 , Operation op )
+ {
+ detail::for_each7( boost::begin( s1 ) , boost::end( s1 ) ,
+ boost::begin( s2 ) ,
+ boost::begin( s3 ) ,
+ boost::begin( s4 ) ,
+ boost::begin( s5 ) ,
+ boost::begin( s6 ) ,
+ boost::begin( s7 ) ,
+ op );
+ }
+
+
+
+
+
+
+
+
         template< class StateType1 , class StateType2 , class StateType3 , class StateType4 , class StateType5 , class StateType6 ,class StateType7 , class StateType8 , class Operation >
         static void for_each8( StateType1 &s1 , StateType2 &s2 , StateType3 &s3 , StateType4 &s4 , StateType5 &s5 , StateType6 &s6 , StateType7 &s7 , StateType8 &s8 , Operation op )
         {
@@ -123,12 +219,36 @@
                                                    op );
         }
 
+ template< class StateType1 , class StateType2 , class StateType3 , class StateType4 , class StateType5 , class StateType6 ,class StateType7 , class StateType8 , class Operation >
+ static void for_each8( const StateType1 &s1 , const StateType2 &s2 , const StateType3 &s3 , const StateType4 &s4 , const StateType5 &s5 , const StateType6 &s6 , const StateType7 &s7 , const StateType8 &s8 , Operation op )
+ {
+ detail::for_each8( boost::begin( s1 ) , boost::end( s1 ) ,
+ boost::begin( s2 ) ,
+ boost::begin( s3 ) ,
+ boost::begin( s4 ) ,
+ boost::begin( s5 ) ,
+ boost::begin( s6 ) ,
+ boost::begin( s7 ) ,
+ boost::begin( s8 ) ,
+ op );
+ }
+
+
+
+
 
         template< class ValueType , class StateType , class Reduction >
         static ValueType reduce( StateType &s , Reduction red , ValueType init)
         {
                 return detail::reduce( boost::begin( s ) , boost::end( s ) , red , init );
         }
+
+ template< class ValueType , class StateType , class Reduction >
+ static ValueType reduce( const StateType &s , Reduction red , ValueType init)
+ {
+ return detail::reduce( boost::begin( s ) , boost::end( s ) , red , init );
+ }
+
 };
 
 } // odeint

Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/vector_space_algebra.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/vector_space_algebra.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/vector_space_algebra.hpp 2011-01-11 15:14:54 EST (Tue, 11 Jan 2011)
@@ -62,6 +62,13 @@
                 op( s1 , s2 , s3 , s4 , s5 , s6 , s7 );
         }
 
+ template< class StateType1 , class StateType2 , class StateType3 , class StateType4 , class StateType5 , class StateType6 ,class StateType7 , class StateType8 , class Operation >
+ static void for_each8( StateType1 &s1 , StateType2 &s2 , StateType3 &s3 , StateType4 &s4 , StateType5 &s5 , StateType6 &s6 , StateType7 &s7 , StateType8 &s8 , Operation op )
+ {
+ op( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 );
+ }
+
+
 
         /* ToDo : get ValueType from Container? */
         template< class ValueType , class StateType , class Reduction>


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