Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r68282 - in sandbox/odeint/branches/karsten: boost/numeric/odeint/algebra libs/numeric/odeint/test
From: karsten.ahnert_at_[hidden]
Date: 2011-01-19 07:46:34


Author: karsten
Date: 2011-01-19 07:46:27 EST (Wed, 19 Jan 2011)
New Revision: 68282
URL: http://svn.boost.org/trac/boost/changeset/68282

Log:
* cleaning up the maximums calculation for vector_space_algebras
Text files modified:
   sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_operations.hpp | 13 +++++--------
   sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/vector_space_algebra.hpp | 9 +++++----
   sandbox/odeint/branches/karsten/libs/numeric/odeint/test/vector_space_1d.hpp | 18 ++++++++++++++++++
   3 files changed, 28 insertions(+), 12 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 2011-01-19 07:46:27 EST (Wed, 19 Jan 2011)
@@ -156,6 +156,9 @@
 
 
 
+ /*
+ * for usage in for_each2
+ */
         template< class Fac1 >
         struct rel_error
         {
@@ -175,8 +178,8 @@
         };
 
 
- /* ToDo : this is a reduction-operation so it needs 2 arguments for usage in reduce() functions,
- * but for vector spaces only one argument should be supplied - this should be rethought in details.
+ /*
+ * for usage in reduce
          */
         template< class Fac1 >
         struct maximum
@@ -187,12 +190,6 @@
                         using std::max;
                         return max( t1 , t2 );
                 }
-
- template< class T >
- Fac1 operator()( const T &t1 ) const
- { // for the vector space algebra
- return max( t1 );
- }
         };
 
 

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-19 07:46:27 EST (Wed, 19 Jan 2011)
@@ -13,6 +13,8 @@
 #ifndef BOOST_BOOST_NUMERIC_ODEINT_VECTOR_SPACE_ALGEBRA_HPP_INCLUDED
 #define BOOST_BOOST_NUMERIC_ODEINT_VECTOR_SPACE_ALGEBRA_HPP_INCLUDED
 
+#include <boost/numeric/odeint/algebra/vector_space_reduce.hpp>
+
 namespace boost {
 namespace numeric {
 namespace odeint {
@@ -69,12 +71,11 @@
         }
 
 
-
- /* ToDo : get ValueType from Container? */
         template< class ValueType , class StateType , class Reduction>
- static ValueType reduce( StateType &s , Reduction red , ValueType init)
+ static ValueType reduce( StateType &s , Reduction red , ValueType init )
         {
- return red( s );
+ boost::numeric::odeint::vector_space_reduce< StateType > r;
+ return r( s , red , init );
         }
 };
 

Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/test/vector_space_1d.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/test/vector_space_1d.hpp (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/test/vector_space_1d.hpp 2011-01-19 07:46:27 EST (Wed, 19 Jan 2011)
@@ -94,4 +94,22 @@
         return v.m_x;
 }
 
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+template< class T >
+struct vector_space_reduce< vector_space_1d< T > >
+{
+ template< class Op >
+ T operator()( const vector_space_1d< T > &v , Op op , T value )
+ {
+ return v.m_x;
+ }
+};
+
+} // odeint
+} // numeric
+} // boost
+
 #endif // VECTOR_SPACE_1D_HPP_INCLUDED


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