Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r60473 - in sandbox/odeint: . libs/numeric/odeint/examples libs/numeric/odeint/stuff libs/numeric/odeint/stuff/gsl_compare libs/numeric/odeint/stuff/iterator_algebra libs/numeric/odeint/stuff/performance libs/numeric/odeint/test
From: karsten.ahnert_at_[hidden]
Date: 2010-03-11 03:45:33


Author: karsten
Date: 2010-03-11 03:45:30 EST (Thu, 11 Mar 2010)
New Revision: 60473
URL: http://svn.boost.org/trac/boost/changeset/60473

Log:
some structural changes in the directory structure
Added:
   sandbox/odeint/libs/numeric/odeint/examples/dnls.cpp
      - copied unchanged from r60427, /sandbox/odeint/libs/numeric/odeint/examples/dnls_stepper_compare.cpp
   sandbox/odeint/libs/numeric/odeint/stuff/performance/
   sandbox/odeint/libs/numeric/odeint/stuff/performance/Jamfile (contents, props changed)
   sandbox/odeint/libs/numeric/odeint/stuff/performance/gsl_compare_lorenz.cpp
      - copied, changed from r60427, /sandbox/odeint/libs/numeric/odeint/stuff/gsl_compare/lorenz_stepper_cmp.cpp
   sandbox/odeint/libs/numeric/odeint/stuff/performance/iterator_algebra_increment_decrement.cpp
      - copied, changed from r60427, /sandbox/odeint/libs/numeric/odeint/stuff/iterator_algebra/increment_decrement.cc
   sandbox/odeint/libs/numeric/odeint/stuff/performance/transform_zip_iterators_cmp.cpp
      - copied unchanged from r60432, /sandbox/odeint/libs/numeric/odeint/stuff/transform_cmp.cc
Removed:
   sandbox/odeint/libs/numeric/odeint/examples/dnls_stepper_compare.cpp
   sandbox/odeint/libs/numeric/odeint/examples/hamiltonian_test.cpp
   sandbox/odeint/libs/numeric/odeint/stuff/gsl_compare/
   sandbox/odeint/libs/numeric/odeint/stuff/iterator_algebra/
   sandbox/odeint/libs/numeric/odeint/stuff/transform_cmp.cc
Text files modified:
   sandbox/odeint/ToDo | 33 ++++++++++++++++++++++++++-------
   sandbox/odeint/libs/numeric/odeint/examples/Jamfile | 4 ++--
   sandbox/odeint/libs/numeric/odeint/examples/harmonic_oscillator.cpp | 1 -
   sandbox/odeint/libs/numeric/odeint/examples/pendulum_vibrating_pivot.cpp | 10 ++++++----
   sandbox/odeint/libs/numeric/odeint/stuff/performance/gsl_compare_lorenz.cpp | 8 ++++----
   sandbox/odeint/libs/numeric/odeint/stuff/performance/iterator_algebra_increment_decrement.cpp | 17 -----------------
   sandbox/odeint/libs/numeric/odeint/test/check_stepper_concepts.cpp | 34 ++++++++++++++++++++++++++++++++++
   7 files changed, 72 insertions(+), 35 deletions(-)

Modified: sandbox/odeint/ToDo
==============================================================================
--- sandbox/odeint/ToDo (original)
+++ sandbox/odeint/ToDo 2010-03-11 03:45:30 EST (Thu, 11 Mar 2010)
@@ -1,17 +1,20 @@
 = Features and Coding issues: =
 
 Karsten:
+
 * Resizer functionality should be called explicitly and not in every call of do_step or try_step
+
 * Add new order function (because we need three orders for rk78)
   suggestion: * order_step()
               * order_error_step()
               * order_error()
+
 * deriv every stepper from stepper_base< stepper >, because do_step( system , x , t , dt ) is only implemented once ( and calls the special do_step( system , x , dxdt , t , dt )
+ * is not possible
+
 * In all steppers:
   * const unsigned short -> short - DONE
   * typedef typename traits_type::container_type container_type statt typedef Container container_type - DONE
-* Concept checks, für vernünftige Fehlermeldungen
- * auch für checks ob abs() vorhanden ist
 
 * check: orders and adjust_size() and something more in :
   * stepper_euler.hpp - DONE
@@ -26,7 +29,9 @@
     * check the error orders
   * controlled_stepper_standard.hpp - DONE
     * contruction of the internal stepper from its standard constructor - DONE
+ * concecpt check
   * controlled_stepper_bs.hpp
+ * concecpt check
 
 
 * die auskommentierten Iteratoren typedefs entfernen
@@ -48,8 +53,6 @@
   * auch für checks ob abs() vorhanden ist
 
 
-Karsten:
-* hamiltonian solvers with input std::pair< container_type , container_type >, than it can be used in integrate_const.
 
 Mario: check
 * change integrate_const to use number of steps instead of end_time and remove integrate_const_step
@@ -72,10 +75,12 @@
 
 
 
-= Unit testing =
+= Testing =
 
 Karsten:
+
 * aufsetzen des Frameworks - DONE
+
 * checken zwischen autonomous and non-autonomous integration, with constant time
 
 
@@ -91,8 +96,12 @@
 = Examples and perforance testing =
 
 * cleanup examples directory, only one example per system
-* create performance directory/project
+ * combine all lorenz examples
+
+* create performance directory/project - DONE
+
 * one example with complex types, cgle, mit spiral waves und multi_array (grisha)
+
 * solar system
   * http://ssd.jpl.nasa.gov/
   * masses: http://ssd.jpl.nasa.gov/?planet_phys_par
@@ -103,6 +112,7 @@
 = Headers =
 
 * header cleanup, every header should include all header it needs
+
 * <tr1/array> ist not always present, on many systems it is <array>
 
 
@@ -119,6 +129,13 @@
   * http://math-www.uni-paderborn.de/~walter/publications/
   * http://arxiv.org/abs/astro-ph/0005074
 * check other methods, Nystrom ...
+* hamiltonian solvers with input std::pair< container_type , container_type >, than it can be used in integrate_const.
+
+
+
+
+
+
 
 
 = Wish list =
@@ -142,4 +159,6 @@
 
 = Some issues =
 
-* zip iterator is slow, hence writing the iterator algebra with zip iterators is not an option
+* iterator algebra
+ * zip_iterators are a possibility
+ * transform functions with more iterators are a possibility

Modified: sandbox/odeint/libs/numeric/odeint/examples/Jamfile
==============================================================================
--- sandbox/odeint/libs/numeric/odeint/examples/Jamfile (original)
+++ sandbox/odeint/libs/numeric/odeint/examples/Jamfile 2010-03-11 03:45:30 EST (Thu, 11 Mar 2010)
@@ -15,7 +15,7 @@
     ;
 
 exe harmonic_oscillator : harmonic_oscillator.cpp ;
-exe hamiltonian_test : hamiltonian_test.cpp ;
+
 
 exe lorenz_cmp_rk4_rk_generic : lorenz_cmp_rk4_rk_generic.cpp ;
 exe lorenz_controlled : lorenz_controlled.cpp ;
@@ -23,7 +23,7 @@
 exe lorenz_integrator : lorenz_integrator.cpp ;
 exe lorenz_stepper : lorenz_stepper.cpp ;
 exe pendulum_vibrating_pivot : pendulum_vibrating_pivot.cpp ;
-exe dnls_stepper_compare : dnls_stepper_compare.cpp ;
+exe dnls : dnls.cpp ;
 
 exe doc_harm_osc : doc_harm_osc.cpp ;
 exe doc_integrate : doc_integrate.cpp ;

Deleted: sandbox/odeint/libs/numeric/odeint/examples/dnls_stepper_compare.cpp
==============================================================================
--- sandbox/odeint/libs/numeric/odeint/examples/dnls_stepper_compare.cpp 2010-03-11 03:45:30 EST (Thu, 11 Mar 2010)
+++ (empty file)
@@ -1,115 +0,0 @@
-/* Boost numeric/odeint/examples/lorenz_integrator.cpp
-
- Copyright 2009 Karsten Ahnert
- Copyright 2009 Mario Mulansky
-
- compares the steppers rk4 and rk78
- the system is the dnls, which is complex and Hamiltonian
-
- Distributed under the Boost Software License, Version 1.0.
-(See accompanying file LICENSE_1_0.txt or
- copy at http://www.boost.org/LICENSE_1_0.txt)
-*/
-
-#include <iostream>
-#include <vector>
-#include <iterator>
-#include <list>
-#include <algorithm>
-#include <tr1/array>
-
-#include <boost/numeric/odeint.hpp>
-
-#define tab "\t"
-
-using namespace std;
-using namespace std::tr1;
-using namespace boost::numeric::odeint;
-
-
-const size_t n = 64;
-const double beta = 1.0;
-
-typedef array< complex<double> , n > state_type;
-
-const complex<double> II( 0.0 , -1.0 );
-
-void dnls( state_type &x , state_type &dxdt , double t )
-{
- dxdt[0] = II * ( beta * norm( x[0] ) * x[0] + x[1] + x[n-1] );
- for( size_t i=1 ; i<n-1 ; ++i )
- dxdt[i] = II * ( beta * norm( x[i] ) * x[i] + x[i+1] + x[i-1] );
- dxdt[n-1] = II * ( beta * norm( x[n-1] ) * x[n-1] + x[0] + x[n-2] );
-}
-
-double norm( const state_type &x )
-{
- double nn = 0.0;
- state_type::const_iterator iter = x.begin() ;
- while( iter != x.end() ) nn += norm( *iter++ );
- return nn;
-}
-
-double energy( const state_type &x )
-{
- double e = 0.0 , nn;
- for( size_t i=0 ; i<n-1 ; ++i )
- {
- nn = norm( x[i] );
- e += 0.5 * beta * nn * nn + 2.0 * ( x[i]*conj(x[i+1]) ).real();
- }
- nn = norm( x[n-1] );
- e += 0.5 * beta * nn * nn + 2.0 * ( x[n-1]*conj(x[0]) ).real();
- return e;
-}
-
-ostream& operator<<( ostream &out , const state_type &x )
-{
- state_type::const_iterator iter = x.begin() ;
- while( iter != x.end() )
- {
- const complex<double> &y = *iter++;
- out << y.real() << tab << y.imag() << tab << norm( y ) << "\n";
- }
- return out;
-}
-
-int main( int argc , char **argv )
-{
- state_type x;
-
- generate( x.begin() , x.end() , drand48 );
-
- state_type x1( x ) , x2( x );
- stepper_rk4< state_type > rk4;
- stepper_rk78_fehlberg< state_type > rk78;
-
- double norm0 = norm( x1 ) , energy0 = energy( x1 );
-
- const size_t olen = 10000 , ilen = 100;
- const double dt = 0.01;
- double t = 0.0;
- cout.precision(14);
- cout.flags( ios::scientific );
- for( size_t oi=0 ; oi<olen ; ++oi )
- {
- double norm1 = norm( x1 ) , norm2 = norm( x2 );
- double energy1 = energy( x1 ) , energy2 = energy( x2 );
-
- cout << t << tab;
- cout << norm1 << tab << norm2 << tab;
- cout << energy1 << tab << energy2 << tab;
- cout << norm1 - norm0 << tab << norm2 - norm0 << tab;
- cout << energy1 - energy0 << tab << energy2 - energy0 << endl;
-
- for( size_t ii=0 ; ii<ilen ; ++ii,t+=dt )
- {
- rk4.do_step( dnls , x1 , t , dt );
- rk78.do_step( dnls , x2 , t , dt );
- }
- }
-
-
-
- return 0;
-}

Deleted: sandbox/odeint/libs/numeric/odeint/examples/hamiltonian_test.cpp
==============================================================================
--- sandbox/odeint/libs/numeric/odeint/examples/hamiltonian_test.cpp 2010-03-11 03:45:30 EST (Thu, 11 Mar 2010)
+++ (empty file)
@@ -1,67 +0,0 @@
-/* Boost numeric/odeint/examples/lorenz_stepper.cpp
-
- Copyright 2009 Karsten Ahnert
- Copyright 2009 Mario Mulansky
-
- Testing of the Hamiltonian solvers
-
- Furthermore, the usage of std::tr1::array and std::vector in odeint is
- shown and the performance of both containers is compared.
-
- Distributed under the Boost Software License, Version 1.0.
-(See accompanying file LICENSE_1_0.txt or
- copy at http://www.boost.org/LICENSE_1_0.txt)
-*/
-
-#include <iostream>
-#include <vector>
-#include <list>
-#include <tr1/array>
-
-#include <boost/numeric/odeint.hpp>
-
-#define tab "\t"
-
-using namespace std;
-using namespace boost::numeric::odeint;
-
-
-typedef std::tr1::array< double , 1 > state_type;
-
-void harm_osc( state_type& q , state_type &dpdt )
-{
- dpdt[0] = - q[0];
-}
-
-
-
-
-int main( int argc , char **argv )
-{
- const double dt = 0.25;
- const size_t olen = 10000;
-
- state_type q1 = {{ 1.0 }} , p1 = {{ 0.0 }};
- state_type q2 = {{ 1.0 }} , p2 = {{ 0.0 }};
-
- hamiltonian_stepper_euler< state_type > euler;
- hamiltonian_stepper_rk< state_type > rk;
-
- double t = 0.0;
- for( size_t oi=0 ; oi<olen ; ++oi,t+=dt )
- {
- euler.do_step( harm_osc , q1 , p1 , dt );
- rk.do_step( harm_osc , q2 , p2 , dt );
- cout << t << tab << q1[0] << tab << p1[0] << tab;
- cout << q2[0] << tab << p2[0] << "\n";
- }
-
- return 0;
-}
-
-
-
-/*
- Compile with
- g++ -Wall -O3 -I$BOOST_ROOT -I../../../../ lorenz_stepper.cpp
-*/

Modified: sandbox/odeint/libs/numeric/odeint/examples/harmonic_oscillator.cpp
==============================================================================
--- sandbox/odeint/libs/numeric/odeint/examples/harmonic_oscillator.cpp (original)
+++ sandbox/odeint/libs/numeric/odeint/examples/harmonic_oscillator.cpp 2010-03-11 03:45:30 EST (Thu, 11 Mar 2010)
@@ -292,4 +292,3 @@
   return 0;
 }
 #endif
-

Modified: sandbox/odeint/libs/numeric/odeint/examples/pendulum_vibrating_pivot.cpp
==============================================================================
--- sandbox/odeint/libs/numeric/odeint/examples/pendulum_vibrating_pivot.cpp (original)
+++ sandbox/odeint/libs/numeric/odeint/examples/pendulum_vibrating_pivot.cpp 2010-03-11 03:45:30 EST (Thu, 11 Mar 2010)
@@ -55,21 +55,23 @@
     
     stepper_half_step< stepper_rk4< state_type > > stepper;
 
- controlled_stepper_standard< stepper_half_step< stepper_rk4< state_type > > >
- controlled_stepper( 1E-6 , 1E-7 , 1.0 , 1.0 );
+ controlled_stepper_standard
+ < stepper_half_step< stepper_rk4< state_type > >
+ > controlled_stepper( 1E-6 , 1E-7 , 1.0 , 1.0 );
 
     size_t steps = integrate( controlled_stepper, my_system, x,
                               0.0, 100.0,1E-4,
                               back_inserter(times),
                               back_inserter(x_t_vec));
 
- clog << "Steps: " << steps << endl;
+ clog << "Steps: " << steps << endl;
 
     cout.precision(5);
     cout.setf(ios::fixed,ios::floatfield);
     
 
- for( size_t i=0; i<times.size(); i++ ) {
+ for( size_t i=0; i<times.size(); i++ )
+ {
         //cout << "current state: " ;
         cout << times[i] << tab;
         cout << x_t_vec[i][0] << tab << x_t_vec[i][1] << endl;

Added: sandbox/odeint/libs/numeric/odeint/stuff/performance/Jamfile
==============================================================================
--- (empty file)
+++ sandbox/odeint/libs/numeric/odeint/stuff/performance/Jamfile 2010-03-11 03:45:30 EST (Thu, 11 Mar 2010)
@@ -0,0 +1,27 @@
+# Copyright 2009 Karsten Ahnert and Mario Mulansky.
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+
+project
+ : requirements
+ <include>../../../../..
+ <include>$BOOST_ROOT
+ <include>$BLITZ_ROOT
+ <include>$MTL4_ROOT
+ <define>BOOST_ALL_NO_LIB=1
+ : build-dir .
+ ;
+
+lib libgsl : : <name>gsl ;
+lib libgslcblas : : <name>gslcblas ;
+
+exe transform_zip_iterators_cmp
+ : transform_zip_iterators_cmp.cpp ;
+
+exe iterator_algebra_increment_decrement
+ : iterator_algebra_increment_decrement.cpp ;
+
+exe gsl_compare_lorenz :
+ gsl_compare_lorenz.cpp libgsl libgslcblas ;

Copied: sandbox/odeint/libs/numeric/odeint/stuff/performance/gsl_compare_lorenz.cpp (from r60427, /sandbox/odeint/libs/numeric/odeint/stuff/gsl_compare/lorenz_stepper_cmp.cpp)
==============================================================================
--- /sandbox/odeint/libs/numeric/odeint/stuff/gsl_compare/lorenz_stepper_cmp.cpp (original)
+++ sandbox/odeint/libs/numeric/odeint/stuff/performance/gsl_compare_lorenz.cpp 2010-03-11 03:45:30 EST (Thu, 11 Mar 2010)
@@ -112,7 +112,7 @@
     start= clock();
     t = 0.0;
     for( size_t oi=0 ; oi<olen ; ++oi,t+=dt )
- stepper.next_step( lorenz , x1 , t , dt , x1_err );
+ stepper.do_step( lorenz , x1 , t , dt , x1_err );
     end = clock();
     clog << "odeint half step array : " << double ( end - start ) / double( CLOCKS_PER_SEC ) << endl;
 
@@ -122,7 +122,7 @@
     start = clock();
     t = 0.0;
     for( size_t oi=0 ; oi<olen ; ++oi,t+=dt )
- stepper_cash_karp.next_step( lorenz , x1 , t , dt , x1_err );
+ stepper_cash_karp.do_step( lorenz , x1 , t , dt , x1_err );
     end = clock();
     clog << "odeint Cash-Karp array : " << double ( end - start ) / double( CLOCKS_PER_SEC ) << endl;
 
@@ -169,13 +169,13 @@
     t = 0.0;
     for( size_t i=0 ; i<tslen ; ++i,t+=dt )
     {
- stepper.next_step( lorenz , x1 , t , dt , x1_err );
+ stepper.do_step( lorenz , x1 , t , dt , x1_err );
         gsl_odeiv_step_apply ( s , t , dt , x2 , x2_err , 0 , 0 , &sys );
         rk4_lorenz( x3 , 0.5*dt );
         rk4_lorenz( x3 , 0.5*dt );
         cout << t << tab << x1[0] << tab << x2[0] << tab << x3[0] << tab;
         // compare cash-karp methods
- stepper_cash_karp.next_step( lorenz , x_odeint_rkck , t , dt , x1_err );
+ stepper_cash_karp.do_step( lorenz , x_odeint_rkck , t , dt , x1_err );
         gsl_odeiv_step_apply ( s_rkck , t , dt , x_gsl_rkck , x2_err , 0 , 0 , &sys );
         cout << x_odeint_rkck[0] << tab << x_gsl_rkck[0] << endl;
     }

Copied: sandbox/odeint/libs/numeric/odeint/stuff/performance/iterator_algebra_increment_decrement.cpp (from r60427, /sandbox/odeint/libs/numeric/odeint/stuff/iterator_algebra/increment_decrement.cc)
==============================================================================
--- /sandbox/odeint/libs/numeric/odeint/stuff/iterator_algebra/increment_decrement.cc (original)
+++ sandbox/odeint/libs/numeric/odeint/stuff/performance/iterator_algebra_increment_decrement.cpp 2010-03-11 03:45:30 EST (Thu, 11 Mar 2010)
@@ -252,20 +252,3 @@
 
     return 0;
 }
-
-
-/*
-int main( int argc , char **argv )
-{
- const size_t n = 1000000;
- vector<double> eins( n ) , zwei( n ) , drei( n );
- generate( eins.begin() , eins.end() , drand48 );
- generate( zwei.begin() , zwei.end() , drand48 );
- generate( drei.begin() , drei.end() , drand48 );
-
- increment( eins.begin() , eins.end() , zwei.begin() , 0.5*_1 );
- increment( eins.begin() , eins.end() , zwei.begin() , drei.begin() , _1 + 0.5*_2 );
-
- return 0;
-}
-*/

Deleted: sandbox/odeint/libs/numeric/odeint/stuff/transform_cmp.cc
==============================================================================
--- sandbox/odeint/libs/numeric/odeint/stuff/transform_cmp.cc 2010-03-11 03:45:30 EST (Thu, 11 Mar 2010)
+++ (empty file)
@@ -1,222 +0,0 @@
-#include <algorithm>
-#include <vector>
-#include <iostream>
-
-#include <boost/accumulators/accumulators.hpp>
-#include <boost/accumulators/statistics.hpp>
-#include <boost/iterator/zip_iterator.hpp>
-
-#include <boost/timer.hpp>
-
-#define tab "\t"
-
-using namespace std;
-using namespace boost::accumulators;
-
-using boost::make_zip_iterator;
-using boost::make_tuple;
-using boost::tuples::get;
-
-
-
-typedef accumulator_set<
- double , stats< tag::mean , tag::variance >
- > accumulator_type;
-
-typedef boost::timer timer_type;
-
-ostream& operator<<( ostream& out , accumulator_type &acc )
-{
- out << boost::accumulators::mean( acc ) << tab;
-// out << boost::accumulators::variance( acc ) << tab;
- return out;
-}
-
-
-
-// computes y = x1 + alpha2*x2 + alpha3*x3
-template < class Iterator1 , class Iterator2 , class Iterator3 , class T >
-inline void scale_sum( Iterator1 first1 , Iterator1 last1 ,
- T a1 , Iterator2 first2 ,
- T a2 , Iterator3 first3 )
-{
- while( first1 != last1 )
- (*first1++) = a1 * (*first2++) + a2 * (*first3++);
-}
-
-template < class Iterator1 , class Iterator2 , class Iterator3 , class Operator >
-void transform3_1( Iterator1 first1 , Iterator1 last1,
- Iterator2 first2 , Iterator3 first3 ,
- Operator op )
-{
- while( first1 != last1 ) op( *first1++ , *first2++ , *first3++ );
-}
-
-template < class Iterator1 , class Iterator2 , class Iterator3 , class Operator >
-void transform3_2( Iterator1 first1 , Iterator1 last1,
- Iterator2 first2 , Iterator3 first3 ,
- Operator op )
-{
- for( ; first1 != last1 ; ++first1 , ++first2 , ++first3 )
- op( *first1 , *first2 , *first3 );
-}
-
-template < class Iterator1 , class Iterator2 , class Iterator3 , class Operator >
-void transform3_3( Iterator1 first1 , Iterator1 last1,
- Iterator2 first2 , Iterator3 first3 ,
- Operator op )
-{
- while( first1 != last1 )
- {
- op( *first1 , *first2 , *first3 );
- ++first1;
- ++first2;
- ++first3;
- }
-}
-
-struct scale_sum_op
-{
- double a1 , a2;
-
- scale_sum_op( double _a1 , double _a2 )
- : a1( _a1 ) , a2( _a2 ) {}
-
- template< class T >
- void operator()( T &x1 , T &x2 , T &x3 )
- {
- x1 = a1 * x2 + a2 * x3;
- }
-};
-
-struct scale_sum_op_tuple
-{
- double a1 , a2;
- scale_sum_op_tuple( double _a1 , double _a2 )
- : a1( _a1 ) , a2( _a2 ) {}
-
- template< class Tuple >
- void operator()( const Tuple &t ) const
- {
- get<0>(t) = a1 * get<1>(t) + a2 * get<2>(t);
- }
-};
-
-
-int main( int argc , char **argv )
-{
- const size_t n = 1024 * 1024;
- const size_t num_of_iterations = 16;
- double a1 = 0.25 , a2 = 1.25;
-
-
- accumulator_type acc1 , acc2 , acc3 , acc4 , acc5;
- timer_type timer;
-
-
- size_t count = 0;
- clog.precision(4);
- while( true )
- {
- vector< double > org1( n ) , org2( n ) , org3( n );
- generate( org1.begin() , org1.end() , drand48 );
- generate( org2.begin() , org2.end() , drand48 );
- generate( org3.begin() , org3.end() , drand48 );
-
- vector< double > v1( org1 ) , v2( org2 ) , v3( org3 );
- vector< double > w1( org1 ) , w2( org2 ) , w3( org3 );
- vector< double > u1( org1 ) , u2( org2 ) , u3( org3 );
- vector< double > x1( org1 ) , x2( org2 ) , x3( org3 );
-
- timer.restart();
- for( size_t i=0 ; i<num_of_iterations ; ++i )
- scale_sum( v1.begin() , v1.end() , a1 , v2.begin() , a2 , v3.begin() );
- double res1 = accumulate( v1.begin() , v1.end() , 0.0 );
- acc1( timer.elapsed() );
-
- timer.restart();
- for( size_t i=0 ; i<num_of_iterations ; ++i )
- transform3_1( w1.begin() , w1.end() , w2.begin() , w3.begin() ,
- scale_sum_op( a1 , a2 ) );
- double res2 = accumulate( w1.begin() , w1.end() , 0.0 );
- acc2( timer.elapsed() );
-
-
- timer.restart();
- for( size_t i=0 ; i<num_of_iterations ; ++i )
- std::for_each(
- make_zip_iterator( make_tuple( u1.begin() , u2.begin() , u3.begin() ) ) ,
- make_zip_iterator( make_tuple( u1.end() , u2.end() , u3.end() ) ) ,
- scale_sum_op_tuple( a1 , a2 )
- );
- double res3 = accumulate( u1.begin() , u1.end() , 0.0 );
- acc3( timer.elapsed() );
-
- timer.restart();
- for( size_t i=0 ; i<num_of_iterations ; ++i )
- transform3_2( x1.begin() , x1.end() , x2.begin() , x3.begin() ,
- scale_sum_op( a1 , a2 ) );
- double res4 = accumulate( x1.begin() , x1.end() , 0.0 );
- acc4( timer.elapsed() );
-
- timer.restart();
- for( size_t i=0 ; i<num_of_iterations ; ++i )
- transform3_3( x1.begin() , x1.end() , x2.begin() , x3.begin() ,
- scale_sum_op( a1 , a2 ) );
- double res5 = accumulate( x1.begin() , x1.end() , 0.0 );
- acc5( timer.elapsed() );
-
- if( ( res1 != res2 ) ||
- ( res2 != res3 ) ||
- ( res3 != res4 ) ||
- ( res4 != res5 ) )
- clog << "error" << endl;
-
- ++count;
-
- clog << count << tab;
- clog << acc1 << tab;
- clog << acc2 << tab;
- clog << acc3 << tab;
- clog << acc4 << tab;
- clog << acc5 << tab;
-/* clog << tab;
- clog << res1 << tab;
- clog << res2 << tab;
- clog << res3 << tab;
- clog << res4 << tab;
- clog << res5 << tab;*/
-
- clog << endl;
- }
-
- return 0;
-}
-
-
-
-
-
-
-/*
- Results, average time in
-
- scale_sum transform3_1 for_each(zip_iterator) transform3_2 transform3_3
-
- kink with gcc-4.2
-
- 0.153 0.1521 0.151 0.1483 0.1472
-
- photon with gcc-4.4, kann verfaelscht sein, weil viel laeuft
-
- 0.163 0.1606 0.1646 0.1696 0.1694
-
- quark with gcc-4.4, kann verfaelscht sein
-
- 0.1574 0.1629 0.1686 0.1731 0.1732
-
- at home with gcc-4.4
-
- 0.1004 0.1001 0.1021 0.1009 0.1009
-*/
-

Modified: sandbox/odeint/libs/numeric/odeint/test/check_stepper_concepts.cpp
==============================================================================
--- sandbox/odeint/libs/numeric/odeint/test/check_stepper_concepts.cpp (original)
+++ sandbox/odeint/libs/numeric/odeint/test/check_stepper_concepts.cpp 2010-03-11 03:45:30 EST (Thu, 11 Mar 2010)
@@ -23,6 +23,8 @@
 #include <boost/numeric/odeint/stepper_rk5_ck.hpp>
 #include <boost/numeric/odeint/stepper_rk78_fehlberg.hpp>
 
+#include <boost/numeric/odeint/controlled_stepper_standard.hpp>
+
 using namespace boost::unit_test;
 using namespace boost::numeric::odeint;
 
@@ -110,6 +112,28 @@
 
 
 
+template< class ControlledErrorStepper >
+void check_controlled_stepper_concept(
+ ControlledErrorStepper &stepper
+ )
+{
+ typedef ControlledErrorStepper stepper_type;
+ typedef typename stepper_type::container_type container_type;
+ typedef typename stepper_type::traits_type traits_type;
+ typedef typename stepper_type::value_type value_type;
+ typedef typename stepper_type::order_type order_type;
+ typedef typename stepper_type::time_type time_type;
+
+// constant_system< container_type > con;
+
+ container_type x( 1 , 0.0 );
+ stepper.adjust_size( x );
+}
+
+
+
+
+
 void test_euler_concept()
 {
     stepper_euler< std::vector<double> > stepper;
@@ -159,6 +183,15 @@
     check_error_stepper_concept( stepper , 7 , 8 );
 }
 
+void test_controlled_stepper_standard_concept()
+{
+ typedef stepper_rk5_ck< std::vector< double > > stepper_type;
+ typedef controlled_stepper_standard< stepper_type > controlled_stepper_type;
+
+ controlled_stepper_type stepper( 1.0 , 1.0 , 1.0 , 1.0 );
+ check_controlled_stepper_concept( stepper );
+}
+
 
 
 
@@ -173,6 +206,7 @@
     test->add( BOOST_TEST_CASE( &test_rk4_concept ) );
     test->add( BOOST_TEST_CASE( &test_rk5_ck_concept ) );
     test->add( BOOST_TEST_CASE( &test_rk78_fehlberg_concept ) );
+ test->add( BOOST_TEST_CASE( &test_controlled_stepper_standard_concept ) );
 
     return test;
 }


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