Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81491 - in trunk: boost/numeric/odeint boost/numeric/odeint/algebra boost/numeric/odeint/algebra/detail boost/numeric/odeint/external boost/numeric/odeint/external/gsl boost/numeric/odeint/external/mkl boost/numeric/odeint/external/mtl4 boost/numeric/odeint/external/thrust boost/numeric/odeint/external/vexcl boost/numeric/odeint/external/viennacl boost/numeric/odeint/integrate boost/numeric/odeint/integrate/detail boost/numeric/odeint/iterator boost/numeric/odeint/iterator/detail boost/numeric/odeint/stepper boost/numeric/odeint/stepper/base boost/numeric/odeint/stepper/detail boost/numeric/odeint/stepper/generation boost/numeric/odeint/util boost/numeric/odeint/util/detail libs/numeric/odeint libs/numeric/odeint/doc libs/numeric/odeint/doc/concepts libs/numeric/odeint/doc/html libs/numeric/odeint/examples libs/numeric/odeint/examples/2d_lattice libs/numeric/odeint/examples/gmpxx libs/numeric/odeint/examples/mtl libs/numeric/odeint/examples/quadmath libs/numeric/odeint/examples/thrust libs/numeric/odeint/examples/ublas libs/numeric/odeint/examples/vexcl libs/numeric/odeint/performance libs/numeric/odeint/test libs/numeric/odeint/test/numeric libs/numeric/odeint/test_external libs/numeric/odeint/test_external/gmp libs/numeric/odeint/test_external/gsl libs/numeric/odeint/test_external/mkl libs/numeric/odeint/test_external/mtl4 libs/numeric/odeint/test_external/thrust libs/numeric/odeint/test_external/vexcl status
From: karsten.ahnert_at_[hidden]
Date: 2012-11-23 09:22:51


Author: karsten
Date: 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
New Revision: 81491
URL: http://svn.boost.org/trac/boost/changeset/81491

Log:
initial odeint commit
Added:
   trunk/boost/numeric/odeint/
   trunk/boost/numeric/odeint/algebra/
   trunk/boost/numeric/odeint/algebra/array_algebra.hpp (contents, props changed)
   trunk/boost/numeric/odeint/algebra/default_operations.hpp (contents, props changed)
   trunk/boost/numeric/odeint/algebra/detail/
   trunk/boost/numeric/odeint/algebra/detail/for_each.hpp (contents, props changed)
   trunk/boost/numeric/odeint/algebra/detail/macros.hpp (contents, props changed)
   trunk/boost/numeric/odeint/algebra/detail/reduce.hpp (contents, props changed)
   trunk/boost/numeric/odeint/algebra/fusion_algebra.hpp (contents, props changed)
   trunk/boost/numeric/odeint/algebra/range_algebra.hpp (contents, props changed)
   trunk/boost/numeric/odeint/algebra/vector_space_algebra.hpp (contents, props changed)
   trunk/boost/numeric/odeint/config.hpp (contents, props changed)
   trunk/boost/numeric/odeint/external/
   trunk/boost/numeric/odeint/external/gsl/
   trunk/boost/numeric/odeint/external/gsl/gsl_wrapper.hpp (contents, props changed)
   trunk/boost/numeric/odeint/external/mkl/
   trunk/boost/numeric/odeint/external/mkl/mkl_operations.hpp (contents, props changed)
   trunk/boost/numeric/odeint/external/mtl4/
   trunk/boost/numeric/odeint/external/mtl4/implicit_euler_mtl4.hpp (contents, props changed)
   trunk/boost/numeric/odeint/external/mtl4/mtl4_resize.hpp (contents, props changed)
   trunk/boost/numeric/odeint/external/thrust/
   trunk/boost/numeric/odeint/external/thrust/thrust_algebra.hpp (contents, props changed)
   trunk/boost/numeric/odeint/external/thrust/thrust_operations.hpp (contents, props changed)
   trunk/boost/numeric/odeint/external/thrust/thrust_resize.hpp (contents, props changed)
   trunk/boost/numeric/odeint/external/vexcl/
   trunk/boost/numeric/odeint/external/vexcl/vexcl_resize.hpp (contents, props changed)
   trunk/boost/numeric/odeint/external/viennacl/
   trunk/boost/numeric/odeint/external/viennacl/viennacl_operations.hpp (contents, props changed)
   trunk/boost/numeric/odeint/external/viennacl/viennacl_resize.hpp (contents, props changed)
   trunk/boost/numeric/odeint/integrate/
   trunk/boost/numeric/odeint/integrate/detail/
   trunk/boost/numeric/odeint/integrate/detail/integrate_adaptive.hpp (contents, props changed)
   trunk/boost/numeric/odeint/integrate/detail/integrate_const.hpp (contents, props changed)
   trunk/boost/numeric/odeint/integrate/detail/integrate_n_steps.hpp (contents, props changed)
   trunk/boost/numeric/odeint/integrate/detail/integrate_times.hpp (contents, props changed)
   trunk/boost/numeric/odeint/integrate/integrate.hpp (contents, props changed)
   trunk/boost/numeric/odeint/integrate/integrate_adaptive.hpp (contents, props changed)
   trunk/boost/numeric/odeint/integrate/integrate_const.hpp (contents, props changed)
   trunk/boost/numeric/odeint/integrate/integrate_n_steps.hpp (contents, props changed)
   trunk/boost/numeric/odeint/integrate/integrate_times.hpp (contents, props changed)
   trunk/boost/numeric/odeint/integrate/null_observer.hpp (contents, props changed)
   trunk/boost/numeric/odeint/integrate/observer_collection.hpp (contents, props changed)
   trunk/boost/numeric/odeint/iterator/
   trunk/boost/numeric/odeint/iterator/adaptive_iterator.hpp (contents, props changed)
   trunk/boost/numeric/odeint/iterator/adaptive_time_iterator.hpp (contents, props changed)
   trunk/boost/numeric/odeint/iterator/const_step_iterator.hpp (contents, props changed)
   trunk/boost/numeric/odeint/iterator/const_step_time_iterator.hpp (contents, props changed)
   trunk/boost/numeric/odeint/iterator/detail/
   trunk/boost/numeric/odeint/iterator/detail/ode_iterator_base.hpp (contents, props changed)
   trunk/boost/numeric/odeint/iterator/detail/ode_time_iterator_base.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/
   trunk/boost/numeric/odeint/stepper/adams_bashforth.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/adams_bashforth_moulton.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/adams_moulton.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/base/
   trunk/boost/numeric/odeint/stepper/base/algebra_stepper_base.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/base/explicit_error_stepper_base.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/base/explicit_error_stepper_fsal_base.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/base/symplectic_rkn_stepper_base.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/bulirsch_stoer.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/bulirsch_stoer_dense_out.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/controlled_runge_kutta.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/controlled_step_result.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/dense_output_runge_kutta.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/detail/
   trunk/boost/numeric/odeint/stepper/detail/adams_bashforth_call_algebra.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/detail/adams_bashforth_coefficients.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/detail/adams_moulton_call_algebra.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/detail/adams_moulton_coefficients.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/detail/generic_rk_algorithm.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/detail/generic_rk_call_algebra.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/detail/generic_rk_operations.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/detail/rotating_buffer.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/euler.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/explicit_error_generic_rk.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/explicit_generic_rk.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/generation/
   trunk/boost/numeric/odeint/stepper/generation.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/generation/generation_controlled_runge_kutta.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/generation/generation_dense_output_runge_kutta.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/generation/generation_rosenbrock4.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/generation/generation_runge_kutta_cash_karp54.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/generation/generation_runge_kutta_cash_karp54_classic.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/generation/generation_runge_kutta_dopri5.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/generation/generation_runge_kutta_fehlberg78.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/generation/make_controlled.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/generation/make_dense_output.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/implicit_euler.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/modified_midpoint.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/rosenbrock4.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/rosenbrock4_controller.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/rosenbrock4_dense_output.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/runge_kutta4.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/runge_kutta4_classic.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/runge_kutta_cash_karp54.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/runge_kutta_cash_karp54_classic.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/runge_kutta_dopri5.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/runge_kutta_fehlberg78.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/stepper_categories.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/symplectic_euler.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/symplectic_rkn_sb3a_m4_mclachlan.hpp (contents, props changed)
   trunk/boost/numeric/odeint/stepper/symplectic_rkn_sb3a_mclachlan.hpp (contents, props changed)
   trunk/boost/numeric/odeint/util/
   trunk/boost/numeric/odeint/util/bind.hpp (contents, props changed)
   trunk/boost/numeric/odeint/util/copy.hpp (contents, props changed)
   trunk/boost/numeric/odeint/util/detail/
   trunk/boost/numeric/odeint/util/detail/is_range.hpp (contents, props changed)
   trunk/boost/numeric/odeint/util/detail/less_with_sign.hpp (contents, props changed)
   trunk/boost/numeric/odeint/util/is_pair.hpp (contents, props changed)
   trunk/boost/numeric/odeint/util/is_resizeable.hpp (contents, props changed)
   trunk/boost/numeric/odeint/util/resize.hpp (contents, props changed)
   trunk/boost/numeric/odeint/util/resizer.hpp (contents, props changed)
   trunk/boost/numeric/odeint/util/same_instance.hpp (contents, props changed)
   trunk/boost/numeric/odeint/util/same_size.hpp (contents, props changed)
   trunk/boost/numeric/odeint/util/state_wrapper.hpp (contents, props changed)
   trunk/boost/numeric/odeint/util/ublas_wrapper.hpp (contents, props changed)
   trunk/boost/numeric/odeint/util/unit_helper.hpp (contents, props changed)
   trunk/boost/numeric/odeint/util/unwrap_reference.hpp (contents, props changed)
   trunk/boost/numeric/odeint/version.hpp (contents, props changed)
   trunk/libs/numeric/odeint/
   trunk/libs/numeric/odeint/doc/
   trunk/libs/numeric/odeint/doc/Jamfile.v2 (contents, props changed)
   trunk/libs/numeric/odeint/doc/acknowledgements.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/concepts/
   trunk/libs/numeric/odeint/doc/concepts.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/concepts/controlled_stepper.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/concepts/dense_output_stepper.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/concepts/error_stepper.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/concepts/implicit_system.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/concepts/state_algebra_operations.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/concepts/state_wrapper.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/concepts/stepper.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/concepts/symplectic_system.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/concepts/system.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/controlled_stepper_table.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/details.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/details_bind_member_functions.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/details_boost_range.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/details_boost_ref.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/details_generation_functions.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/details_integrate_functions.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/details_iterators.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/details_state_types_algebras_operations.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/details_steppers.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/examples_table.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/getting_started.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/html/
   trunk/libs/numeric/odeint/doc/html/logo.jpg (contents, props changed)
   trunk/libs/numeric/odeint/doc/html/phase_lattice_2d_0000.jpg (contents, props changed)
   trunk/libs/numeric/odeint/doc/html/phase_lattice_2d_0100.jpg (contents, props changed)
   trunk/libs/numeric/odeint/doc/html/phase_lattice_2d_1000.jpg (contents, props changed)
   trunk/libs/numeric/odeint/doc/html/solar_system.jpg (contents, props changed)
   trunk/libs/numeric/odeint/doc/literature.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/make_controlled_table.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/make_dense_output_table.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/odeint.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/range_table.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/stepper_table.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/tutorial.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/tutorial_chaotic_system.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/tutorial_harmonic_oscillator.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/tutorial_solar_system.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/tutorial_special_topics.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/tutorial_stiff_systems.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/tutorial_thrust_cuda.qbk (contents, props changed)
   trunk/libs/numeric/odeint/doc/tutorial_vexcl_opencl.qbk (contents, props changed)
   trunk/libs/numeric/odeint/examples/
   trunk/libs/numeric/odeint/examples/2d_lattice/
   trunk/libs/numeric/odeint/examples/2d_lattice/Jamfile.v2 (contents, props changed)
   trunk/libs/numeric/odeint/examples/2d_lattice/lattice2d.hpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/2d_lattice/nested_range_algebra.hpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/2d_lattice/spreading.cpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/2d_lattice/vector_vector_resize.hpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/Jamfile.v2 (contents, props changed)
   trunk/libs/numeric/odeint/examples/adaptive_iterator.cpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/bind_member_functions.cpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/bind_member_functions_cpp11.cpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/bulirsch_stoer.cpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/chaotic_system.cpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/const_step_iterator.cpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/elliptic.py (contents, props changed)
   trunk/libs/numeric/odeint/examples/elliptic_functions.cpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/fpu.cpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/generation_functions.cpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/gmpxx/
   trunk/libs/numeric/odeint/examples/gmpxx/Jamfile (contents, props changed)
   trunk/libs/numeric/odeint/examples/gmpxx/lorenz_gmpxx.cpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/gram_schmidt.hpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/harmonic_oscillator.cpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/harmonic_oscillator_units.cpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/heun.cpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/list_lattice.cpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/lorenz_point.cpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/mtl/
   trunk/libs/numeric/odeint/examples/mtl/Jamfile.v2 (contents, props changed)
   trunk/libs/numeric/odeint/examples/mtl/gauss_packet.cpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/mtl/implicit_euler_mtl.cpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/my_vector.cpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/phase_oscillator_ensemble.cpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/point_type.hpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/quadmath/
   trunk/libs/numeric/odeint/examples/quadmath/Jamfile.v2 (contents, props changed)
   trunk/libs/numeric/odeint/examples/quadmath/black_hole.cpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/resizing_lattice.cpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/simple1d.cpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/solar_system.agr (contents, props changed)
   trunk/libs/numeric/odeint/examples/solar_system.cpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/stepper_details.cpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/stiff_system.cpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/stochastic_euler.cpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/stuart_landau.cpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/thrust/
   trunk/libs/numeric/odeint/examples/thrust/Makefile (contents, props changed)
   trunk/libs/numeric/odeint/examples/thrust/lorenz_parameters.cu (contents, props changed)
   trunk/libs/numeric/odeint/examples/thrust/phase_oscillator_chain.cu (contents, props changed)
   trunk/libs/numeric/odeint/examples/thrust/phase_oscillator_ensemble.cu (contents, props changed)
   trunk/libs/numeric/odeint/examples/thrust/relaxation.cu (contents, props changed)
   trunk/libs/numeric/odeint/examples/two_dimensional_phase_lattice.cpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/ublas/
   trunk/libs/numeric/odeint/examples/ublas/Jamfile.v2 (contents, props changed)
   trunk/libs/numeric/odeint/examples/ublas/lorenz_ublas.cpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/van_der_pol_stiff.cpp (contents, props changed)
   trunk/libs/numeric/odeint/examples/vexcl/
   trunk/libs/numeric/odeint/examples/vexcl/Jamfile.v2 (contents, props changed)
   trunk/libs/numeric/odeint/examples/vexcl/lorenz_ensemble.cpp (contents, props changed)
   trunk/libs/numeric/odeint/performance/
   trunk/libs/numeric/odeint/performance/Jamfile.v2 (contents, props changed)
   trunk/libs/numeric/odeint/performance/const_step_iterator.cpp (contents, props changed)
   trunk/libs/numeric/odeint/performance/fusion_algebra.hpp (contents, props changed)
   trunk/libs/numeric/odeint/performance/fusion_explicit_error_rk.hpp (contents, props changed)
   trunk/libs/numeric/odeint/performance/fusion_explicit_rk_new.hpp (contents, props changed)
   trunk/libs/numeric/odeint/performance/generic_odeint_rk4_lorenz.cpp (contents, props changed)
   trunk/libs/numeric/odeint/performance/gsl_rk4_lorenz.cpp (contents, props changed)
   trunk/libs/numeric/odeint/performance/lorenz.hpp (contents, props changed)
   trunk/libs/numeric/odeint/performance/lorenz_gsl.hpp (contents, props changed)
   trunk/libs/numeric/odeint/performance/nr_rk4_lorenz.cpp (contents, props changed)
   trunk/libs/numeric/odeint/performance/nr_rk4_phase_lattice.cpp (contents, props changed)
   trunk/libs/numeric/odeint/performance/odeint_rk4_lorenz_array.cpp (contents, props changed)
   trunk/libs/numeric/odeint/performance/odeint_rk4_lorenz_range.cpp (contents, props changed)
   trunk/libs/numeric/odeint/performance/odeint_rk4_phase_lattice.cpp (contents, props changed)
   trunk/libs/numeric/odeint/performance/odeint_rk4_phase_lattice_mkl.cpp (contents, props changed)
   trunk/libs/numeric/odeint/performance/performance.py (contents, props changed)
   trunk/libs/numeric/odeint/performance/phase_lattice.hpp (contents, props changed)
   trunk/libs/numeric/odeint/performance/phase_lattice_mkl.hpp (contents, props changed)
   trunk/libs/numeric/odeint/performance/plot_result.py (contents, props changed)
   trunk/libs/numeric/odeint/performance/rk4_lorenz.f (contents, props changed)
   trunk/libs/numeric/odeint/performance/rk_performance_test_case.hpp (contents, props changed)
   trunk/libs/numeric/odeint/performance/rt_algebra.hpp (contents, props changed)
   trunk/libs/numeric/odeint/performance/rt_explicit_rk.hpp (contents, props changed)
   trunk/libs/numeric/odeint/performance/rt_generic_rk4_lorenz.cpp (contents, props changed)
   trunk/libs/numeric/odeint/performance/rt_generic_rk4_phase_lattice.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/
   trunk/libs/numeric/odeint/test/Jamfile.v2 (contents, props changed)
   trunk/libs/numeric/odeint/test/adams_bashforth.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/adams_bashforth_moulton.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/adams_moulton.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/adaptive_iterator.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/adaptive_time_iterator.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/boost_units_helpers.hpp (contents, props changed)
   trunk/libs/numeric/odeint/test/bulirsch_stoer.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/const_range.hpp (contents, props changed)
   trunk/libs/numeric/odeint/test/const_step_iterator.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/const_step_time_iterator.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/default_operations.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/diagnostic_state_type.hpp (contents, props changed)
   trunk/libs/numeric/odeint/test/dummy_odes.hpp (contents, props changed)
   trunk/libs/numeric/odeint/test/dummy_steppers.hpp (contents, props changed)
   trunk/libs/numeric/odeint/test/euler_stepper.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/fusion_algebra.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/generation.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/generic_error_stepper.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/generic_stepper.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/implicit_euler.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/integrate.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/integrate_implicit.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/integrate_times.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/is_pair.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/is_resizeable.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/numeric/
   trunk/libs/numeric/odeint/test/numeric/Jamfile.v2 (contents, props changed)
   trunk/libs/numeric/odeint/test/numeric/rosenbrock.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/numeric/runge_kutta.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/numeric/symplectic.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/prepare_stepper_testing.hpp (contents, props changed)
   trunk/libs/numeric/odeint/test/range_algebra.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/resize.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/resizing.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/rosenbrock4.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/runge_kutta_concepts.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/runge_kutta_controlled_concepts.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/runge_kutta_error_concepts.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/same_size.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/stepper_copying.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/stepper_with_ranges.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/stepper_with_units.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/symplectic_steppers.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/trivial_state.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test/vector_space_1d.hpp (contents, props changed)
   trunk/libs/numeric/odeint/test_external/
   trunk/libs/numeric/odeint/test_external/gmp/
   trunk/libs/numeric/odeint/test_external/gmp/Jamfile.v2 (contents, props changed)
   trunk/libs/numeric/odeint/test_external/gmp/check_gmp.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test_external/gsl/
   trunk/libs/numeric/odeint/test_external/gsl/Jamfile.v2 (contents, props changed)
   trunk/libs/numeric/odeint/test_external/gsl/check_gsl.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test_external/mkl/
   trunk/libs/numeric/odeint/test_external/mkl/Jamfile.v2 (contents, props changed)
   trunk/libs/numeric/odeint/test_external/mkl/check_mkl.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test_external/mtl4/
   trunk/libs/numeric/odeint/test_external/mtl4/Jamfile.v2 (contents, props changed)
   trunk/libs/numeric/odeint/test_external/mtl4/mtl4_resize.cpp (contents, props changed)
   trunk/libs/numeric/odeint/test_external/thrust/
   trunk/libs/numeric/odeint/test_external/thrust/Makefile (contents, props changed)
   trunk/libs/numeric/odeint/test_external/thrust/check_thrust.cu (contents, props changed)
   trunk/libs/numeric/odeint/test_external/vexcl/
   trunk/libs/numeric/odeint/test_external/vexcl/Jamfile.v2 (contents, props changed)
   trunk/libs/numeric/odeint/test_external/vexcl/lorenz.cpp (contents, props changed)
Text files modified:
   trunk/status/Jamfile.v2 | 1 +
   1 files changed, 1 insertions(+), 0 deletions(-)

Added: trunk/boost/numeric/odeint/algebra/array_algebra.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/algebra/array_algebra.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,265 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/algebra/array_algebra.hpp
+
+ [begin_description]
+ Algebra for boost::array. Highly specialized for odeint. Const arguments are introduce to work with odeint.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_ALGEBRA_ARRAY_ALGEBRA_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_ALGEBRA_ARRAY_ALGEBRA_HPP_INCLUDED
+
+#include <boost/array.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+struct array_algebra
+{
+ template< typename T , size_t dim , class Op >
+ static void for_each1( boost::array< T , dim > &s1 , Op op )
+ {
+ for( size_t i=0 ; i<dim ; ++i )
+ op( s1[i] );
+ }
+
+
+ template< typename T1 , typename T2 , size_t dim , class Op >
+ static void for_each2( boost::array< T1 , dim > &s1 ,
+ const boost::array< T2 , dim > &s2 , Op op )
+ {
+ for( size_t i=0 ; i<dim ; ++i )
+ op( s1[i] , s2[i] );
+ }
+
+ template< typename T , size_t dim , class Op >
+ static void for_each3( boost::array< T , dim > &s1 ,
+ const boost::array< T , dim > &s2 ,
+ const boost::array< T , dim > &s3 , Op op )
+ {
+ for( size_t i=0 ; i<dim ; ++i )
+ op( s1[i] , s2[i] , s3[i] );
+ }
+
+ /* different const signature - required for the scale_sum_swap2 operation */
+ template< typename T , size_t dim , class Op >
+ static void for_each3( boost::array< T , dim > &s1 ,
+ boost::array< T , dim > &s2 ,
+ const boost::array< T , dim > &s3 , Op op )
+ {
+ for( size_t i=0 ; i<dim ; ++i )
+ op( s1[i] , s2[i] , s3[i] );
+ }
+
+ template< typename T , size_t dim , class Op >
+ static void for_each4( boost::array< T , dim > &s1 ,
+ const boost::array< T , dim > &s2 ,
+ const boost::array< T , dim > &s3 ,
+ const boost::array< T , dim > &s4 , Op op )
+ {
+ for( size_t i=0 ; i<dim ; ++i )
+ op( s1[i] , s2[i] , s3[i] , s4[i] );
+ }
+
+ template< typename T , size_t dim , class Op >
+ static void for_each5( boost::array< T , dim > &s1 ,
+ const boost::array< T , dim > &s2 ,
+ const boost::array< T , dim > &s3 ,
+ const boost::array< T , dim > &s4 ,
+ const boost::array< T , dim > &s5 , Op op )
+ {
+ for( size_t i=0 ; i<dim ; ++i )
+ op( s1[i] , s2[i] , s3[i] , s4[i] , s5[i] );
+ }
+
+ template< typename T , size_t dim , class Op >
+ static void for_each6( boost::array< T , dim > &s1 ,
+ const boost::array< T , dim > &s2 ,
+ const boost::array< T , dim > &s3 ,
+ const boost::array< T , dim > &s4 ,
+ const boost::array< T , dim > &s5 ,
+ const boost::array< T , dim > &s6 , Op op )
+ {
+ for( size_t i=0 ; i<dim ; ++i )
+ op( s1[i] , s2[i] , s3[i] , s4[i] , s5[i] , s6[i] );
+ }
+
+ template< typename T , size_t dim , class Op >
+ static void for_each7( boost::array< T , dim > &s1 ,
+ const boost::array< T , dim > &s2 ,
+ const boost::array< T , dim > &s3 ,
+ const boost::array< T , dim > &s4 ,
+ const boost::array< T , dim > &s5 ,
+ const boost::array< T , dim > &s6 ,
+ const boost::array< T , dim > &s7 , Op op )
+ {
+ for( size_t i=0 ; i<dim ; ++i )
+ op( s1[i] , s2[i] , s3[i] , s4[i] , s5[i] , s6[i] , s7[i] );
+ }
+
+ template< typename T , size_t dim , class Op >
+ static void for_each8( boost::array< T , dim > &s1 ,
+ const boost::array< T , dim > &s2 ,
+ const boost::array< T , dim > &s3 ,
+ const boost::array< T , dim > &s4 ,
+ const boost::array< T , dim > &s5 ,
+ const boost::array< T , dim > &s6 ,
+ const boost::array< T , dim > &s7 ,
+ const boost::array< T , dim > &s8 , Op op )
+ {
+ for( size_t i=0 ; i<dim ; ++i )
+ op( s1[i] , s2[i] , s3[i] , s4[i] , s5[i] , s6[i] , s7[i] , s8[i] );
+ }
+
+ template< typename T , size_t dim , class Op >
+ static void for_each9( boost::array< T , dim > &s1 ,
+ const boost::array< T , dim > &s2 ,
+ const boost::array< T , dim > &s3 ,
+ const boost::array< T , dim > &s4 ,
+ const boost::array< T , dim > &s5 ,
+ const boost::array< T , dim > &s6 ,
+ const boost::array< T , dim > &s7 ,
+ const boost::array< T , dim > &s8 ,
+ const boost::array< T , dim > &s9 , Op op )
+ {
+ for( size_t i=0 ; i<dim ; ++i )
+ op( s1[i] , s2[i] , s3[i] , s4[i] , s5[i] , s6[i] , s7[i] , s8[i] , s9[i] );
+ }
+
+ template< typename T , size_t dim , class Op >
+ static void for_each10( boost::array< T , dim > &s1 ,
+ const boost::array< T , dim > &s2 ,
+ const boost::array< T , dim > &s3 ,
+ const boost::array< T , dim > &s4 ,
+ const boost::array< T , dim > &s5 ,
+ const boost::array< T , dim > &s6 ,
+ const boost::array< T , dim > &s7 ,
+ const boost::array< T , dim > &s8 ,
+ const boost::array< T , dim > &s9 ,
+ const boost::array< T , dim > &s10 , Op op )
+ {
+ for( size_t i=0 ; i<dim ; ++i )
+ op( s1[i] , s2[i] , s3[i] , s4[i] , s5[i] , s6[i] , s7[i] , s8[i] , s9[i] , s10[i] );
+ }
+
+ template< typename T , size_t dim , class Op >
+ static void for_each11( boost::array< T , dim > &s1 ,
+ const boost::array< T , dim > &s2 ,
+ const boost::array< T , dim > &s3 ,
+ const boost::array< T , dim > &s4 ,
+ const boost::array< T , dim > &s5 ,
+ const boost::array< T , dim > &s6 ,
+ const boost::array< T , dim > &s7 ,
+ const boost::array< T , dim > &s8 ,
+ const boost::array< T , dim > &s9 ,
+ const boost::array< T , dim > &s10 ,
+ const boost::array< T , dim > &s11 , Op op )
+ {
+ for( size_t i=0 ; i<dim ; ++i )
+ op( s1[i] , s2[i] , s3[i] , s4[i] , s5[i] , s6[i] , s7[i] , s8[i] , s9[i] , s10[i] , s11[i] );
+ }
+
+ template< typename T , size_t dim , class Op >
+ static void for_each12( boost::array< T , dim > &s1 ,
+ const boost::array< T , dim > &s2 ,
+ const boost::array< T , dim > &s3 ,
+ const boost::array< T , dim > &s4 ,
+ const boost::array< T , dim > &s5 ,
+ const boost::array< T , dim > &s6 ,
+ const boost::array< T , dim > &s7 ,
+ const boost::array< T , dim > &s8 ,
+ const boost::array< T , dim > &s9 ,
+ const boost::array< T , dim > &s10 ,
+ const boost::array< T , dim > &s11 ,
+ const boost::array< T , dim > &s12 , Op op )
+ {
+ for( size_t i=0 ; i<dim ; ++i )
+ op( s1[i] , s2[i] , s3[i] , s4[i] , s5[i] , s6[i] , s7[i] , s8[i] , s9[i] , s10[i] , s11[i] , s12[i] );
+ }
+
+ template< typename T , size_t dim , class Op >
+ static void for_each13( boost::array< T , dim > &s1 ,
+ const boost::array< T , dim > &s2 ,
+ const boost::array< T , dim > &s3 ,
+ const boost::array< T , dim > &s4 ,
+ const boost::array< T , dim > &s5 ,
+ const boost::array< T , dim > &s6 ,
+ const boost::array< T , dim > &s7 ,
+ const boost::array< T , dim > &s8 ,
+ const boost::array< T , dim > &s9 ,
+ const boost::array< T , dim > &s10 ,
+ const boost::array< T , dim > &s11 ,
+ const boost::array< T , dim > &s12 ,
+ const boost::array< T , dim > &s13 , Op op )
+ {
+ for( size_t i=0 ; i<dim ; ++i )
+ op( s1[i] , s2[i] , s3[i] , s4[i] , s5[i] , s6[i] , s7[i] , s8[i] , s9[i] , s10[i] , s11[i] , s12[i] , s13[i] );
+ }
+
+ template< typename T , size_t dim , class Op >
+ static void for_each14( boost::array< T , dim > &s1 ,
+ const boost::array< T , dim > &s2 ,
+ const boost::array< T , dim > &s3 ,
+ const boost::array< T , dim > &s4 ,
+ const boost::array< T , dim > &s5 ,
+ const boost::array< T , dim > &s6 ,
+ const boost::array< T , dim > &s7 ,
+ const boost::array< T , dim > &s8 ,
+ const boost::array< T , dim > &s9 ,
+ const boost::array< T , dim > &s10 ,
+ const boost::array< T , dim > &s11 ,
+ const boost::array< T , dim > &s12 ,
+ const boost::array< T , dim > &s13 ,
+ const boost::array< T , dim > &s14 , Op op )
+ {
+ for( size_t i=0 ; i<dim ; ++i )
+ op( s1[i] , s2[i] , s3[i] , s4[i] , s5[i] , s6[i] , s7[i] , s8[i] , s9[i] , s10[i] , s11[i] , s12[i] , s13[i] , s14[i] );
+ }
+
+ template< typename T , size_t dim , class Op >
+ static void for_each15( boost::array< T , dim > &s1 ,
+ const boost::array< T , dim > &s2 ,
+ const boost::array< T , dim > &s3 ,
+ const boost::array< T , dim > &s4 ,
+ const boost::array< T , dim > &s5 ,
+ const boost::array< T , dim > &s6 ,
+ const boost::array< T , dim > &s7 ,
+ const boost::array< T , dim > &s8 ,
+ const boost::array< T , dim > &s9 ,
+ const boost::array< T , dim > &s10 ,
+ const boost::array< T , dim > &s11 ,
+ const boost::array< T , dim > &s12 ,
+ const boost::array< T , dim > &s13 ,
+ const boost::array< T , dim > &s14 ,
+ const boost::array< T , dim > &s15 , Op op )
+ {
+ for( size_t i=0 ; i<dim ; ++i )
+ op( s1[i] , s2[i] , s3[i] , s4[i] , s5[i] , s6[i] , s7[i] , s8[i] , s9[i] , s10[i] , s11[i] , s12[i] , s13[i] , s14[i] , s15[i] );
+ }
+
+
+ template< class Value , class T , size_t dim , class Red >
+ static Value reduce( const boost::array< T , dim > &s , Red red , Value init)
+ {
+ for( size_t i=0 ; i<dim ; ++i )
+ init = red( init , s[i] );
+ return init;
+ }
+
+};
+
+}
+}
+}
+
+#endif // BOOST_NUMERIC_ODEINT_ALGEBRA_ARRAY_ALGEBRA_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/algebra/default_operations.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/algebra/default_operations.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,602 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/algebra/default_operations.hpp
+
+ [begin_description]
+ Default operations. They work with the default numerical types, like float, double, complex< double> ...
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_ALGEBRA_DEFAULT_OPERATIONS_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_ALGEBRA_DEFAULT_OPERATIONS_HPP_INCLUDED
+
+#include <algorithm>
+
+#include <boost/config.hpp>
+#include <boost/array.hpp>
+
+#include <boost/numeric/odeint/util/unit_helper.hpp>
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+
+/*
+ * Notes:
+ *
+ * * the results structs are needed in order to work with fusion_algebra
+ */
+struct default_operations
+{
+
+ template< class Fac1 = double >
+ struct scale
+ {
+ const Fac1 m_alpha1;
+
+ scale( Fac1 alpha1 ) : m_alpha1( alpha1 ) { }
+
+ template< class T1 >
+ void operator()( T1 &t1 ) const
+ {
+ t1 *= m_alpha1;
+ }
+
+ typedef void result_type;
+ };
+
+ template< class Fac1 = double >
+ struct scale_sum1
+ {
+ const Fac1 m_alpha1;
+
+ scale_sum1( Fac1 alpha1 ) : m_alpha1( alpha1 ) { }
+
+ template< class T1 , class T2 >
+ void operator()( T1 &t1 , const T2 &t2 ) const
+ {
+ t1 = m_alpha1 * t2;
+ }
+
+ typedef void result_type;
+ };
+
+
+ template< class Fac1 = double , class Fac2 = Fac1 >
+ struct scale_sum2
+ {
+ const Fac1 m_alpha1;
+ const Fac2 m_alpha2;
+
+ scale_sum2( Fac1 alpha1 , Fac2 alpha2 ) : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) { }
+
+ template< class T1 , class T2 , class T3 >
+ void operator()( T1 &t1 , const T2 &t2 , const T3 &t3) const
+ {
+ t1 = m_alpha1 * t2 + m_alpha2 * t3;
+ }
+
+ typedef void result_type;
+ };
+
+
+ template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 >
+ struct scale_sum3
+ {
+ const Fac1 m_alpha1;
+ const Fac2 m_alpha2;
+ const Fac3 m_alpha3;
+
+ scale_sum3( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 )
+ : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) { }
+
+ template< class T1 , class T2 , class T3 , class T4 >
+ void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 ) const
+ {
+ t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4;
+ }
+
+ typedef void result_type;
+ };
+
+
+ template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 >
+ struct scale_sum4
+ {
+ const Fac1 m_alpha1;
+ const Fac2 m_alpha2;
+ const Fac3 m_alpha3;
+ const Fac4 m_alpha4;
+
+ scale_sum4( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 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) const
+ {
+ t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5;
+ }
+
+ typedef void result_type;
+ };
+
+
+ template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 , class Fac5 = Fac4 >
+ struct scale_sum5
+ {
+ const Fac1 m_alpha1;
+ const Fac2 m_alpha2;
+ const Fac3 m_alpha3;
+ const Fac4 m_alpha4;
+ const Fac5 m_alpha5;
+
+ scale_sum5( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 , Fac5 alpha5 )
+ : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) { }
+
+ template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 >
+ void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 , const T6 &t6) const
+ {
+ t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5 + m_alpha5 * t6;
+ }
+
+ typedef void result_type;
+ };
+
+
+ template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 , class Fac5 = Fac4 , class Fac6 = Fac5 >
+ struct scale_sum6
+ {
+ const Fac1 m_alpha1;
+ const Fac2 m_alpha2;
+ const Fac3 m_alpha3;
+ const Fac4 m_alpha4;
+ const Fac5 m_alpha5;
+ const Fac6 m_alpha6;
+
+ scale_sum6( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 , Fac5 alpha5 , Fac6 alpha6 )
+ : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) , m_alpha6( alpha6 ){ }
+
+ template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 >
+ void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 , const T6 &t6 ,const T7 &t7) const
+ {
+ t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5 + m_alpha5 * t6 + m_alpha6 * t7;
+ }
+
+ typedef void result_type;
+ };
+
+
+ template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 , class Fac5 = Fac4 , class Fac6 = Fac5 , class Fac7 = Fac6 >
+ struct scale_sum7
+ {
+ const Fac1 m_alpha1;
+ const Fac2 m_alpha2;
+ const Fac3 m_alpha3;
+ const Fac4 m_alpha4;
+ const Fac5 m_alpha5;
+ const Fac6 m_alpha6;
+ const Fac7 m_alpha7;
+
+ scale_sum7( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 ,
+ Fac5 alpha5 , Fac6 alpha6 , Fac7 alpha7 )
+ : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) , m_alpha6( alpha6 ) , m_alpha7( alpha7 ) { }
+
+ template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 >
+ void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 , const T6 &t6 , const T7 &t7 , const T8 &t8 ) const
+ {
+ t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5 + m_alpha5 * t6 + m_alpha6 * t7 + m_alpha7 * t8;
+ }
+
+ typedef void result_type;
+ };
+
+
+ template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 , class Fac5 = Fac4 , class Fac6 = Fac5 , class Fac7 = Fac6 , class Fac8 = Fac7 >
+ struct scale_sum8
+ {
+ const Fac1 m_alpha1;
+ const Fac2 m_alpha2;
+ const Fac3 m_alpha3;
+ const Fac4 m_alpha4;
+ const Fac5 m_alpha5;
+ const Fac6 m_alpha6;
+ const Fac7 m_alpha7;
+ const Fac8 m_alpha8;
+
+ scale_sum8( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 ,
+ Fac5 alpha5 , Fac6 alpha6 , Fac7 alpha7 , Fac8 alpha8 )
+ : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) , m_alpha6( alpha6 ) , m_alpha7( alpha7 ) , m_alpha8( alpha8 ) { }
+
+ template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 >
+ void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 , const T6 &t6 , const T7 &t7 , const T8 &t8 , const T9 &t9 ) const
+ {
+ t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5 + m_alpha5 * t6 + m_alpha6 * t7 + m_alpha7 * t8 + m_alpha8 * t9;
+ }
+
+ typedef void result_type;
+ };
+
+ template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 , class Fac5 = Fac4 , class Fac6 = Fac5 , class Fac7 = Fac6 , class Fac8 = Fac7 , class Fac9 = Fac8 >
+ struct scale_sum9
+ {
+ const Fac1 m_alpha1;
+ const Fac2 m_alpha2;
+ const Fac3 m_alpha3;
+ const Fac4 m_alpha4;
+ const Fac5 m_alpha5;
+ const Fac6 m_alpha6;
+ const Fac7 m_alpha7;
+ const Fac8 m_alpha8;
+ const Fac9 m_alpha9;
+
+ scale_sum9( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 ,
+ Fac5 alpha5 , Fac6 alpha6 , Fac7 alpha7 , Fac8 alpha8 , Fac9 alpha9 )
+ : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) , m_alpha6( alpha6 ) , m_alpha7( alpha7 ) , m_alpha8( alpha8 ) , m_alpha9( alpha9 ) { }
+
+ template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 >
+ void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 , const T6 &t6 , const T7 &t7 , const T8 &t8 , const T9 &t9 , const T10 &t10 ) const
+ {
+ t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5 + m_alpha5 * t6 + m_alpha6 * t7 + m_alpha7 * t8 + m_alpha8 * t9 + m_alpha9 * t10;
+ }
+
+ typedef void result_type;
+ };
+
+ template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 , class Fac5 = Fac4 , class Fac6 = Fac5 , class Fac7 = Fac6 , class Fac8 = Fac7 , class Fac9 = Fac8 , class Fac10 = Fac9 >
+ struct scale_sum10
+ {
+ const Fac1 m_alpha1;
+ const Fac2 m_alpha2;
+ const Fac3 m_alpha3;
+ const Fac4 m_alpha4;
+ const Fac5 m_alpha5;
+ const Fac6 m_alpha6;
+ const Fac7 m_alpha7;
+ const Fac8 m_alpha8;
+ const Fac9 m_alpha9;
+ const Fac10 m_alpha10;
+
+ scale_sum10( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 ,
+ Fac5 alpha5 , Fac6 alpha6 , Fac7 alpha7 , Fac8 alpha8 , Fac9 alpha9 , Fac10 alpha10 )
+ : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) , m_alpha6( alpha6 ) , m_alpha7( alpha7 ) , m_alpha8( alpha8 ) , m_alpha9( alpha9 ) , m_alpha10( alpha10 ) { }
+
+ template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 >
+ void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 , const T6 &t6 , const T7 &t7 , const T8 &t8 , const T9 &t9 , const T10 &t10 , const T11 &t11 ) const
+ {
+ t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5 + m_alpha5 * t6 + m_alpha6 * t7 + m_alpha7 * t8 + m_alpha8 * t9 + m_alpha9 * t10 + m_alpha10 * t11;
+ }
+
+ typedef void result_type;
+ };
+
+
+ template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 , class Fac5 = Fac4 , class Fac6 = Fac5 , class Fac7 = Fac6 , class Fac8 = Fac7 , class Fac9 = Fac8 , class Fac10 = Fac9 , class Fac11 = Fac10 >
+ struct scale_sum11
+ {
+ const Fac1 m_alpha1;
+ const Fac2 m_alpha2;
+ const Fac3 m_alpha3;
+ const Fac4 m_alpha4;
+ const Fac5 m_alpha5;
+ const Fac6 m_alpha6;
+ const Fac7 m_alpha7;
+ const Fac8 m_alpha8;
+ const Fac9 m_alpha9;
+ const Fac10 m_alpha10;
+ const Fac11 m_alpha11;
+
+ scale_sum11( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 ,
+ Fac5 alpha5 , Fac6 alpha6 , Fac7 alpha7 , Fac8 alpha8 , Fac9 alpha9 ,
+ Fac10 alpha10 , Fac11 alpha11 )
+ : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) , m_alpha6( alpha6 ) , m_alpha7( alpha7 ) , m_alpha8( alpha8 ) , m_alpha9( alpha9 ) , m_alpha10( alpha10 ) , m_alpha11( alpha11 ) { }
+
+ template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 >
+ void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 , const T6 &t6 , const T7 &t7 , const T8 &t8 , const T9 &t9 , const T10 &t10 , const T11 &t11 , const T12 &t12 ) const
+ {
+ t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5 + m_alpha5 * t6 + m_alpha6 * t7 + m_alpha7 * t8 + m_alpha8 * t9 + m_alpha9 * t10 + m_alpha10 * t11 + m_alpha11 * t12;
+ }
+
+ typedef void result_type;
+ };
+
+ template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 , class Fac5 = Fac4 , class Fac6 = Fac5 , class Fac7 = Fac6 , class Fac8 = Fac7 , class Fac9 = Fac8 , class Fac10 = Fac9 , class Fac11 = Fac10 , class Fac12 = Fac11 >
+ struct scale_sum12
+ {
+ const Fac1 m_alpha1;
+ const Fac2 m_alpha2;
+ const Fac3 m_alpha3;
+ const Fac4 m_alpha4;
+ const Fac5 m_alpha5;
+ const Fac6 m_alpha6;
+ const Fac7 m_alpha7;
+ const Fac8 m_alpha8;
+ const Fac9 m_alpha9;
+ const Fac10 m_alpha10;
+ const Fac11 m_alpha11;
+ const Fac12 m_alpha12;
+
+ scale_sum12( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 ,
+ Fac5 alpha5 , Fac6 alpha6 , Fac7 alpha7 , Fac8 alpha8 , Fac9 alpha9 ,
+ Fac10 alpha10 , Fac11 alpha11 , Fac12 alpha12 )
+ : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) , m_alpha6( alpha6 ) , m_alpha7( alpha7 ) , m_alpha8( alpha8 ) , m_alpha9( alpha9 ) , m_alpha10( alpha10 ) , m_alpha11( alpha11 ) , m_alpha12( alpha12 ) { }
+
+ template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 >
+ void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 , const T6 &t6 , const T7 &t7 , const T8 &t8 , const T9 &t9 , const T10 &t10 , const T11 &t11 , const T12 &t12 , const T13 &t13 ) const
+ {
+ t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5 + m_alpha5 * t6 + m_alpha6 * t7 + m_alpha7 * t8 + m_alpha8 * t9 + m_alpha9 * t10 + m_alpha10 * t11 + m_alpha11 * t12 + m_alpha12 * t13;
+ }
+
+ typedef void result_type;
+ };
+
+ template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 , class Fac5 = Fac4 , class Fac6 = Fac5 , class Fac7 = Fac6 , class Fac8 = Fac7 , class Fac9 = Fac8 , class Fac10 = Fac9 , class Fac11 = Fac10 , class Fac12 = Fac11 , class Fac13 = Fac12 >
+ struct scale_sum13
+ {
+ const Fac1 m_alpha1;
+ const Fac2 m_alpha2;
+ const Fac3 m_alpha3;
+ const Fac4 m_alpha4;
+ const Fac5 m_alpha5;
+ const Fac6 m_alpha6;
+ const Fac7 m_alpha7;
+ const Fac8 m_alpha8;
+ const Fac9 m_alpha9;
+ const Fac10 m_alpha10;
+ const Fac11 m_alpha11;
+ const Fac12 m_alpha12;
+ const Fac13 m_alpha13;
+
+ scale_sum13( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 ,
+ Fac5 alpha5 , Fac6 alpha6 , Fac7 alpha7 , Fac8 alpha8 , Fac9 alpha9 ,
+ Fac10 alpha10 , Fac11 alpha11 , Fac12 alpha12 , Fac13 alpha13 )
+ : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) , m_alpha6( alpha6 ) , m_alpha7( alpha7 ) , m_alpha8( alpha8 ) , m_alpha9( alpha9 ) , m_alpha10( alpha10 ) , m_alpha11( alpha11 ) , m_alpha12( alpha12 ) , m_alpha13( alpha13 ) { }
+
+ template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 >
+ void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 , const T6 &t6 , const T7 &t7 , const T8 &t8 , const T9 &t9 , const T10 &t10 , const T11 &t11 , const T12 &t12 , const T13 &t13 , const T14 &t14 ) const
+ {
+ t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5 + m_alpha5 * t6 + m_alpha6 * t7 + m_alpha7 * t8 + m_alpha8 * t9 + m_alpha9 * t10 + m_alpha10 * t11 + m_alpha11 * t12 + m_alpha12 * t13 + m_alpha13 * t14;
+ }
+
+ typedef void result_type;
+ };
+
+ template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 , class Fac5 = Fac4 , class Fac6 = Fac5 , class Fac7 = Fac6 , class Fac8 = Fac7 , class Fac9 = Fac8 , class Fac10 = Fac9 , class Fac11 = Fac10 , class Fac12 = Fac11 , class Fac13 = Fac12 , class Fac14 = Fac13 >
+ struct scale_sum14
+ {
+ const Fac1 m_alpha1;
+ const Fac2 m_alpha2;
+ const Fac3 m_alpha3;
+ const Fac4 m_alpha4;
+ const Fac5 m_alpha5;
+ const Fac6 m_alpha6;
+ const Fac7 m_alpha7;
+ const Fac8 m_alpha8;
+ const Fac9 m_alpha9;
+ const Fac10 m_alpha10;
+ const Fac11 m_alpha11;
+ const Fac12 m_alpha12;
+ const Fac13 m_alpha13;
+ const Fac14 m_alpha14;
+
+ scale_sum14( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 ,
+ Fac5 alpha5 , Fac6 alpha6 , Fac7 alpha7 , Fac8 alpha8 , Fac9 alpha9 ,
+ Fac10 alpha10 , Fac11 alpha11 , Fac12 alpha12 , Fac13 alpha13 , Fac14 alpha14 )
+ : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) , m_alpha6( alpha6 ) , m_alpha7( alpha7 ) , m_alpha8( alpha8 ) , m_alpha9( alpha9 ) , m_alpha10( alpha10 ) , m_alpha11( alpha11 ) , m_alpha12( alpha12 ) , m_alpha13( alpha13 ) , m_alpha14( alpha14 ) { }
+
+ template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 >
+ void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 , const T6 &t6 , const T7 &t7 , const T8 &t8 , const T9 &t9 , const T10 &t10 , const T11 &t11 , const T12 &t12 , const T13 &t13 , const T14 &t14 , const T15 &t15 ) const
+ {
+ t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5 + m_alpha5 * t6 + m_alpha6 * t7 + m_alpha7 * t8 + m_alpha8 * t9 + m_alpha9 * t10 + m_alpha10 * t11 + m_alpha11 * t12 + m_alpha12 * t13 + m_alpha13 * t14 + m_alpha14 * t15;
+ }
+
+ typedef void result_type;
+ };
+
+ template< class Fac1 = double , class Fac2 = Fac1 >
+ struct scale_sum_swap2
+ {
+ const Fac1 m_alpha1;
+ const Fac2 m_alpha2;
+
+ scale_sum_swap2( Fac1 alpha1 , Fac2 alpha2 ) : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) { }
+
+ template< class T1 , class T2 , class T3 >
+ void operator()( T1 &t1 , T2 &t2 , const T3 &t3) const
+ {
+ const T1 tmp( t1 );
+ t1 = m_alpha1 * t2 + m_alpha2 * t3;
+ t2 = tmp;
+ }
+
+ typedef void result_type;
+ };
+
+ /*
+ * for usage in for_each2
+ *
+ * Works with boost::units by eliminating the unit
+ */
+ template< class Fac1 = double >
+ struct rel_error
+ {
+ const Fac1 m_eps_abs , m_eps_rel , m_a_x , m_a_dxdt;
+
+ rel_error( Fac1 eps_abs , Fac1 eps_rel , Fac1 a_x , Fac1 a_dxdt )
+ : m_eps_abs( eps_abs ) , m_eps_rel( eps_rel ) , m_a_x( a_x ) , m_a_dxdt( a_dxdt ) { }
+
+
+ template< class T1 , class T2 , class T3 >
+ void operator()( T3 &t3 , const T1 &t1 , const T2 &t2 ) const
+ {
+ using std::abs;
+ set_unit_value( t3 , abs( get_unit_value( t3 ) ) / ( m_eps_abs + m_eps_rel * ( m_a_x * abs( get_unit_value( t1 ) ) + m_a_dxdt * abs( get_unit_value( t2 ) ) ) ) );
+ }
+
+ typedef void result_type;
+ };
+
+
+ /*
+ * for usage in for_each3
+ *
+ * used in the controller for the rosenbrock4 method
+ *
+ * Works with boost::units by eliminating the unit
+ */
+ template< class Fac1 = double >
+ struct default_rel_error
+ {
+ const Fac1 m_eps_abs , m_eps_rel ;
+
+ default_rel_error( Fac1 eps_abs , Fac1 eps_rel )
+ : m_eps_abs( eps_abs ) , m_eps_rel( eps_rel ) { }
+
+
+ /*
+ * xerr = xerr / ( eps_abs + eps_rel * max( x , x_old ) )
+ */
+ template< class T1 , class T2 , class T3 >
+ void operator()( T3 &t3 , const T1 &t1 , const T2 &t2 ) const
+ {
+ BOOST_USING_STD_MAX();
+ using std::abs;
+ Fac1 x1 = abs( get_unit_value( t1 ) ) , x2 = abs( get_unit_value( t2 ) );
+ set_unit_value( t3 , abs( get_unit_value( t3 ) ) / ( m_eps_abs + m_eps_rel * max BOOST_PREVENT_MACRO_SUBSTITUTION ( x1 , x2 ) ) );
+ }
+
+ typedef void result_type;
+ };
+
+
+
+ /*
+ * for usage in reduce
+ */
+
+ template< class Value >
+ struct maximum
+ {
+ template< class Fac1 , class Fac2 >
+ Value operator()( Fac1 t1 , const Fac2 t2 ) const
+ {
+ using std::abs;
+ Value a1 = abs( get_unit_value( t1 ) ) , a2 = abs( get_unit_value( t2 ) );
+ return ( a1 < a2 ) ? a2 : a1 ;
+ }
+
+ typedef Value result_type;
+ };
+
+
+
+
+
+ template< class Fac1 = double >
+ struct rel_error_max
+ {
+ const Fac1 m_eps_abs , m_eps_rel;
+
+ rel_error_max( Fac1 eps_abs , Fac1 eps_rel )
+ : m_eps_abs( eps_abs ) , m_eps_rel( eps_rel )
+ { }
+
+ template< class Res , class T1 , class T2 , class T3 >
+ Res operator()( Res r , const T1 &x_old , const T2 &x , const T3 &x_err )
+ {
+ BOOST_USING_STD_MAX();
+ using std::abs;
+ Res tmp = abs( get_unit_value( x_err ) ) / ( m_eps_abs + m_eps_rel * max BOOST_PREVENT_MACRO_SUBSTITUTION ( abs( x_old ) , abs( x ) ) );
+ return max BOOST_PREVENT_MACRO_SUBSTITUTION ( r , tmp );
+ }
+ };
+
+
+ template< class Fac1 = double >
+ struct rel_error_max2
+ {
+ const Fac1 m_eps_abs , m_eps_rel , m_a_x , m_a_dxdt;
+
+ rel_error_max2( Fac1 eps_abs , Fac1 eps_rel , Fac1 a_x , Fac1 a_dxdt )
+ : m_eps_abs( eps_abs ) , m_eps_rel( eps_rel ) , m_a_x( a_x ) , m_a_dxdt( a_dxdt )
+ { }
+
+ template< class Res , class T1 , class T2 , class T3 , class T4 >
+ Res operator()( Res r , const T1 &x_old , const T2 &x , const T3 &dxdt_old , const T4 &x_err )
+ {
+ BOOST_USING_STD_MAX();
+ using std::abs;
+ Res tmp = abs( get_unit_value( x_err ) ) /
+ ( m_eps_abs + m_eps_rel * ( m_a_x * abs( get_unit_value( x_old ) ) + m_a_dxdt * abs( get_unit_value( dxdt_old ) ) ) );
+ return max BOOST_PREVENT_MACRO_SUBSTITUTION ( r , tmp );
+ }
+ };
+
+
+
+
+ template< class Fac1 = double >
+ struct rel_error_l2
+ {
+ const Fac1 m_eps_abs , m_eps_rel;
+
+ rel_error_l2( Fac1 eps_abs , Fac1 eps_rel )
+ : m_eps_abs( eps_abs ) , m_eps_rel( eps_rel )
+ { }
+
+ template< class Res , class T1 , class T2 , class T3 >
+ Res operator()( Res r , const T1 &x_old , const T2 &x , const T3 &x_err )
+ {
+ BOOST_USING_STD_MAX();
+ using std::abs;
+ Res tmp = abs( get_unit_value( x_err ) ) / ( m_eps_abs + m_eps_rel * max BOOST_PREVENT_MACRO_SUBSTITUTION ( abs( x_old ) , abs( x ) ) );
+ return r + tmp * tmp;
+ }
+ };
+
+
+
+
+ template< class Fac1 = double >
+ struct rel_error_l2_2
+ {
+ const Fac1 m_eps_abs , m_eps_rel , m_a_x , m_a_dxdt;
+
+ rel_error_l2_2( Fac1 eps_abs , Fac1 eps_rel , Fac1 a_x , Fac1 a_dxdt )
+ : m_eps_abs( eps_abs ) , m_eps_rel( eps_rel ) , m_a_x( a_x ) , m_a_dxdt( a_dxdt )
+ { }
+
+ template< class Res , class T1 , class T2 , class T3 , class T4 >
+ Res operator()( Res r , const T1 &x_old , const T2 &x , const T3 &dxdt_old , const T4 &x_err )
+ {
+ using std::abs;
+ Res tmp = abs( get_unit_value( x_err ) ) /
+ ( m_eps_abs + m_eps_rel * ( m_a_x * abs( get_unit_value( x_old ) ) + m_a_dxdt * abs( get_unit_value( dxdt_old ) ) ) );
+ return r + tmp * tmp;
+ }
+ };
+
+
+
+
+
+
+};
+
+
+} // odeint
+} // numeric
+} // boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_ALGEBRA_DEFAULT_OPERATIONS_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/algebra/detail/for_each.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/algebra/detail/for_each.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,165 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/algebra/detail/for_each.hpp
+
+ [begin_description]
+ Default for_each implementations.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_FOR_EACH_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_FOR_EACH_HPP_INCLUDED
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+namespace detail {
+
+
+ template< class Iterator1 , class Operation >
+ inline void for_each1( Iterator1 first1 , Iterator1 last1 , Operation op )
+ {
+ for( ; first1 != last1 ; )
+ op( *first1++ );
+ }
+
+
+ template< class Iterator1 , class Iterator2 , class Operation >
+ inline void for_each2( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Operation op )
+ {
+ for( ; first1 != last1 ; )
+ op( *first1++ , *first2++ );
+ }
+
+
+ template< class Iterator1 , class Iterator2 , class Iterator3 , class Operation >
+ inline void for_each3( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Iterator3 first3, Operation op )
+ {
+ for( ; first1 != last1 ; )
+ op( *first1++ , *first2++ , *first3++ );
+ }
+
+
+ template< class Iterator1 , class Iterator2 , class Iterator3 , class Iterator4 , class Operation >
+ inline void for_each4( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Iterator3 first3, Iterator4 first4, Operation op )
+ {
+ for( ; first1 != last1 ; )
+ op( *first1++ , *first2++ , *first3++ , *first4++ );
+ }
+
+
+ template< class Iterator1 , class Iterator2 , class Iterator3 , class Iterator4 , class Iterator5 , class Operation >
+ inline void for_each5( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Iterator3 first3,
+ Iterator4 first4, Iterator5 first5, Operation op )
+ {
+ for( ; first1 != last1 ; )
+ op( *first1++ , *first2++ , *first3++ , *first4++ , *first5++ );
+ }
+
+
+ template< class Iterator1 , class Iterator2 , class Iterator3 , class Iterator4 , class Iterator5 , class Iterator6 , class Operation >
+ inline void for_each6( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Iterator3 first3,
+ Iterator4 first4, Iterator5 first5, Iterator6 first6 , Operation op )
+ {
+ for( ; first1 != last1 ; )
+ op( *first1++ , *first2++ , *first3++ , *first4++ , *first5++ , *first6++ );
+ }
+
+
+ template< class Iterator1 , class Iterator2 , class Iterator3 , class Iterator4 , class Iterator5 , class Iterator6 , class Iterator7 , class Operation >
+ inline void for_each7( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Iterator3 first3,
+ Iterator4 first4, Iterator5 first5, Iterator6 first6 , Iterator7 first7 , Operation op )
+ {
+ for( ; first1 != last1 ; )
+ op( *first1++ , *first2++ , *first3++ , *first4++ , *first5++ , *first6++ , *first7++ );
+ }
+
+ template< class Iterator1 , class Iterator2 , class Iterator3 , class Iterator4 , class Iterator5 , class Iterator6 , class Iterator7 , class Iterator8 , class Operation >
+ inline void for_each8( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Iterator3 first3,
+ Iterator4 first4, Iterator5 first5, Iterator6 first6 , Iterator7 first7 , Iterator8 first8 , Operation op )
+ {
+ for( ; first1 != last1 ; )
+ op( *first1++ , *first2++ , *first3++ , *first4++ , *first5++ , *first6++ , *first7++ , *first8++ );
+ }
+
+ template< class Iterator1 , class Iterator2 , class Iterator3 , class Iterator4 , class Iterator5 , class Iterator6 , class Iterator7 , class Iterator8 , class Iterator9 , class Operation >
+ inline void for_each9( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Iterator3 first3,
+ Iterator4 first4, Iterator5 first5, Iterator6 first6 , Iterator7 first7 , Iterator8 first8 ,
+ Iterator9 first9 , Operation op )
+ {
+ for( ; first1 != last1 ; )
+ op( *first1++ , *first2++ , *first3++ , *first4++ , *first5++ , *first6++ , *first7++ , *first8++ , *first9++ );
+ }
+
+ template< class Iterator1 , class Iterator2 , class Iterator3 , class Iterator4 , class Iterator5 , class Iterator6 , class Iterator7 , class Iterator8 , class Iterator9 , class Iterator10 , class Operation >
+ inline void for_each10( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Iterator3 first3,
+ Iterator4 first4, Iterator5 first5, Iterator6 first6 , Iterator7 first7 , Iterator8 first8 ,
+ Iterator9 first9 , Iterator10 first10 , Operation op )
+ {
+ for( ; first1 != last1 ; )
+ op( *first1++ , *first2++ , *first3++ , *first4++ , *first5++ , *first6++ , *first7++ , *first8++ , *first9++ , *first10++ );
+ }
+
+ template< class Iterator1 , class Iterator2 , class Iterator3 , class Iterator4 , class Iterator5 , class Iterator6 , class Iterator7 , class Iterator8 , class Iterator9 , class Iterator10 , class Iterator11 , class Operation >
+ inline void for_each11( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Iterator3 first3,
+ Iterator4 first4, Iterator5 first5, Iterator6 first6 , Iterator7 first7 , Iterator8 first8 ,
+ Iterator9 first9 , Iterator10 first10 , Iterator11 first11 , Operation op )
+ {
+ for( ; first1 != last1 ; )
+ op( *first1++ , *first2++ , *first3++ , *first4++ , *first5++ , *first6++ , *first7++ , *first8++ , *first9++ , *first10++ , *first11++ );
+ }
+
+ template< class Iterator1 , class Iterator2 , class Iterator3 , class Iterator4 , class Iterator5 , class Iterator6 , class Iterator7 , class Iterator8 , class Iterator9 , class Iterator10 , class Iterator11 , class Iterator12 , class Operation >
+ inline void for_each12( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Iterator3 first3,
+ Iterator4 first4, Iterator5 first5, Iterator6 first6 , Iterator7 first7 , Iterator8 first8 ,
+ Iterator9 first9 , Iterator10 first10 , Iterator11 first11 , Iterator12 first12 , Operation op )
+ {
+ for( ; first1 != last1 ; )
+ op( *first1++ , *first2++ , *first3++ , *first4++ , *first5++ , *first6++ , *first7++ , *first8++ , *first9++ , *first10++ , *first11++ , *first12++ );
+ }
+
+ template< class Iterator1 , class Iterator2 , class Iterator3 , class Iterator4 , class Iterator5 , class Iterator6 , class Iterator7 , class Iterator8 , class Iterator9 , class Iterator10 , class Iterator11 , class Iterator12 , class Iterator13 , class Operation >
+ inline void for_each13( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Iterator3 first3,
+ Iterator4 first4, Iterator5 first5, Iterator6 first6 , Iterator7 first7 , Iterator8 first8 ,
+ Iterator9 first9 , Iterator10 first10 , Iterator11 first11 , Iterator12 first12 , Iterator13 first13 , Operation op )
+ {
+ for( ; first1 != last1 ; )
+ op( *first1++ , *first2++ , *first3++ , *first4++ , *first5++ , *first6++ , *first7++ , *first8++ , *first9++ , *first10++ , *first11++ , *first12++ , *first13++ );
+ }
+
+ template< class Iterator1 , class Iterator2 , class Iterator3 , class Iterator4 , class Iterator5 , class Iterator6 , class Iterator7 , class Iterator8 , class Iterator9 , class Iterator10 , class Iterator11 , class Iterator12 , class Iterator13 , class Iterator14 , class Operation >
+ inline void for_each14( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Iterator3 first3,
+ Iterator4 first4, Iterator5 first5, Iterator6 first6 , Iterator7 first7 , Iterator8 first8 ,
+ Iterator9 first9 , Iterator10 first10 , Iterator11 first11 , Iterator12 first12 , Iterator13 first13 ,
+ Iterator14 first14 , Operation op )
+ {
+ for( ; first1 != last1 ; )
+ op( *first1++ , *first2++ , *first3++ , *first4++ , *first5++ , *first6++ , *first7++ , *first8++ , *first9++ , *first10++ , *first11++ , *first12++ , *first13++ , *first14++ );
+ }
+
+ template< class Iterator1 , class Iterator2 , class Iterator3 , class Iterator4 , class Iterator5 , class Iterator6 , class Iterator7 , class Iterator8 , class Iterator9 , class Iterator10 , class Iterator11 , class Iterator12 , class Iterator13 , class Iterator14 , class Iterator15 , class Operation >
+ inline void for_each15( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Iterator3 first3,
+ Iterator4 first4, Iterator5 first5, Iterator6 first6 , Iterator7 first7 , Iterator8 first8 ,
+ Iterator9 first9 , Iterator10 first10 , Iterator11 first11 , Iterator12 first12 , Iterator13 first13 ,
+ Iterator14 first14 , Iterator15 first15 , Operation op )
+ {
+ for( ; first1 != last1 ; )
+ op( *first1++ , *first2++ , *first3++ , *first4++ , *first5++ , *first6++ , *first7++ , *first8++ , *first9++ , *first10++ , *first11++ , *first12++ , *first13++ , *first14++ , *first15++ );
+ }
+
+
+} // detail
+} // odeint
+} // numeric
+} // boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_FOR_EACH_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/algebra/detail/macros.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/algebra/detail/macros.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,43 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/algebra/detail/macros.hpp
+
+ [begin_description]
+ Some macros for type checking.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_MACROS_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_MACROS_HPP_INCLUDED
+
+
+//type traits aren't working with nvcc
+#ifndef __CUDACC__
+#include <boost/type_traits.hpp>
+#include <boost/static_assert.hpp>
+
+#define BOOST_ODEINT_CHECK_CONTAINER_TYPE( Type1 , Type2 ) \
+ BOOST_STATIC_ASSERT(( boost::is_same< typename boost::remove_const< Type1 >::type , Type2 >::value ))
+
+#else
+//empty macro for nvcc
+#define BOOST_ODEINT_CHECK_CONTAINER_TYPE( Type1 , Type2 )
+
+#endif // __CUDACC__
+
+
+
+/*
+#define BOOST_ODEINT_CHECK_OPERATION_ARITY( Operation , Arity ) \
+ BOOST_STATIC_ASSERT(( boost::function_traits< Operation >::arity == Arity ))
+ */
+
+#endif // BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_MACROS_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/algebra/detail/reduce.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/algebra/detail/reduce.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,67 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/algebra/detail/reduce.hpp
+
+ [begin_description]
+ Default reduce implementation.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_REDUCE_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_REDUCE_HPP_INCLUDED
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+namespace detail {
+
+template< class ValueType , class Iterator1 , class Reduction >
+inline ValueType reduce( Iterator1 first1 , Iterator1 last1 , Reduction red, ValueType init)
+{
+ for( ; first1 != last1 ; )
+ init = red( init , *first1++ );
+ return init;
+}
+
+
+template< class ValueType , class Iterator1 , class Iterator2 , class Reduction >
+inline ValueType reduce2( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Reduction red, ValueType init)
+{
+ for( ; first1 != last1 ; )
+ init = red( init , *first1++ , *first2++ );
+ return init;
+}
+
+template< class ValueType , class Iterator1 , class Iterator2 , class Iterator3 , class Reduction >
+inline ValueType reduce3( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Iterator3 first3 , Reduction red, ValueType init)
+{
+ for( ; first1 != last1 ; )
+ init = red( init , *first1++ , *first2++ , *first3++ );
+ return init;
+}
+
+template< class ValueType , class Iterator1 , class Iterator2 , class Iterator3 , class Iterator4 , class Reduction >
+inline ValueType reduce4( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Iterator3 first3 , Iterator4 first4 , Reduction red, ValueType init)
+{
+ for( ; first1 != last1 ; )
+ init = red( init , *first1++ , *first2++ , *first3++ , *first4++ );
+ return init;
+}
+
+
+} // detail
+} // odeint
+} // numeric
+} // boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_REDUCE_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/algebra/fusion_algebra.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/algebra/fusion_algebra.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,186 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/algebra/fusion_algebra.hpp
+
+ [begin_description]
+ Algebra for boost::fusion sequences.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_ALGEBRA_FUSION_ALGEBRA_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_ALGEBRA_FUSION_ALGEBRA_HPP_INCLUDED
+
+
+#include <boost/fusion/container/vector.hpp>
+#include <boost/fusion/algorithm/iteration/for_each.hpp>
+#include <boost/fusion/view/zip_view.hpp>
+#include <boost/fusion/functional/generation/make_fused.hpp>
+#include <boost/fusion/algorithm/iteration/accumulate.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+struct fusion_algebra
+{
+ template< class S1 , class Op >
+ static void for_each1( S1 &s1 , Op op )
+ {
+ boost::fusion::for_each( s1 , op );
+ };
+
+
+ template< class S1 , class S2 , class Op >
+ static void for_each2( S1 &s1 , S2 &s2 , Op op )
+ {
+ typedef boost::fusion::vector< S1& , S2& > Sequences;
+ Sequences sequences( s1 , s2 );
+ boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
+ }
+
+
+ template< class S1 , class S2 , class S3 , class Op >
+ static void for_each3( S1 &s1 , S2 &s2 , S3 &s3 , Op op )
+ {
+ typedef boost::fusion::vector< S1& , S2& , S3& > Sequences;
+ Sequences sequences( s1 , s2 , s3 );
+ boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class Op >
+ static void for_each4( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , Op op )
+ {
+ typedef boost::fusion::vector< S1& , S2& , S3& , S4& > Sequences;
+ Sequences sequences( s1 , s2 , s3 , s4 );
+ boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
+ }
+
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class Op >
+ static void for_each5( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , Op op )
+ {
+ typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& > Sequences;
+ Sequences sequences( s1 , s2 , s3 , s4 , s5 );
+ boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
+ }
+
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class Op >
+ static void for_each6( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , Op op )
+ {
+ typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& > Sequences;
+ Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 );
+ boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
+ }
+
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class Op >
+ static void for_each7( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , Op op )
+ {
+ typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& , S7& > Sequences;
+ Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 , s7 );
+ boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
+ }
+
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class Op >
+ static void for_each8( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , Op op )
+ {
+ BOOST_STATIC_ASSERT_MSG( BOOST_FUSION_INVOKE_MAX_ARITY >= 8 , "Macro Parameter BOOST_FUSION_INVOKE_MAX_ARITY to small!" );
+ typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& , S7& , S8& > Sequences;
+ Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 );
+ boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class S9 , class Op >
+ static void for_each9( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , Op op )
+ {
+ BOOST_STATIC_ASSERT_MSG( BOOST_FUSION_INVOKE_MAX_ARITY >= 9 , "Macro Parameter BOOST_FUSION_INVOKE_MAX_ARITY to small!" );
+ typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& , S7& , S8& , S9& > Sequences;
+ Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 );
+ boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class S9 , class S10 , class Op >
+ static void for_each10( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , Op op )
+ {
+ BOOST_STATIC_ASSERT_MSG( BOOST_FUSION_INVOKE_MAX_ARITY >= 10 , "Macro Parameter BOOST_FUSION_INVOKE_MAX_ARITY to small!" );
+ typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& , S7& , S8& , S9& , S10& > Sequences;
+ Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s10 );
+ boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class S9 , class S10 , class S11 , class Op >
+ static void for_each11( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , Op op )
+ {
+ BOOST_STATIC_ASSERT_MSG( BOOST_FUSION_INVOKE_MAX_ARITY >= 11 , "Macro Parameter BOOST_FUSION_INVOKE_MAX_ARITY to small!" );
+ BOOST_STATIC_ASSERT_MSG( BOOST_RESULT_OF_NUM_ARGS >= 11 , "Macro Parameter BOOST_RESULT_OF_NUM_ARGS to small!" );
+ typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& , S7& , S8& , S9& , S10& , S11& > Sequences;
+ Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s10 , s11 );
+ boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class Op >
+ static void for_each12( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , Op op )
+ {
+ BOOST_STATIC_ASSERT_MSG( BOOST_FUSION_INVOKE_MAX_ARITY >= 12 , "Macro Parameter BOOST_FUSION_INVOKE_MAX_ARITY to small!" );
+ BOOST_STATIC_ASSERT_MSG( BOOST_RESULT_OF_NUM_ARGS >= 12 , "Macro Parameter BOOST_RESULT_OF_NUM_ARGS to small!" );
+ typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& , S7& , S8& , S9& , S10& , S11& , S12& > Sequences;
+ Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s10 , s11 , s12 );
+ boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class S13 , class Op >
+ static void for_each13( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , S13 &s13 , Op op )
+ {
+ BOOST_STATIC_ASSERT_MSG( BOOST_FUSION_INVOKE_MAX_ARITY >= 13 , "Macro Parameter BOOST_FUSION_INVOKE_MAX_ARITY to small!" );
+ BOOST_STATIC_ASSERT_MSG( BOOST_RESULT_OF_NUM_ARGS >= 13 , "Macro Parameter BOOST_RESULT_OF_NUM_ARGS to small!" );
+ typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& , S7& , S8& , S9& , S10& , S11& , S12& , S13& > Sequences;
+ Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s10 , s11 , s12 , s13 );
+ boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class S13 , class S14 , class Op >
+ static void for_each14( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , S13 &s13 , S14 &s14 , Op op )
+ {
+ BOOST_STATIC_ASSERT_MSG( BOOST_FUSION_INVOKE_MAX_ARITY >= 14 , "Macro Parameter BOOST_FUSION_INVOKE_MAX_ARITY to small!" );
+ BOOST_STATIC_ASSERT_MSG( BOOST_RESULT_OF_NUM_ARGS >= 14 , "Macro Parameter BOOST_RESULT_OF_NUM_ARGS to small!" );
+ typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& , S7& , S8& , S9& , S10& , S11& , S12& , S13& , S14& > Sequences;
+ Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s10 , s11 , s12 , s13 , s14 );
+ boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class S13 , class S14 , class S15 , class Op >
+ static void for_each15( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , S13 &s13 , S14 &s14 , S15 &s15 , Op op )
+ {
+ BOOST_STATIC_ASSERT_MSG( BOOST_FUSION_INVOKE_MAX_ARITY >= 15 , "Macro Parameter BOOST_FUSION_INVOKE_MAX_ARITY to small!" );
+ BOOST_STATIC_ASSERT_MSG( BOOST_RESULT_OF_NUM_ARGS >= 15 , "Macro Parameter BOOST_RESULT_OF_NUM_ARGS to small!" );
+ typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& , S7& , S8& , S9& , S10& , S11& , S12& , S13& , S14& , S15& > Sequences;
+ Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s10 , s11 , s12 , s13 , s14 , s15 );
+ boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
+ }
+
+ template< class Value , class S , class Reduction >
+ static Value reduce( const S &s , Reduction red , Value init)
+ {
+ return boost::fusion::accumulate( s , init , red );
+ }
+};
+
+
+
+} // odeint
+} // numeric
+} // boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_ALGEBRA_FUSION_ALGEBRA_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/algebra/range_algebra.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/algebra/range_algebra.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,159 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/algebra/range_algebra.hpp
+
+ [begin_description]
+ Default algebra, which works with the most state types, like vector< double >, boost::array< double >, boost::range.
+ Internally is uses boost::range to obtain the begin and end iterator of the according sequence.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_ALGEBRA_RANGE_ALGEBRA_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_ALGEBRA_RANGE_ALGEBRA_HPP_INCLUDED
+
+#include <boost/range.hpp>
+#include <boost/mpl/size_t.hpp>
+
+#include <boost/numeric/odeint/algebra/detail/macros.hpp>
+#include <boost/numeric/odeint/algebra/detail/for_each.hpp>
+#include <boost/numeric/odeint/algebra/detail/reduce.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+struct range_algebra
+{
+ template< class S1 , class Op >
+ static void for_each1( S1 &s1 , Op op )
+ {
+ detail::for_each1( boost::begin( s1 ) , boost::end( s1 ) ,
+ op );
+ }
+
+ template< class S1 , class S2 , class Op >
+ static void for_each2( S1 &s1 , S2 &s2 , Op op )
+ {
+ detail::for_each2( boost::begin( s1 ) , boost::end( s1 ) ,
+ boost::begin( s2 ) , op );
+ }
+
+ template< class S1 , class S2 , class S3 , class Op >
+ static void for_each3( S1 &s1 , S2 &s2 , S3 &s3 , Op op )
+ {
+ detail::for_each3( boost::begin( s1 ) , boost::end( s1 ) , boost::begin( s2 ) , boost::begin( s3 ) , op );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class Op >
+ static void for_each4( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , Op op )
+ {
+ detail::for_each4( boost::begin( s1 ) , boost::end( s1 ) , boost::begin( s2 ) , boost::begin( s3 ) , boost::begin( s4 ) , op );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class Op >
+ static void for_each5( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , Op op )
+ {
+ detail::for_each5( boost::begin( s1 ) , boost::end( s1 ) , boost::begin( s2 ) , boost::begin( s3 ) , boost::begin( s4 ) , boost::begin( s5 ) , op );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class Op >
+ static void for_each6( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , Op 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 S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class Op >
+ static void for_each7( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , Op 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 S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class Op >
+ static void for_each8( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , Op 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 S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class Op >
+ static void for_each9( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , Op op )
+ {
+ detail::for_each9( 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 ) , boost::begin( s9 ) , op );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class Op >
+ static void for_each10( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , Op op )
+ {
+ detail::for_each10( 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 ) , boost::begin( s9 ) , boost::begin( s10 ) , op );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class S11 , class Op >
+ static void for_each11( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , Op op )
+ {
+ detail::for_each11( 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 ) , boost::begin( s9 ) , boost::begin( s10 ) , boost::begin( s11 ) , op );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class Op >
+ static void for_each12( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , Op op )
+ {
+ detail::for_each12( 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 ) , boost::begin( s9 ) , boost::begin( s10 ) , boost::begin( s11 ) , boost::begin( s12 ) , op );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class S13 , class Op >
+ static void for_each13( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , S13 &s13 , Op op )
+ {
+ detail::for_each13( 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 ) , boost::begin( s9 ) , boost::begin( s10 ) , boost::begin( s11 ) , boost::begin( s12 ) , boost::begin( s13 ) , op );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class S13 , class S14 , class Op >
+ static void for_each14( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , S13 &s13 , S14 &s14 , Op op )
+ {
+ detail::for_each14( 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 ) , boost::begin( s9 ) , boost::begin( s10 ) , boost::begin( s11 ) , boost::begin( s12 ) , boost::begin( s13 ) , boost::begin( s14 ) , op );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class S13 , class S14 , class S15 , class Op >
+ static void for_each15( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , S13 &s13 , S14 &s14 , S15 &s15 , Op op )
+ {
+ detail::for_each15( 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 ) , boost::begin( s9 ) , boost::begin( s10 ) , boost::begin( s11 ) , boost::begin( s12 ) , boost::begin( s13 ) , boost::begin( s14 ) , boost::begin( s15 ) , op );
+ }
+
+ template< class Value , class S , class Red >
+ static Value reduce( const S &s , Red red , Value init)
+ {
+ return detail::reduce( boost::begin( s ) , boost::end( s ) , red , init );
+ }
+
+ template< class Value , class S1 , class S2 , class Red >
+ static Value reduce2( const S1 &s1 , const S2 &s2 , Red red , Value init )
+ {
+ return detail::reduce2( boost::begin( s1 ) , boost::end( s1 ) , boost::begin( s2 ) , red , init );
+ }
+
+ template< class Value , class S1 , class S2 , class S3 , class Red >
+ static Value reduce3( const S1 &s1 , const S2 &s2 , const S3 &s3 , Red red , Value init )
+ {
+ return detail::reduce3( boost::begin( s1 ) , boost::end( s1 ) , boost::begin( s2 ) , boost::begin( s3 ) , red , init );
+ }
+
+ template< class Value , class S1 , class S2 , class S3 , class S4 , class Red >
+ static Value reduce4( const S1 &s1 , const S2 &s2 , const S3 &s3 , const S4 &s4 , Red red , Value init )
+ {
+ return detail::reduce4( boost::begin( s1 ) , boost::end( s1 ) , boost::begin( s2 ) , boost::begin( s3 ) , boost::begin( s4 ) , red , init );
+ }
+
+
+};
+
+} // odeint
+} // numeric
+} // boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_ALGEBRA_RANGE_ALGEBRA_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/algebra/vector_space_algebra.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/algebra/vector_space_algebra.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,156 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/algebra/vector_space_algebra.hpp
+
+ [begin_description]
+ An algebra for types which have vector space semantics, hence types on which the operators +,-,* are well defined.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_ALGEBRA_VECTOR_SPACE_ALGEBRA_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_ALGEBRA_VECTOR_SPACE_ALGEBRA_HPP_INCLUDED
+
+#include <boost/type_traits/remove_reference.hpp>
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+/*
+ * This class template has to be overload in order to call vector_space_algebra::reduce
+ */
+template< class State > struct vector_space_reduce;
+
+/*
+ * Example: instantiation for sole doubles
+ */
+template<>
+struct vector_space_reduce< double >
+{
+ template< class Op >
+ double operator()( double x , Op op , double init ) const
+ {
+ init = op( init , x );
+ return init;
+ }
+};
+
+
+struct vector_space_algebra
+{
+ template< class S1 , class Op >
+ static void for_each1( S1 &s1 , Op op )
+ {
+ // ToDo : build checks, that the +-*/ operators are well defined
+ op( s1 );
+ }
+
+ template< class S1 , class S2 , class Op >
+ static void for_each2( S1 &s1 , S2 &s2 , Op op )
+ {
+ op( s1 , s2 );
+ }
+
+ template< class S1 , class S2 , class S3 , class Op >
+ static void for_each3( S1 &s1 , S2 &s2 , S3 &s3 , Op op )
+ {
+ op( s1 , s2 , s3 );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class Op >
+ static void for_each4( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , Op op )
+ {
+ op( s1 , s2 , s3 , s4 );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class Op >
+ static void for_each5( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , Op op )
+ {
+ op( s1 , s2 , s3 , s4 , s5 );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class Op >
+ static void for_each6( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , Op op )
+ {
+ op( s1 , s2 , s3 , s4 , s5 , s6 );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class Op >
+ static void for_each7( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , Op op )
+ {
+ op( s1 , s2 , s3 , s4 , s5 , s6 , s7 );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class Op >
+ static void for_each8( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , Op op )
+ {
+ op( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class Op >
+ static void for_each9( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , Op op )
+ {
+ op( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class Op >
+ static void for_each10( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , Op op )
+ {
+ op( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s10 );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class S11 , class Op >
+ static void for_each11( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , Op op )
+ {
+ op( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s10 , s11 );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class Op >
+ static void for_each12( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , Op op )
+ {
+ op( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s10 , s11 , s12 );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class S13 , class Op >
+ static void for_each13( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , S13 &s13 , Op op )
+ {
+ op( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s10 , s11 , s12 , s13 );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class S13 , class S14 , class Op >
+ static void for_each14( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , S13 &s13 , S14 &s14 , Op op )
+ {
+ op( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s10 , s11 , s12 , s13 , s14 );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class S13 , class S14 , class S15 , class Op >
+ static void for_each15( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , S13 &s13 , S14 &s14 , S15 &s15 , Op op )
+ {
+ op( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s10 , s11 , s12 , s13 , s14 , s15 );
+ }
+
+ template< class Value , class S , class Red >
+ static Value reduce( const S &s , Red red , Value init )
+ {
+ boost::numeric::odeint::vector_space_reduce< S > r;
+ return r( s , red , init );
+ }
+};
+
+
+} // odeint
+} // numeric
+} // boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_ALGEBRA_VECTOR_SPACE_ALGEBRA_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/config.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/config.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,47 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/config.hpp
+
+ [begin_description]
+ Sets configurations for odeint and used libraries. Should be included before any other odeint library
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+#ifndef BOOST_NUMERIC_ODEINT_CONFIG_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_CONFIG_HPP_INCLUDED
+
+//increase macro variable to allow rk78 scheme
+#ifndef FUSION_MAX_VECTOR_SIZE
+#define FUSION_MAX_VECTOR_SIZE 15
+#endif
+
+/*
+ * the following definitions are only required if fusion vectors are used as state types
+ * in the rk78 scheme
+ * they should be defined by the user if required, see e.g. libs/numeric/examples/harmonic_oscillator_units.cpp
+ */
+#ifndef BOOST_FUSION_INVOKE_MAX_ARITY
+#define BOOST_FUSION_INVOKE_MAX_ARITY 15
+#endif
+
+#ifndef BOOST_RESULT_OF_NUM_ARGS
+#define BOOST_RESULT_OF_NUM_ARGS 15
+#endif
+/*
+ */
+
+#include <boost/config.hpp>
+
+#if __cplusplus >= 201103L
+#define BOOST_NUMERIC_ODEINT_CXX11 1
+#endif
+
+
+#endif // BOOST_NUMERIC_ODEINT_CONFIG_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/external/gsl/gsl_wrapper.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/external/gsl/gsl_wrapper.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,229 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/external/gsl/gsl_wrapper.hpp
+
+ [begin_description]
+ Wrapper for gsl_vector.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_GSL_GSL_WRAPPER_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_EXTERNAL_GSL_GSL_WRAPPER_HPP_INCLUDED
+
+#include <new>
+
+#include <gsl/gsl_vector.h>
+
+#include <boost/type_traits/integral_constant.hpp>
+#include <boost/range.hpp>
+#include <boost/iterator/iterator_facade.hpp>
+
+
+#include <boost/numeric/odeint/util/state_wrapper.hpp>
+#include <boost/numeric/odeint/util/is_resizeable.hpp>
+#include <boost/numeric/odeint/util/copy.hpp>
+
+class const_gsl_vector_iterator;
+
+/*
+ * defines an iterator for gsl_vector
+ */
+class gsl_vector_iterator : public boost::iterator_facade< gsl_vector_iterator , double , boost::random_access_traversal_tag >
+{
+public :
+
+ gsl_vector_iterator( void ): m_p(0) , m_stride( 0 ) { }
+ explicit gsl_vector_iterator( gsl_vector *p ) : m_p( p->data ) , m_stride( p->stride ) { }
+ friend gsl_vector_iterator end_iterator( gsl_vector * );
+
+private :
+
+ friend class boost::iterator_core_access;
+ friend class const_gsl_vector_iterator;
+
+ void increment( void ) { m_p += m_stride; }
+ void decrement( void ) { m_p -= m_stride; }
+ void advance( ptrdiff_t n ) { m_p += n*m_stride; }
+ bool equal( const gsl_vector_iterator &other ) const { return this->m_p == other.m_p; }
+ bool equal( const const_gsl_vector_iterator &other ) const;
+ double& dereference( void ) const { return *m_p; }
+
+ double *m_p;
+ size_t m_stride;
+};
+
+
+
+/*
+ * defines an const iterator for gsl_vector
+ */
+class const_gsl_vector_iterator : public boost::iterator_facade< const_gsl_vector_iterator , const double , boost::random_access_traversal_tag >
+{
+public :
+
+ const_gsl_vector_iterator( void ): m_p(0) , m_stride( 0 ) { }
+ explicit const_gsl_vector_iterator( const gsl_vector *p ) : m_p( p->data ) , m_stride( p->stride ) { }
+ const_gsl_vector_iterator( const gsl_vector_iterator &p ) : m_p( p.m_p ) , m_stride( p.m_stride ) { }
+
+private :
+
+ friend class boost::iterator_core_access;
+ friend class gsl_vector_iterator;
+ friend const_gsl_vector_iterator end_iterator( const gsl_vector * );
+
+ void increment( void ) { m_p += m_stride; }
+ void decrement( void ) { m_p -= m_stride; }
+ void advance( ptrdiff_t n ) { m_p += n*m_stride; }
+ bool equal( const const_gsl_vector_iterator &other ) const { return this->m_p == other.m_p; }
+ bool equal( const gsl_vector_iterator &other ) const { return this->m_p == other.m_p; }
+ const double& dereference( void ) const { return *m_p; }
+
+ const double *m_p;
+ size_t m_stride;
+};
+
+
+bool gsl_vector_iterator::equal( const const_gsl_vector_iterator &other ) const { return this->m_p == other.m_p; }
+
+
+gsl_vector_iterator end_iterator( gsl_vector *x )
+{
+ gsl_vector_iterator iter( x );
+ iter.m_p += iter.m_stride * x->size;
+ return iter;
+}
+
+const_gsl_vector_iterator end_iterator( const gsl_vector *x )
+{
+ const_gsl_vector_iterator iter( x );
+ iter.m_p += iter.m_stride * x->size;
+ return iter;
+}
+
+
+
+
+namespace boost
+{
+template<>
+struct range_mutable_iterator< gsl_vector* >
+{
+ typedef gsl_vector_iterator type;
+};
+
+template<>
+struct range_const_iterator< gsl_vector* >
+{
+ typedef const_gsl_vector_iterator type;
+};
+} // namespace boost
+
+
+
+
+// template<>
+inline gsl_vector_iterator range_begin( gsl_vector *x )
+{
+ return gsl_vector_iterator( x );
+}
+
+// template<>
+inline const_gsl_vector_iterator range_begin( const gsl_vector *x )
+{
+ return const_gsl_vector_iterator( x );
+}
+
+// template<>
+inline gsl_vector_iterator range_end( gsl_vector *x )
+{
+ return end_iterator( x );
+}
+
+// template<>
+inline const_gsl_vector_iterator range_end( const gsl_vector *x )
+{
+ return end_iterator( x );
+}
+
+
+
+
+
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+template<>
+struct is_resizeable< gsl_vector* >
+{
+ //struct type : public boost::true_type { };
+ typedef boost::true_type type;
+ const static bool value = type::value;
+};
+
+template <>
+struct same_size_impl< gsl_vector* , gsl_vector* >
+{
+ static bool same_size( const gsl_vector* x , const gsl_vector* y )
+ {
+ return x->size == y->size;
+ }
+};
+
+template <>
+struct resize_impl< gsl_vector* , gsl_vector* >
+{
+ static void resize( gsl_vector* x , const gsl_vector* y )
+ {
+ gsl_vector_free( x );
+ x = gsl_vector_alloc( y->size );
+ }
+};
+
+template<>
+struct state_wrapper< gsl_vector* >
+{
+ typedef double value_type;
+ typedef gsl_vector* state_type;
+ typedef state_wrapper< gsl_vector* > state_wrapper_type;
+
+ state_type m_v;
+
+ state_wrapper( )
+ {
+ m_v = gsl_vector_alloc( 1 );
+ }
+
+ state_wrapper( const state_wrapper_type &x )
+ {
+ resize( m_v , x.m_v );
+ gsl_vector_memcpy( m_v , x.m_v );
+ }
+
+
+ ~state_wrapper()
+ {
+ gsl_vector_free( m_v );
+ }
+
+};
+
+} // odeint
+} // numeric
+} // boost
+
+
+
+
+#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_GSL_GSL_WRAPPER_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/external/mkl/mkl_operations.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/external/mkl/mkl_operations.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,181 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/external/mkl/mkl_operations.hpp
+
+ [begin_description]
+ Wrapper classes for intel math kernel library types.
+ Get a free, non-commercial download of MKL at
+ http://software.intel.com/en-us/articles/non-commercial-software-download/
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_MKL_MKL_OPERATIONS_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_EXTERNAL_MKL_MKL_OPERATIONS_HPP_INCLUDED
+
+#include <iostream>
+
+#include <mkl_cblas.h>
+#include <boost/numeric/odeint/algebra/default_operations.hpp>
+
+/* exemplary example for writing bindings to the Intel MKL library
+ * see test/mkl for how to use mkl with odeint
+ * this is a quick and dirty implementation showing the general possibility.
+ * It works only with containers based on double and sequentiel memory allocation.
+ */
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+/* only defined for doubles */
+struct mkl_operations
+{
+ //template< class Fac1 , class Fac2 > struct scale_sum2;
+
+ template< class F1 = double , class F2 = F1 >
+ struct scale_sum2
+ {
+ typedef double Fac1;
+ typedef double Fac2;
+ const Fac1 m_alpha1;
+ const Fac2 m_alpha2;
+
+ scale_sum2( const Fac1 alpha1 , const Fac2 alpha2 ) : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) { }
+
+ template< class T1 , class T2 , class T3 >
+ void operator()( T1 &t1 , const T2 &t2 , const T3 &t3) const
+ { // t1 = m_alpha1 * t2 + m_alpha2 * t3;
+ // we get Containers that have size() and [i]-access
+
+ const int n = t1.size();
+ //boost::numeric::odeint::copy( t1 , t3 );
+ if( &(t2[0]) != &(t1[0]) )
+ {
+ cblas_dcopy( n , &(t2[0]) , 1 , &(t1[0]) , 1 );
+ }
+ cblas_dscal( n , m_alpha1 , &(t1[0]) , 1 );
+ cblas_daxpy( n , m_alpha2 , &(t3[0]) , 1 , &(t1[0]) , 1 );
+ //daxpby( &n , &m_alpha2 , &(t3[0]) , &one , &m_alpha1 , &(t1[0]) , &one );
+ }
+ };
+
+ template< class F1 = double , class F2 = F1 , class F3 = F2 >
+ struct scale_sum3
+ {
+ typedef double Fac1;
+ typedef double Fac2;
+ typedef double Fac3;
+ const Fac1 m_alpha1;
+ const Fac2 m_alpha2;
+ const Fac3 m_alpha3;
+
+ scale_sum3( const Fac1 alpha1 , const Fac2 alpha2 , const Fac3 alpha3 )
+ : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) { }
+
+ template< class T1 , class T2 , class T3 , class T4 >
+ void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 ) const
+ { // t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4;
+ // we get Containers that have size() and [i]-access
+
+ const int n = t1.size();
+ //boost::numeric::odeint::copy( t1 , t3 );
+ if( &(t2[0]) != &(t1[0]) )
+ {
+ cblas_dcopy( n , &(t2[0]) , 1 , &(t1[0]) , 1 );
+ }
+ cblas_dscal( n , m_alpha1 , &(t1[0]) , 1 );
+ cblas_daxpy( n , m_alpha2 , &(t3[0]) , 1 , &(t1[0]) , 1 );
+ //daxpby( &n , &m_alpha2 , &(t3[0]) , &one , &m_alpha1 , &(t1[0]) , &one );
+ cblas_daxpy( n , m_alpha3 , &(t4[0]) , 1 , &(t1[0]) , 1 );
+ }
+ };
+
+ template< class F1 = double , class F2 = F1 , class F3 = F2 , class F4 = F3 >
+ struct scale_sum4
+ {
+ typedef double Fac1;
+ typedef double Fac2;
+ typedef double Fac3;
+ typedef double Fac4;
+ const Fac1 m_alpha1;
+ const Fac2 m_alpha2;
+ const Fac3 m_alpha3;
+ const Fac4 m_alpha4;
+
+ scale_sum4( const Fac1 alpha1 , const Fac2 alpha2 , const Fac3 alpha3 , const Fac4 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 ) const
+ { // t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5;
+ // we get Containers that have size() and [i]-access
+
+ const int n = t1.size();
+ //boost::numeric::odeint::copy( t1 , t3 );
+ if( &(t2[0]) != &(t1[0]) )
+ {
+ cblas_dcopy( n , &(t2[0]) , 1 , &(t1[0]) , 1 );
+ }
+
+ cblas_dscal( n , m_alpha1 , &(t1[0]) , 1 );
+ cblas_daxpy( n , m_alpha2 , &(t3[0]) , 1 , &(t1[0]) , 1 );
+ //daxpby( &n , &m_alpha2 , &(t3[0]) , &one , &m_alpha1 , &(t1[0]) , &one );
+ cblas_daxpy( n , m_alpha3 , &(t4[0]) , 1 , &(t1[0]) , 1 );
+ cblas_daxpy( n , m_alpha4 , &(t5[0]) , 1 , &(t1[0]) , 1 );
+ }
+ };
+
+
+ template< class F1 = double , class F2 = F1 , class F3 = F2 , class F4 = F3 , class F5 = F4 >
+ struct scale_sum5
+ {
+ typedef double Fac1;
+ typedef double Fac2;
+ typedef double Fac3;
+ typedef double Fac4;
+ typedef double Fac5;
+ const Fac1 m_alpha1;
+ const Fac2 m_alpha2;
+ const Fac3 m_alpha3;
+ const Fac4 m_alpha4;
+ const Fac5 m_alpha5;
+
+ scale_sum5( const Fac1 alpha1 , const Fac2 alpha2 , const Fac3 alpha3 , const Fac4 alpha4 , const Fac5 alpha5 )
+ : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) { }
+
+ template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 >
+ void operator()( T1 &t1 , const T2 &t2 , const T3 &t3 , const T4 &t4 , const T5 &t5 , const T6 &t6 ) const
+ { // t1 = m_alpha1 * t2 + m_alpha2 * t3 + m_alpha3 * t4 + m_alpha4 * t5 + m_alpha5 * t6;
+ // we get Containers that have size() and [i]-access
+
+ const int n = t1.size();
+ //boost::numeric::odeint::copy( t1 , t3 );
+ if( &(t2[0]) != &(t1[0]) )
+ {
+ cblas_dcopy( n , &(t2[0]) , 1 , &(t1[0]) , 1 );
+ }
+
+ cblas_dscal( n , m_alpha1 , &(t1[0]) , 1 );
+ cblas_daxpy( n , m_alpha2 , &(t3[0]) , 1 , &(t1[0]) , 1 );
+ //daxpby( &n , &m_alpha2 , &(t3[0]) , &one , &m_alpha1 , &(t1[0]) , &one );
+ cblas_daxpy( n , m_alpha3 , &(t4[0]) , 1 , &(t1[0]) , 1 );
+ cblas_daxpy( n , m_alpha4 , &(t5[0]) , 1 , &(t1[0]) , 1 );
+ cblas_daxpy( n , m_alpha5 , &(t6[0]) , 1 , &(t1[0]) , 1 );
+ }
+ };
+
+};
+
+} // odeint
+} // numeric
+} // boost
+
+#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_MKL_MKL_OPERATIONS_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/external/mtl4/implicit_euler_mtl4.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/external/mtl4/implicit_euler_mtl4.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,162 @@
+/*
+[begin_description]
+Modification of the implicit Euler method, works with the MTL4 matrix library only.
+[end_description]
+
+Copyright 2009-2011 Karsten Ahnert
+Copyright 2009-2011 Mario Mulansky
+Copyright 2012 Andreas Angelopoulos
+
+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)
+*/
+
+
+#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_IMPLICIT_EULER_MTL4_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_EXTERNAL_IMPLICIT_EULER_MTL4_HPP_INCLUDED
+
+
+#include <utility>
+
+#include <boost/numeric/odeint/util/bind.hpp>
+#include <boost/numeric/odeint/util/unwrap_reference.hpp>
+#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
+
+#include <boost/numeric/odeint/external/mtl4/mtl4_resize.hpp>
+
+#include <boost/numeric/mtl/mtl.hpp>
+#include <boost/numeric/itl/itl.hpp>
+
+
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+template< class ValueType , class Resizer = initially_resizer >
+class implicit_euler_mtl4
+{
+
+public:
+
+ typedef ValueType value_type;
+ typedef value_type time_type;
+ typedef mtl::dense_vector<value_type> state_type;
+
+ typedef state_wrapper< state_type > wrapped_state_type;
+ typedef state_type deriv_type;
+ typedef state_wrapper< deriv_type > wrapped_deriv_type;
+ typedef mtl::compressed2D< value_type > matrix_type;
+ typedef state_wrapper< matrix_type > wrapped_matrix_type;
+
+ typedef Resizer resizer_type;
+ typedef stepper_tag stepper_category;
+
+ typedef implicit_euler_mtl4< ValueType , Resizer > stepper_type;
+
+
+ implicit_euler_mtl4( const value_type epsilon = 1E-6 )
+ : m_epsilon( epsilon ) , m_resizer() ,
+ m_dxdt() , m_x() ,
+ m_identity() , m_jacobi()
+ { }
+
+
+ template< class System >
+ void do_step( System system , state_type &x , time_type t , time_type dt )
+ {
+ typedef typename odeint::unwrap_reference< System >::type system_type;
+ typedef typename odeint::unwrap_reference< typename system_type::first_type >::type deriv_func_type;
+ typedef typename odeint::unwrap_reference< typename system_type::second_type >::type jacobi_func_type;
+ system_type &sys = system;
+ deriv_func_type &deriv_func = sys.first;
+ jacobi_func_type &jacobi_func = sys.second;
+
+ m_resizer.adjust_size( x , detail::bind(
+ &stepper_type::template resize_impl< state_type > , detail::ref( *this ) , detail::_1 ) );
+
+ m_identity.m_v = 1;
+
+ t += dt;
+ m_x.m_v = x;
+
+ deriv_func( x , m_dxdt.m_v , t );
+ jacobi_func( x , m_jacobi.m_v , t );
+
+
+ m_dxdt.m_v *= -dt;
+
+ m_jacobi.m_v *= dt;
+ m_jacobi.m_v -= m_identity.m_v ;
+
+
+
+ // using ilu_0 preconditioning -incomplete LU factorisation
+ // itl::pc::diagonal<matrix_type,double> L(m_jacobi.m_v);
+ itl::pc::ilu_0<matrix_type> L( m_jacobi.m_v );
+
+ solve( m_jacobi.m_v , m_x.m_v , m_dxdt.m_v , L );
+ x+= m_x.m_v;
+
+
+ }
+
+
+ template< class StateType >
+ void adjust_size( const StateType &x )
+ {
+ resize_impl( x );
+ }
+
+
+private:
+
+
+ /*
+ Applying approximate iteractive linear solvers
+ default solver is Biconjugate gradient stabilized method
+ itl::bicgstab(A, x, b, L, iter);
+ */
+ template < class LinearOperator, class HilbertSpaceX, class HilbertSpaceB, class Preconditioner>
+ void solve(const LinearOperator& A, HilbertSpaceX& x, const HilbertSpaceB& b,
+ const Preconditioner& L, int max_iteractions =500)
+ {
+ // Termination criterion: r < 1e-6 * b or N iterations
+ itl::basic_iteration< double > iter( b , max_iteractions , 1e-6 );
+ itl::bicgstab( A , x , b , L , iter );
+
+ }
+
+
+ template< class StateIn >
+ bool resize_impl( const StateIn &x )
+ {
+ bool resized = false;
+ resized |= adjust_size_by_resizeability( m_dxdt , x , typename is_resizeable<deriv_type>::type() );
+ resized |= adjust_size_by_resizeability( m_x , x , typename is_resizeable<state_type>::type() );
+ resized |= adjust_size_by_resizeability( m_identity , x , typename is_resizeable<matrix_type>::type() );
+ resized |= adjust_size_by_resizeability( m_jacobi , x , typename is_resizeable<matrix_type>::type() );
+ return resized;
+ }
+
+
+private:
+
+ value_type m_epsilon;
+ resizer_type m_resizer;
+ wrapped_deriv_type m_dxdt;
+ wrapped_state_type m_x;
+ wrapped_matrix_type m_identity;
+ wrapped_matrix_type m_jacobi;
+};
+
+
+} // odeint
+} // numeric
+} // boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_IMPLICIT_EULER_MTL4_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/external/mtl4/mtl4_resize.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/external/mtl4/mtl4_resize.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,133 @@
+/*
+[begin_description]
+Modification of the implicit Euler method, works with the MTL4 matrix library only.
+[end_description]
+
+Copyright 2009-2011 Karsten Ahnert
+Copyright 2009-2011 Mario Mulansky
+Copyright 2012 Andreas Angelopoulos
+
+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)
+*/
+
+
+#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_MTL4_RESIZE_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_EXTERNAL_MTL4_RESIZE_HPP_INCLUDED
+
+#include <boost/numeric/odeint/util/is_resizeable.hpp>
+#include <boost/numeric/odeint/util/resize.hpp>
+#include <boost/numeric/odeint/util/same_size.hpp>
+
+#include <boost/numeric/mtl/vector/dense_vector.hpp>
+#include <boost/numeric/mtl/matrix/dense2D.hpp>
+#include <boost/numeric/mtl/matrix/compressed2D.hpp>
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+template< class Value , class Parameters >
+struct is_resizeable< mtl::dense_vector< Value , Parameters > >
+{
+ typedef boost::true_type type;
+ const static bool value = type::value;
+};
+
+template< class Value , class Parameters >
+struct is_resizeable< mtl::dense2D< Value , Parameters > >
+{
+ typedef boost::true_type type;
+ const static bool value = type::value;
+};
+
+template< class Value , class Parameters >
+struct is_resizeable< mtl::compressed2D< Value , Parameters > >
+{
+ typedef boost::true_type type;
+ const static bool value = type::value;
+};
+
+
+
+
+template< class Value , class Parameters >
+struct same_size_impl< mtl::dense_vector< Value , Parameters > , mtl::dense_vector< Value , Parameters > >
+{
+ static bool same_size( const mtl::dense_vector< Value , Parameters > &v1 ,
+ const mtl::dense_vector< Value , Parameters > &v2 )
+ {
+ return mtl::size( v1 ) == mtl::size( v2 );
+ }
+};
+
+template< class Value , class Parameters >
+struct resize_impl< mtl::dense_vector< Value , Parameters > , mtl::dense_vector< Value , Parameters > >
+{
+ static void resize( mtl::dense_vector< Value , Parameters > &v1 ,
+ const mtl::dense_vector< Value , Parameters > &v2 )
+ {
+ v1.change_dim( mtl::size( v2 ) );
+ }
+};
+
+
+
+template< class Value , class MatrixParameters , class VectorParameters >
+struct same_size_impl< mtl::dense2D< Value , MatrixParameters > , mtl::dense_vector< Value , VectorParameters > >
+{
+ static bool same_size( const mtl::dense2D< Value , MatrixParameters > &m ,
+ const mtl::dense_vector< Value , VectorParameters > &v )
+ {
+ return ( ( mtl::size( v ) == m.num_cols() ) && ( mtl::size( v ) == m.num_rows() ) );
+ }
+};
+
+template< class Value , class MatrixParameters , class VectorParameters >
+struct resize_impl< mtl::dense2D< Value , MatrixParameters > , mtl::dense_vector< Value , VectorParameters > >
+{
+ static void resize( mtl::dense2D< Value , MatrixParameters > &m ,
+ const mtl::dense_vector< Value , VectorParameters > &v )
+ {
+ m.change_dim( mtl::size( v ) , mtl::size( v ) , false );
+ }
+};
+
+
+
+
+template< class Value , class MatrixParameters , class VectorParameters >
+struct same_size_impl< mtl::compressed2D< Value , MatrixParameters > , mtl::dense_vector< Value , VectorParameters > >
+{
+ static bool same_size( const mtl::compressed2D< Value , MatrixParameters > &m ,
+ const mtl::dense_vector< Value , VectorParameters > &v )
+ {
+ return ( ( mtl::size( v ) == m.num_cols() ) && ( mtl::size( v ) == m.num_rows() ) );
+ }
+};
+
+template< class Value , class MatrixParameters , class VectorParameters >
+struct resize_impl< mtl::compressed2D< Value , MatrixParameters > , mtl::dense_vector< Value , VectorParameters > >
+{
+ static void resize( mtl::compressed2D< Value , MatrixParameters > &m ,
+ const mtl::dense_vector< Value , VectorParameters > &v )
+ {
+ m.change_dim( mtl::size( v ) , mtl::size( v ) );
+ }
+};
+
+
+
+
+
+
+
+
+} // namespace odeint
+} // namesapce numeric
+} // namespace boost
+
+#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_MTL4_RESIZE_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/external/thrust/thrust_algebra.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/external/thrust/thrust_algebra.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,198 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/external/thrust/thrust_algebra.hpp
+
+ [begin_description]
+ An algebra for thrusts device_vectors.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_THRUST_ALGEBRA_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_THRUST_ALGEBRA_HPP_INCLUDED
+
+
+#include <thrust/device_vector.h>
+#include <thrust/for_each.h>
+#include <thrust/iterator/zip_iterator.h>
+
+#include <boost/range.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+
+/** ToDO extend until for_each14 for rk78 */
+
+/*
+ * 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 >
+ static void for_each1( 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 )
+ {
+ 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 )
+ {
+ 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::end(s3) ) ) ,
+ op);
+ }
+
+ template< class StateType1 , class StateType2 , class StateType3 , class StateType4 ,
+ class Operation >
+ static void for_each4( StateType1 &s1 , StateType2 &s2 , StateType3 &s3 , StateType4 &s4 ,
+ Operation op )
+ {
+ thrust::for_each(
+ thrust::make_zip_iterator( thrust::make_tuple( boost::begin(s1) ,
+ boost::begin(s2) ,
+ boost::begin(s3) ,
+ boost::begin(s4) ) ) ,
+ thrust::make_zip_iterator( thrust::make_tuple( boost::end(s1) ,
+ boost::end(s2) ,
+ boost::end(s3) ,
+ boost::end(s4) ) ) ,
+ op);
+ }
+
+ template< class StateType1 , class StateType2 , class StateType3 ,
+ class StateType4 , class StateType5 ,class Operation >
+ static void for_each5( StateType1 &s1 , StateType2 &s2 , StateType3 &s3 , StateType4 &s4 ,
+ StateType5 &s5 , Operation op )
+ {
+ thrust::for_each(
+ thrust::make_zip_iterator( thrust::make_tuple( boost::begin(s1) ,
+ boost::begin(s2) ,
+ boost::begin(s3) ,
+ boost::begin(s4) ,
+ boost::begin(s5) ) ) ,
+ thrust::make_zip_iterator( thrust::make_tuple( boost::end(s1) ,
+ boost::end(s2) ,
+ boost::end(s3) ,
+ boost::end(s4) ,
+ boost::end(s5) ) ) ,
+ op);
+ }
+
+ template< class StateType1 , class StateType2 , class StateType3 ,
+ class StateType4 , class StateType5 , class StateType6 , class Operation >
+ static void for_each6( StateType1 &s1 , StateType2 &s2 , StateType3 &s3 , StateType4 &s4 ,
+ StateType5 &s5 , StateType6 &s6 , Operation op )
+ {
+ thrust::for_each(
+ thrust::make_zip_iterator( thrust::make_tuple( boost::begin(s1) ,
+ boost::begin(s2) ,
+ boost::begin(s3) ,
+ boost::begin(s4) ,
+ boost::begin(s5) ,
+ boost::begin(s6) ) ) ,
+ thrust::make_zip_iterator( thrust::make_tuple( boost::end(s1) ,
+ boost::end(s2) ,
+ boost::end(s3) ,
+ boost::end(s4) ,
+ boost::end(s5) ,
+ boost::end(s6) ) ) ,
+ op);
+ }
+
+ template< class StateType1 , class StateType2 , class StateType3 , class StateType4 ,
+ class StateType5 , class StateType6 , class StateType7 , class Operation >
+ static void for_each7( StateType1 &s1 , StateType2 &s2 , StateType3 &s3 , StateType4 &s4 ,
+ StateType5 &s5 , StateType6 &s6 , StateType7 &s7 , Operation op )
+ {
+ thrust::for_each(
+ thrust::make_zip_iterator( thrust::make_tuple( boost::begin(s1) ,
+ boost::begin(s2) ,
+ boost::begin(s3) ,
+ boost::begin(s4) ,
+ boost::begin(s5) ,
+ boost::begin(s6) ,
+ boost::begin(s7) ) ) ,
+ thrust::make_zip_iterator( thrust::make_tuple( boost::end(s1) ,
+ boost::end(s2) ,
+ boost::end(s3) ,
+ boost::end(s4) ,
+ boost::end(s5) ,
+ boost::end(s6) ,
+ boost::end(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 )
+ {
+ thrust::for_each(
+ thrust::make_zip_iterator( thrust::make_tuple( boost::begin(s1) ,
+ boost::begin(s2) ,
+ boost::begin(s3) ,
+ boost::begin(s4) ,
+ boost::begin(s5) ,
+ boost::begin(s6) ,
+ boost::begin(s7) ,
+ boost::begin(s8) ) ) ,
+ thrust::make_zip_iterator( thrust::make_tuple( boost::end(s1) ,
+ boost::end(s2) ,
+ boost::end(s3) ,
+ boost::end(s4) ,
+ boost::end(s5) ,
+ boost::end(s6) ,
+ boost::end(s7) ,
+ boost::end(s8) ) ) ,
+ op);
+ }
+
+
+ template< class Value , class S , class Red >
+ Value reduce( const S &s , Red red , Value init)
+ {
+ return thrust::reduce( boost::begin( s ) , boost::end( s ) , init , red );
+ }
+
+
+
+
+};
+
+
+} // odeint
+} // numeric
+} // boost
+
+
+
+#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_THRUST_ALGEBRA_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/external/thrust/thrust_operations.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/external/thrust/thrust_operations.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,252 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/external/thrust/thrust_operations.hpp
+
+ [begin_description]
+ Operations of thrust zipped iterators. Is the counterpart of the thrust_algebra.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_THRUST_OPERATIONS_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_THRUST_OPERATIONS_HPP_INCLUDED
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+#include <thrust/tuple.h>
+#include <thrust/iterator/zip_iterator.h>
+
+/**ToDo extend to scale_sum13 for rk78 */
+
+struct thrust_operations
+{
+ template< class Fac1 = double , class Fac2 = Fac1 >
+ struct scale_sum2
+ {
+ const Fac1 m_alpha1;
+ const Fac2 m_alpha2;
+
+ scale_sum2( const Fac1 alpha1 , const Fac2 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);
+ }
+ };
+
+ template< class Fac1 = double , class Fac2 = Fac1 >
+ struct scale_sum_swap2
+ {
+ const Fac1 m_alpha1;
+ const Fac2 m_alpha2;
+
+ scale_sum_swap2( const Fac1 alpha1 , const Fac2 alpha2 )
+ : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) { }
+
+ template< class Tuple >
+ __host__ __device__
+ void operator()( Tuple t ) const
+ {
+ typename thrust::tuple_element<0,Tuple>::type tmp = thrust::get<0>(t);
+ thrust::get<0>(t) = m_alpha1 * thrust::get<1>(t) + m_alpha2 * thrust::get<2>(t);
+ thrust::get<1>(t) = tmp;
+ }
+ };
+
+ template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 >
+ struct scale_sum3
+ {
+ const Fac1 m_alpha1;
+ const Fac2 m_alpha2;
+ const Fac3 m_alpha3;
+
+ scale_sum3( const Fac1 alpha1 , const Fac2 alpha2 , const Fac3 alpha3 )
+ : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) { }
+
+ 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) +
+ m_alpha3 * thrust::get<3>(t);
+ }
+ };
+
+
+ template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 >
+ struct scale_sum4
+ {
+ const Fac1 m_alpha1;
+ const Fac2 m_alpha2;
+ const Fac3 m_alpha3;
+ const Fac4 m_alpha4;
+
+ scale_sum4( const Fac1 alpha1 , const Fac2 alpha2 , const Fac3 alpha3 , const Fac4 alpha4 )
+ : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ){ }
+
+ 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) +
+ m_alpha3 * thrust::get<3>(t) +
+ m_alpha4 * thrust::get<4>(t);
+ }
+ };
+
+
+ template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 ,
+ class Fac4 = Fac3 , class Fac5 = Fac4 >
+ struct scale_sum5
+ {
+ const Fac1 m_alpha1;
+ const Fac2 m_alpha2;
+ const Fac3 m_alpha3;
+ const Fac4 m_alpha4;
+ const Fac5 m_alpha5;
+
+ scale_sum5( const Fac1 alpha1 , const Fac2 alpha2 , const Fac3 alpha3 ,
+ const Fac4 alpha4 , const Fac5 alpha5 )
+ : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) ,
+ m_alpha4( alpha4 ) , m_alpha5( alpha5 ) { }
+
+ 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) +
+ m_alpha3 * thrust::get<3>(t) +
+ m_alpha4 * thrust::get<4>(t) +
+ m_alpha5 * thrust::get<5>(t);
+ }
+ };
+
+
+ template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 ,
+ class Fac4 = Fac3 , class Fac5 = Fac4 , class Fac6 = Fac5 >
+ struct scale_sum6
+ {
+ const Fac1 m_alpha1;
+ const Fac2 m_alpha2;
+ const Fac3 m_alpha3;
+ const Fac4 m_alpha4;
+ const Fac5 m_alpha5;
+ const Fac6 m_alpha6;
+
+ scale_sum6( const Fac1 alpha1 , const Fac2 alpha2 , const Fac3 alpha3 ,
+ const Fac4 alpha4 , const Fac5 alpha5 , const Fac6 alpha6 )
+ : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) ,
+ m_alpha4( alpha4 ) , m_alpha5( alpha5 ) , m_alpha6( alpha6 ) { }
+
+ 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) +
+ m_alpha3 * thrust::get<3>(t) +
+ m_alpha4 * thrust::get<4>(t) +
+ m_alpha5 * thrust::get<5>(t) +
+ m_alpha6 * thrust::get<6>(t);
+ }
+ };
+
+
+ template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 ,
+ class Fac5 = Fac4 , class Fac6 = Fac5 , class Fac7 = Fac6 >
+ struct scale_sum7
+ {
+ const Fac1 m_alpha1;
+ const Fac2 m_alpha2;
+ const Fac3 m_alpha3;
+ const Fac4 m_alpha4;
+ const Fac5 m_alpha5;
+ const Fac6 m_alpha6;
+ const Fac7 m_alpha7;
+
+ scale_sum7( const Fac1 alpha1 , const Fac2 alpha2 , const Fac3 alpha3 ,
+ const Fac4 alpha4 , const Fac5 alpha5 , const Fac6 alpha6 , const Fac7 alpha7 )
+ : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) ,
+ m_alpha4( alpha4 ) , m_alpha5( alpha5 ) , m_alpha6( alpha6 ) , m_alpha7( alpha7 ) { }
+
+ 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) +
+ m_alpha3 * thrust::get<3>(t) +
+ m_alpha4 * thrust::get<4>(t) +
+ m_alpha5 * thrust::get<5>(t) +
+ m_alpha6 * thrust::get<6>(t) +
+ m_alpha7 * thrust::get<7>(t) ;
+ }
+ };
+
+
+
+
+ template< class Fac1 = double >
+ struct rel_error
+ {
+ const Fac1 m_eps_abs , m_eps_rel , m_a_x , m_a_dxdt;
+
+ rel_error( const Fac1 eps_abs , const Fac1 eps_rel , const Fac1 a_x , const Fac1 a_dxdt )
+ : m_eps_abs( eps_abs ) , m_eps_rel( eps_rel ) , m_a_x( a_x ) , m_a_dxdt( a_dxdt ) { }
+
+
+ template< class Tuple >
+ __host__ __device__
+ void operator()( Tuple t ) const
+ {
+ using std::abs;
+ thrust::get< 0 >( t ) = abs( thrust::get< 0 >( t ) ) /
+ ( m_eps_abs + m_eps_rel * ( m_a_x * abs( thrust::get< 1 >( t ) + m_a_dxdt * abs( thrust::get< 2 >( t ) ) ) ) );
+ }
+
+ typedef void result_type;
+ };
+
+
+ /*
+ * for usage in reduce
+ */
+
+ template< class Value >
+ struct maximum
+ {
+ template< class Fac1 , class Fac2 >
+ __host__ __device__
+ Value operator()( const Fac1 t1 , const Fac2 t2 ) const
+ {
+ using std::max;
+ return ( abs( t1 ) < abs( t2 ) ) ? t2 : t1 ;
+ }
+
+ typedef Value result_type;
+ };
+
+
+};
+
+} // odeint
+} // numeric
+} // boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_THRUST_OPERATIONS_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/external/thrust/thrust_resize.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/external/thrust/thrust_resize.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,119 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/external/thrust/thrust_resize.hpp
+
+ [begin_description]
+ Enable resizing for thrusts device and host_vector.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_THRUST_RESIZE_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_THRUST_RESIZE_HPP_INCLUDED
+
+
+#include <thrust/device_vector.h>
+#include <thrust/host_vector.h>
+
+#include <boost/numeric/odeint/util/copy.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+template< class T >
+struct is_resizeable< thrust::device_vector< T > >
+{
+ struct type : public boost::true_type { };
+ const static bool value = type::value;
+};
+
+template< class T >
+struct same_size_impl< thrust::device_vector< T > , thrust::device_vector< T > >
+{
+ static bool same_size( const thrust::device_vector< T > &x , const thrust::device_vector< T > &y )
+ {
+ return x.size() == y.size();
+ }
+};
+
+template< class T >
+struct resize_impl< thrust::device_vector< T > , thrust::device_vector< T > >
+{
+ static void resize( thrust::device_vector< T > &x , const thrust::device_vector< T > &y )
+ {
+ x.resize( y.size() );
+ }
+};
+
+
+template< class T >
+struct is_resizeable< thrust::host_vector< T > >
+{
+ struct type : public boost::true_type { };
+ const static bool value = type::value;
+};
+
+template< class T >
+struct same_size_impl< thrust::host_vector< T > , thrust::host_vector< T > >
+{
+ static bool same_size( const thrust::host_vector< T > &x , const thrust::host_vector< T > &y )
+ {
+ return x.size() == y.size();
+ }
+};
+
+template< class T >
+struct resize_impl< thrust::host_vector< T > , thrust::host_vector< T > >
+{
+ static void resize( thrust::host_vector< T > &x , const thrust::host_vector< T > &y )
+ {
+ x.resize( y.size() );
+ }
+};
+
+
+
+template< class Container1, class Value >
+struct copy_impl< Container1 , thrust::device_vector< Value > >
+{
+ static void copy( const Container1 &from , thrust::device_vector< Value > &to )
+ {
+ thrust::copy( boost::begin( from ) , boost::end( from ) , boost::begin( to ) );
+ }
+};
+
+template< class Value , class Container2 >
+struct copy_impl< thrust::device_vector< Value > , Container2 >
+{
+ static void copy( const thrust::device_vector< Value > &from , Container2 &to )
+ {
+ thrust::copy( boost::begin( from ) , boost::end( from ) , boost::begin( to ) );
+ }
+};
+
+template< class Value >
+struct copy_impl< thrust::device_vector< Value > , thrust::device_vector< Value > >
+{
+ static void copy( const thrust::device_vector< Value > &from , thrust::device_vector< Value > &to )
+ {
+ thrust::copy( boost::begin( from ) , boost::end( from ) , boost::begin( to ) );
+ }
+};
+
+
+
+
+} // odeint
+} // numeric
+} // boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_THRUST_RESIZE_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/external/vexcl/vexcl_resize.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/external/vexcl/vexcl_resize.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,92 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/external/vexcl/vexcl_resize.hpp
+
+ [begin_description]
+ Enable resizing for vexcl vector and multivector.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_RESIZE_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_RESIZE_HPP_INCLUDED
+
+#include <vexcl/vector.hpp>
+
+#include <boost/numeric/odeint/util/is_resizeable.hpp>
+#include <boost/numeric/odeint/util/resize.hpp>
+#include <boost/numeric/odeint/util/same_size.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+
+/*
+ * specializations for vex::vector< T >
+ */
+template< typename T >
+struct is_resizeable< vex::vector< T > > : boost::true_type { };
+
+template< typename T >
+struct resize_impl< vex::vector< T > , vex::vector< T > >
+{
+ static void resize( vex::vector< T > &x1 , const vex::vector< T > &x2 )
+ {
+ x1.resize( x2.queue_list() , x2.size() );
+ }
+};
+
+template< typename T >
+struct same_size_impl< vex::vector< T > , vex::vector< T > >
+{
+ static bool same_size( const vex::vector< T > &x1 , const vex::vector< T > &x2 )
+ {
+ return x1.size() == x2.size();
+ }
+};
+
+
+
+
+
+/*
+ * specializations for vex::multivector< T >
+ */
+template< typename T , uint N >
+struct is_resizeable< vex::multivector< T , N > > : boost::true_type { };
+
+template< typename T , uint N >
+struct resize_impl< vex::multivector< T , N > , vex::multivector< T , N > >
+{
+ static void resize( vex::multivector< T , N > &x1 , const vex::multivector< T , N > &x2 )
+ {
+ x1.resize( x2.queue_list() , x2.size() );
+ }
+};
+
+template< typename T , uint N >
+struct same_size_impl< vex::multivector< T , N > , vex::multivector< T , N > >
+{
+ static bool same_size( const vex::multivector< T , N > &x1 , const vex::multivector< T , N > &x2 )
+ {
+ return x1.size() == x2.size();
+ }
+};
+
+
+} // namespace odeint
+} // namespace numeric
+} // namespace boost
+
+
+
+#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_RESIZE_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/external/viennacl/viennacl_operations.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/external/viennacl/viennacl_operations.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,245 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/external/viennacl_operations.hpp
+
+ [begin_description]
+ ViennaCL operations.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_VIENNACL_VIENNACL_OPERATIONS_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_EXTERNAL_VIENNACL_VIENNACL_OPERATIONS_HPP_INCLUDED
+
+#include <viennacl/vector.hpp>
+#include <viennacl/generator/custom_operation.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+
+struct viennacl_operations
+{
+
+ template< class Fac1 = double , class Fac2 = Fac1 >
+ struct scale_sum2
+ {
+ const Fac1 m_alpha1;
+ const Fac2 m_alpha2;
+
+ scale_sum2( Fac1 alpha1 , Fac2 alpha2 )
+ : m_alpha1( alpha1 ) , m_alpha2( alpha2 )
+ { }
+
+ template< class T1 , class T2 , class T3 >
+ void operator()( viennacl::vector<T1> &v1 ,
+ const viennacl::vector<T2> &v2 ,
+ const viennacl::vector<T3> &v3
+ ) const
+ {
+ using namespace viennacl;
+
+ static generator::symbolic_vector <0, T1> sym_v1;
+ static generator::symbolic_vector <1, T2> sym_v2;
+ static generator::symbolic_vector <2, T3> sym_v3;
+ static generator::cpu_symbolic_scalar<3, Fac1> sym_a1;
+ static generator::cpu_symbolic_scalar<4, Fac2> sym_a2;
+
+ static generator::custom_operation op(
+ sym_v1 = sym_a1 * sym_v2
+ + sym_a2 * sym_v3
+ );
+
+ ocl::enqueue( op(v1,
+ const_cast< viennacl::vector<T2>& >(v2),
+ const_cast< viennacl::vector<T3>& >(v3),
+ const_cast< Fac1& >(m_alpha1),
+ const_cast< Fac2& >(m_alpha2)
+ ) );
+ }
+
+ typedef void result_type;
+ };
+
+
+ template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 >
+ struct scale_sum3
+ {
+ const Fac1 m_alpha1;
+ const Fac2 m_alpha2;
+ const Fac3 m_alpha3;
+
+ scale_sum3( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 )
+ : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 )
+ { }
+
+ template< class T1 , class T2 , class T3 , class T4 >
+ void operator()( viennacl::vector<T1> &v1 ,
+ const viennacl::vector<T2> &v2 ,
+ const viennacl::vector<T3> &v3 ,
+ const viennacl::vector<T4> &v4
+ ) const
+ {
+ using namespace viennacl;
+
+ static generator::symbolic_vector <0, T1> sym_v1;
+ static generator::symbolic_vector <1, T2> sym_v2;
+ static generator::symbolic_vector <2, T3> sym_v3;
+ static generator::symbolic_vector <3, T4> sym_v4;
+ static generator::cpu_symbolic_scalar<4, Fac1> sym_a1;
+ static generator::cpu_symbolic_scalar<5, Fac2> sym_a2;
+ static generator::cpu_symbolic_scalar<6, Fac3> sym_a3;
+
+ static generator::custom_operation op(
+ sym_v1 = sym_a1 * sym_v2
+ + sym_a2 * sym_v3
+ + sym_a3 * sym_v4
+ );
+
+ ocl::enqueue( op(v1,
+ const_cast< viennacl::vector<T2>& >(v2),
+ const_cast< viennacl::vector<T3>& >(v3),
+ const_cast< viennacl::vector<T4>& >(v4),
+ const_cast< Fac1& >(m_alpha1),
+ const_cast< Fac2& >(m_alpha2),
+ const_cast< Fac3& >(m_alpha3)
+ ) );
+ }
+
+ typedef void result_type;
+ };
+
+
+ template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 >
+ struct scale_sum4
+ {
+ const Fac1 m_alpha1;
+ const Fac2 m_alpha2;
+ const Fac3 m_alpha3;
+ const Fac4 m_alpha4;
+
+ scale_sum4( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 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()( viennacl::vector<T1> &v1 ,
+ const viennacl::vector<T2> &v2 ,
+ const viennacl::vector<T3> &v3 ,
+ const viennacl::vector<T4> &v4 ,
+ const viennacl::vector<T5> &v5
+ ) const
+ {
+ using namespace viennacl;
+
+ static generator::symbolic_vector <0, T1> sym_v1;
+ static generator::symbolic_vector <1, T2> sym_v2;
+ static generator::symbolic_vector <2, T3> sym_v3;
+ static generator::symbolic_vector <3, T4> sym_v4;
+ static generator::symbolic_vector <4, T5> sym_v5;
+ static generator::cpu_symbolic_scalar<5, Fac1> sym_a1;
+ static generator::cpu_symbolic_scalar<6, Fac2> sym_a2;
+ static generator::cpu_symbolic_scalar<7, Fac3> sym_a3;
+ static generator::cpu_symbolic_scalar<8, Fac4> sym_a4;
+
+ static generator::custom_operation op(
+ sym_v1 = sym_a1 * sym_v2
+ + sym_a2 * sym_v3
+ + sym_a3 * sym_v4
+ + sym_a4 * sym_v5
+ );
+
+ ocl::enqueue( op(v1,
+ const_cast< viennacl::vector<T2>& >(v2),
+ const_cast< viennacl::vector<T3>& >(v3),
+ const_cast< viennacl::vector<T4>& >(v4),
+ const_cast< viennacl::vector<T5>& >(v5),
+ const_cast< Fac1& >(m_alpha1),
+ const_cast< Fac2& >(m_alpha2),
+ const_cast< Fac3& >(m_alpha3),
+ const_cast< Fac4& >(m_alpha4)
+ ) );
+ }
+
+ typedef void result_type;
+ };
+
+
+ template< class Fac1 = double , class Fac2 = Fac1 , class Fac3 = Fac2 , class Fac4 = Fac3 , class Fac5 = Fac4 >
+ struct scale_sum5
+ {
+ const Fac1 m_alpha1;
+ const Fac2 m_alpha2;
+ const Fac3 m_alpha3;
+ const Fac4 m_alpha4;
+ const Fac5 m_alpha5;
+
+ scale_sum5( Fac1 alpha1 , Fac2 alpha2 , Fac3 alpha3 , Fac4 alpha4 , Fac5 alpha5 )
+ : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) { }
+
+ template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 >
+ void operator()( viennacl::vector<T1> &v1 ,
+ const viennacl::vector<T2> &v2 ,
+ const viennacl::vector<T3> &v3 ,
+ const viennacl::vector<T4> &v4 ,
+ const viennacl::vector<T5> &v5 ,
+ const viennacl::vector<T6> &v6
+ ) const
+ {
+ using namespace viennacl;
+
+ static generator::symbolic_vector < 0, T1> sym_v1;
+ static generator::symbolic_vector < 1, T2> sym_v2;
+ static generator::symbolic_vector < 2, T3> sym_v3;
+ static generator::symbolic_vector < 3, T4> sym_v4;
+ static generator::symbolic_vector < 4, T5> sym_v5;
+ static generator::symbolic_vector < 5, T6> sym_v6;
+ static generator::cpu_symbolic_scalar< 6, Fac1> sym_a1;
+ static generator::cpu_symbolic_scalar< 7, Fac2> sym_a2;
+ static generator::cpu_symbolic_scalar< 8, Fac3> sym_a3;
+ static generator::cpu_symbolic_scalar< 9, Fac4> sym_a4;
+ static generator::cpu_symbolic_scalar<10, Fac5> sym_a5;
+
+ static generator::custom_operation op(
+ sym_v1 = sym_a1 * sym_v2
+ + sym_a2 * sym_v3
+ + sym_a3 * sym_v4
+ + sym_a4 * sym_v5
+ + sym_a5 * sym_v6
+ );
+
+ ocl::enqueue( op(v1,
+ const_cast< viennacl::vector<T2>& >(v2),
+ const_cast< viennacl::vector<T3>& >(v3),
+ const_cast< viennacl::vector<T4>& >(v4),
+ const_cast< viennacl::vector<T5>& >(v5),
+ const_cast< viennacl::vector<T6>& >(v6),
+ const_cast< Fac1& >(m_alpha1),
+ const_cast< Fac2& >(m_alpha2),
+ const_cast< Fac3& >(m_alpha3),
+ const_cast< Fac4& >(m_alpha4),
+ const_cast< Fac5& >(m_alpha5)
+ ) );
+ }
+
+ typedef void result_type;
+ };
+
+
+};
+
+
+} // odeint
+} // numeric
+} // boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_VIENNACL_VIENNACL_OPERATIONS_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/external/viennacl/viennacl_resize.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/external/viennacl/viennacl_resize.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,65 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/external/viennacl/viennacl_resize.hpp
+
+ [begin_description]
+ Enable resizing for viennacl vector.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_VIENNACL_VIENNACL_RESIZE_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_EXTERNAL_VIENNACL_VIENNACL_RESIZE_HPP_INCLUDED
+
+#include <viennacl/vector.hpp>
+
+#include <boost/numeric/odeint/util/is_resizeable.hpp>
+#include <boost/numeric/odeint/util/resize.hpp>
+#include <boost/numeric/odeint/util/same_size.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+
+/*
+ * specializations for viennacl::vector< T >
+ */
+template< typename T >
+struct is_resizeable< viennacl::vector< T > > : boost::true_type { };
+
+template< typename T >
+struct resize_impl< viennacl::vector< T > , viennacl::vector< T > >
+{
+ static void resize( viennacl::vector< T > &x1 , const viennacl::vector< T > &x2 )
+ {
+ x1.resize( x2.size() , false );
+ }
+};
+
+template< typename T >
+struct same_size_impl< viennacl::vector< T > , viennacl::vector< T > >
+{
+ static bool same_size( const viennacl::vector< T > &x1 , const viennacl::vector< T > &x2 )
+ {
+ return x1.size() == x2.size();
+ }
+};
+
+
+
+} // namespace odeint
+} // namespace numeric
+} // namespace boost
+
+
+
+#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_VIENNACL_VIENNACL_RESIZE_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/integrate/detail/integrate_adaptive.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/integrate/detail/integrate_adaptive.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,154 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/integrate/detail/integrate_adaptive.hpp
+
+ [begin_description]
+ Default Integrate adaptive implementation.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_ADAPTIVE_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_ADAPTIVE_HPP_INCLUDED
+
+#include <stdexcept>
+
+#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
+#include <boost/numeric/odeint/stepper/controlled_step_result.hpp>
+#include <boost/numeric/odeint/integrate/detail/integrate_n_steps.hpp>
+#include <boost/numeric/odeint/util/bind.hpp>
+#include <boost/numeric/odeint/util/unwrap_reference.hpp>
+#include <boost/numeric/odeint/util/copy.hpp>
+
+#include <boost/numeric/odeint/util/detail/less_with_sign.hpp>
+
+
+#include <iostream>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+namespace detail {
+
+// forward declaration
+template< class Stepper , class System , class State , class Time , class Observer>
+Time integrate_n_steps(
+ Stepper stepper , System system , State &start_state ,
+ Time start_time , Time dt , size_t num_of_steps ,
+ Observer observer , stepper_tag );
+
+/*
+ * integrate_adaptive for simple stepper is basically an integrate_const + some last step
+ */
+template< class Stepper , class System , class State , class Time , class Observer >
+size_t integrate_adaptive(
+ Stepper stepper , System system , State &start_state ,
+ Time start_time , Time end_time , Time dt ,
+ Observer observer , stepper_tag
+)
+{
+ size_t steps = static_cast< size_t >( (end_time-start_time)/dt );
+ Time end = detail::integrate_n_steps( stepper , system , start_state , start_time ,
+ dt , steps , observer , stepper_tag() );
+ if( less_with_sign( end , end_time , dt ) )
+ { //make a last step to end exactly at end_time
+ stepper.do_step( system , start_state , end , end_time - end );
+ steps++;
+ typename odeint::unwrap_reference< Observer >::type &obs = observer;
+ obs( start_state , end_time );
+ }
+ return steps;
+}
+
+
+/*
+ * classical integrate adpative
+ */
+template< class Stepper , class System , class State , class Time , class Observer >
+size_t integrate_adaptive(
+ Stepper stepper , System system , State &start_state ,
+ Time &start_time , Time end_time , Time &dt ,
+ Observer observer , controlled_stepper_tag
+)
+{
+ typename odeint::unwrap_reference< Observer >::type &obs = observer;
+
+ const size_t max_attempts = 1000;
+ const char *error_string = "Integrate adaptive : Maximal number of iterations reached. A step size could not be found.";
+ size_t count = 0;
+ while( less_with_sign( start_time , end_time , dt ) )
+ {
+ obs( start_state , start_time );
+ if( less_with_sign( end_time , start_time + dt , dt ) )
+ {
+ dt = end_time - start_time;
+ }
+
+ size_t trials = 0;
+ controlled_step_result res = success;
+ do
+ {
+ res = stepper.try_step( system , start_state , start_time , dt );
+ ++trials;
+ }
+ while( ( res == fail ) && ( trials < max_attempts ) );
+ if( trials == max_attempts ) throw std::overflow_error( error_string );
+
+ ++count;
+ }
+ obs( start_state , start_time );
+ return count;
+}
+
+
+/*
+ * integrate adaptive for dense output steppers
+ *
+ * step size control is used if the stepper supports it
+ */
+template< class Stepper , class System , class State , class Time , class Observer >
+size_t integrate_adaptive(
+ Stepper stepper , System system , State &start_state ,
+ Time start_time , Time end_time , Time dt ,
+ Observer observer , dense_output_stepper_tag )
+{
+ typename odeint::unwrap_reference< Observer >::type &obs = observer;
+
+ size_t count = 0;
+ stepper.initialize( start_state , start_time , dt );
+
+ while( less_with_sign( stepper.current_time() , end_time , stepper.current_time_step() ) )
+ {
+ while( less_eq_with_sign( stepper.current_time() + stepper.current_time_step() ,
+ end_time ,
+ stepper.current_time_step() ) )
+ { //make sure we don't go beyond the end_time
+ obs( stepper.current_state() , stepper.current_time() );
+ stepper.do_step( system );
+ ++count;
+ }
+ stepper.initialize( stepper.current_state() , stepper.current_time() , end_time - stepper.current_time() );
+ }
+ obs( stepper.current_state() , stepper.current_time() );
+ // overwrite start_state with the final point
+ boost::numeric::odeint::copy( stepper.current_state() , start_state );
+ return count;
+}
+
+
+
+
+} // namespace detail
+} // namespace odeint
+} // namespace numeric
+} // namespace boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_ADAPTIVE_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/integrate/detail/integrate_const.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/integrate/detail/integrate_const.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,159 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/integrate/detail/integrate_const.hpp
+
+ [begin_description]
+ integrate const implementation
+ [end_description]
+
+ Copyright 2009-2012 Karsten Ahnert
+ Copyright 2009-2012 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)
+ */
+
+#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_CONST_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_CONST_HPP_INCLUDED
+
+#include <boost/numeric/odeint/util/unwrap_reference.hpp>
+#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
+#include <boost/numeric/odeint/util/unit_helper.hpp>
+#include <boost/numeric/odeint/integrate/detail/integrate_adaptive.hpp>
+
+#include <boost/numeric/odeint/util/detail/less_with_sign.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+namespace detail {
+
+// forward declaration
+template< class Stepper , class System , class State , class Time , class Observer >
+size_t integrate_adaptive(
+ Stepper stepper , System system , State &start_state ,
+ Time &start_time , Time end_time , Time &dt ,
+ Observer observer , controlled_stepper_tag
+);
+
+
+template< class Stepper , class System , class State , class Time , class Observer >
+size_t integrate_const(
+ Stepper stepper , System system , State &start_state ,
+ Time start_time , Time end_time , Time dt ,
+ Observer observer , stepper_tag
+)
+{
+ typename odeint::unwrap_reference< Observer >::type &obs = observer;
+
+ Time time = start_time;
+ int step = 0;
+
+ while( less_eq_with_sign( time+dt , end_time , dt ) )
+ {
+ obs( start_state , time );
+ stepper.do_step( system , start_state , time , dt );
+ // direct computation of the time avoids error propagation happening when using time += dt
+ // we need clumsy type analysis to get boost units working here
+ ++step;
+ time = start_time + static_cast< typename unit_value_type<Time>::type >(step) * dt;
+ }
+ obs( start_state , time );
+
+ return step;
+}
+
+
+
+template< class Stepper , class System , class State , class Time , class Observer >
+size_t integrate_const(
+ Stepper stepper , System system , State &start_state ,
+ Time start_time , Time end_time , Time dt ,
+ Observer observer , controlled_stepper_tag
+)
+{
+ typename odeint::unwrap_reference< Observer >::type &obs = observer;
+
+ Time time = start_time;
+ const Time time_step = dt;
+ int step = 0;
+
+ while( less_eq_with_sign( time+time_step , end_time , dt ) )
+ {
+ obs( start_state , time );
+ detail::integrate_adaptive( stepper , system , start_state , time , time+time_step , dt ,
+ null_observer() , controlled_stepper_tag() );
+ // direct computation of the time avoids error propagation happening when using time += dt
+ // we need clumsy type analysis to get boost units working here
+ ++step;
+ time = start_time + static_cast< typename unit_value_type<Time>::type >(step) * time_step;
+ }
+ obs( start_state , time );
+
+ return step;
+}
+
+
+template< class Stepper , class System , class State , class Time , class Observer >
+size_t integrate_const(
+ Stepper stepper , System system , State &start_state ,
+ Time start_time , Time end_time , Time dt ,
+ Observer observer , dense_output_stepper_tag
+)
+{
+ typename odeint::unwrap_reference< Observer >::type &obs = observer;
+
+ Time time = start_time;
+
+ stepper.initialize( start_state , time , dt );
+ obs( start_state , time );
+ time += dt;
+
+ int obs_step( 1 );
+ int real_step( 0 );
+
+ while( less_with_sign( time+dt , end_time , dt ) )
+ {
+ while( less_eq_with_sign( time , stepper.current_time() , dt ) )
+ {
+ stepper.calc_state( time , start_state );
+ obs( start_state , time );
+ ++obs_step;
+ // direct computation of the time avoids error propagation happening when using time += dt
+ // we need clumsy type analysis to get boost units working here
+ time = start_time + static_cast< typename unit_value_type<Time>::type >(obs_step) * dt;
+ }
+ // we have not reached the end, do another real step
+ if( less_with_sign( stepper.current_time()+stepper.current_time_step() ,
+ end_time ,
+ stepper.current_time_step() ) )
+ {
+ while( less_eq_with_sign( stepper.current_time() , time , dt ) )
+ {
+ stepper.do_step( system );
+ ++real_step;
+ }
+ }
+ else if( less_with_sign( stepper.current_time() , end_time , stepper.current_time_step() ) )
+ { // do the last step ending exactly on the end point
+ stepper.initialize( stepper.current_state() , stepper.current_time() , end_time - stepper.current_time() );
+ stepper.do_step( system );
+ ++real_step;
+ }
+
+ }
+ // last observation, if we are still in observation interval
+ if( less_eq_with_sign( time , end_time , dt ) )
+ {
+ stepper.calc_state( time , start_state );
+ obs( start_state , time );
+ }
+
+ return real_step;
+}
+
+
+} } } }
+
+#endif

Added: trunk/boost/numeric/odeint/integrate/detail/integrate_n_steps.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/integrate/detail/integrate_n_steps.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,156 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/integrate/detail/integrate_n_steps.hpp
+
+ [begin_description]
+ integrate steps implementation
+ [end_description]
+
+ Copyright 2009-2012 Karsten Ahnert
+ Copyright 2009-2012 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)
+ */
+
+#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_N_STEPS_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_N_STEPS_HPP_INCLUDED
+
+#include <boost/numeric/odeint/util/unwrap_reference.hpp>
+#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
+#include <boost/numeric/odeint/integrate/detail/integrate_adaptive.hpp>
+#include <boost/numeric/odeint/util/unit_helper.hpp>
+
+#include <boost/numeric/odeint/util/detail/less_with_sign.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+namespace detail {
+
+// forward declaration
+template< class Stepper , class System , class State , class Time , class Observer >
+size_t integrate_adaptive(
+ Stepper stepper , System system , State &start_state ,
+ Time &start_time , Time end_time , Time &dt ,
+ Observer observer , controlled_stepper_tag
+);
+
+
+/* basic version */
+template< class Stepper , class System , class State , class Time , class Observer>
+Time integrate_n_steps(
+ Stepper stepper , System system , State &start_state ,
+ Time start_time , Time dt , size_t num_of_steps ,
+ Observer observer , stepper_tag )
+{
+ typename odeint::unwrap_reference< Observer >::type &obs = observer;
+
+ Time time = start_time;
+
+ for( size_t step = 0; step < num_of_steps ; ++step )
+ {
+ obs( start_state , time );
+ stepper.do_step( system , start_state , time , dt );
+ // direct computation of the time avoids error propagation happening when using time += dt
+ // we need clumsy type analysis to get boost units working here
+ time = start_time + static_cast< typename unit_value_type<Time>::type >( step+1 ) * dt;
+ }
+ obs( start_state , time );
+
+ return time;
+}
+
+
+/* controlled version */
+template< class Stepper , class System , class State , class Time , class Observer>
+Time integrate_n_steps(
+ Stepper stepper , System system , State &start_state ,
+ Time start_time , Time dt , size_t num_of_steps ,
+ Observer observer , controlled_stepper_tag )
+{
+ typename odeint::unwrap_reference< Observer >::type &obs = observer;
+
+ Time time = start_time;
+ Time time_step = dt;
+
+ for( size_t step = 0; step < num_of_steps ; ++step )
+ {
+ obs( start_state , time );
+ detail::integrate_adaptive( stepper , system , start_state , time , time+time_step , dt ,
+ null_observer() , controlled_stepper_tag() );
+ // direct computation of the time avoids error propagation happening when using time += dt
+ // we need clumsy type analysis to get boost units working here
+ time = start_time + static_cast< typename unit_value_type<Time>::type >(step+1) * time_step;
+ }
+ obs( start_state , time );
+
+ return time;
+}
+
+
+/* dense output version */
+template< class Stepper , class System , class State , class Time , class Observer>
+Time integrate_n_steps(
+ Stepper stepper , System system , State &start_state ,
+ Time start_time , Time dt , size_t num_of_steps ,
+ Observer observer , dense_output_stepper_tag )
+{
+ typename odeint::unwrap_reference< Observer >::type &obs = observer;
+
+ Time time = start_time;
+ const Time end_time = start_time + static_cast< typename unit_value_type<Time>::type >(num_of_steps) * dt;
+
+ stepper.initialize( start_state , time , dt );
+
+ size_t step = 0;
+
+ while( step < num_of_steps )
+ {
+ while( less_with_sign( time , stepper.current_time() , stepper.current_time_step() ) )
+ {
+ stepper.calc_state( time , start_state );
+ obs( start_state , time );
+ ++step;
+ // direct computation of the time avoids error propagation happening when using time += dt
+ // we need clumsy type analysis to get boost units working here
+ time = start_time + static_cast< typename unit_value_type<Time>::type >(step) * dt;
+ }
+
+ // we have not reached the end, do another real step
+ if( less_with_sign( stepper.current_time()+stepper.current_time_step() ,
+ end_time ,
+ stepper.current_time_step() ) )
+ {
+ stepper.do_step( system );
+ }
+ else if( less_with_sign( stepper.current_time() , end_time , stepper.current_time_step() ) )
+ { // do the last step ending exactly on the end point
+ stepper.initialize( stepper.current_state() , stepper.current_time() , end_time - stepper.current_time() );
+ stepper.do_step( system );
+ }
+ }
+
+ while( stepper.current_time() < end_time )
+ {
+ if( less_with_sign( end_time ,
+ stepper.current_time()+stepper.current_time_step() ,
+ stepper.current_time_step() ) )
+ stepper.initialize( stepper.current_state() , stepper.current_time() , end_time - stepper.current_time() );
+ stepper.do_step( system );
+ }
+
+ // observation at end point, only if we ended exactly on the end-point (or above due to finite precision)
+ obs( stepper.current_state() , end_time );
+
+ return time;
+}
+
+
+}
+}
+}
+}
+
+#endif /* BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_N_STEPS_HPP_INCLUDED */

Added: trunk/boost/numeric/odeint/integrate/detail/integrate_times.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/integrate/detail/integrate_times.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,166 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/integrate/detail/integrate_times.hpp
+
+ [begin_description]
+ Default integrate times implementation.
+ [end_description]
+
+ Copyright 2009-2012 Karsten Ahnert
+ Copyright 2009-2012 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_TIMES_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_TIMES_HPP_INCLUDED
+
+#include <stdexcept>
+
+#include <boost/config.hpp>
+#include <boost/numeric/odeint/util/unwrap_reference.hpp>
+#include <boost/numeric/odeint/stepper/controlled_step_result.hpp>
+#include <boost/numeric/odeint/util/detail/less_with_sign.hpp>
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+namespace detail {
+
+
+
+/*
+ * integrate_times for simple stepper
+ */
+template< class Stepper , class System , class State , class TimeIterator , class Time , class Observer >
+size_t integrate_times(
+ Stepper stepper , System system , State &start_state ,
+ TimeIterator start_time , TimeIterator end_time , Time dt ,
+ Observer observer , stepper_tag
+)
+{
+ BOOST_USING_STD_MIN();
+
+ typename odeint::unwrap_reference< Observer >::type &obs = observer;
+
+ size_t steps = 0;
+ Time current_dt = dt;
+ while( true )
+ {
+ Time current_time = *start_time++;
+ obs( start_state , current_time );
+ if( start_time == end_time )
+ break;
+ while( less_with_sign( current_time , *start_time , current_dt ) )
+ {
+ current_dt = min BOOST_PREVENT_MACRO_SUBSTITUTION ( dt , *start_time - current_time );
+ stepper.do_step( system , start_state , current_time , current_dt );
+ current_time += current_dt;
+ steps++;
+ }
+ }
+ return steps;
+}
+
+/*
+ * integrate_times for controlled stepper
+ */
+template< class Stepper , class System , class State , class TimeIterator , class Time , class Observer >
+size_t integrate_times(
+ Stepper stepper , System system , State &start_state ,
+ TimeIterator start_time , TimeIterator end_time , Time dt ,
+ Observer observer , controlled_stepper_tag
+)
+{
+ BOOST_USING_STD_MIN();
+
+ typename odeint::unwrap_reference< Observer >::type &obs = observer;
+
+ const size_t max_attempts = 1000;
+ const char *error_string = "Integrate adaptive : Maximal number of iterations reached. A step size could not be found.";
+ size_t steps = 0;
+ while( true )
+ {
+ size_t fail_steps = 0;
+ Time current_time = *start_time++;
+ obs( start_state , current_time );
+ if( start_time == end_time )
+ break;
+ while( less_with_sign( current_time , *start_time , dt ) )
+ {
+ dt = min BOOST_PREVENT_MACRO_SUBSTITUTION ( dt , *start_time - current_time );
+ if( stepper.try_step( system , start_state , current_time , dt ) == success )
+ {
+ ++steps;
+ }
+ else
+ {
+ ++fail_steps;
+ }
+ if( fail_steps == max_attempts ) throw std::overflow_error( error_string );
+ }
+ }
+ return steps;
+}
+
+/*
+ * integrate_times for dense output stepper
+ */
+template< class Stepper , class System , class State , class TimeIterator , class Time , class Observer >
+size_t integrate_times(
+ Stepper stepper , System system , State &start_state ,
+ TimeIterator start_time , TimeIterator end_time , Time dt ,
+ Observer observer , dense_output_stepper_tag
+)
+{
+ typename odeint::unwrap_reference< Observer >::type &obs = observer;
+
+
+ if( start_time == end_time )
+ return 0;
+
+ Time last_time_point = *(end_time-1);
+
+ stepper.initialize( start_state , *start_time , dt );
+ obs( start_state , *start_time++ );
+
+ size_t count = 0;
+ while( start_time != end_time )
+ {
+ while( ( start_time != end_time ) && less_eq_with_sign( *start_time , stepper.current_time() , stepper.current_time_step() ) )
+ {
+ stepper.calc_state( *start_time , start_state );
+ obs( start_state , *start_time );
+ start_time++;
+ }
+
+ // we have not reached the end, do another real step
+ if( less_eq_with_sign( stepper.current_time() + stepper.current_time_step() ,
+ last_time_point ,
+ stepper.current_time_step() ) )
+ {
+ stepper.do_step( system );
+ ++count;
+ }
+ else if( start_time != end_time )
+ { // do the last step ending exactly on the end point
+ stepper.initialize( stepper.current_state() , stepper.current_time() , last_time_point - stepper.current_time() );
+ stepper.do_step( system );
+ ++count;
+ }
+ }
+ return count;
+}
+
+
+} // namespace detail
+} // namespace odeint
+} // namespace numeric
+} // namespace boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_ADAPTIVE_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/integrate/integrate.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/integrate/integrate.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,82 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/integrate/integrate.hpp
+
+ [begin_description]
+ Convenience methods which choose the stepper for the current ODE.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_HPP_INCLUDED
+
+#include <boost/numeric/odeint/stepper/runge_kutta_dopri5.hpp>
+#include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp>
+#include <boost/numeric/odeint/integrate/null_observer.hpp>
+#include <boost/numeric/odeint/integrate/integrate_adaptive.hpp>
+
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+/*
+ * ToDo :
+ *
+ * determine type of dxdt for units
+ *
+ * the two overloads are needed in order to solve the forwarding problem
+ */
+template< class System , class State , class Time , class Observer >
+size_t integrate( System system , State &start_state , Time start_time , Time end_time , Time dt , Observer observer )
+{
+ return integrate_adaptive( controlled_runge_kutta< runge_kutta_dopri5< State > >() , system , start_state , start_time , end_time , dt , observer );
+}
+
+template< class System , class State , class Time , class Observer >
+size_t integrate( System system , const State &start_state , Time start_time , Time end_time , Time dt , Observer observer )
+{
+ return integrate_adaptive( controlled_runge_kutta< runge_kutta_dopri5< State > >() , system , start_state , start_time , end_time , dt , observer );
+}
+
+
+
+
+
+
+
+/*
+ * the two overloads are needed in order to solve the forwarding problem
+ */
+template< class System , class State , class Time >
+size_t integrate( System system , State &start_state , Time start_time , Time end_time , Time dt )
+{
+ return integrate( system , start_state , start_time , end_time , dt , null_observer() );
+}
+
+template< class System , class State , class Time >
+size_t integrate( System system , const State &start_state , Time start_time , Time end_time , Time dt )
+{
+ return integrate( system , start_state , start_time , end_time , dt , null_observer() );
+}
+
+
+
+
+} // namespace odeint
+} // namespace numeric
+} // namespace boost
+
+
+
+#endif // BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/integrate/integrate_adaptive.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/integrate/integrate_adaptive.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,95 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/integrate/integrate_adaptive.hpp
+
+ [begin_description]
+ Adaptive integration of ODEs.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_ADAPTIVE_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_ADAPTIVE_HPP_INCLUDED
+
+#include <boost/type_traits/is_same.hpp>
+
+#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
+#include <boost/numeric/odeint/integrate/null_observer.hpp>
+#include <boost/numeric/odeint/integrate/detail/integrate_adaptive.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+/*
+ * the two overloads are needed in order to solve the forwarding problem
+ */
+template< class Stepper , class System , class State , class Time , class Observer >
+size_t integrate_adaptive(
+ Stepper stepper , System system , State &start_state ,
+ Time start_time , Time end_time , Time dt ,
+ Observer observer )
+{
+ return detail::integrate_adaptive(
+ stepper , system , start_state ,
+ start_time , end_time , dt ,
+ observer , typename Stepper::stepper_category() );
+
+ /*
+ * Suggestion for a new extendable version:
+ *
+ * integrator_adaptive< Stepper , System, State , Time , Observer , typename Stepper::stepper_category > integrator;
+ * return integrator.run( stepper , system , start_state , start_time , end_time , dt , observer );
+ */
+}
+
+template< class Stepper , class System , class State , class Time , class Observer >
+size_t integrate_adaptive(
+ Stepper stepper , System system , const State &start_state ,
+ Time start_time , Time end_time , Time dt ,
+ Observer observer )
+{
+ return detail::integrate_adaptive(
+ stepper , system , start_state ,
+ start_time , end_time , dt ,
+ observer , typename Stepper::stepper_category() );
+}
+
+
+
+
+/*
+ * the two overloads are needed in order to solve the forwarding problem
+ */
+template< class Stepper , class System , class State , class Time >
+size_t integrate_adaptive(
+ Stepper stepper , System system , State &start_state ,
+ Time start_time , Time end_time , Time dt )
+{
+ return integrate_adaptive( stepper , system , start_state , start_time , end_time , dt , null_observer() );
+}
+
+template< class Stepper , class System , class State , class Time >
+size_t integrate_adaptive(
+ Stepper stepper , System system , const State &start_state ,
+ Time start_time , Time end_time , Time dt )
+{
+ return integrate_adaptive( stepper , system , start_state , start_time , end_time , dt , null_observer() );
+}
+
+
+} // namespace odeint
+} // namespace numeric
+} // namespace boost
+
+
+
+#endif // BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_ADAPTIVE_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/integrate/integrate_const.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/integrate/integrate_const.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,124 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/integrate/integrate_const.hpp
+
+ [begin_description]
+ Constant integration of ODEs, meaning that the state of the ODE is observed on constant time intervals.
+ The routines makes full use of adaptive and dense-output methods.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_CONST_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_CONST_HPP_INCLUDED
+
+#include <boost/type_traits/is_same.hpp>
+
+#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
+#include <boost/numeric/odeint/integrate/null_observer.hpp>
+#include <boost/numeric/odeint/integrate/detail/integrate_const.hpp>
+#include <boost/numeric/odeint/integrate/detail/integrate_adaptive.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+
+
+
+/*
+ * Integrates with constant time step dt.
+ */
+template< class Stepper , class System , class State , class Time , class Observer >
+size_t integrate_const(
+ Stepper stepper , System system , State &start_state ,
+ Time start_time , Time end_time , Time dt ,
+ Observer observer
+)
+{
+ // we want to get as fast as possible to the end
+ if( boost::is_same< null_observer , Observer >::value )
+ {
+ return detail::integrate_adaptive(
+ stepper , system , start_state ,
+ start_time , end_time , dt ,
+ observer , typename Stepper::stepper_category() );
+ }
+ else
+ {
+ return detail::integrate_const( stepper , system , start_state ,
+ start_time , end_time , dt ,
+ observer , typename Stepper::stepper_category() );
+ }
+}
+
+
+template< class Stepper , class System , class State , class Time , class Observer >
+size_t integrate_const(
+ Stepper stepper , System system , const State &start_state ,
+ Time start_time , Time end_time , Time dt ,
+ Observer observer
+)
+{
+ // we want to get as fast as possible to the end
+ if( boost::is_same< null_observer , Observer >::value )
+ {
+ return detail::integrate_adaptive(
+ stepper , system , start_state ,
+ start_time , end_time , dt ,
+ observer , typename Stepper::stepper_category() );
+ }
+ else
+ {
+ return detail::integrate_const( stepper , system , start_state ,
+ start_time , end_time , dt ,
+ observer , typename Stepper::stepper_category() );
+ }
+}
+
+
+
+
+
+/*
+ * Without observers
+ */
+template< class Stepper , class System , class State , class Time >
+size_t integrate_const(
+ Stepper stepper , System system , State &start_state ,
+ Time start_time , Time end_time , Time dt
+)
+{
+ return integrate_const( stepper , system , start_state , start_time , end_time , dt , null_observer() );
+}
+
+template< class Stepper , class System , class State , class Time >
+size_t integrate_const(
+ Stepper stepper , System system , const State &start_state ,
+ Time start_time , Time end_time , Time dt
+)
+{
+ return integrate_const( stepper , system , start_state , start_time , end_time , dt , null_observer() );
+}
+
+
+
+
+
+
+
+} // namespace odeint
+} // namespace numeric
+} // namespace boost
+
+
+
+#endif // BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_CONST_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/integrate/integrate_n_steps.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/integrate/integrate_n_steps.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,97 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/integrate/integrate_n_steps.hpp
+
+ [begin_description]
+ Integration of n steps with constant time size. Adaptive and dense-output methods are fully supported.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_N_STEPS_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_N_STEPS_HPP_INCLUDED
+
+#include <boost/type_traits/is_same.hpp>
+
+#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
+#include <boost/numeric/odeint/integrate/null_observer.hpp>
+#include <boost/numeric/odeint/integrate/detail/integrate_n_steps.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+/*
+ * Integrates n steps
+ *
+ * the two overloads are needed in order to solve the forwarding problem
+ */
+template< class Stepper , class System , class State , class Time , class Observer>
+Time integrate_n_steps(
+ Stepper stepper , System system , State &start_state ,
+ Time start_time , Time dt , size_t num_of_steps ,
+ Observer observer )
+{
+
+ return detail::integrate_n_steps(
+ stepper , system , start_state ,
+ start_time , dt , num_of_steps ,
+ observer , typename Stepper::stepper_category() );
+}
+
+template< class Stepper , class System , class State , class Time , class Observer >
+Time integrate_n_steps(
+ Stepper stepper , System system , const State &start_state ,
+ Time start_time , Time dt , size_t num_of_steps ,
+ Observer observer )
+{
+ return detail::integrate_n_steps(
+ stepper , system , start_state ,
+ start_time , dt , num_of_steps ,
+ observer , typename Stepper::stepper_category() );
+}
+
+
+
+
+
+
+
+
+/*
+ * the two overloads are needed in order to solve the forwarding problem
+ */
+template< class Stepper , class System , class State , class Time >
+Time integrate_n_steps(
+ Stepper stepper , System system , State &start_state ,
+ Time start_time , Time dt , size_t num_of_steps )
+{
+ return integrate_n_steps( stepper , system , start_state , start_time , dt , num_of_steps , null_observer() );
+}
+
+template< class Stepper , class System , class State , class Time >
+Time integrate_n_steps(
+ Stepper stepper , System system , const State &start_state ,
+ Time start_time , Time dt , size_t num_of_steps )
+{
+ return integrate_n_steps( stepper , system , start_state , start_time , dt , num_of_steps , null_observer() );
+}
+
+
+
+
+} // namespace odeint
+} // namespace numeric
+} // namespace boost
+
+
+
+#endif // BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_N_STEPS_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/integrate/integrate_times.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/integrate/integrate_times.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,93 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/integrate/integrate_times.hpp
+
+ [begin_description]
+ Integration of ODEs with observation at user defined points
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_TIMES_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_TIMES_HPP_INCLUDED
+
+#include <boost/type_traits/is_same.hpp>
+
+#include <boost/range.hpp>
+
+#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
+#include <boost/numeric/odeint/integrate/null_observer.hpp>
+#include <boost/numeric/odeint/integrate/detail/integrate_times.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+/*
+ * the two overloads are needed in order to solve the forwarding problem
+ */
+template< class Stepper , class System , class State , class TimeIterator , class Time , class Observer >
+size_t integrate_times(
+ Stepper stepper , System system , State &start_state ,
+ TimeIterator times_start , TimeIterator times_end , Time dt ,
+ Observer observer )
+{
+ return detail::integrate_times(
+ stepper , system , start_state ,
+ times_start , times_end , dt ,
+ observer , typename Stepper::stepper_category() );
+}
+
+template< class Stepper , class System , class State , class TimeIterator , class Time , class Observer >
+size_t integrate_times(
+ Stepper stepper , System system , const State &start_state ,
+ TimeIterator times_start , TimeIterator times_end , Time dt ,
+ Observer observer )
+{
+ return detail::integrate_times(
+ stepper , system , start_state ,
+ times_start , times_end , dt ,
+ observer , typename Stepper::stepper_category() );
+}
+
+/*
+ * Range Version:
+ * the two overloads are needed in order to solve the forwarding problem
+ */
+template< class Stepper , class System , class State , class TimeRange , class Time , class Observer >
+size_t integrate_times(
+ Stepper stepper , System system , State &start_state ,
+ const TimeRange &times , Time dt ,
+ Observer observer )
+{
+ return integrate_times(
+ stepper , system , start_state ,
+ boost::begin( times ) , boost::end( times ) , dt , observer );
+}
+
+template< class Stepper , class System , class State , class TimeRange , class Time , class Observer >
+size_t integrate_times(
+ Stepper stepper , System system , const State &start_state ,
+ const TimeRange &times , Time dt ,
+ Observer observer )
+{
+ return integrate_times(
+ stepper , system , start_state ,
+ boost::begin( times ) , boost::end( times ) , dt , observer );
+}
+
+} // namespace odeint
+} // namespace numeric
+} // namespace boost
+
+
+
+#endif // BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_TIMES_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/integrate/null_observer.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/integrate/null_observer.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,38 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/integrate/null_observer.hpp
+
+ [begin_description]
+ null_observer
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_NULL_OBSERVER_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_INTEGRATE_NULL_OBSERVER_HPP_INCLUDED
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+struct null_observer
+{
+ template< class State , class Time >
+ void operator()( const State& /* x */ , Time /* t */ ) const
+ {
+
+ }
+};
+
+} // namespace odeint
+} // namespace numeric
+} // namespace boost
+
+#endif // BOOST_NUMERIC_ODEINT_INTEGRATE_NULL_OBSERVER_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/integrate/observer_collection.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/integrate/observer_collection.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,56 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/integrate/observer_collection.hpp
+
+ [begin_description]
+ Collection of observers, which are all called during the evolution of the ODE.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_OBSERVER_COLLECTION_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_INTEGRATE_OBSERVER_COLLECTION_HPP_INCLUDED
+
+#include <vector>
+
+#include <boost/function.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+template< class State , class Time >
+class observer_collection
+{
+public:
+
+ typedef boost::function< void( const State& , const Time& ) > observer_type;
+ typedef std::vector< observer_type > collection_type;
+
+ void operator()( const State& x , Time t )
+ {
+ for( size_t i=0 ; i<m_observers.size() ; ++i )
+ m_observers[i]( x , t );
+ }
+
+ collection_type& observers( void ) { return m_observers; }
+ const collection_type& observers( void ) const { return m_observers; }
+
+private:
+
+ collection_type m_observers;
+};
+
+} // namespace odeint
+} // namespace numeric
+} // namespace boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_INTEGRATE_OBSERVER_COLLECTION_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/iterator/adaptive_iterator.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/iterator/adaptive_iterator.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,211 @@
+
+/*
+ [auto_generated]
+ boost/numeric/odeint/iterator/adaptive_iterator.hpp
+
+ [begin_description]
+ Iterator for iterating throught the solution of an ODE with adaptive step size. The dereferenced types containes also the time.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_ITERATOR_ADAPTIVE_ITERATOR_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_ITERATOR_ADAPTIVE_ITERATOR_HPP_INCLUDED
+
+#include <boost/numeric/odeint/iterator/detail/ode_iterator_base.hpp>
+
+#include <boost/numeric/odeint/util/unit_helper.hpp>
+#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
+#include <boost/numeric/odeint/stepper/controlled_step_result.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+ template< class Stepper , class System , class StepperTag = typename base_tag< typename Stepper::stepper_category >::type >
+ class adaptive_iterator;
+
+
+ /*
+ * Specilization for controlled steppers
+ */
+ template< class Stepper , class System >
+ class adaptive_iterator< Stepper , System , controlled_stepper_tag > : public detail::ode_iterator_base
+ <
+ adaptive_iterator< Stepper , System , controlled_stepper_tag > ,
+ Stepper , System , controlled_stepper_tag
+ >
+ {
+ private:
+
+ typedef Stepper stepper_type;
+ typedef System system_type;
+ typedef typename stepper_type::state_type state_type;
+ typedef typename stepper_type::time_type time_type;
+ typedef typename stepper_type::value_type ode_value_type;
+ typedef detail::ode_iterator_base<
+ adaptive_iterator< Stepper , System , controlled_stepper_tag > ,
+ Stepper , System , controlled_stepper_tag
+ > base_type;
+
+ public:
+
+ adaptive_iterator( stepper_type stepper , system_type sys , state_type &s , time_type t , time_type t_end , time_type dt )
+ : base_type( stepper , sys , s , t , t_end , dt ) { }
+
+ adaptive_iterator( stepper_type stepper , system_type sys , state_type &s )
+ : base_type( stepper , sys , s ) { }
+
+ protected:
+
+ friend class boost::iterator_core_access;
+
+ void increment()
+ {
+ const size_t max_attempts = 1000;
+ size_t trials = 0;
+ controlled_step_result res = success;
+ do
+ {
+ res = this->m_stepper.try_step( this->m_system , this->m_state , this->m_t , this->m_dt );
+ ++trials;
+ }
+ while( ( res == fail ) && ( trials < max_attempts ) );
+ if( trials == max_attempts )
+ {
+ throw std::overflow_error( "Adaptive iterator : Maximal number of iterations reached. A step size could not be found." );
+ }
+ this->check_end();
+ }
+ };
+
+
+
+
+
+
+ /*
+ * Specilization for dense outputer steppers
+ */
+ template< class Stepper , class System >
+ class adaptive_iterator< Stepper , System , dense_output_stepper_tag > : public detail::ode_iterator_base
+ <
+ adaptive_iterator< Stepper , System , dense_output_stepper_tag > ,
+ Stepper , System , dense_output_stepper_tag
+ >
+ {
+ private:
+
+ typedef Stepper stepper_type;
+ typedef System system_type;
+ typedef typename stepper_type::state_type state_type;
+ typedef typename stepper_type::time_type time_type;
+ typedef typename stepper_type::value_type ode_value_type;
+ typedef detail::ode_iterator_base<
+ adaptive_iterator< Stepper , System , dense_output_stepper_tag > ,
+ Stepper , System , dense_output_stepper_tag
+ > base_type;
+
+ public:
+
+
+ adaptive_iterator( stepper_type stepper , system_type sys , state_type &s , time_type t , time_type t_end , time_type dt )
+ : base_type( stepper , sys , s , t , t_end , dt )
+ {
+ this->m_stepper.initialize( this->m_state , this->m_t , this->m_dt );
+ }
+
+ adaptive_iterator( stepper_type stepper , system_type sys , state_type &s )
+ : base_type( stepper , sys , s ) { }
+
+ protected:
+
+ friend class boost::iterator_core_access;
+
+ void increment()
+ {
+ this->m_stepper.do_step( this->m_system );
+ this->m_t = this->m_stepper.current_time();
+ this->check_end();
+ }
+
+ // overwrite dereference from ode_iterator_base
+ const state_type& dereference() const
+ {
+ return this->m_stepper.current_state();
+ }
+
+
+ };
+
+
+
+
+
+
+
+
+ template< class Stepper , class System >
+ adaptive_iterator< Stepper , System > make_adaptive_iterator_begin(
+ Stepper stepper ,
+ System system ,
+ typename Stepper::state_type &x ,
+ typename Stepper::time_type t ,
+ typename Stepper::time_type t_end ,
+ typename Stepper::time_type dt )
+ {
+ return adaptive_iterator< Stepper , System >( stepper , system , x , t , t_end , dt );
+ }
+
+ template< class Stepper , class System >
+ adaptive_iterator< Stepper , System > make_adaptive_iterator_end(
+ Stepper stepper ,
+ System system ,
+ typename Stepper::state_type &x )
+ {
+ return adaptive_iterator< Stepper , System >( stepper , system , x );
+ }
+
+
+ template< class Stepper , class System >
+ std::pair< adaptive_iterator< Stepper , System > , adaptive_iterator< Stepper , System > >
+ make_adaptive_range(
+ Stepper stepper ,
+ System system ,
+ typename Stepper::state_type &x ,
+ typename Stepper::time_type t_start ,
+ typename Stepper::time_type t_end ,
+ typename Stepper::time_type dt )
+ {
+ return std::make_pair(
+ adaptive_iterator< Stepper , System >( stepper , system , x , t_start , t_end , dt ) ,
+ adaptive_iterator< Stepper , System >( stepper , system , x )
+ );
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+} // namespace odeint
+} // namespace numeric
+} // namespace boost
+
+
+
+#endif // BOOST_NUMERIC_ODEINT_ITERATOR_ADAPTIVE_ITERATOR_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/iterator/adaptive_time_iterator.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/iterator/adaptive_time_iterator.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,205 @@
+
+/*
+ [auto_generated]
+ boost/numeric/odeint/iterator/adaptive_time_iterator.hpp
+
+ [begin_description]
+ Iterator for iterating throught the solution of an ODE with adaptive step size. The dereferenced types containes also the time.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_ITERATOR_ADAPTIVE_TIME_ITERATOR_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_ITERATOR_ADAPTIVE_TIME_ITERATOR_HPP_INCLUDED
+
+
+#include <boost/numeric/odeint/util/unit_helper.hpp>
+#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
+#include <boost/numeric/odeint/stepper/controlled_step_result.hpp>
+#include <boost/numeric/odeint/iterator/detail/ode_time_iterator_base.hpp>
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+ template< class Stepper , class System , class StepperTag = typename base_tag< typename Stepper::stepper_category >::type >
+ class adaptive_time_iterator;
+
+
+ /*
+ * Specilization for controlled steppers
+ */
+ template< class Stepper , class System >
+ class adaptive_time_iterator< Stepper , System , controlled_stepper_tag > : public detail::ode_time_iterator_base
+ <
+ adaptive_time_iterator< Stepper , System , controlled_stepper_tag > ,
+ Stepper , System , controlled_stepper_tag
+ >
+ {
+ private:
+
+ typedef Stepper stepper_type;
+ typedef System system_type;
+ typedef typename stepper_type::state_type state_type;
+ typedef typename stepper_type::time_type time_type;
+ typedef typename stepper_type::value_type ode_value_type;
+ typedef detail::ode_time_iterator_base<
+ adaptive_time_iterator< Stepper , System , controlled_stepper_tag > ,
+ Stepper , System , controlled_stepper_tag > base_type;
+
+
+ public:
+
+ adaptive_time_iterator( stepper_type stepper , system_type sys , state_type &s , time_type t , time_type t_end , time_type dt )
+ : base_type( stepper , sys , s , t , t_end , dt ) {}
+
+ adaptive_time_iterator( stepper_type stepper , system_type sys , state_type &s )
+ : base_type( stepper , sys , s ) {}
+
+ private:
+
+ friend class boost::iterator_core_access;
+
+ void increment()
+ {
+ const size_t max_attempts = 1000;
+ size_t trials = 0;
+ controlled_step_result res = success;
+ do
+ {
+ res = this->m_stepper.try_step( this->m_system , this->m_state.first , this->m_state.second , this->m_dt );
+ ++trials;
+ }
+ while( ( res == fail ) && ( trials < max_attempts ) );
+ if( trials == max_attempts )
+ {
+ throw std::overflow_error( "Adaptive iterator : Maximal number of iterations reached. A step size could not be found." );
+ }
+ this->check_end();
+ }
+ };
+
+
+
+
+
+
+ /*
+ * Specilization for steppers and error steppers
+ */
+ template< class Stepper , class System >
+ class adaptive_time_iterator< Stepper , System , dense_output_stepper_tag > : public detail::ode_time_iterator_base
+ <
+ adaptive_time_iterator< Stepper , System , dense_output_stepper_tag > ,
+ Stepper , System , dense_output_stepper_tag
+ >
+ {
+ private:
+
+ typedef Stepper stepper_type;
+ typedef System system_type;
+ typedef typename stepper_type::state_type state_type;
+ typedef typename stepper_type::time_type time_type;
+ typedef typename stepper_type::value_type ode_value_type;
+ typedef detail::ode_time_iterator_base<
+ adaptive_time_iterator< Stepper , System , dense_output_stepper_tag > ,
+ Stepper , System , dense_output_stepper_tag > base_type;
+
+ public:
+
+ adaptive_time_iterator( stepper_type stepper , system_type sys , state_type &s , time_type t , time_type t_end , time_type dt )
+ : base_type( stepper , sys , s , t , t_end , dt )
+ {
+ this->m_stepper.initialize( this->m_state.first , this->m_state.second , this->m_dt );
+ }
+
+ adaptive_time_iterator( stepper_type stepper , system_type sys , state_type &s )
+ : base_type( stepper , sys , s )
+ {
+ }
+
+
+ private:
+
+ friend class boost::iterator_core_access;
+
+ void increment()
+ {
+ this->m_stepper.do_step( this->m_system );
+ this->m_state.second = this->m_stepper.current_time();
+ this->m_stepper.calc_state( this->m_state.second , this->m_state.first );
+ this->check_end();
+ }
+ };
+
+
+
+
+
+
+
+
+ template< class Stepper , class System >
+ adaptive_time_iterator< Stepper , System > make_adaptive_time_iterator_begin(
+ Stepper stepper ,
+ System system ,
+ typename Stepper::state_type &x ,
+ typename Stepper::time_type t ,
+ typename Stepper::time_type t_end ,
+ typename Stepper::time_type dt )
+ {
+ return adaptive_time_iterator< Stepper , System >( stepper , system , x , t , t_end , dt );
+ }
+
+ template< class Stepper , class System >
+ adaptive_time_iterator< Stepper , System > make_adaptive_time_iterator_end(
+ Stepper stepper ,
+ System system ,
+ typename Stepper::state_type &x )
+ {
+ return adaptive_time_iterator< Stepper , System >( stepper , system , x );
+ }
+
+
+ template< class Stepper , class System >
+ std::pair< adaptive_time_iterator< Stepper , System > , adaptive_time_iterator< Stepper , System > >
+ make_adaptive_time_range(
+ Stepper stepper ,
+ System system ,
+ typename Stepper::state_type &x ,
+ typename Stepper::time_type t_start ,
+ typename Stepper::time_type t_end ,
+ typename Stepper::time_type dt )
+ {
+ return std::make_pair(
+ adaptive_time_iterator< Stepper , System >( stepper , system , x , t_start , t_end , dt ) ,
+ adaptive_time_iterator< Stepper , System >( stepper , system , x ) );
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+} // namespace odeint
+} // namespace numeric
+} // namespace boost
+
+
+
+#endif // BOOST_NUMERIC_ODEINT_ITERATOR_ADAPTIVE_TIME_ITERATOR_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/iterator/const_step_iterator.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/iterator/const_step_iterator.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,194 @@
+
+/*
+ [auto_generated]
+ boost/numeric/odeint/iterator/const_step_ode_iterator.hpp
+
+ [begin_description]
+ Iterator for iterating throught the solution of an ODE with constant step size.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_ITERATOR_CONST_STEP_ODE_ITERATOR_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_ITERATOR_CONST_STEP_ODE_ITERATOR_HPP_INCLUDED
+
+#include <boost/numeric/odeint/iterator/detail/ode_iterator_base.hpp>
+
+#include <boost/numeric/odeint/util/unit_helper.hpp>
+#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+ template< class Stepper , class System , class StepperTag = typename base_tag< typename Stepper::stepper_category >::type >
+ class const_step_iterator;
+
+
+
+
+
+ /*
+ * Specilization for steppers and error steppers
+ */
+ template< class Stepper , class System >
+ class const_step_iterator< Stepper , System , stepper_tag >
+ : public detail::ode_iterator_base<
+ const_step_iterator< Stepper , System , stepper_tag > ,
+ Stepper , System , stepper_tag >
+ {
+ private:
+
+ typedef Stepper stepper_type;
+ typedef System system_type;
+ typedef typename stepper_type::state_type state_type;
+ typedef typename stepper_type::time_type time_type;
+ typedef typename stepper_type::value_type ode_value_type;
+ typedef detail::ode_iterator_base<
+ const_step_iterator< Stepper , System , stepper_tag > ,
+ Stepper , System , stepper_tag > base_type;
+
+ public:
+
+ const_step_iterator( stepper_type stepper , system_type sys , state_type &s , time_type t , time_type t_end , time_type dt )
+ : base_type( stepper , sys , s , t , t_end , dt ) { }
+
+ const_step_iterator( stepper_type stepper , system_type sys , state_type &s )
+ : base_type( stepper , sys , s ) { }
+
+ protected:
+
+ friend class boost::iterator_core_access;
+
+ void increment()
+ {
+ this->m_stepper.do_step( this->m_system , this->m_state , this->m_t , this->m_dt );
+ this->m_t += this->m_dt;
+ this->check_end();
+ }
+ };
+
+
+
+ /*
+ * Specilization for dense output stepper
+ */
+ template< class Stepper , class System >
+ class const_step_iterator< Stepper , System , dense_output_stepper_tag >
+ : public detail::ode_iterator_base<
+ const_step_iterator< Stepper , System , dense_output_stepper_tag > ,
+ Stepper , System , dense_output_stepper_tag >
+ {
+ private:
+
+ typedef Stepper stepper_type;
+ typedef System system_type;
+ typedef typename stepper_type::state_type state_type;
+ typedef typename stepper_type::time_type time_type;
+ typedef typename stepper_type::value_type ode_value_type;
+ typedef detail::ode_iterator_base<
+ const_step_iterator< Stepper , System , dense_output_stepper_tag > ,
+ Stepper , System , dense_output_stepper_tag > base_type;
+
+ public:
+
+ const_step_iterator( stepper_type stepper , system_type sys , state_type &s , time_type t , time_type t_end , time_type dt )
+ : base_type( stepper , sys , s , t , t_end , dt )
+ {
+ this->m_stepper.initialize( this->m_state , this->m_t , this->m_dt );
+ }
+
+ const_step_iterator( stepper_type stepper , system_type sys , state_type &s )
+ : base_type( stepper , sys , s ) { }
+
+
+ protected:
+
+ friend class boost::iterator_core_access;
+
+ void increment( void )
+ {
+ this->m_t += this->m_dt;
+ if( get_unit_value( this->m_dt ) > static_cast< ode_value_type >( 0.0 ) )
+ {
+ while( this->m_stepper.current_time() < this->m_t )
+ this->m_stepper.do_step( this->m_system );
+ }
+ else
+ {
+ while( this->m_stepper.current_time() > this->m_t )
+ this->m_stepper.do_step( this->m_system );
+ }
+ this->m_stepper.calc_state( this->m_t , this->m_state );
+ this->check_end();
+ }
+ };
+
+
+
+
+
+ template< class Stepper , class System >
+ const_step_iterator< Stepper , System > make_const_step_iterator_begin(
+ Stepper stepper ,
+ System system ,
+ typename Stepper::state_type &x ,
+ typename Stepper::time_type t ,
+ typename Stepper::time_type t_end ,
+ typename Stepper::time_type dt )
+ {
+ return const_step_iterator< Stepper , System >( stepper , system , x , t , t_end , dt );
+ }
+
+ template< class Stepper , class System >
+ const_step_iterator< Stepper , System > make_const_step_iterator_end(
+ Stepper stepper ,
+ System system ,
+ typename Stepper::state_type &x )
+ {
+ return const_step_iterator< Stepper , System >( stepper , system , x );
+ }
+
+
+ template< class Stepper , class System >
+ std::pair< const_step_iterator< Stepper , System > , const_step_iterator< Stepper , System > >
+ make_const_step_range(
+ Stepper stepper ,
+ System system ,
+ typename Stepper::state_type &x ,
+ typename Stepper::time_type t_start ,
+ typename Stepper::time_type t_end ,
+ typename Stepper::time_type dt )
+ {
+ return std::make_pair(
+ const_step_iterator< Stepper , System >( stepper , system , x , t_start , t_end , dt ) ,
+ const_step_iterator< Stepper , System >( stepper , system , x )
+ );
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+} // namespace odeint
+} // namespace numeric
+} // namespace boost
+
+
+
+#endif // BOOST_NUMERIC_ODEINT_ITERATOR_CONST_STEP_ODE_ITERATOR_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/iterator/const_step_time_iterator.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/iterator/const_step_time_iterator.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,192 @@
+
+/*
+ [auto_generated]
+ boost/numeric/odeint/iterator/const_step_time_iterator.hpp
+
+ [begin_description]
+ Iterator for iterating throught the solution of an ODE with constant step size. The dereferences types containes also the time.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_ITERATOR_CONST_STEP_TIME_ITERATOR_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_ITERATOR_CONST_STEP_TIME_ITERATOR_HPP_INCLUDED
+
+#include <boost/numeric/odeint/util/unit_helper.hpp>
+#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
+#include <boost/numeric/odeint/iterator/detail/ode_time_iterator_base.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+ template< class Stepper , class System , class StepperTag = typename base_tag< typename Stepper::stepper_category >::type >
+ class const_step_time_iterator;
+
+
+ /*
+ * Specilization for steppers and error steppers
+ */
+ template< class Stepper , class System >
+ class const_step_time_iterator< Stepper , System , stepper_tag > : public detail::ode_time_iterator_base
+ <
+ const_step_time_iterator< Stepper , System , stepper_tag > ,
+ Stepper , System , stepper_tag
+ >
+ {
+ private:
+
+ typedef Stepper stepper_type;
+ typedef System system_type;
+ typedef typename stepper_type::state_type state_type;
+ typedef typename stepper_type::time_type time_type;
+ typedef typename stepper_type::value_type ode_value_type;
+ typedef detail::ode_time_iterator_base<
+ const_step_time_iterator< Stepper , System , stepper_tag > ,
+ Stepper , System , stepper_tag > base_type;
+
+ public:
+
+ const_step_time_iterator( stepper_type stepper , system_type sys , state_type &s , time_type t , time_type t_end , time_type dt )
+ : base_type( stepper , sys , s , t , t_end , dt ) {}
+
+ const_step_time_iterator( stepper_type stepper , system_type sys , state_type &s )
+ : base_type( stepper , sys , s ) {}
+
+ protected:
+
+ friend class boost::iterator_core_access;
+
+ void increment()
+ {
+ this->m_stepper.do_step( this->m_system , this->m_state.first , this->m_state.second , this->m_dt );
+ this->m_state.second += this->m_dt;
+ this->check_end();
+ }
+
+ };
+
+
+
+
+
+
+ /*
+ * Specilization for steppers and error steppers
+ */
+ template< class Stepper , class System >
+ class const_step_time_iterator< Stepper , System , dense_output_stepper_tag > : public detail::ode_time_iterator_base
+ <
+ const_step_time_iterator< Stepper , System , dense_output_stepper_tag > ,
+ Stepper , System , dense_output_stepper_tag
+ >
+ {
+ private:
+
+ typedef Stepper stepper_type;
+ typedef System system_type;
+ typedef typename stepper_type::state_type state_type;
+ typedef typename stepper_type::time_type time_type;
+ typedef typename stepper_type::value_type ode_value_type;
+ typedef detail::ode_time_iterator_base<
+ const_step_time_iterator< Stepper , System , dense_output_stepper_tag > ,
+ Stepper , System , dense_output_stepper_tag > base_type;
+
+
+ public:
+
+ const_step_time_iterator( stepper_type stepper , system_type sys , state_type &s , time_type t , time_type t_end , time_type dt )
+ : base_type( stepper , sys , s , t , t_end , dt )
+ {
+ this->m_stepper.initialize( this->m_state.first , this->m_state.second , this->m_dt );
+ }
+
+ const_step_time_iterator( stepper_type stepper , system_type sys , state_type &s )
+ : base_type( stepper , sys , s ) {}
+
+ protected:
+
+ friend class boost::iterator_core_access;
+
+ void increment()
+ {
+ this->m_state.second += this->m_dt;
+ if( get_unit_value( this->m_dt ) > static_cast< ode_value_type >( 0.0 ) )
+ {
+ while( this->m_stepper.current_time() < this->m_state.second )
+ this->m_stepper.do_step( this->m_system );
+ }
+ else
+ {
+ while( this->m_stepper.current_time() > this->m_state.second )
+ this->m_stepper.do_step( this->m_system );
+ }
+ this->m_stepper.calc_state( this->m_state.second , this->m_state.first );
+ this->check_end();
+ }
+ };
+
+
+
+
+
+
+
+
+ template< class Stepper , class System >
+ const_step_time_iterator< Stepper , System > make_const_step_time_iterator_begin(
+ Stepper stepper ,
+ System system ,
+ typename Stepper::state_type &x ,
+ typename Stepper::time_type t ,
+ typename Stepper::time_type t_end ,
+ typename Stepper::time_type dt )
+ {
+ return const_step_time_iterator< Stepper , System >( stepper , system , x , t , t_end , dt );
+ }
+
+ template< class Stepper , class System >
+ const_step_time_iterator< Stepper , System > make_const_step_time_iterator_end(
+ Stepper stepper ,
+ System system ,
+ typename Stepper::state_type &x )
+ {
+ return const_step_time_iterator< Stepper , System >( stepper , system , x );
+ }
+
+
+ template< class Stepper , class System >
+ std::pair< const_step_time_iterator< Stepper , System > , const_step_time_iterator< Stepper , System > >
+ make_const_step_time_range(
+ Stepper stepper ,
+ System system ,
+ typename Stepper::state_type &x ,
+ typename Stepper::time_type t_start ,
+ typename Stepper::time_type t_end ,
+ typename Stepper::time_type dt )
+ {
+ return std::make_pair(
+ const_step_time_iterator< Stepper , System >( stepper , system , x , t_start , t_end , dt ) ,
+ const_step_time_iterator< Stepper , System >( stepper , system , x ) );
+ }
+
+
+
+
+
+
+} // namespace odeint
+} // namespace numeric
+} // namespace boost
+
+
+
+#endif // BOOST_NUMERIC_ODEINT_ITERATOR_CONST_STEP_TIME_ITERATOR_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/iterator/detail/ode_iterator_base.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/iterator/detail/ode_iterator_base.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,127 @@
+
+/*
+ [auto_generated]
+ boost/numeric/odeint/iterator/detail/ode_iterator_base.hpp
+
+ [begin_description]
+ Base class for const_step_iterator and adaptive_iterator.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_ITERATOR_DETAIL_ODE_ITERATOR_BASE_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_ITERATOR_DETAIL_ODE_ITERATOR_BASE_HPP_INCLUDED
+
+#include <boost/iterator/iterator_facade.hpp>
+
+#include <boost/numeric/odeint/util/unit_helper.hpp>
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+namespace detail {
+
+
+
+
+ template< class Iterator , class Stepper , class System , class StepperTag >
+ class ode_iterator_base : public boost::iterator_facade
+ <
+ Iterator ,
+ typename Stepper::state_type const ,
+ boost::single_pass_traversal_tag
+ >
+ {
+ private:
+
+ typedef Stepper stepper_type;
+ typedef System system_type;
+ typedef typename stepper_type::state_type state_type;
+ typedef typename stepper_type::time_type time_type;
+ typedef typename stepper_type::value_type ode_value_type;
+
+ public:
+
+ ode_iterator_base( stepper_type stepper , system_type sys , state_type &s ,
+ time_type t , time_type t_end , time_type dt )
+ : m_stepper( stepper ) , m_system( sys ) , m_state( s ) , m_t( t ) , m_t_end( t_end ) , m_dt( dt ) , m_first( true )
+ {
+ check_end();
+ }
+
+ ode_iterator_base( stepper_type stepper , system_type sys , state_type &s )
+ : m_stepper( stepper ) , m_system( sys ) , m_state( s ) , m_t() , m_t_end() , m_dt() , m_first( false )
+ {
+ }
+
+
+ protected:
+
+ friend class boost::iterator_core_access;
+
+ bool equal( ode_iterator_base const& other ) const
+ {
+ if( m_first == other.m_first )
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ const state_type& dereference() const
+ {
+ return m_state;
+ }
+
+ void check_end( void )
+ {
+ if( get_unit_value( m_dt ) > static_cast< ode_value_type >( 0.0 ) )
+ {
+ if( m_t > m_t_end )
+ {
+ m_first = false;
+ }
+ }
+ else
+ {
+ if( m_t < m_t_end )
+ {
+ m_first = false;
+ }
+ }
+ }
+
+ stepper_type m_stepper;
+ system_type m_system;
+ state_type &m_state;
+ time_type m_t;
+ time_type m_t_end;
+ time_type m_dt;
+ bool m_first;
+ };
+
+
+
+
+
+
+
+} // namespace detail
+} // namespace odeint
+} // namespace numeric
+} // namespace boost
+
+
+
+#endif // BOOST_NUMERIC_ODEINT_ITERATOR_DETAIL_ODE_ITERATOR_BASE_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/iterator/detail/ode_time_iterator_base.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/iterator/detail/ode_time_iterator_base.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,126 @@
+
+/*
+ [auto_generated]
+ boost/numeric/odeint/iterator/detail/ode_time_iterator_base.hpp
+
+ [begin_description]
+ Base class for const_step_time_iterator and adaptive_time_iterator.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_ITERATOR_DETAIL_ODE_TIME_ITERATOR_BASE_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_ITERATOR_DETAIL_ODE_TIME_ITERATOR_BASE_HPP_INCLUDED
+
+#include <boost/iterator/iterator_facade.hpp>
+
+#include <boost/numeric/odeint/util/unit_helper.hpp>
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+namespace detail {
+
+
+
+
+ template< class Iterator , class Stepper , class System , class StepperTag >
+ class ode_time_iterator_base : public boost::iterator_facade
+ <
+ Iterator ,
+ std::pair< typename Stepper::state_type& , typename Stepper::time_type > const ,
+ boost::single_pass_traversal_tag
+ >
+ {
+ private:
+
+ typedef Stepper stepper_type;
+ typedef System system_type;
+ typedef typename stepper_type::state_type state_type;
+ typedef typename stepper_type::time_type time_type;
+ typedef typename stepper_type::value_type ode_value_type;
+
+ public:
+
+ ode_time_iterator_base( stepper_type stepper , system_type sys , state_type &s , time_type t , time_type t_end , time_type dt )
+ : m_stepper( stepper ) , m_system( sys ) , m_state( s , t ) , m_t_end( t_end ) , m_dt( dt ) , m_first( true )
+ {
+ check_end();
+ }
+
+ ode_time_iterator_base( stepper_type stepper , system_type sys , state_type &s )
+ : m_stepper( stepper ) , m_system( sys ) , m_state( s , 0.0 ) , m_t_end() , m_dt() , m_first( false )
+ {
+ }
+
+
+ protected:
+
+ friend class boost::iterator_core_access;
+
+ bool equal( ode_time_iterator_base const& other ) const
+ {
+ if( m_first == other.m_first )
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ const std::pair< state_type& , time_type >& dereference() const
+ {
+ return m_state;
+ }
+
+ void check_end( void )
+ {
+ if( get_unit_value( m_dt ) > static_cast< ode_value_type >( 0.0 ) )
+ {
+ if( m_state.second > m_t_end )
+ {
+ m_first = false;
+ }
+ }
+ else
+ {
+ if( m_state.second < m_t_end )
+ {
+ m_first = false;
+ }
+ }
+ }
+
+ stepper_type m_stepper;
+ system_type m_system;
+ std::pair< state_type& , time_type > m_state;
+ time_type m_t_end;
+ time_type m_dt;
+ bool m_first;
+
+ };
+
+
+
+
+
+
+
+} // namespace detail
+} // namespace odeint
+} // namespace numeric
+} // namespace boost
+
+
+
+#endif // BOOST_NUMERIC_ODEINT_ITERATOR_DETAIL_ODE_TIME_ITERATOR_BASE_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/adams_bashforth.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/adams_bashforth.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,285 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/adams_bashforth.hpp
+
+ [begin_description]
+ Implementaton of the Adam-Bashforth method a multistep method used for the predictor step in the
+ Adams-Bashforth-Moulton method.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_ADAMS_BASHFORTH_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_ADAMS_BASHFORTH_HPP_INCLUDED
+
+#include <boost/static_assert.hpp>
+
+#include <boost/numeric/odeint/util/bind.hpp>
+#include <boost/numeric/odeint/util/unwrap_reference.hpp>
+
+#include <boost/numeric/odeint/algebra/range_algebra.hpp>
+#include <boost/numeric/odeint/algebra/default_operations.hpp>
+
+#include <boost/numeric/odeint/util/state_wrapper.hpp>
+#include <boost/numeric/odeint/util/is_resizeable.hpp>
+#include <boost/numeric/odeint/util/resizer.hpp>
+
+#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
+#include <boost/numeric/odeint/stepper/runge_kutta4.hpp>
+
+#include <boost/numeric/odeint/stepper/base/algebra_stepper_base.hpp>
+
+#include <boost/numeric/odeint/stepper/detail/adams_bashforth_coefficients.hpp>
+#include <boost/numeric/odeint/stepper/detail/adams_bashforth_call_algebra.hpp>
+#include <boost/numeric/odeint/stepper/detail/rotating_buffer.hpp>
+
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+/*
+ * Static explicit Adams-Bashforth multistep-solver without step size control and without dense output.
+ */
+template<
+size_t Steps ,
+class State ,
+class Value = double ,
+class Deriv = State ,
+class Time = Value ,
+class Algebra = range_algebra ,
+class Operations = default_operations ,
+class Resizer = initially_resizer ,
+class InitializingStepper = runge_kutta4< State , Value , Deriv , Time , Algebra , Operations, Resizer >
+>
+class adams_bashforth : public algebra_stepper_base< Algebra , Operations >
+{
+ BOOST_STATIC_ASSERT(( Steps > 0 ));
+
+public :
+
+ typedef State state_type;
+ typedef state_wrapper< state_type > wrapped_state_type;
+ typedef Value value_type;
+ typedef Deriv deriv_type;
+ typedef state_wrapper< deriv_type > wrapped_deriv_type;
+ typedef Time time_type;
+ typedef Resizer resizer_type;
+ typedef stepper_tag stepper_category;
+
+ typedef typename algebra_stepper_base< Algebra , Operations >::algebra_type algebra_type;
+ typedef typename algebra_stepper_base< Algebra , Operations >::operations_type operations_type;
+ typedef adams_bashforth< Steps , State , Value , Deriv , Time , Algebra , Operations , Resizer , InitializingStepper > stepper_type;
+ typedef InitializingStepper initializing_stepper_type;
+
+ static const size_t steps = Steps;
+
+
+
+ typedef unsigned short order_type;
+ static const order_type order_value = steps;
+
+ typedef detail::rotating_buffer< wrapped_deriv_type , steps > step_storage_type;
+
+
+ order_type order( void ) const { return order_value; }
+
+
+ adams_bashforth( const algebra_type &algebra = algebra_type() )
+ : m_step_storage() , m_resizer() , m_coefficients() ,
+ m_steps_initialized( 0 ) , m_initializing_stepper() ,
+ m_algebra( algebra )
+ { }
+
+ adams_bashforth( const adams_bashforth &stepper )
+ : m_step_storage( stepper.m_step_storage ) , m_resizer( stepper.m_resizer ) , m_coefficients() ,
+ m_steps_initialized( stepper.m_steps_initialized ) , m_initializing_stepper( stepper.m_initializing_stepper ) ,
+ m_algebra( stepper.m_algebra )
+ { }
+
+ adams_bashforth& operator=( const adams_bashforth &stepper )
+ {
+ m_resizer = stepper.m_resizer;
+ m_step_storage = stepper.m_step_storage;
+ m_algebra = stepper.m_algebra;
+ return *this;
+ }
+
+
+ /*
+ * Version 1 : do_step( system , x , t , dt );
+ *
+ * solves the forwarding problem
+ */
+ template< class System , class StateInOut >
+ void do_step( System system , StateInOut &x , time_type t , time_type dt )
+ {
+ do_step( system , x , t , x , dt );
+ }
+
+ template< class System , class StateInOut >
+ void do_step( System system , const StateInOut &x , time_type t , time_type dt )
+ {
+ do_step( system , x , t , x , dt );
+ }
+
+
+
+ /*
+ * Version 2 : do_step( system , in , t , out , dt );
+ *
+ * solves the forwarding problem
+ */
+ template< class System , class StateIn , class StateOut >
+ void do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt )
+ {
+ do_step_impl( system , in , t , out , dt );
+ }
+
+ template< class System , class StateIn , class StateOut >
+ void do_step( System system , const StateIn &in , time_type t , const StateOut &out , time_type dt )
+ {
+ do_step_impl( system , in , t , out , dt );
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ template< class StateType >
+ void adjust_size( const StateType &x )
+ {
+ resize_impl( x );
+ }
+
+ const step_storage_type& step_storage( void ) const
+ {
+ return m_step_storage;
+ }
+
+ step_storage_type& step_storage( void )
+ {
+ return m_step_storage;
+ }
+
+ template< class ExplicitStepper , class System , class StateIn >
+ void initialize( ExplicitStepper explicit_stepper , System system , StateIn &x , time_type &t , time_type dt )
+ {
+ typename odeint::unwrap_reference< ExplicitStepper >::type &stepper = explicit_stepper;
+ typename odeint::unwrap_reference< System >::type &sys = system;
+
+ m_resizer.adjust_size( x , detail::bind( &stepper_type::template resize_impl<StateIn> , detail::ref( *this ) , detail::_1 ) );
+
+ for( size_t i=0 ; i<steps-1 ; ++i )
+ {
+ if( i != 0 ) m_step_storage.rotate();
+ sys( x , m_step_storage[0].m_v , t );
+ stepper.do_step( system , x , m_step_storage[0].m_v , t , dt );
+ t += dt;
+ }
+ m_steps_initialized = steps;
+ }
+
+ template< class System , class StateIn >
+ void initialize( System system , StateIn &x , time_type &t , time_type dt )
+ {
+ initialize( detail::ref( m_initializing_stepper ) , system , x , t , dt );
+ }
+
+ void reset( void )
+ {
+ m_steps_initialized = 0;
+ }
+
+ bool is_initialized( void ) const
+ {
+ return m_steps_initialized >= steps;
+ }
+
+ const initializing_stepper_type& initializing_stepper( void ) const { return m_initializing_stepper; }
+
+ initializing_stepper_type& initializing_stepper( void ) { return m_initializing_stepper; }
+
+private:
+
+ template< class System , class StateIn , class StateOut >
+ void do_step_impl( System system , const StateIn &in , time_type t , StateOut &out , time_type dt )
+ {
+ typename odeint::unwrap_reference< System >::type &sys = system;
+ if( m_resizer.adjust_size( in , detail::bind( &stepper_type::template resize_impl<StateIn> , detail::ref( *this ) , detail::_1 ) ) )
+ {
+ m_steps_initialized = 0;
+ }
+
+ if( m_steps_initialized < steps - 1 )
+ {
+ if( m_steps_initialized != 0 ) m_step_storage.rotate();
+ sys( in , m_step_storage[0].m_v , t );
+ m_initializing_stepper.do_step( system , in , m_step_storage[0].m_v , t , out , dt );
+ m_steps_initialized++;
+ }
+ else
+ {
+ m_step_storage.rotate();
+ sys( in , m_step_storage[0].m_v , t );
+ detail::adams_bashforth_call_algebra< steps , algebra_type , operations_type >()( m_algebra , in , out , m_step_storage , m_coefficients , dt );
+ }
+ }
+
+
+ template< class StateIn >
+ bool resize_impl( const StateIn &x )
+ {
+ bool resized( false );
+ for( size_t i=0 ; i<steps ; ++i )
+ {
+ resized |= adjust_size_by_resizeability( m_step_storage[i] , x , typename is_resizeable<deriv_type>::type() );
+ }
+ return resized;
+ }
+
+ step_storage_type m_step_storage;
+ resizer_type m_resizer;
+ const detail::adams_bashforth_coefficients< value_type , steps > m_coefficients;
+ size_t m_steps_initialized;
+ initializing_stepper_type m_initializing_stepper;
+
+
+
+
+
+
+
+protected:
+
+ algebra_type m_algebra;
+};
+
+
+
+
+} // odeint
+} // numeric
+} // boost
+
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_ADAMS_BASHFORTH_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/adams_bashforth_moulton.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/adams_bashforth_moulton.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,152 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/adams_bashforth_moulton.hpp
+
+ [begin_description]
+ Implementation of the Adams-Bashforth-Moulton method, a predictor-corrector multistep method.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_ADAMS_BASHFORTH_MOULTON_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_ADAMS_BASHFORTH_MOULTON_HPP_INCLUDED
+
+
+#include <boost/numeric/odeint/util/bind.hpp>
+
+#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
+#include <boost/numeric/odeint/algebra/range_algebra.hpp>
+#include <boost/numeric/odeint/algebra/default_operations.hpp>
+
+#include <boost/numeric/odeint/util/state_wrapper.hpp>
+#include <boost/numeric/odeint/util/resizer.hpp>
+
+#include <boost/numeric/odeint/stepper/adams_bashforth.hpp>
+#include <boost/numeric/odeint/stepper/adams_moulton.hpp>
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+/*
+ * Static Adams-Bashforth-Moulton multistep-solver without step size control and without dense output.
+ */
+template<
+size_t Steps ,
+class State ,
+class Value = double ,
+class Deriv = State ,
+class Time = Value ,
+class Algebra = range_algebra ,
+class Operations = default_operations ,
+class Resizer = initially_resizer
+>
+class adams_bashforth_moulton
+{
+
+public :
+
+ typedef State state_type;
+ typedef state_wrapper< state_type > wrapped_state_type;
+ typedef Value value_type;
+ typedef Deriv deriv_type;
+ typedef state_wrapper< deriv_type > wrapped_deriv_type;
+ typedef Time time_type;
+ typedef Algebra algebra_type;
+ typedef Operations operations_type;
+ typedef Resizer resizer_type;
+ typedef stepper_tag stepper_category;
+
+ static const size_t steps = Steps;
+
+ typedef adams_bashforth< steps , state_type , value_type , deriv_type , time_type , algebra_type , operations_type , resizer_type > adams_bashforth_type;
+ typedef adams_moulton< steps , state_type , value_type , deriv_type , time_type , algebra_type , operations_type , resizer_type > adams_moulton_type;
+
+ typedef unsigned short order_type;
+ static const order_type order_value = steps + 1;
+
+ adams_bashforth_moulton( void )
+ : m_adams_bashforth() , m_adams_moulton( m_adams_bashforth.algebra() )
+ { }
+
+ adams_bashforth_moulton( const algebra_type &algebra )
+ : m_adams_bashforth( algebra ) , m_adams_moulton( m_adams_bashforth.algebra() )
+ { }
+
+ order_type order( void ) const { return order_value; }
+
+ template< class System , class StateInOut >
+ void do_step( System system , StateInOut &x , time_type t , time_type dt )
+ {
+ m_adams_bashforth.do_step( system , x , t , dt );
+ m_adams_moulton.do_step( system , x , t , dt , m_adams_bashforth.step_storage() );
+ }
+
+ template< class System , class StateInOut >
+ void do_step( System system , const StateInOut &x , time_type t , time_type dt )
+ {
+ m_adams_bashforth.do_step( system , x , t , dt );
+ m_adams_moulton.do_step( system , x , t , dt , m_adams_bashforth.step_storage() );
+ }
+
+ template< class System , class StateIn , class StateOut >
+ void do_step( System system , const StateIn &in , time_type t , const StateOut &out , time_type dt )
+ {
+ m_adams_bashforth.do_step( system , in , t , out , dt );
+ m_adams_moulton.do_step( system , out , t , dt , m_adams_bashforth.step_storage() );
+ }
+
+ template< class System , class StateIn , class StateOut >
+ void do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt )
+ {
+ m_adams_bashforth.do_step( system , in , t , out , dt );
+ m_adams_moulton.do_step( system , out , t , dt , m_adams_bashforth.step_storage() );
+ }
+
+ template< class StateType >
+ void adjust_size( const StateType &x )
+ {
+ m_adams_bashforth.adjust_size( x );
+ m_adams_moulton.adjust_size( x );
+ }
+
+
+ template< class ExplicitStepper , class System , class StateIn >
+ void initialize( ExplicitStepper explicit_stepper , System system , StateIn &x , time_type &t , time_type dt )
+ {
+ m_adams_bashforth.initialize( explicit_stepper , system , x , t , dt );
+ }
+
+ template< class System , class StateIn >
+ void initialize( System system , StateIn &x , time_type &t , time_type dt )
+ {
+ m_adams_bashforth.initialize( system , x , t , dt );
+ }
+
+
+
+private:
+
+ adams_bashforth_type m_adams_bashforth;
+ adams_moulton_type m_adams_moulton;
+};
+
+
+
+
+} // odeint
+} // numeric
+} // boost
+
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_ADAMS_BASHFORTH_MOULTON_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/adams_moulton.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/adams_moulton.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,195 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/adams_moulton.hpp
+
+ [begin_description]
+ Implementation of the Adams-Moulton method. This is method is not a real stepper, it is more a helper class
+ which computes the corrector step in the Adams-Bashforth-Moulton method.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_ADAMS_MOULTON_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_ADAMS_MOULTON_HPP_INCLUDED
+
+
+#include <boost/numeric/odeint/util/bind.hpp>
+
+#include <boost/numeric/odeint/algebra/range_algebra.hpp>
+#include <boost/numeric/odeint/algebra/default_operations.hpp>
+
+#include <boost/numeric/odeint/util/state_wrapper.hpp>
+#include <boost/numeric/odeint/util/is_resizeable.hpp>
+#include <boost/numeric/odeint/util/resizer.hpp>
+
+#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
+#include <boost/numeric/odeint/stepper/runge_kutta4_classic.hpp>
+
+#include <boost/numeric/odeint/stepper/detail/adams_moulton_call_algebra.hpp>
+#include <boost/numeric/odeint/stepper/detail/adams_moulton_coefficients.hpp>
+#include <boost/numeric/odeint/stepper/detail/rotating_buffer.hpp>
+
+
+
+
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+/*
+ * Static implicit Adams-Moulton multistep-solver without step size control and without dense output.
+ */
+template<
+size_t Steps ,
+class State ,
+class Value = double ,
+class Deriv = State ,
+class Time = Value ,
+class Algebra = range_algebra ,
+class Operations = default_operations ,
+class Resizer = initially_resizer
+>
+class adams_moulton
+{
+private:
+
+
+public :
+
+ typedef State state_type;
+ typedef state_wrapper< state_type > wrapped_state_type;
+ typedef Value value_type;
+ typedef Deriv deriv_type;
+ typedef state_wrapper< deriv_type > wrapped_deriv_type;
+ typedef Time time_type;
+ typedef Algebra algebra_type;
+ typedef Operations operations_type;
+ typedef Resizer resizer_type;
+ typedef stepper_tag stepper_category;
+
+ typedef adams_moulton< Steps , State , Value , Deriv , Time , Algebra , Operations , Resizer > stepper_type;
+
+ static const size_t steps = Steps;
+
+ typedef unsigned short order_type;
+ static const order_type order_value = steps + 1;
+
+ typedef detail::rotating_buffer< wrapped_deriv_type , steps > step_storage_type;
+
+ adams_moulton( )
+ : m_coefficients() , m_dxdt() , m_resizer() ,
+ m_algebra_instance() , m_algebra( m_algebra_instance )
+ { }
+
+ adams_moulton( algebra_type &algebra )
+ : m_coefficients() , m_dxdt() , m_resizer() ,
+ m_algebra_instance() , m_algebra( algebra )
+ { }
+
+ adams_moulton& operator=( const adams_moulton &stepper )
+ {
+ m_dxdt = stepper.m_dxdt;
+ m_resizer = stepper.m_resizer;
+ m_algebra = stepper.m_algebra;
+ return *this;
+ }
+
+ order_type order( void ) const { return order_value; }
+
+
+ /*
+ * Version 1 : do_step( system , x , t , dt , buf );
+ *
+ * solves the forwarding problem
+ */
+ template< class System , class StateInOut , class ABBuf >
+ void do_step( System system , StateInOut &in , time_type t , time_type dt , const ABBuf &buf )
+ {
+ do_step( system , in , t , in , dt , buf );
+ }
+
+ template< class System , class StateInOut , class ABBuf >
+ void do_step( System system , const StateInOut &in , time_type t , time_type dt , const ABBuf &buf )
+ {
+ do_step( system , in , t , in , dt , buf );
+ }
+
+
+
+ /*
+ * Version 2 : do_step( system , in , t , out , dt , buf );
+ *
+ * solves the forwarding problem
+ */
+ template< class System , class StateIn , class StateOut , class ABBuf >
+ void do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt , const ABBuf &buf )
+ {
+ typename odeint::unwrap_reference< System >::type &sys = system;
+ m_resizer.adjust_size( in , detail::bind( &stepper_type::template resize_impl<StateIn> , detail::ref( *this ) , detail::_1 ) );
+ sys( in , m_dxdt.m_v , t );
+ detail::adams_moulton_call_algebra< steps , algebra_type , operations_type >()( m_algebra , in , out , m_dxdt.m_v , buf , m_coefficients , dt );
+ }
+
+ template< class System , class StateIn , class StateOut , class ABBuf >
+ void do_step( System system , const StateIn &in , time_type t , const StateOut &out , time_type dt , const ABBuf &buf )
+ {
+ typename odeint::unwrap_reference< System >::type &sys = system;
+ m_resizer.adjust_size( in , detail::bind( &stepper_type::template resize_impl<StateIn> , detail::ref( *this ) , detail::_1 ) );
+ sys( in , m_dxdt.m_v , t );
+ detail::adams_moulton_call_algebra< steps , algebra_type , operations_type >()( m_algebra , in , out , m_dxdt.m_v , buf , m_coefficients , dt );
+ }
+
+
+
+ template< class StateType >
+ void adjust_size( const StateType &x )
+ {
+ resize_impl( x );
+ }
+
+ algebra_type& algebra()
+ { return m_algebra; }
+
+ const algebra_type& algebra() const
+ { return m_algebra; }
+
+
+private:
+
+ template< class StateIn >
+ bool resize_impl( const StateIn &x )
+ {
+ return adjust_size_by_resizeability( m_dxdt , x , typename is_resizeable<deriv_type>::type() );
+ }
+
+
+ const detail::adams_moulton_coefficients< value_type , steps > m_coefficients;
+ wrapped_deriv_type m_dxdt;
+ resizer_type m_resizer;
+
+protected:
+
+ algebra_type m_algebra_instance;
+ algebra_type &m_algebra;
+};
+
+
+
+
+} // odeint
+} // numeric
+} // boost
+
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_ADAMS_MOULTON_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/base/algebra_stepper_base.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/base/algebra_stepper_base.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,81 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/base/algebra_stepper_base.hpp
+
+ [begin_description]
+ Base class for all steppers with an algebra and operations.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_BASE_ALGEBRA_STEPPER_BASE_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_BASE_ALGEBRA_STEPPER_BASE_HPP_INCLUDED
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+/**
+ * \class algebra_stepper_base
+ * \brief Base class for all steppers with algebra and operations.
+ *
+ * This class serves a base class for all steppers with algebra and operations. It holds the
+ * algebra and provides access to the algebra. The operations are not instantiated, since they are
+ * static classes inside the operations class.
+ *
+ * \tparam Algebra The type of the algebra. Must fullfil the Algebra Concept, at least partially to work
+ * with the stepper.
+ * \tparam Operations The type of the operations. Must fullfil the Operations Concept, at least partially
+ * to work with the stepper.
+ */
+template< class Algebra , class Operations >
+class algebra_stepper_base
+{
+public:
+
+ typedef Algebra algebra_type;
+ typedef Operations operations_type;
+
+ /**
+ * \brief Constructs a algebra_stepper_base and creates the algebra. This constructor can be used as a default
+ * constructor if the algebra has a default constructor.
+ * \param algebra The algebra_stepper_base stores and uses a copy of algebra.
+ */
+ algebra_stepper_base( const algebra_type &algebra = algebra_type() )
+ : m_algebra( algebra ) { }
+
+ /**
+ * \return A reference to the algebra which is held by this class.
+ */
+ algebra_type& algebra()
+ {
+ return m_algebra;
+ }
+
+ /**
+ * \return A const reference to the algebra which is held by this class.
+ */
+ const algebra_type& algebra() const
+ {
+ return m_algebra;
+ }
+
+protected:
+
+ algebra_type m_algebra;
+};
+
+} // odeint
+} // numeric
+} // boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_BASE_ALGEBRA_STEPPER_BASE_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/base/explicit_error_stepper_base.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/base/explicit_error_stepper_base.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,543 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/base/explicit_error_stepper_base.hpp
+
+ [begin_description]
+ Base class for all explicit Runge Kutta stepper which are also error steppers.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_BASE_EXPLICIT_ERROR_STEPPER_BASE_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_BASE_EXPLICIT_ERROR_STEPPER_BASE_HPP_INCLUDED
+
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+
+#include <boost/numeric/odeint/util/bind.hpp>
+#include <boost/numeric/odeint/util/unwrap_reference.hpp>
+#include <boost/numeric/odeint/util/state_wrapper.hpp>
+#include <boost/numeric/odeint/util/is_resizeable.hpp>
+#include <boost/numeric/odeint/util/resizer.hpp>
+
+#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
+
+#include <boost/numeric/odeint/stepper/base/algebra_stepper_base.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+/*
+ * base class for explicit stepper and error steppers
+ * models the stepper AND the error stepper concept
+ *
+ * this class provides the following do_step variants:
+ * do_step( sys , x , t , dt )
+ * do_step( sys , x , dxdt , t , dt )
+ * do_step( sys , in , t , out , dt )
+ * do_step( sys , in , dxdt , t , out , dt )
+ * do_step( sys , x , t , dt , xerr )
+ * do_step( sys , x , dxdt , t , dt , xerr )
+ * do_step( sys , in , t , out , dt , xerr )
+ * do_step( sys , in , dxdt , t , out , dt , xerr )
+ */
+/**
+ * \class explicit_error_stepper_base
+ * \brief Base class for explicit steppers with error estimation. This class can used with
+ * controlled steppers for step size control.
+ *
+ * This class serves as the base class for all explicit steppers with algebra and operations. In contrast to
+ * explicit_stepper_base it also estimates the error and can be used in a controlled stepper to provide
+ * step size control.
+ *
+ * \note This stepper provides `do_step` methods with and without error estimation. It has therefore three orders,
+ * one for the order of a step if the error is not estimated. The other two orders are the orders of the step and
+ * the error step if the error estimation is performed.
+ *
+ * explicit_error_stepper_base is used as the interface in a CRTP (currently recurring template
+ * pattern). In order to work correctly the parent class needs to have a method
+ * `do_step_impl( system , in , dxdt_in , t , out , dt , xerr )`.
+ * explicit_error_stepper_base derives from algebra_stepper_base.
+ *
+ * explicit_error_stepper_base provides several overloaded `do_step` methods, see the list below. Only two of them
+ * are needed to fullfil the Error Stepper concept. The other ones are for convenience and for performance. Some
+ * of them simply update the state out-of-place, while other expect that the first derivative at `t` is passed to the
+ * stepper.
+ *
+ * - `do_step( sys , x , t , dt )` - The classical `do_step` method needed to fullfil the Error Stepper concept. The
+ * state is updated in-place. A type modelling a Boost.Range can be used for x.
+ * - `do_step( sys , x , dxdt , t , dt )` - This method updates the state in-place, but the derivative at the point `t`
+ * must be explicitely passed in `dxdt`.
+ * - `do_step( sys , in , t , out , dt )` - This method updates the state out-of-place, hence the result of the step
+ * is stored in `out`.
+ * - `do_step( sys , in , dxdt , t , out , dt )` - This method update the state out-of-place and expects that the
+ * derivative at the point `t` is explicitely passed in `dxdt`. It is a combination of the two `do_step` methods
+ * above.
+ * - `do_step( sys , x , t , dt , xerr )` - This `do_step` method is needed to fullfil the Error Stepper concept. The
+ * state is updated in-place and an error estimate is calculated. A type modelling a Boost.Range can be used for x.
+ * - `do_step( sys , x , dxdt , t , dt , xerr )` - This method updates the state in-place, but the derivative at the
+ * point `t` must be passed in `dxdt`. An error estimate is calculated.
+ * - `do_step( sys , in , t , out , dt , xerr )` - This method updates the state out-of-place and estimates the error
+ * during the step.
+ * - `do_step( sys , in , dxdt , t , out , dt , xerr )` - This methods updates the state out-of-place and estimates
+ * the error during the step. Furthermore, the derivative at `t` must be passed in `dxdt`.
+ *
+ * \note The system is always passed as value, which might result in poor performance if it contains data. In this
+ * case it can be used with `boost::ref` or `std::ref`, for example `stepper.do_step( boost::ref( sys ) , x , t , dt );`
+ *
+ * \note The time `t` is not advanced by the stepper. This has to done manually, or by the appropriate `integrate`
+ * routines or `iterator`s.
+ *
+ * \tparam Stepper The stepper on which this class should work. It is used via CRTP, hence explicit_stepper_base
+ * provides the interface for the Stepper.
+ * \tparam Order The order of a stepper if the stepper is used without error estimation.
+ * \tparam StepperOrder The order of a step if the stepper is used with error estimation. Usually Order and StepperOrder have
+ * the same value.
+ * \tparam ErrorOrder The order of the error step if the stepper is used with error estimation.
+ * \tparam State The state type for the stepper.
+ * \tparam Value The value type for the stepper. This should be a floating point type, like float,
+ * double, or a multiprecision type. It must not neccessary be the value_type of the State. For example
+ * the State can be a `vector< complex< double > >` in this case the Value must be double.
+ * The default value is double.
+ * \tparam Deriv The type representing time derivatives of the state type. It is usually the same type as the
+ * state type, only if used with Boost.Units both types differ.
+ * \tparam Time The type representing the time. Usually the same type as the value type. When Boost.Units is
+ * used, this type has usually a unit.
+ * \tparam Algebra The algebra type which must fullfil the Algebra Concept.
+ * \tparam Operations The type for the operations wich must fullfil the Operations Concept.
+ * \tparam Resizer The resizer policy class.
+ */
+template<
+class Stepper ,
+unsigned short Order ,
+unsigned short StepperOrder ,
+unsigned short ErrorOrder ,
+class State ,
+class Value ,
+class Deriv ,
+class Time ,
+class Algebra ,
+class Operations ,
+class Resizer
+>
+class explicit_error_stepper_base : public algebra_stepper_base< Algebra , Operations >
+{
+public:
+
+ typedef algebra_stepper_base< Algebra , Operations > algebra_stepper_base_type;
+ typedef typename algebra_stepper_base_type::algebra_type algebra_type;
+
+
+ typedef State state_type;
+ typedef Value value_type;
+ typedef Deriv deriv_type;
+ typedef Time time_type;
+ typedef Resizer resizer_type;
+ typedef Stepper stepper_type;
+ typedef explicit_error_stepper_tag stepper_category;
+ #ifndef DOXYGEN_SKIP
+ typedef state_wrapper< state_type > wrapped_state_type;
+ typedef state_wrapper< deriv_type > wrapped_deriv_type;
+ typedef explicit_error_stepper_base< Stepper , Order , StepperOrder , ErrorOrder ,
+ State , Value , Deriv , Time , Algebra , Operations , Resizer > internal_stepper_base_type;
+ #endif
+
+ typedef unsigned short order_type;
+ static const order_type order_value = Order;
+ static const order_type stepper_order_value = StepperOrder;
+ static const order_type error_order_value = ErrorOrder;
+
+
+ /**
+ * \brief Constructs a explicit_stepper_base class. This constructor can be used as a default
+ * constructor if the algebra has a default constructor.
+ * \param algebra A copy of algebra is made and stored inside explicit_stepper_base.
+ */
+ explicit_error_stepper_base( const algebra_type &algebra = algebra_type() )
+ : algebra_stepper_base_type( algebra )
+ { }
+
+ /**
+ * \return Returns the order of the stepper if it used without error estimation.
+ */
+ order_type order( void ) const
+ {
+ return order_value;
+ }
+
+ /**
+ * \return Returns the order of a step if the stepper is used without error estimation.
+ */
+ order_type stepper_order( void ) const
+ {
+ return stepper_order_value;
+ }
+
+ /**
+ * \return Returns the order of an error step if the stepper is used without error estimation.
+ */
+ order_type error_order( void ) const
+ {
+ return error_order_value;
+ }
+
+
+
+ /*
+ * Version 1 : do_step( sys , x , t , dt )
+ *
+ * the two overloads are needed in order to solve the forwarding problem
+ */
+ /**
+ * \brief This method performs one step. It transforms the result in-place.
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ordinary differential equation. It must fullfil the
+ * Simple System concept.
+ * \param x The state of the ODE which should be solved. After calling do_step the result is updated in x.
+ * \param t The value of the time, at which the step should be performed.
+ * \param dt The step size.
+ */
+ template< class System , class StateInOut >
+ void do_step( System system , StateInOut &x , time_type t , time_type dt )
+ {
+ do_step_v1( system , x , t , dt );
+ }
+
+ /**
+ * \brief This method performs one step with the stepper passed by Stepper.
+ * It transforms the result in-place. This method is needed in order to solve the forwarding problem.
+ * The difference to the other version is that it can be used like
+ * `stepper.do_step( sys , make_range( iter1 , iter2 ) , t , dt )`
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ordinary differential equation. It must fullfil the
+ * Simple System concept.
+ * \param x The state of the ODE which should be solved. After calling do_step the result is updated in x.
+ * \param t The value of the time, at which the step should be performed.
+ * \param dt The step size.
+ */
+ template< class System , class StateInOut >
+ void do_step( System system , const StateInOut &x , time_type t , time_type dt )
+ {
+ do_step_v1( system , x , t , dt );
+ }
+
+
+
+ /*
+ * Version 2 : do_step( sys , x , dxdt , t , dt )
+ *
+ * this version does not solve the forwarding problem, boost.range can not be used
+ *
+ * the disable is needed to avoid ambiguous overloads if state_type = time_type
+ */
+ /**
+ * \brief The method performs one step with the stepper passed by Stepper. Additionally to the other method
+ * the derivative of x is also passed to this method. It is equivalent to
+ *
+ * \code
+ * sys( x , dxdt , t );
+ * stepper.do_step( sys , x , dxdt , t , dt );
+ * \endcode
+ *
+ * The result is updated in place in x. This method is disabled if Time and Deriv are of the same type. In this
+ * case the method could not be distinguished from other `do_step` versions.
+ *
+ * \note This method does not solve the forwarding problem.
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ODE. It must fullfil the
+ * Simple System concept.
+ * \param x The state of the ODE which should be solved. After calling do_step the result is updated in x.
+ * \param dxdt The derivative of x at t.
+ * \param t The value of the time, at which the step should be performed.
+ * \param dt The step size.
+ */
+ template< class System , class StateInOut , class DerivIn >
+ typename boost::disable_if< boost::is_same< DerivIn , time_type > , void >::type
+ do_step( System system , StateInOut &x , const DerivIn &dxdt , time_type t , time_type dt )
+ {
+ this->stepper().do_step_impl( system , x , dxdt , t , x , dt );
+ }
+
+
+ /*
+ * Version 3 : do_step( sys , in , t , out , dt )
+ *
+ * this version does not solve the forwarding problem, boost.range can not be used
+ *
+ * the disable is needed to avoid ambiguous overloads if state_type = time_type
+ */
+ /**
+ * \brief The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place.
+ * This method is disabled if StateIn and Time are the same type. In this case the method can not be distinguished from
+ * other `do_step` variants.
+ * \note This method does not solve the forwarding problem.
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ODE. It must fullfil the
+ * Simple System concept.
+ * \param in The state of the ODE which should be solved. in is not modified in this method
+ * \param t The value of the time, at which the step should be performed.
+ * \param out The result of the step is written in out.
+ * \param dt The step size.
+ */
+ template< class System , class StateIn , class StateOut >
+ typename boost::disable_if< boost::is_same< StateIn , time_type > , void >::type
+ do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt )
+ {
+ typename odeint::unwrap_reference< System >::type &sys = system;
+ m_resizer.adjust_size( in , detail::bind( &internal_stepper_base_type::template resize_impl<StateIn> , detail::ref( *this ) , detail::_1 ) );
+ sys( in , m_dxdt.m_v ,t );
+ this->stepper().do_step_impl( system , in , m_dxdt.m_v , t , out , dt );
+ }
+
+ /*
+ * Version 4 :do_step( sys , in , dxdt , t , out , dt )
+ *
+ * this version does not solve the forwarding problem, boost.range can not be used
+ *
+ * the disable is needed to avoid ambiguous overloads if state_type = time_type
+ */
+ /**
+ * \brief The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place.
+ * Furthermore, the derivative of x at t is passed to the stepper. It is equivalent to:
+ *
+ * \code
+ * sys( in , dxdt , t );
+ * stepper.do_step( sys , in , dxdt , t , out , dt );
+ * \endcode
+ *
+ * This method is disabled if DerivIn and Time are of same type.
+ *
+ * \note This method does not solve the forwarding problem.
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ODE. It must fullfil the
+ * Simple System concept.
+ * \param in The state of the ODE which should be solved. in is not modified in this method
+ * \param dxdt The derivative of x at t.
+ * \param t The value of the time, at which the step should be performed.
+ * \param out The result of the step is written in out.
+ * \param dt The step size.
+ */
+ template< class System , class StateIn , class DerivIn , class StateOut >
+ typename boost::disable_if< boost::is_same< DerivIn , time_type > , void >::type
+ do_step( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt )
+ {
+ this->stepper().do_step_impl( system , in , dxdt , t , out , dt );
+ }
+
+
+
+
+
+ /*
+ * Version 5 :do_step( sys , x , t , dt , xerr )
+ *
+ * the two overloads are needed in order to solve the forwarding problem
+ */
+ /**
+ * \brief The method performs one step with the stepper passed by Stepper and estimates the error. The state of the ODE
+ * is updated in-place.
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ODE. It must fullfil the
+ * Simple System concept.
+ * \param x The state of the ODE which should be solved. x is updated by this method.
+ * \param t The value of the time, at which the step should be performed.
+ * \param dt The step size.
+ * \param xerr The estimation of the error is stored in xerr.
+ */
+ template< class System , class StateInOut , class Err >
+ void do_step( System system , StateInOut &x , time_type t , time_type dt , Err &xerr )
+ {
+ do_step_v5( system , x , t , dt , xerr );
+ }
+
+ /**
+ * \brief The method performs one step with the stepper passed by Stepper and estimates the error. The state of the ODE
+ * is updated in-place. This method is needed in order to solve the forwarding problem.
+ * The difference to the other version is that it can be used like
+ * `stepper.do_step( sys , make_range( iter1 , iter2 ) , t , dt )`
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ODE. It must fullfil the
+ * Simple System concept.
+ * \param x The state of the ODE which should be solved. x is updated by this method.
+ * \param t The value of the time, at which the step should be performed.
+ * \param dt The step size.
+ * \param xerr The estimation of the error is stored in xerr.
+ */
+ template< class System , class StateInOut , class Err >
+ void do_step( System system , const StateInOut &x , time_type t , time_type dt , Err &xerr )
+ {
+ do_step_v5( system , x , t , dt , xerr );
+ }
+
+
+ /*
+ * Version 6 :do_step( sys , x , dxdt , t , dt , xerr )
+ *
+ * this version does not solve the forwarding problem, boost.range can not be used
+ *
+ * the disable is needed to avoid ambiguous overloads if state_type = time_type
+ */
+ /**
+ * \brief The method performs one step with the stepper passed by Stepper. Additionally to the other method
+ * the derivative of x is also passed to this method. It is equivalent to
+ *
+ * \code
+ * sys( x , dxdt , t );
+ * stepper.do_step( sys , x , dxdt , t , dt , xerr );
+ * \endcode
+ *
+ * The result is updated in place in x. This method is disabled if Time and DerivIn are of the same type. In this
+ * case the method could not be distinguished from other `do_step` versions.
+ *
+ * \note This method does not solve the forwarding problem.
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ODE. It must fullfil the
+ * Simple System concept.
+ * \param x The state of the ODE which should be solved. After calling do_step the result is updated in x.
+ * \param dxdt The derivative of x at t.
+ * \param t The value of the time, at which the step should be performed.
+ * \param dt The step size.
+ * \param xerr The error estimate is stored in xerr.
+ */
+ template< class System , class StateInOut , class DerivIn , class Err >
+ typename boost::disable_if< boost::is_same< DerivIn , time_type > , void >::type
+ do_step( System system , StateInOut &x , const DerivIn &dxdt , time_type t , time_type dt , Err &xerr )
+ {
+ this->stepper().do_step_impl( system , x , dxdt , t , x , dt , xerr );
+ }
+
+
+ /*
+ * Version 7 : do_step( sys , in , t , out , dt , xerr )
+ *
+ * this version does not solve the forwarding problem, boost.range can not be used
+ */
+ /**
+ * \brief The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place.
+ * Furthermore, the error is estimated.
+ *
+ * \note This method does not solve the forwarding problem.
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ODE. It must fullfil the
+ * Simple System concept.
+ * \param in The state of the ODE which should be solved. in is not modified in this method
+ * \param t The value of the time, at which the step should be performed.
+ * \param out The result of the step is written in out.
+ * \param dt The step size.
+ * \param xerr The error estimate.
+ */
+ template< class System , class StateIn , class StateOut , class Err >
+ void do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt , Err &xerr )
+ {
+ typename odeint::unwrap_reference< System >::type &sys = system;
+ m_resizer.adjust_size( in , detail::bind( &internal_stepper_base_type::template resize_impl<StateIn> , detail::ref( *this ) , detail::_1 ) );
+ sys( in , m_dxdt.m_v ,t );
+ this->stepper().do_step_impl( system , in , m_dxdt.m_v , t , out , dt , xerr );
+ }
+
+
+ /*
+ * Version 8 : do_step( sys , in , dxdt , t , out , dt , xerr )
+ *
+ * this version does not solve the forwarding problem, boost.range can not be used
+ */
+ /**
+ * \brief The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place.
+ * Furthermore, the derivative of x at t is passed to the stepper and the error is estimated. It is equivalent to:
+ *
+ * \code
+ * sys( in , dxdt , t );
+ * stepper.do_step( sys , in , dxdt , t , out , dt );
+ * \endcode
+ *
+ * This method is disabled if DerivIn and Time are of same type.
+ *
+ * \note This method does not solve the forwarding problem.
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ODE. It must fullfil the
+ * Simple System concept.
+ * \param in The state of the ODE which should be solved. in is not modified in this method
+ * \param dxdt The derivative of x at t.
+ * \param t The value of the time, at which the step should be performed.
+ * \param out The result of the step is written in out.
+ * \param dt The step size.
+ * \param xerr The error estimate.
+ */
+ template< class System , class StateIn , class DerivIn , class StateOut , class Err >
+ void do_step( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt , Err &xerr )
+ {
+ this->stepper().do_step_impl( system , in , dxdt , t , out , dt , xerr );
+ }
+
+ /**
+ * \brief Adjust the size of all temporaries in the stepper manually.
+ * \param x A state from which the size of the temporaries to be resized is deduced.
+ */
+ template< class StateIn >
+ void adjust_size( const StateIn &x )
+ {
+ resize_impl( x );
+ }
+
+
+
+private:
+
+ template< class System , class StateInOut >
+ void do_step_v1( System system , StateInOut &x , time_type t , time_type dt )
+ {
+ typename odeint::unwrap_reference< System >::type &sys = system;
+ m_resizer.adjust_size( x , detail::bind( &internal_stepper_base_type::template resize_impl<StateInOut> , detail::ref( *this ) , detail::_1 ) );
+ sys( x , m_dxdt.m_v ,t );
+ this->stepper().do_step_impl( system , x , m_dxdt.m_v , t , x , dt );
+ }
+
+ template< class System , class StateInOut , class Err >
+ void do_step_v5( System system , StateInOut &x , time_type t , time_type dt , Err &xerr )
+ {
+ typename odeint::unwrap_reference< System >::type &sys = system;
+ m_resizer.adjust_size( x , detail::bind( &internal_stepper_base_type::template resize_impl<StateInOut> , detail::ref( *this ) , detail::_1 ) );
+ sys( x , m_dxdt.m_v ,t );
+ this->stepper().do_step_impl( system , x , m_dxdt.m_v , t , x , dt , xerr );
+ }
+
+ template< class StateIn >
+ bool resize_impl( const StateIn &x )
+ {
+ return adjust_size_by_resizeability( m_dxdt , x , typename is_resizeable<deriv_type>::type() );
+ }
+
+ stepper_type& stepper( void )
+ {
+ return *static_cast< stepper_type* >( this );
+ }
+
+ const stepper_type& stepper( void ) const
+ {
+ return *static_cast< const stepper_type* >( this );
+ }
+
+
+ resizer_type m_resizer;
+
+protected:
+
+ wrapped_deriv_type m_dxdt;
+};
+
+
+} // odeint
+} // numeric
+} // boost
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_BASE_EXPLICIT_ERROR_STEPPER_BASE_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/base/explicit_error_stepper_fsal_base.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/base/explicit_error_stepper_fsal_base.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,641 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/base/explicit_error_stepper_fsal_base.hpp
+
+ [begin_description]
+ Base class for all explicit first-same-as-last Runge Kutta steppers.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_BASE_EXPLICIT_ERROR_STEPPER_FSAL_BASE_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_BASE_EXPLICIT_ERROR_STEPPER_FSAL_BASE_HPP_INCLUDED
+
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+
+#include <boost/numeric/odeint/util/bind.hpp>
+#include <boost/numeric/odeint/util/unwrap_reference.hpp>
+#include <boost/numeric/odeint/util/state_wrapper.hpp>
+#include <boost/numeric/odeint/util/is_resizeable.hpp>
+#include <boost/numeric/odeint/util/resizer.hpp>
+#include <boost/numeric/odeint/util/copy.hpp>
+
+#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
+
+#include <boost/numeric/odeint/stepper/base/algebra_stepper_base.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+/*
+ * base class for explicit stepper and error steppers with the fsal property
+ * models the stepper AND the error stepper fsal concept
+ *
+ * this class provides the following do_step overloads
+ * do_step( sys , x , t , dt )
+ * do_step( sys , x , dxdt , t , dt )
+ * do_step( sys , in , t , out , dt )
+ * do_step( sys , in , dxdt_in , t , out , dxdt_out , dt )
+ * do_step( sys , x , t , dt , xerr )
+ * do_step( sys , x , dxdt , t , dt , xerr )
+ * do_step( sys , in , t , out , dt , xerr )
+ * do_step( sys , in , dxdt_in , t , out , dxdt_out , dt , xerr )
+ */
+/**
+ * \class explicit_error_stepper_fsal_base
+ * \brief Base class for explicit steppers with error estimation and stepper fullfiling the FSAL (first-same-as-last)
+ * property. This class can be used with controlled steppers for step size control.
+ *
+ * This class serves as the base class for all explicit steppers with algebra and operations and which fullfil the FSAL
+ * property. In contrast to explicit_stepper_base it also estimates the error and can be used in a controlled stepper
+ * to provide step size control.
+ *
+ * The FSAL property means that the derivative of the system at t+dt is already used in the current step going from
+ * t to t +dt. Therefore, some more do_steps method can be introduced and the controlled steppers can explicitely make use
+ * of this property.
+ *
+ * \note This stepper provides `do_step` methods with and without error estimation. It has therefore three orders,
+ * one for the order of a step if the error is not estimated. The other two orders are the orders of the step and
+ * the error step if the error estimation is performed.
+ *
+ * explicit_error_stepper_fsal_base is used as the interface in a CRTP (currently recurring template
+ * pattern). In order to work correctly the parent class needs to have a method
+ * `do_step_impl( system , in , dxdt_in , t , out , dxdt_out , dt , xerr )`.
+ * explicit_error_stepper_fsal_base derives from algebra_stepper_base.
+ *
+ * This class can have an intrinsic state depending on the explicit usage of the `do_step` method. This means that some
+ * `do_step` methods are expected to be called in order. For example the `do_step( sys , x , t , dt , xerr )` will keep track
+ * of the derivative of `x` which is the internal state. The first call of this method is recognized such that one
+ * does not explicitely initialize the internal state, so it is safe to use this method like
+ *
+ * \code
+ * stepper_type stepper;
+ * stepper.do_step( sys , x , t , dt , xerr );
+ * stepper.do_step( sys , x , t , dt , xerr );
+ * stepper.do_step( sys , x , t , dt , xerr );
+ * \endcode
+ *
+ * But it is unsafe to call this method with different system functions after each other. Do do so, one must initialize the
+ * internal state with the `initialize` method or reset the internal state with the `reset` method.
+ *
+ * explicit_error_stepper_fsal_base provides several overloaded `do_step` methods, see the list below. Only two of them are needed
+ * to fullfil the Error Stepper concept. The other ones are for convenience and for better performance. Some of them
+ * simply update the state out-of-place, while other expect that the first derivative at `t` is passed to the stepper.
+ *
+ * - `do_step( sys , x , t , dt )` - The classical `do_step` method needed to fullfil the Error Stepper concept. The
+ * state is updated in-place. A type modelling a Boost.Range can be used for x.
+ * - `do_step( sys , x , dxdt , t , dt )` - This method updates the state x and the derivative dxdt in-place. It is expected
+ * that dxdt has the value of the derivative of x at time t.
+ * - `do_step( sys , in , t , out , dt )` - This method updates the state out-of-place, hence the result of the step
+ * is stored in `out`.
+ * - `do_step( sys , in , dxdt_in , t , out , dxdt_out , dt )` - This method updates the state and the derivative
+ * out-of-place. It expects that the derivative at the point `t` is explicitely passed in `dxdt_in`.
+ * - `do_step( sys , x , t , dt , xerr )` - This `do_step` method is needed to fullfil the Error Stepper concept. The
+ * state is updated in-place and an error estimate is calculated. A type modelling a Boost.Range can be used for x.
+ * - `do_step( sys , x , dxdt , t , dt , xerr )` - This method updates the state and the derivative in-place. It is assumed
+ * that the dxdt has the value of the derivative of x at time t. An error estimate is calculated.
+ * - `do_step( sys , in , t , out , dt , xerr )` - This method updates the state out-of-place and estimates the error
+ * during the step.
+ * - `do_step( sys , in , dxdt_in , t , out , dxdt_out , dt , xerr )` - This methods updates the state and the derivative
+ * out-of-place and estimates the error during the step. It is assumed the dxdt_in is derivative of in at time t.
+ *
+ * \note The system is always passed as value, which might result in poor performance if it contains data. In this
+ * case it can be used with `boost::ref` or `std::ref`, for example `stepper.do_step( boost::ref( sys ) , x , t , dt );`
+ *
+ * \note The time `t` is not advanced by the stepper. This has to done manually, or by the appropriate `integrate`
+ * routines or `iterator`s.
+ *
+ * \tparam Stepper The stepper on which this class should work. It is used via CRTP, hence explicit_stepper_base
+ * provides the interface for the Stepper.
+ * \tparam Order The order of a stepper if the stepper is used without error estimation.
+ * \tparam StepperOrder The order of a step if the stepper is used with error estimation. Usually Order and StepperOrder have
+ * the same value.
+ * \tparam ErrorOrder The order of the error step if the stepper is used with error estimation.
+ * \tparam State The state type for the stepper.
+ * \tparam Value The value type for the stepper. This should be a floating point type, like float,
+ * double, or a multiprecision type. It must not neccessary be the value_type of the State. For example
+ * the State can be a `vector< complex< double > >` in this case the Value must be double.
+ * The default value is double.
+ * \tparam Deriv The type representing time derivatives of the state type. It is usually the same type as the
+ * state type, only if used with Boost.Units both types differ.
+ * \tparam Time The type representing the time. Usually the same type as the value type. When Boost.Units is
+ * used, this type has usually a unit.
+ * \tparam Algebra The algebra type which must fullfil the Algebra Concept.
+ * \tparam Operations The type for the operations wich must fullfil the Operations Concept.
+ * \tparam Resizer The resizer policy class.
+ */
+template<
+class Stepper ,
+unsigned short Order ,
+unsigned short StepperOrder ,
+unsigned short ErrorOrder ,
+class State ,
+class Value ,
+class Deriv ,
+class Time ,
+class Algebra ,
+class Operations ,
+class Resizer
+>
+class explicit_error_stepper_fsal_base : public algebra_stepper_base< Algebra , Operations >
+{
+public:
+
+ typedef algebra_stepper_base< Algebra , Operations > algebra_stepper_base_type;
+ typedef typename algebra_stepper_base_type::algebra_type algebra_type;
+
+ typedef State state_type;
+ typedef Value value_type;
+ typedef Deriv deriv_type;
+ typedef Time time_type;
+ typedef Resizer resizer_type;
+ typedef Stepper stepper_type;
+ typedef explicit_error_stepper_fsal_tag stepper_category;
+
+ #ifndef DOXYGEN_SKIP
+ typedef state_wrapper< state_type > wrapped_state_type;
+ typedef state_wrapper< deriv_type > wrapped_deriv_type;
+ typedef explicit_error_stepper_fsal_base< Stepper , Order , StepperOrder , ErrorOrder ,
+ State , Value , Deriv , Time , Algebra , Operations , Resizer > internal_stepper_base_type;
+ #endif
+
+
+ typedef unsigned short order_type;
+ static const order_type order_value = Order;
+ static const order_type stepper_order_value = StepperOrder;
+ static const order_type error_order_value = ErrorOrder;
+
+ /**
+ * \brief Constructs a explicit_stepper_fsal_base class. This constructor can be used as a default
+ * constructor if the algebra has a default constructor.
+ * \param algebra A copy of algebra is made and stored inside explicit_stepper_base.
+ */
+ explicit_error_stepper_fsal_base( const algebra_type &algebra = algebra_type() )
+ : algebra_stepper_base_type( algebra ) , m_first_call( true )
+ { }
+
+ /**
+ * \return Returns the order of the stepper if it used without error estimation.
+ */
+ order_type order( void ) const
+ {
+ return order_value;
+ }
+
+ /**
+ * \return Returns the order of a step if the stepper is used without error estimation.
+ */
+ order_type stepper_order( void ) const
+ {
+ return stepper_order_value;
+ }
+
+ /**
+ * \return Returns the order of an error step if the stepper is used without error estimation.
+ */
+ order_type error_order( void ) const
+ {
+ return error_order_value;
+ }
+
+
+ /*
+ * version 1 : do_step( sys , x , t , dt )
+ *
+ * the two overloads are needed in order to solve the forwarding problem
+ */
+ /**
+ * \brief This method performs one step. It transforms the result in-place.
+ *
+ * \note This method uses the internal state of the stepper.
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ordinary differential equation. It must fullfil the
+ * Simple System concept.
+ * \param x The state of the ODE which should be solved. After calling do_step the result is updated in x.
+ * \param t The value of the time, at which the step should be performed.
+ * \param dt The step size.
+ */
+ template< class System , class StateInOut >
+ void do_step( System system , StateInOut &x , time_type t , time_type dt )
+ {
+ do_step_v1( system , x , t , dt );
+ }
+
+ /**
+ * \brief This method performs one step with the stepper passed by Stepper.
+ * It transforms the result in-place. This method is needed in order to solve the forwarding problem.
+ * The difference to the other version is that it can be used like
+ * `stepper.do_step( sys , make_range( iter1 , iter2 ) , t , dt )`
+ *
+ * \note This method uses the internal state of the stepper.
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ordinary differential equation. It must fullfil the
+ * Simple System concept.
+ * \param x The state of the ODE which should be solved. After calling do_step the result is updated in x.
+ * \param t The value of the time, at which the step should be performed.
+ * \param dt The step size.
+ */
+ template< class System , class StateInOut >
+ void do_step( System system , const StateInOut &x , time_type t , time_type dt )
+ {
+ do_step_v1( system , x , t , dt );
+ }
+
+
+ /*
+ * version 2 : do_step( sys , x , dxdt , t , dt )
+ *
+ * this version does not solve the forwarding problem, boost.range can not be used
+ *
+ * the disable is needed to avoid ambiguous overloads if state_type = time_type
+ */
+ /**
+ * \brief The method performs one step with the stepper passed by Stepper. Additionally to the other methods
+ * the derivative of x is also passed to this method. Therefore, dxdt must be evaluated initially:
+ *
+ * \code
+ * ode( x , dxdt , t );
+ * for( ... )
+ * {
+ * stepper.do_step( ode , x , dxdt , t , dt );
+ * t += dt;
+ * }
+ * \endcode
+ *
+ * \note This method does NOT use the initial state, since the first derivative is explicitely passed to this method.
+ *
+ * The result is updated in place in x as well as the derivative dxdt. This method is disabled if
+ * Time and StateInOut are of the same type. In this case the method could not be distinguished from other `do_step`
+ * versions.
+ *
+ * \note This method does not solve the forwarding problem.
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ODE. It must fullfil the
+ * Simple System concept.
+ * \param x The state of the ODE which should be solved. After calling do_step the result is updated in x.
+ * \param dxdt The derivative of x at t. After calling `do_step` dxdt is updated to the new value.
+ * \param t The value of the time, at which the step should be performed.
+ * \param dt The step size.
+ */
+ template< class System , class StateInOut , class DerivInOut >
+ typename boost::disable_if< boost::is_same< StateInOut , time_type > , void >::type
+ do_step( System system , StateInOut &x , DerivInOut &dxdt , time_type t , time_type dt )
+ {
+ m_first_call = true;
+ this->stepper().do_step_impl( system , x , dxdt , t , x , dxdt , dt );
+ }
+
+
+ /*
+ * version 3 : do_step( sys , in , t , out , dt )
+ *
+ * this version does not solve the forwarding problem, boost.range can not be used
+ *
+ * the disable is needed to avoid ambiguous overloads if state_type = time_type
+ */
+ /**
+ * \brief The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place.
+ * This method is disabled if StateIn and Time are the same type. In this case the method can not be distinguished from
+ * other `do_step` variants.
+ *
+ * \note This method uses the internal state of the stepper.
+ *
+ * \note This method does not solve the forwarding problem.
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ODE. It must fullfil the
+ * Simple System concept.
+ * \param in The state of the ODE which should be solved. in is not modified in this method
+ * \param t The value of the time, at which the step should be performed.
+ * \param out The result of the step is written in out.
+ * \param dt The step size.
+ */
+ template< class System , class StateIn , class StateOut >
+ typename boost::disable_if< boost::is_same< StateIn , time_type > , void >::type
+ do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt )
+ {
+ if( m_resizer.adjust_size( in , detail::bind( &internal_stepper_base_type::template resize_impl< StateIn > , detail::ref( *this ) , detail::_1 ) ) || m_first_call )
+ {
+ initialize( system , in , t );
+ }
+ this->stepper().do_step_impl( system , in , m_dxdt.m_v , t , out , m_dxdt.m_v , dt );
+ }
+
+
+ /*
+ * version 4 : do_step( sys , in , dxdt_in , t , out , dxdt_out , dt )
+ *
+ * this version does not solve the forwarding problem, boost.range can not be used
+ */
+ /**
+ * \brief The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place.
+ * Furthermore, the derivative of x at t is passed to the stepper and updated by the stepper to its new value at
+ * t+dt.
+ *
+ * \note This method does not solve the forwarding problem.
+ *
+ * \note This method does NOT use the internal state of the stepper.
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ODE. It must fullfil the
+ * Simple System concept.
+ * \param in The state of the ODE which should be solved. in is not modified in this method
+ * \param dxdt_in The derivative of x at t.
+ * \param t The value of the time, at which the step should be performed.
+ * \param out The result of the step is written in out.
+ * \param dxdt_out The updated derivative of `out` at `t+dt`.
+ * \param dt The step size.
+ */
+ template< class System , class StateIn , class DerivIn , class StateOut , class DerivOut >
+ void do_step( System system , const StateIn &in , const DerivIn &dxdt_in , time_type t ,
+ StateOut &out , DerivOut &dxdt_out , time_type dt )
+ {
+ m_first_call = true;
+ this->stepper().do_step_impl( system , in , dxdt_in , t , out , dxdt_out , dt );
+ }
+
+
+
+
+
+ /*
+ * version 5 : do_step( sys , x , t , dt , xerr )
+ *
+ * the two overloads are needed in order to solve the forwarding problem
+ */
+ /**
+ * \brief The method performs one step with the stepper passed by Stepper and estimates the error. The state of the ODE
+ * is updated in-place.
+ *
+ *
+ * \note This method uses the internal state of the stepper.
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ODE. It must fullfil the
+ * Simple System concept.
+ * \param x The state of the ODE which should be solved. x is updated by this method.
+ * \param t The value of the time, at which the step should be performed.
+ * \param dt The step size.
+ * \param xerr The estimation of the error is stored in xerr.
+ */
+ template< class System , class StateInOut , class Err >
+ void do_step( System system , StateInOut &x , time_type t , time_type dt , Err &xerr )
+ {
+ do_step_v5( system , x , t , dt , xerr );
+ }
+
+ /**
+ * \brief The method performs one step with the stepper passed by Stepper and estimates the error. The state of the ODE
+ * is updated in-place. This method is needed in order to solve the forwarding problem.
+ * The difference to the other version is that it can be used like
+ * `stepper.do_step( sys , make_range( iter1 , iter2 ) , t , dt )`
+ *
+ * \note This method uses the internal state of the stepper.
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ODE. It must fullfil the
+ * Simple System concept.
+ * \param x The state of the ODE which should be solved. x is updated by this method.
+ * \param t The value of the time, at which the step should be performed.
+ * \param dt The step size.
+ * \param xerr The estimation of the error is stored in xerr.
+ */
+ template< class System , class StateInOut , class Err >
+ void do_step( System system , const StateInOut &x , time_type t , time_type dt , Err &xerr )
+ {
+ do_step_v5( system , x , t , dt , xerr );
+ }
+
+
+ /*
+ * version 6 : do_step( sys , x , dxdt , t , dt , xerr )
+ *
+ * this version does not solve the forwarding problem, boost.range can not be used
+ *
+ * the disable is needed to avoid ambiguous overloads if state_type = time_type
+ *
+ * the disable is needed to avoid ambiguous overloads if state_type = time_type
+ */
+ /**
+ * \brief The method performs one step with the stepper passed by Stepper. Additionally to the other method
+ * the derivative of x is also passed to this method and updated by this method.
+ *
+ * \note This method does NOT use the internal state of the stepper.
+ *
+ * The result is updated in place in x. This method is disabled if Time and Deriv are of the same type. In this
+ * case the method could not be distinguished from other `do_step` versions. This method is disabled if StateInOut and
+ * Time are of the same type.
+ *
+ * \note This method does NOT use the internal state of the stepper.
+ *
+ * \note This method does not solve the forwarding problem.
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ODE. It must fullfil the
+ * Simple System concept.
+ * \param x The state of the ODE which should be solved. After calling do_step the result is updated in x.
+ * \param dxdt The derivative of x at t. After calling `do_step` this value is updated to the new value at `t+dt`.
+ * \param t The value of the time, at which the step should be performed.
+ * \param dt The step size.
+ * \param xerr The error estimate is stored in xerr.
+ */
+ template< class System , class StateInOut , class DerivInOut , class Err >
+ typename boost::disable_if< boost::is_same< StateInOut , time_type > , void >::type
+ do_step( System system , StateInOut &x , DerivInOut &dxdt , time_type t , time_type dt , Err &xerr )
+ {
+ m_first_call = true;
+ this->stepper().do_step_impl( system , x , dxdt , t , x , dxdt , dt , xerr );
+ }
+
+
+
+
+ /*
+ * version 7 : do_step( sys , in , t , out , dt , xerr )
+ *
+ * this version does not solve the forwarding problem, boost.range can not be used
+ */
+ /**
+ * \brief The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place.
+ * Furthermore, the error is estimated.
+ *
+ * \note This method uses the internal state of the stepper.
+ *
+ * \note This method does not solve the forwarding problem.
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ODE. It must fullfil the
+ * Simple System concept.
+ * \param in The state of the ODE which should be solved. in is not modified in this method
+ * \param t The value of the time, at which the step should be performed.
+ * \param out The result of the step is written in out.
+ * \param dt The step size.
+ * \param xerr The error estimate.
+ */
+ template< class System , class StateIn , class StateOut , class Err >
+ void do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt , Err &xerr )
+ {
+ if( m_resizer.adjust_size( in , detail::bind( &internal_stepper_base_type::template resize_impl< StateIn > , detail::ref( *this ) , detail::_1 ) ) || m_first_call )
+ {
+ initialize( system , in , t );
+ }
+ this->stepper().do_step_impl( system , in , m_dxdt.m_v , t , out , m_dxdt.m_v , dt , xerr );
+ }
+
+
+ /*
+ * version 8 : do_step( sys , in , dxdt_in , t , out , dxdt_out , dt , xerr )
+ *
+ * this version does not solve the forwarding problem, boost.range can not be used
+ */
+ /**
+ * \brief The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place.
+ * Furthermore, the derivative of x at t is passed to the stepper and the error is estimated.
+ *
+ * \note This method does NOT use the internal state of the stepper.
+ *
+ * \note This method does not solve the forwarding problem.
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ODE. It must fullfil the
+ * Simple System concept.
+ * \param in The state of the ODE which should be solved. in is not modified in this method
+ * \param dxdt_in The derivative of x at t.
+ * \param t The value of the time, at which the step should be performed.
+ * \param out The result of the step is written in out.
+ * \param dxdt_out The new derivative at `t+dt` is written into this variable.
+ * \param dt The step size.
+ * \param xerr The error estimate.
+ */
+ template< class System , class StateIn , class DerivIn , class StateOut , class DerivOut , class Err >
+ void do_step( System system , const StateIn &in , const DerivIn &dxdt_in , time_type t ,
+ StateOut &out , DerivOut &dxdt_out , time_type dt , Err &xerr )
+ {
+ m_first_call = true;
+ this->stepper().do_step_impl( system , in , dxdt_in , t , out , dxdt_out , dt , xerr );
+ }
+
+ /**
+ * \brief Adjust the size of all temporaries in the stepper manually.
+ * \param x A state from which the size of the temporaries to be resized is deduced.
+ */
+ template< class StateIn >
+ void adjust_size( const StateIn &x )
+ {
+ resize_impl( x );
+ }
+
+
+ /**
+ * \brief Resets the internal state of this stepper. After calling this method it is safe to use all
+ * `do_step` method without explicitly initializing the stepper.
+ */
+ void reset( void )
+ {
+ m_first_call = true;
+ }
+
+ /**
+ * \brief Initializes the interal state of the stepper.
+ * \param deriv The derivative of x. The next call of `do_step` expects that the derivative of `x` passed to `do_step`
+ * has the value of `deriv`.
+ */
+ template< class DerivIn >
+ void initialize( const DerivIn &deriv )
+ {
+ boost::numeric::odeint::copy( deriv , m_dxdt.m_v );
+ m_first_call = false;
+ }
+
+ /**
+ * \brief Initializes the interal state of the stepper.
+ *
+ * This method is equivalent to
+ * \code
+ * Deriv dxdt;
+ * system( x , dxdt , t );
+ * stepper.initialize( dxdt );
+ * \endcode
+ *
+ * \param system The system function for the next calls of `do_step`.
+ * \param x The current state of the ODE.
+ * \param t The current time of the ODE.
+ */
+ template< class System , class StateIn >
+ void initialize( System system , const StateIn &x , time_type t )
+ {
+ typename odeint::unwrap_reference< System >::type &sys = system;
+ sys( x , m_dxdt.m_v , t );
+ m_first_call = false;
+ }
+
+ /**
+ * \brief Returns if the stepper is already initialized. If the stepper is not initialized, the first
+ * call of `do_step` will initialize the state of the stepper. If the stepper is already initialized
+ * the system function can not be safely exchanged between consecutive `do_step` calls.
+ */
+ bool is_initialized( void ) const
+ {
+ return ! m_first_call;
+ }
+
+
+
+private:
+
+ template< class System , class StateInOut >
+ void do_step_v1( System system , StateInOut &x , time_type t , time_type dt )
+ {
+ if( m_resizer.adjust_size( x , detail::bind( &internal_stepper_base_type::template resize_impl< StateInOut > , detail::ref( *this ) , detail::_1 ) ) || m_first_call )
+ {
+ initialize( system , x , t );
+ }
+ this->stepper().do_step_impl( system , x , m_dxdt.m_v , t , x , m_dxdt.m_v , dt );
+ }
+
+ template< class System , class StateInOut , class Err >
+ void do_step_v5( System system , StateInOut &x , time_type t , time_type dt , Err &xerr )
+ {
+ if( m_resizer.adjust_size( x , detail::bind( &internal_stepper_base_type::template resize_impl< StateInOut > , detail::ref( *this ) , detail::_1 ) ) || m_first_call )
+ {
+ initialize( system , x , t );
+ }
+ this->stepper().do_step_impl( system , x , m_dxdt.m_v , t , x , m_dxdt.m_v , dt , xerr );
+ }
+
+ template< class StateIn >
+ bool resize_impl( const StateIn &x )
+ {
+ return adjust_size_by_resizeability( m_dxdt , x , typename is_resizeable<deriv_type>::type() );
+ }
+
+
+ stepper_type& stepper( void )
+ {
+ return *static_cast< stepper_type* >( this );
+ }
+
+ const stepper_type& stepper( void ) const
+ {
+ return *static_cast< const stepper_type* >( this );
+ }
+
+
+ resizer_type m_resizer;
+ bool m_first_call;
+
+protected:
+
+
+ wrapped_deriv_type m_dxdt;
+};
+
+
+} // odeint
+} // numeric
+} // boost
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_BASE_EXPLICIT_ERROR_STEPPER_FSAL_BASE_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,371 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp
+
+ [begin_description]
+ Base class for all explicit Runge Kutta steppers.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_BASE_EXPLICIT_STEPPER_BASE_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_BASE_EXPLICIT_STEPPER_BASE_HPP_INCLUDED
+
+
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+#include <boost/numeric/odeint/util/bind.hpp>
+#include <boost/numeric/odeint/util/unwrap_reference.hpp>
+
+#include <boost/numeric/odeint/util/state_wrapper.hpp>
+#include <boost/numeric/odeint/util/resizer.hpp>
+#include <boost/numeric/odeint/util/is_resizeable.hpp>
+
+#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
+
+#include <boost/numeric/odeint/stepper/base/algebra_stepper_base.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+/*
+ * base class for explicit steppers
+ * models the stepper concept
+ *
+ * this class provides the following overloads
+ * do_step( sys , x , t , dt )
+ * do_step( sys , in , t , out , dt )
+ * do_step( sys , x , dxdt_in , t , dt )
+ * do_step( sys , in , dxdt_in , t , out , dt )
+ */
+
+/**
+ * \class explicit_stepper_base
+ * \brief Base class for explicit steppers without step size control and without dense output.
+ *
+ * This class serves as the base class for all explicit steppers with algebra and operations.
+ * Step size control and error estimation as well as dense output are not provided. explicit_stepper_base
+ * is used as the interface in a CRTP (currently recurring template pattern). In order to work
+ * correctly the parent class needs to have a method `do_step_impl( system , in , dxdt_in , t , out , dt )`.
+ * This is method is used by explicit_stepper_base. explicit_stepper_base derives from
+ * algebra_stepper_base. An example how this class can be used is
+ *
+ * \code
+ * template< class State , class Value , class Deriv , class Time , class Algebra , class Operations , class Resizer >
+ * class custom_euler : public explicit_stepper_base< 1 , State , Value , Deriv , Time , Algebra , Operations , Resizer >
+ * {
+ * public:
+ *
+ * typedef explicit_stepper_base< 1 , State , Value , Deriv , Time , Algebra , Operations , Resizer > base_type;
+ *
+ * custom_euler( const Algebra &algebra = Algebra() ) { }
+ *
+ * template< class Sys , class StateIn , class DerivIn , class StateOut >
+ * void do_step_impl( Sys sys , const StateIn &in , const DerivIn &dxdt , Time t , StateOut &out , Time dt )
+ * {
+ * m_algebra.for_each3( out , in , dxdt , Operations::scale_sum2< Value , Time >( 1.0 , dt );
+ * }
+ *
+ * template< class State >
+ * void adjust_size( const State &x )
+ * {
+ * base_type::adjust_size( x );
+ * }
+ * };
+ * \endcode
+ *
+ * For the Stepper concept only the `do_step( sys , x , t , dt )` needs to be implemented. But this class
+ * provides additional `do_step` variants since the stepper is explicit. These methods can be used to increase
+ * the performance in some situation, for example if one needs to analyze `dxdt` during each step. In this case
+ * one can use
+ *
+ * \code
+ * sys( x , dxdt , t );
+ * stepper.do_step( sys , x , dxdt , t , dt ); // the value of dxdt is used here
+ * t += dt;
+ * \endcode
+ *
+ * In detail explicit_stepper_base provides the following `do_step` variants
+ * - `do_step( sys , x , t , dt )` - The classical `do_step` method needed to fullfil the Stepper concept. The state is updated in-place.
+ * A type modelling a Boost.Range can be used for x.
+ * - `do_step( sys , in , t , out , dt )` - This method updates the state out-of-place, hence the result of the step is stored in `out`.
+ * - `do_step( sys , x , dxdt , t , dt )` - This method updates the state in-place, but the derivative at the point `t` must be
+ * explicitely passed in `dxdt`. For an example see the code snippet above.
+ * - `do_step( sys , in , dxdt , t , out , dt )` - This method update the state out-of-place and expects that the derivative at the point
+ * `t` is explicitely passed in `dxdt`. It is a combination of the two `do_step` methods above.
+ *
+ * \note The system is always passed as value, which might result in poor performance if it contains data. In this case it can be used with `boost::ref`
+ * or `std::ref`, for example `stepper.do_step( boost::ref( sys ) , x , t , dt );`
+ *
+ * \note The time `t` is not advanced by the stepper. This has to done manually, or by the appropriate `integrate` routines or `iterator`s.
+ *
+ * \tparam Stepper The stepper on which this class should work. It is used via CRTP, hence explicit_stepper_base
+ * provides the interface for the Stepper.
+ * \tparam Order The order of the stepper.
+ * \tparam State The state type for the stepper.
+ * \tparam Value The value type for the stepper. This should be a floating point type, like float,
+ * double, or a multiprecision type. It must not neccessary be the value_type of the State. For example
+ * the State can be a `vector< complex< double > >` in this case the Value must be double.
+ * The default value is double.
+ * \tparam Deriv The type representing time derivatives of the state type. It is usually the same type as the
+ * state type, only if used with Boost.Units both types differ.
+ * \tparam Time The type representing the time. Usually the same type as the value type. When Boost.Units is
+ * used, this type has usually a unit.
+ * \tparam Algebra The algebra type which must fullfil the Algebra Concept.
+ * \tparam Operations The type for the operations wich must fullfil the Operations Concept.
+ * \tparam Resizer The resizer policy class.
+ */
+template<
+class Stepper ,
+unsigned short Order ,
+class State ,
+class Value ,
+class Deriv ,
+class Time ,
+class Algebra ,
+class Operations ,
+class Resizer
+>
+class explicit_stepper_base : public algebra_stepper_base< Algebra , Operations >
+{
+public:
+
+ #ifndef DOXYGEN_SKIP
+ typedef explicit_stepper_base< Stepper , Order , State , Value , Deriv , Time , Algebra , Operations , Resizer > internal_stepper_base_type;
+ #endif // DOXYGEN_SKIP
+
+
+ typedef State state_type;
+ typedef Value value_type;
+ typedef Deriv deriv_type;
+ typedef Time time_type;
+ typedef Resizer resizer_type;
+ typedef Stepper stepper_type;
+ typedef stepper_tag stepper_category;
+ typedef algebra_stepper_base< Algebra , Operations > algebra_stepper_base_type;
+ typedef typename algebra_stepper_base_type::algebra_type algebra_type;
+ typedef typename algebra_stepper_base_type::operations_type operations_type;
+ typedef unsigned short order_type;
+
+ #ifndef DOXYGEN_SKIP
+ typedef state_wrapper< state_type > wrapped_state_type;
+ typedef state_wrapper< deriv_type > wrapped_deriv_type;
+ #endif // DOXYGEN_SKIP
+
+
+ static const order_type order_value = Order;
+
+
+ /**
+ * \brief Constructs a explicit_stepper_base class. This constructor can be used as a default
+ * constructor if the algebra has a default constructor.
+ * \param algebra A copy of algebra is made and stored inside explicit_stepper_base.
+ */
+ explicit_stepper_base( const algebra_type &algebra = algebra_type() )
+ : algebra_stepper_base_type( algebra )
+ { }
+
+ /**
+ * \return Returns the order of the stepper.
+ */
+ order_type order( void ) const
+ {
+ return order_value;
+ }
+
+
+ /*
+ * Version 1 : do_step( sys , x , t , dt )
+ *
+ * the two overloads are needed in order to solve the forwarding problem
+ */
+
+ /**
+ * \brief This method performs one step. It transforms the result in-place.
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ordinary differential equation. It must fullfil the
+ * Simple System concept.
+ * \param x The state of the ODE which should be solved. After calling do_step the result is updated in x.
+ * \param t The value of the time, at which the step should be performed.
+ * \param dt The step size.
+ */
+ template< class System , class StateInOut >
+ void do_step( System system , StateInOut &x , time_type t , time_type dt )
+ {
+ do_step_v1( system , x , t , dt );
+ }
+
+ /**
+ * \brief This method performs one step with the stepper passed by Stepper.
+ * It transforms the result in-place. This method is needed in order to solve the forwarding problem.
+ * The difference to the other version is that it can be used like
+ * `stepper.do_step( sys , make_range( iter1 , iter2 ) , t , dt )`
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ordinary differential equation. It must fullfil the
+ * Simple System concept.
+ * \param x The state of the ODE which should be solved. After calling do_step the result is updated in x.
+ * \param t The value of the time, at which the step should be performed.
+ * \param dt The step size.
+ */
+ template< class System , class StateInOut >
+ void do_step( System system , const StateInOut &x , time_type t , time_type dt )
+ {
+ do_step_v1( system , x , t , dt );
+ }
+
+
+ /*
+ * Version 2 : do_step( sys , x , dxdt , t , dt )
+ *
+ * this version does not solve the forwarding problem, boost.range can not be used
+ *
+ * the disable is needed to avoid ambiguous overloads if state_type = time_type
+ */
+ /**
+ * \brief The method performs one step with the stepper passed by Stepper. Additionally to the other method
+ * the derivative of x is also passed to this method. It is equivalent to
+ *
+ * \code
+ * sys( x , dxdt , t );
+ * stepper.do_step( sys , x , dxdt , t , dt );
+ * \endcode
+ *
+ * The result is updated in place in x. This method is disabled if Time and Deriv are of the same type. In this
+ * case the method could not be distinguished from other `do_step` versions.
+ *
+ * \note This method does not solve the forwarding problem.
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ODE. It must fullfil the
+ * Simple System concept.
+ * \param x The state of the ODE which should be solved. After calling do_step the result is updated in x.
+ * \param dxdt The derivative of x at t.
+ * \param t The value of the time, at which the step should be performed.
+ * \param dt The step size.
+ */
+ template< class System , class StateInOut , class DerivIn >
+ typename boost::disable_if< boost::is_same< DerivIn , time_type > , void >::type
+ do_step( System system , StateInOut &x , const DerivIn &dxdt , time_type t , time_type dt )
+ {
+ this->stepper().do_step_impl( system , x , dxdt , t , x , dt );
+ }
+
+
+ /*
+ * Version 3 : do_step( sys , in , t , out , dt )
+ *
+ * this version does not solve the forwarding problem, boost.range can not be used
+ */
+ /**
+ * \brief The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place.
+ * \note This method does not solve the forwarding problem.
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ODE. It must fullfil the
+ * Simple System concept.
+ * \param in The state of the ODE which should be solved. in is not modified in this method
+ * \param t The value of the time, at which the step should be performed.
+ * \param out The result of the step is written in out.
+ * \param dt The step size.
+ */
+ template< class System , class StateIn , class StateOut >
+ void do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt )
+ {
+ typename odeint::unwrap_reference< System >::type &sys = system;
+ m_resizer.adjust_size( in , detail::bind( &internal_stepper_base_type::template resize_impl<StateIn> , detail::ref( *this ) , detail::_1 ) );
+ sys( in , m_dxdt.m_v ,t );
+ this->stepper().do_step_impl( system , in , m_dxdt.m_v , t , out , dt );
+ }
+
+
+ /*
+ * Version 4 : do_step( sys , in , dxdt , t , out , dt )
+ *
+ * this version does not solve the forwarding problem, boost.range can not be used
+ */
+ /**
+ * \brief The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place.
+ * Furthermore, the derivative of x at t is passed to the stepper. It is equivalent to:
+ *
+ * \code
+ * sys( in , dxdt , t );
+ * stepper.do_step( sys , in , dxdt , t , out , dt );
+ * \endcode
+ *
+ * \note This method does not solve the forwarding problem.
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ODE. It must fullfil the
+ * Simple System concept.
+ * \param in The state of the ODE which should be solved. in is not modified in this method
+ * \param dxdt The derivative of x at t.
+ * \param t The value of the time, at which the step should be performed.
+ * \param out The result of the step is written in out.
+ * \param dt The step size.
+ */
+ template< class System , class StateIn , class DerivIn , class StateOut >
+ void do_step( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt )
+ {
+ this->stepper().do_step_impl( system , in , dxdt , t , out , dt );
+ }
+
+
+ /**
+ * \brief Adjust the size of all temporaries in the stepper manually.
+ * \param x A state from which the size of the temporaries to be resized is deduced.
+ */
+ template< class StateIn >
+ void adjust_size( const StateIn &x )
+ {
+ resize_impl( x );
+ }
+
+private:
+
+ stepper_type& stepper( void )
+ {
+ return *static_cast< stepper_type* >( this );
+ }
+
+ const stepper_type& stepper( void ) const
+ {
+ return *static_cast< const stepper_type* >( this );
+ }
+
+
+ template< class StateIn >
+ bool resize_impl( const StateIn &x )
+ {
+ return adjust_size_by_resizeability( m_dxdt , x , typename is_resizeable<deriv_type>::type() );
+ }
+
+
+ template< class System , class StateInOut >
+ void do_step_v1( System system , StateInOut &x , time_type t , time_type dt )
+ {
+ typename odeint::unwrap_reference< System >::type &sys = system;
+ m_resizer.adjust_size( x , detail::bind( &internal_stepper_base_type::template resize_impl< StateInOut > , detail::ref( *this ) , detail::_1 ) );
+ sys( x , m_dxdt.m_v ,t );
+ this->stepper().do_step_impl( system , x , m_dxdt.m_v , t , x , dt );
+ }
+
+
+ resizer_type m_resizer;
+
+protected:
+
+ wrapped_deriv_type m_dxdt;
+};
+
+
+} // odeint
+} // numeric
+} // boost
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_BASE_EXPLICIT_STEPPER_BASE_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/base/symplectic_rkn_stepper_base.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/base/symplectic_rkn_stepper_base.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,418 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/base/symplectic_rkn_stepper_base.hpp
+
+ [begin_description]
+ Base class for symplectic Runge-Kutta-Nystrom steppers.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_BASE_SYMPLECTIC_RKN_STEPPER_BASE_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_BASE_SYMPLECTIC_RKN_STEPPER_BASE_HPP_INCLUDED
+
+#include <boost/array.hpp>
+
+#include <boost/numeric/odeint/util/bind.hpp>
+#include <boost/numeric/odeint/util/unwrap_reference.hpp>
+
+#include <boost/numeric/odeint/util/copy.hpp>
+#include <boost/numeric/odeint/util/is_pair.hpp>
+
+#include <boost/numeric/odeint/util/state_wrapper.hpp>
+#include <boost/numeric/odeint/util/resizer.hpp>
+
+#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
+
+#include <boost/numeric/odeint/stepper/base/algebra_stepper_base.hpp>
+
+
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+/**
+ * \class symplectic_nystroem_stepper_base
+ * \brief Base class for all symplectic steppers of Nystroem type.
+ *
+ * This class is the base class for the symplectic Runge-Kutta-Nystroem steppers. Symplectic steppers are usually
+ * used to solve Hamiltonian systems and they conserve the phase space volume, see
+ * en.wikipedia.org/wiki/Symplectic_integrator.
+ * Furthermore, the energy is conserved
+ * in average. In detail this class of steppers can be used to solve separable Hamiltonian systems which can be written
+ * in the form H(q,p) = H1(p) + H2(q). q is usually called the coordinate, while p is the momentum. The equations of motion
+ * are dq/dt = dH1/dp, dp/dt = -dH2/dq.
+ *
+ * ToDo : add formula for solver and explanation of the coefficients
+ *
+ * symplectic_nystroem_stepper_base uses odeints algebra and operation system. Step size and error estimation are not
+ * provided for this class of solvers. It derives from algebra_stepper_base. Several `do_step` variants are provided:
+ *
+ * - `do_step( sys , x , t , dt )` - The classical `do_step` method. The sys can be either a pair of function objects
+ * for the coordinate or the momentum part or one function object for the momentum part. `x` is a pair of coordinate
+ * and momentum. The state is updated in-place.
+ * - `do_step( sys , q , p , t , dt )` - This method is similar to the method above with the difference that the coordinate
+ * and the momentum are passed explicitely and not packed into a pair.
+ * - `do_step( sys , x_in , t , x_out , dt )` - This method transforms the state out-of-place. `x_in` and `x_out` are here pairs
+ * of coordinate and momentum.
+ *
+ * \tparam NumOfStages Number of stages.
+ * \tparam Order The order of the stepper.
+ * \tparam Coor The type representing the coordinates q.
+ * \tparam Momentum The type representing the coordinates p.
+ * \tparam Value The basic value type. Should be somethink like float, double or a high-precision type.
+ * \tparam CoorDeriv The type representing the time derivative of the coordinate dq/dt.
+ * \tparam MomemtnumDeriv The type representing the time derivative of the momentum dp/dt.
+ * \tparam Time The type representing the time t.
+ * \tparam Algebra The algebra.
+ * \tparam Operations The operations.
+ * \tparam Resizer The resizer policy.
+ */
+template<
+size_t NumOfStages ,
+unsigned short Order ,
+class Coor ,
+class Momentum ,
+class Value ,
+class CoorDeriv ,
+class MomentumDeriv ,
+class Time ,
+class Algebra ,
+class Operations ,
+class Resizer
+>
+class symplectic_nystroem_stepper_base : public algebra_stepper_base< Algebra , Operations >
+{
+
+public:
+
+ typedef algebra_stepper_base< Algebra , Operations > algebra_stepper_base_type;
+ typedef typename algebra_stepper_base_type::algebra_type algebra_type;
+ typedef typename algebra_stepper_base_type::operations_type operations_type;
+
+ const static size_t num_of_stages = NumOfStages;
+ typedef Coor coor_type;
+ typedef Momentum momentum_type;
+ typedef std::pair< coor_type , momentum_type > state_type;
+ typedef CoorDeriv coor_deriv_type;
+ typedef state_wrapper< coor_deriv_type> wrapped_coor_deriv_type;
+ typedef MomentumDeriv momentum_deriv_type;
+ typedef state_wrapper< momentum_deriv_type > wrapped_momentum_deriv_type;
+ typedef std::pair< coor_deriv_type , momentum_deriv_type > deriv_type;
+ typedef Value value_type;
+ typedef Time time_type;
+ typedef Resizer resizer_type;
+ typedef stepper_tag stepper_category;
+
+ #ifndef DOXYGEN_SKIP
+ typedef symplectic_nystroem_stepper_base< NumOfStages , Order , Coor , Momentum , Value ,
+ CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer > internal_stepper_base_type;
+ #endif
+ typedef unsigned short order_type;
+
+ static const order_type order_value = Order;
+
+ typedef boost::array< value_type , num_of_stages > coef_type;
+
+ /**
+ * \brief Constructs a symplectic_nystroem_stepper_base class. The parameters of the specific Nystroem method and the
+ * algebra have to be passed.
+ * \param coef_a The coefficients a.
+ * \param coef_b The coefficients b.
+ * \param algebra A copy of algebra is made and stored inside explicit_stepper_base.
+ */
+ symplectic_nystroem_stepper_base( const coef_type &coef_a , const coef_type &coef_b , const algebra_type &algebra = algebra_type() )
+ : algebra_stepper_base_type( algebra ) , m_coef_a( coef_a ) , m_coef_b( coef_b ) ,
+ m_dqdt_resizer() , m_dpdt_resizer() , m_dqdt() , m_dpdt()
+ { }
+
+
+ /**
+ * \return Returns the order of the stepper.
+ */
+ order_type order( void ) const
+ {
+ return order_value;
+ }
+
+ /*
+ * Version 1 : do_step( system , x , t , dt )
+ *
+ * This version does not solve the forwarding problem, boost.range can not be used.
+ */
+ /**
+ * \brief This method performs one step. The system can be either a pair of two function object
+ * decribing the momentum part and the coordinate part or one function object describing only
+ * the momentum part. In this case the coordinate is assumed to be trivial dq/dt = p. The state
+ * is updated in-place.
+ *
+ * \note boost::ref or std::ref can be used for the system as well as for the state. So, it is correct
+ * to write `stepper.do_step( make_pair( std::ref( fq ) , std::ref( fp ) ) , make_pair( std::ref( q ) , std::ref( p ) ) , t , dt )`.
+ *
+ * \note This method solves the forwarding problem.
+ *
+ * \param system The system, can be represented as a pair of two function object or one function object. See above.
+ * \param state The state of the ODE. It is a pair of Coor and Momentum. The state is updated in-place, therefore, the
+ * new value of the state will be written into this variable.
+ * \param t The time of the ODE. It is not advanced by this method.
+ * \param dt The time step.
+ */
+ template< class System , class StateInOut >
+ void do_step( System system , const StateInOut &state , time_type t , time_type dt )
+ {
+ typedef typename odeint::unwrap_reference< System >::type system_type;
+ do_step_impl( system , state , t , state , dt , typename is_pair< system_type >::type() );
+ }
+
+ /**
+ * \brief Same function as do_step( system , x , t , dt ). It differs only in a different const specifier in order
+ * to solve the forwarding problem.
+ */
+ template< class System , class StateInOut >
+ void do_step( System system , StateInOut &state , time_type t , time_type dt )
+ {
+ typedef typename odeint::unwrap_reference< System >::type system_type;
+ do_step_impl( system , state , t , state , dt , typename is_pair< system_type >::type() );
+ }
+
+
+
+
+ /*
+ * Version 2 : do_step( system , q , p , t , dt );
+ *
+ * For Convenience
+ *
+ * The two overloads are needed in order to solve the forwarding problem.
+ */
+ /**
+ * \brief This method performs one step. The system can be either a pair of two function object
+ * decribing the momentum part and the coordinate part or one function object describing only
+ * the momentum part. In this case the coordinate is assumed to be trivial dq/dt = p. The state
+ * is updated in-place.
+ *
+ * \note boost::ref or std::ref can be used for the system. So, it is correct
+ * to write `stepper.do_step( make_pair( std::ref( fq ) , std::ref( fp ) ) , q , p , t , dt )`.
+ *
+ * \note This method solves the forwarding problem.
+ *
+ * \param system The system, can be represented as a pair of two function object or one function object. See above.
+ * \param q The coordinate of the ODE. It is updated in-place. Therefore, the new value of the coorindate will be written
+ * into this variable.
+ * \param p The momentum of the ODE. It is updated in-place. Therefore, the new value of the momentum will be written info
+ * this variable.
+ * \param t The time of the ODE. It is not advanced by this method.
+ * \param dt The time step.
+ */
+ template< class System , class CoorInOut , class MomentumInOut >
+ void do_step( System system , CoorInOut &q , MomentumInOut &p , time_type t , time_type dt )
+ {
+ do_step( system , std::make_pair( detail::ref( q ) , detail::ref( p ) ) , t , dt );
+ }
+
+ /**
+ * \brief Same function as do_step( system , q , p , t , dt ). It differs only in a different const specifier in order
+ * to solve the forwarding problem.
+ */
+ template< class System , class CoorInOut , class MomentumInOut >
+ void do_step( System system , const CoorInOut &q , const MomentumInOut &p , time_type t , time_type dt )
+ {
+ do_step( system , std::make_pair( detail::ref( q ) , detail::ref( p ) ) , t , dt );
+ }
+
+
+
+
+
+ /*
+ * Version 3 : do_step( system , in , t , out , dt )
+ *
+ * The forwarding problem is not solved in this version
+ */
+ /**
+ * \brief This method performs one step. The system can be either a pair of two function object
+ * decribing the momentum part and the coordinate part or one function object describing only
+ * the momentum part. In this case the coordinate is assumed to be trivial dq/dt = p. The state
+ * is updated out-of-place.
+ *
+ * \note boost::ref or std::ref can be used for the system. So, it is correct
+ * to write `stepper.do_step( make_pair( std::ref( fq ) , std::ref( fp ) ) , x_in , t , x_out , dt )`.
+ *
+ * \note This method NOT solve the forwarding problem.
+ *
+ * \param system The system, can be represented as a pair of two function object or one function object. See above.
+ * \param in The state of the ODE, which is a pair of coordinate and momentum. The state is updated out-of-place, therefore the
+ * new value is written into out
+ * \param t The time of the ODE. It is not advanced by this method.
+ * \param out The new state of the ODE.
+ * \param dt The time step.
+ */
+ template< class System , class StateIn , class StateOut >
+ void do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt )
+ {
+ typedef typename odeint::unwrap_reference< System >::type system_type;
+ do_step_impl( system , in , t , out , dt , typename is_pair< system_type >::type() );
+ }
+
+
+ /**
+ * \brief Adjust the size of all temporaries in the stepper manually.
+ * \param x A state from which the size of the temporaries to be resized is deduced.
+ */
+ template< class StateType >
+ void adjust_size( const StateType &x )
+ {
+ resize_dqdt( x );
+ resize_dpdt( x );
+ }
+
+ /** \brief Returns the coefficients a. */
+ const coef_type& coef_a( void ) const { return m_coef_a; }
+
+ /** \brief Returns the coefficients b. */
+ const coef_type& coef_b( void ) const { return m_coef_b; }
+
+private:
+
+ // stepper for systems with function for dq/dt = f(p) and dp/dt = -f(q)
+ template< class System , class StateIn , class StateOut >
+ void do_step_impl( System system , const StateIn &in , time_type t , StateOut &out , time_type dt , boost::mpl::true_ )
+ {
+ typedef typename odeint::unwrap_reference< System >::type system_type;
+ typedef typename odeint::unwrap_reference< typename system_type::first_type >::type coor_deriv_func_type;
+ typedef typename odeint::unwrap_reference< typename system_type::second_type >::type momentum_deriv_func_type;
+ system_type &sys = system;
+ coor_deriv_func_type &coor_func = sys.first;
+ momentum_deriv_func_type &momentum_func = sys.second;
+
+ typedef typename odeint::unwrap_reference< StateIn >::type state_in_type;
+ typedef typename odeint::unwrap_reference< typename state_in_type::first_type >::type coor_in_type;
+ typedef typename odeint::unwrap_reference< typename state_in_type::second_type >::type momentum_in_type;
+ const state_in_type &state_in = in;
+ const coor_in_type &coor_in = state_in.first;
+ const momentum_in_type &momentum_in = state_in.second;
+
+ typedef typename odeint::unwrap_reference< StateOut >::type state_out_type;
+ typedef typename odeint::unwrap_reference< typename state_out_type::first_type >::type coor_out_type;
+ typedef typename odeint::unwrap_reference< typename state_out_type::second_type >::type momentum_out_type;
+ state_out_type &state_out = out;
+ coor_out_type &coor_out = state_out.first;
+ momentum_out_type &momentum_out = state_out.second;
+
+ m_dqdt_resizer.adjust_size( coor_in , detail::bind( &internal_stepper_base_type::template resize_dqdt< coor_in_type > , detail::ref( *this ) , detail::_1 ) );
+ m_dpdt_resizer.adjust_size( momentum_in , detail::bind( &internal_stepper_base_type::template resize_dpdt< momentum_in_type > , detail::ref( *this ) , detail::_1 ) );
+
+ // ToDo: check sizes?
+
+ for( size_t l=0 ; l<num_of_stages ; ++l )
+ {
+ if( l == 0 )
+ {
+ coor_func( momentum_in , m_dqdt.m_v );
+ this->m_algebra.for_each3( coor_out , coor_in , m_dqdt.m_v ,
+ typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , m_coef_a[l] * dt ) );
+ momentum_func( coor_out , m_dpdt.m_v );
+ this->m_algebra.for_each3( momentum_out , momentum_in , m_dpdt.m_v ,
+ typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , m_coef_b[l] * dt ) );
+ }
+ else
+ {
+ coor_func( momentum_out , m_dqdt.m_v );
+ this->m_algebra.for_each3( coor_out , coor_out , m_dqdt.m_v ,
+ typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , m_coef_a[l] * dt ) );
+ momentum_func( coor_out , m_dpdt.m_v );
+ this->m_algebra.for_each3( momentum_out , momentum_out , m_dpdt.m_v ,
+ typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , m_coef_b[l] * dt ) );
+ }
+ }
+ }
+
+
+ // stepper for systems with only function dp /dt = -f(q), dq/dt = p, time not required but still expected for compatibility reasons
+ template< class System , class StateIn , class StateOut >
+ void do_step_impl( System system , const StateIn &in , time_type /* t */ , StateOut &out , time_type dt , boost::mpl::false_ )
+ {
+ typedef typename odeint::unwrap_reference< System >::type momentum_deriv_func_type;
+ momentum_deriv_func_type &momentum_func = system;
+
+ typedef typename odeint::unwrap_reference< StateIn >::type state_in_type;
+ typedef typename odeint::unwrap_reference< typename state_in_type::first_type >::type coor_in_type;
+ typedef typename odeint::unwrap_reference< typename state_in_type::second_type >::type momentum_in_type;
+ const state_in_type &state_in = in;
+ const coor_in_type &coor_in = state_in.first;
+ const momentum_in_type &momentum_in = state_in.second;
+
+ typedef typename odeint::unwrap_reference< StateOut >::type state_out_type;
+ typedef typename odeint::unwrap_reference< typename state_out_type::first_type >::type coor_out_type;
+ typedef typename odeint::unwrap_reference< typename state_out_type::second_type >::type momentum_out_type;
+ state_out_type &state_out = out;
+ coor_out_type &coor_out = state_out.first;
+ momentum_out_type &momentum_out = state_out.second;
+
+
+ m_dqdt_resizer.adjust_size( coor_in , detail::bind( &internal_stepper_base_type::template resize_dqdt< coor_in_type > , detail::ref( *this ) , detail::_1 ) );
+ m_dpdt_resizer.adjust_size( momentum_in , detail::bind( &internal_stepper_base_type::template resize_dpdt< momentum_in_type > , detail::ref( *this ) , detail::_1 ) );
+
+
+ // ToDo: check sizes?
+
+ for( size_t l=0 ; l<num_of_stages ; ++l )
+ {
+ if( l == 0 )
+ {
+ this->m_algebra.for_each3( coor_out , coor_in , momentum_in ,
+ typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , m_coef_a[l] * dt ) );
+ momentum_func( coor_out , m_dpdt.m_v );
+ this->m_algebra.for_each3( momentum_out , momentum_in , m_dpdt.m_v ,
+ typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , m_coef_b[l] * dt ) );
+ }
+ else
+ {
+ this->m_algebra.for_each3( coor_out , coor_out , momentum_out ,
+ typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , m_coef_a[l] * dt ) );
+ momentum_func( coor_out , m_dpdt.m_v );
+ this->m_algebra.for_each3( momentum_out , momentum_out , m_dpdt.m_v ,
+ typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , m_coef_b[l] * dt ) );
+ }
+ }
+ }
+
+ template< class StateIn >
+ bool resize_dqdt( const StateIn &x )
+ {
+ return adjust_size_by_resizeability( m_dqdt , x , typename is_resizeable<coor_deriv_type>::type() );
+ }
+
+ template< class StateIn >
+ bool resize_dpdt( const StateIn &x )
+ {
+ return adjust_size_by_resizeability( m_dpdt , x , typename is_resizeable<momentum_deriv_type>::type() );
+ }
+
+
+ const coef_type m_coef_a;
+ const coef_type m_coef_b;
+
+ resizer_type m_dqdt_resizer;
+ resizer_type m_dpdt_resizer;
+ wrapped_coor_deriv_type m_dqdt;
+ wrapped_momentum_deriv_type m_dpdt;
+
+};
+
+} // namespace odeint
+} // namespace numeric
+} // namespace boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_BASE_SYMPLECTIC_RKN_STEPPER_BASE_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/bulirsch_stoer.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/bulirsch_stoer.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,507 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/bulirsch_stoer.hpp
+
+ [begin_description]
+ Implementaiton of the Burlish-Stoer method. As described in
+ Ernst Hairer, Syvert Paul Norsett, Gerhard Wanner
+ Solving Ordinary Differential Equations I. Nonstiff Problems.
+ Springer Series in Comput. Mathematics, Vol. 8, Springer-Verlag 1987, Second revised edition 1993.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+*/
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_BULIRSCH_STOER_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_BULIRSCH_STOER_HPP_INCLUDED
+
+
+#include <iostream>
+
+#include <algorithm>
+
+#include <boost/config.hpp> // for min/max guidelines
+
+#include <boost/numeric/odeint/util/bind.hpp>
+#include <boost/numeric/odeint/util/unwrap_reference.hpp>
+
+#include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp>
+#include <boost/numeric/odeint/stepper/modified_midpoint.hpp>
+#include <boost/numeric/odeint/stepper/controlled_step_result.hpp>
+#include <boost/numeric/odeint/algebra/range_algebra.hpp>
+#include <boost/numeric/odeint/algebra/default_operations.hpp>
+
+#include <boost/numeric/odeint/util/state_wrapper.hpp>
+#include <boost/numeric/odeint/util/is_resizeable.hpp>
+#include <boost/numeric/odeint/util/resizer.hpp>
+#include <boost/numeric/odeint/util/unit_helper.hpp>
+#include <boost/numeric/odeint/util/detail/less_with_sign.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+/** ToDo try_step stepsize changed return values doesn't make too much sense here as we have order control as well */
+
+template<
+ class State ,
+ class Value = double ,
+ class Deriv = State ,
+ class Time = Value ,
+ class Algebra = range_algebra ,
+ class Operations = default_operations ,
+ class Resizer = initially_resizer
+ >
+class bulirsch_stoer {
+
+public:
+
+ typedef State state_type;
+ typedef Value value_type;
+ typedef Deriv deriv_type;
+ typedef Time time_type;
+ typedef Algebra algebra_type;
+ typedef Operations operations_type;
+ typedef Resizer resizer_type;
+ typedef state_wrapper< state_type > wrapped_state_type;
+ typedef state_wrapper< deriv_type > wrapped_deriv_type;
+ typedef controlled_stepper_tag stepper_category;
+
+ typedef bulirsch_stoer< State , Value , Deriv , Time , Algebra , Operations , Resizer > controlled_error_bs_type;
+
+ typedef typename inverse_time< time_type >::type inv_time_type;
+
+ typedef std::vector< value_type > value_vector;
+ typedef std::vector< time_type > time_vector;
+ typedef std::vector< inv_time_type > inv_time_vector; //should be 1/time_type for boost.units
+ typedef std::vector< value_vector > value_matrix;
+ typedef std::vector< size_t > int_vector;
+ typedef std::vector< wrapped_state_type > state_table_type;
+
+ const static size_t m_k_max = 8;
+
+
+ bulirsch_stoer(
+ value_type eps_abs = 1E-6 , value_type eps_rel = 1E-6 ,
+ value_type factor_x = 1.0 , value_type factor_dxdt = 1.0 )
+ : m_error_checker( eps_abs , eps_rel , factor_x, factor_dxdt ) , m_midpoint() ,
+ m_last_step_rejected( false ) , m_first( true ) ,
+ /* , m_t_last() ,
+ m_current_k_opt() ,
+ m_algebra() ,
+ m_dxdt_resizer() , m_xnew_resizer() , m_resizer() ,
+ m_xnew() , m_err() , m_dxdt() ,*/
+ m_interval_sequence( m_k_max+1 ) ,
+ m_coeff( m_k_max+1 ) ,
+ m_cost( m_k_max+1 ) ,
+ m_table( m_k_max ) ,
+ STEPFAC1( 0.65 ) , STEPFAC2( 0.94 ) , STEPFAC3( 0.02 ) , STEPFAC4( 4.0 ) , KFAC1( 0.8 ) , KFAC2( 0.9 )
+ {
+ BOOST_USING_STD_MIN();
+ BOOST_USING_STD_MAX();
+ //m_dt_last = 1.0E30;
+ for( unsigned short i = 0; i < m_k_max+1; i++ )
+ {
+ m_interval_sequence[i] = 2 * (i+1);
+ if( i == 0 )
+ m_cost[i] = m_interval_sequence[i];
+ else
+ m_cost[i] = m_cost[i-1] + m_interval_sequence[i];
+ m_coeff[i].resize(i);
+ for( size_t k = 0 ; k < i ; ++k )
+ {
+ const value_type r = static_cast< value_type >( m_interval_sequence[i] ) / static_cast< value_type >( m_interval_sequence[k] );
+ m_coeff[i][k] = 1.0 / ( r*r - static_cast< value_type >( 1.0 ) ); // coefficients for extrapolation
+ //std::cout << i << "," << k << " " << m_coeff[i][k] << '\t' ;
+ }
+ //std ::cout << std::endl;
+ // crude estimate of optimal order
+ const value_type logfact( -log10( max BOOST_PREVENT_MACRO_SUBSTITUTION( eps_rel , 1.0E-12 ) ) * 0.6 + 0.5 );
+ m_current_k_opt = max BOOST_PREVENT_MACRO_SUBSTITUTION( 1 , min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<int>( m_k_max-1 ) , static_cast<int>( logfact ) ));
+ //m_current_k_opt = m_k_max - 1;
+ //std::cout << m_cost[i] << std::endl;
+ }
+
+ }
+
+
+ /*
+ * Version 1 : try_step( sys , x , t , dt )
+ *
+ * The overloads are needed to solve the forwarding problem
+ */
+ template< class System , class StateInOut >
+ controlled_step_result try_step( System system , StateInOut &x , time_type &t , time_type &dt )
+ {
+ return try_step_v1( system , x , t, dt );
+ }
+
+ template< class System , class StateInOut >
+ controlled_step_result try_step( System system , const StateInOut &x , time_type &t , time_type &dt )
+ {
+ return try_step_v1( system , x , t, dt );
+ }
+
+ /*
+ * Version 2 : try_step( sys , x , dxdt , t , dt )
+ *
+ * this version does not solve the forwarding problem, boost.range can not be used
+ */
+ template< class System , class StateInOut , class DerivIn >
+ controlled_step_result try_step( System system , StateInOut &x , const DerivIn &dxdt , time_type &t , time_type &dt )
+ {
+ m_xnew_resizer.adjust_size( x , detail::bind( &controlled_error_bs_type::template resize_m_xnew< StateInOut > , detail::ref( *this ) , detail::_1 ) );
+ controlled_step_result res = try_step( system , x , dxdt , t , m_xnew.m_v , dt );
+ if( res == success )
+ {
+ boost::numeric::odeint::copy( m_xnew.m_v , x );
+ }
+ return res;
+ }
+
+ /*
+ * Version 3 : try_step( sys , in , t , out , dt )
+ *
+ * this version does not solve the forwarding problem, boost.range can not be used
+ */
+ template< class System , class StateIn , class StateOut >
+ controlled_step_result try_step( System system , const StateIn &in , time_type &t , StateOut &out , time_type &dt )
+ {
+ typename odeint::unwrap_reference< System >::type &sys = system;
+ m_dxdt_resizer.adjust_size( in , detail::bind( &controlled_error_bs_type::template resize_m_dxdt< StateIn > , detail::ref( *this ) , detail::_1 ) );
+ sys( in , m_dxdt.m_v , t );
+ return try_step( system , in , m_dxdt.m_v , t , out , dt );
+ }
+
+
+ template< class System , class StateIn , class DerivIn , class StateOut >
+ controlled_step_result try_step( System system , const StateIn &in , const DerivIn &dxdt , time_type &t , StateOut &out , time_type &dt )
+ {
+ BOOST_USING_STD_MIN();
+ BOOST_USING_STD_MAX();
+
+ static const value_type val1( 1.0 );
+
+ typename odeint::unwrap_reference< System >::type &sys = system;
+ if( m_resizer.adjust_size( in , detail::bind( &controlled_error_bs_type::template resize_impl< StateIn > , detail::ref( *this ) , detail::_1 ) ) )
+ {
+ reset(); // system resized -> reset
+ }
+
+ if( dt != m_dt_last )
+ {
+ reset(); // step size changed from outside -> reset
+ }
+
+ bool reject( true );
+
+ time_vector h_opt( m_k_max+1 );
+ inv_time_vector work( m_k_max+1 );
+
+ //std::cout << "t=" << t <<", dt=" << dt << "(" << m_dt_last << ")" << ", k_opt=" << m_current_k_opt << std::endl;
+
+ time_type new_h = dt;
+
+ for( size_t k = 0 ; k <= m_current_k_opt+1 ; k++ )
+ {
+ //std::cout << " k=" << k; //<<": " << ", first: " << m_first << std::endl;
+ m_midpoint.set_steps( m_interval_sequence[k] );
+ if( k == 0 )
+ {
+ m_midpoint.do_step( sys , in , dxdt , t , out , dt );
+ }
+ else
+ {
+ m_midpoint.do_step( sys , in , dxdt , t , m_table[k-1].m_v , dt );
+ extrapolate( k , m_table , m_coeff , out );
+ // get error estimate
+ m_algebra.for_each3( m_err.m_v , out , m_table[0].m_v ,
+ typename operations_type::template scale_sum2< value_type , value_type >( val1 , -val1 ) );
+ const value_type error = m_error_checker.error( m_algebra , in , dxdt , m_err.m_v , dt );
+ h_opt[k] = calc_h_opt( dt , error , k );
+ work[k] = static_cast<value_type>( m_cost[k] ) / h_opt[k];
+ //std::cout << '\t' << "h_opt=" << h_opt[k] << ", work=" << work[k] << std::endl;
+ //std::cout << '\t' << "error: " << error << std::endl;
+
+ if( (k == m_current_k_opt-1) || m_first )
+ { // convergence before k_opt ?
+ if( error < 1.0 )
+ {
+ //convergence
+ reject = false;
+ if( (work[k] < KFAC2*work[k-1]) || (m_current_k_opt <= 2) )
+ {
+ // leave order as is (except we were in first round)
+ m_current_k_opt = min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<int>(m_k_max)-1 , max BOOST_PREVENT_MACRO_SUBSTITUTION( 2 , static_cast<int>(k)+1 ) );
+ new_h = h_opt[k];
+ new_h *= static_cast<value_type>( m_cost[k+1] ) / static_cast<value_type>( m_cost[k] );
+ } else {
+ m_current_k_opt = min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<int>(m_k_max)-1 , max BOOST_PREVENT_MACRO_SUBSTITUTION( 2 , static_cast<int>(k) ) );
+ new_h = h_opt[k];
+ }
+ break;
+ }
+ else if( should_reject( error , k ) && !m_first )
+ {
+ reject = true;
+ new_h = h_opt[k];
+ break;
+ }
+ }
+ if( k == m_current_k_opt )
+ { // convergence at k_opt ?
+ if( error < 1.0 )
+ {
+ //convergence
+ reject = false;
+ if( (work[k-1] < KFAC2*work[k]) )
+ {
+ m_current_k_opt = max BOOST_PREVENT_MACRO_SUBSTITUTION( 2 , static_cast<int>(m_current_k_opt)-1 );
+ new_h = h_opt[m_current_k_opt];
+ }
+ else if( (work[k] < KFAC2*work[k-1]) && !m_last_step_rejected )
+ {
+ m_current_k_opt = min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<int>(m_k_max-1) , static_cast<int>(m_current_k_opt)+1 );
+ new_h = h_opt[k];
+ new_h *= m_cost[m_current_k_opt]/m_cost[k];
+ //std::cout << new_h << std::endl;
+ } else
+ new_h = h_opt[m_current_k_opt];
+ break;
+ }
+ else if( should_reject( error , k ) )
+ {
+ reject = true;
+ new_h = h_opt[m_current_k_opt];
+ break;
+ }
+ }
+ if( k == m_current_k_opt+1 )
+ { // convergence at k_opt+1 ?
+ //std::cout << "convergence at k_opt+1 ?" << std::endl;
+ if( error < 1.0 )
+ { //convergence
+ reject = false;
+ if( work[k-2] < KFAC2*work[k-1] )
+ m_current_k_opt = max BOOST_PREVENT_MACRO_SUBSTITUTION( 2 , static_cast<int>(m_current_k_opt)-1 );
+ if( (work[k] < KFAC2*work[m_current_k_opt]) && !m_last_step_rejected )
+ m_current_k_opt = min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<int>(m_k_max)-1 , static_cast<int>(k) );
+ new_h = h_opt[m_current_k_opt];
+ } else
+ {
+ reject = true;
+ new_h = h_opt[m_current_k_opt];
+ }
+ break;
+ }
+ }
+ }
+
+ if( !reject )
+ {
+ t += dt;
+ }// else
+ // std::cout << "REJECT!" << std::endl;
+
+ if( !m_last_step_rejected || boost::numeric::odeint::detail::less_with_sign(new_h, dt, dt) )
+ {
+ m_dt_last = new_h;
+ dt = new_h;
+ }
+
+ m_last_step_rejected = reject;
+ m_first = false;
+
+ if( reject )
+ return fail;
+ else
+ return success;
+ }
+
+ void reset()
+ {
+ //std::cout << "reset" << std::endl;
+ m_first = true;
+ m_last_step_rejected = false;
+ }
+
+
+ /* Resizer methods */
+
+
+ template< class StateIn >
+ void adjust_size( const StateIn &x )
+ {
+ resize_m_dxdt( x );
+ resize_m_xnew( x );
+ resize_impl( x );
+ m_midpoint.adjust_size();
+ }
+
+
+private:
+
+ template< class StateIn >
+ bool resize_m_dxdt( const StateIn &x )
+ {
+ return adjust_size_by_resizeability( m_dxdt , x , typename is_resizeable<deriv_type>::type() );
+ }
+
+ template< class StateIn >
+ bool resize_m_xnew( const StateIn &x )
+ {
+ return adjust_size_by_resizeability( m_xnew , x , typename is_resizeable<state_type>::type() );
+ }
+
+ template< class StateIn >
+ bool resize_impl( const StateIn &x )
+ {
+ bool resized( false );
+ for( size_t i = 0 ; i < m_k_max ; ++i )
+ resized |= adjust_size_by_resizeability( m_table[i] , x , typename is_resizeable<state_type>::type() );
+ resized |= adjust_size_by_resizeability( m_err , x , typename is_resizeable<state_type>::type() );
+ return resized;
+ }
+
+
+ template< class System , class StateInOut >
+ controlled_step_result try_step_v1( System system , StateInOut &x , time_type &t , time_type &dt )
+ {
+ typename odeint::unwrap_reference< System >::type &sys = system;
+ m_dxdt_resizer.adjust_size( x , detail::bind( &controlled_error_bs_type::template resize_m_dxdt< StateInOut > , detail::ref( *this ) , detail::_1 ) );
+ sys( x , m_dxdt.m_v ,t );
+ return try_step( system , x , m_dxdt.m_v , t , dt );
+ }
+
+
+ template< class StateInOut >
+ void extrapolate( size_t k , state_table_type &table , const value_matrix &coeff , StateInOut &xest )
+ //polynomial extrapolation, see http://www.nr.com/webnotes/nr3web21.pdf
+ {
+ //std::cout << "extrapolate k=" << k << ":" << std::endl;
+ static const value_type val1 = static_cast< value_type >( 1.0 );
+ for( int j=k-1 ; j>0 ; --j )
+ {
+ //std::cout << '\t' << m_coeff[k][j];
+ m_algebra.for_each3( table[j-1].m_v , table[j].m_v , table[j-1].m_v ,
+ typename operations_type::template scale_sum2< value_type , value_type >( val1 + coeff[k][j] , -coeff[k][j] ) );
+ }
+ //std::cout << std::endl << m_coeff[k][0] << std::endl;
+ m_algebra.for_each3( xest , table[0].m_v , xest ,
+ typename operations_type::template scale_sum2< value_type , value_type >( val1 + coeff[k][0] , -coeff[k][0]) );
+ }
+
+ time_type calc_h_opt( time_type h , value_type error , size_t k ) const
+ {
+ BOOST_USING_STD_MIN();
+ BOOST_USING_STD_MAX();
+ using std::pow;
+ value_type expo=1.0/(2*k+1);
+ value_type facmin = pow BOOST_PREVENT_MACRO_SUBSTITUTION( STEPFAC3 , expo );
+ value_type fac;
+ if (error == 0.0)
+ fac=1.0/facmin;
+ else
+ {
+ fac = STEPFAC2 / pow BOOST_PREVENT_MACRO_SUBSTITUTION( error / STEPFAC1 , expo );
+ fac = max BOOST_PREVENT_MACRO_SUBSTITUTION( facmin/STEPFAC4 , min BOOST_PREVENT_MACRO_SUBSTITUTION( 1.0/facmin , fac ) );
+ }
+ //return std::abs(h*fac);
+ return h*fac;
+ }
+
+ controlled_step_result set_k_opt( size_t k , const inv_time_vector &work , const time_vector &h_opt , time_type &dt )
+ {
+ //std::cout << "finding k_opt..." << std::endl;
+ if( k == 1 )
+ {
+ m_current_k_opt = 2;
+ //dt = h_opt[ m_current_k_opt-1 ] * m_cost[ m_current_k_opt ] / m_cost[ m_current_k_opt-1 ] ;
+ return success;
+ }
+ if( (work[k-1] < KFAC1*work[k]) || (k == m_k_max) )
+ { // order decrease
+ m_current_k_opt = k-1;
+ dt = h_opt[ m_current_k_opt ];
+ return success;
+ }
+ else if( (work[k] < KFAC2*work[k-1]) || m_last_step_rejected || (k == m_k_max-1) )
+ { // same order - also do this if last step got rejected
+ m_current_k_opt = k;
+ dt = h_opt[ m_current_k_opt ];
+ return success;
+ }
+ else
+ { // order increase - only if last step was not rejected
+ m_current_k_opt = k+1;
+ dt = h_opt[ m_current_k_opt-1 ] * m_cost[ m_current_k_opt ] / m_cost[ m_current_k_opt-1 ] ;
+ return success;
+ }
+ }
+
+ bool in_convergence_window( size_t k ) const
+ {
+ if( (k == m_current_k_opt-1) && !m_last_step_rejected )
+ return true; // decrease stepsize only if last step was not rejected
+ return ( (k == m_current_k_opt) || (k == m_current_k_opt+1) );
+ }
+
+ bool should_reject( value_type error , size_t k ) const
+ {
+ if( k == m_current_k_opt-1 )
+ {
+ const value_type d = m_interval_sequence[m_current_k_opt] * m_interval_sequence[m_current_k_opt+1] /
+ (m_interval_sequence[0]*m_interval_sequence[0]);
+ //step will fail, criterion 17.3.17 in NR
+ return ( error > d*d );
+ }
+ else if( k == m_current_k_opt )
+ {
+ const value_type d = m_interval_sequence[m_current_k_opt] / m_interval_sequence[0];
+ return ( error > d*d );
+ } else
+ return error > 1.0;
+ }
+
+ default_error_checker< value_type, algebra_type , operations_type > m_error_checker;
+ modified_midpoint< state_type , value_type , deriv_type , time_type , algebra_type , operations_type , resizer_type > m_midpoint;
+
+ bool m_last_step_rejected;
+ bool m_first;
+
+ time_type m_dt_last;
+ time_type m_t_last;
+
+ size_t m_current_k_opt;
+
+ algebra_type m_algebra;
+
+ resizer_type m_dxdt_resizer;
+ resizer_type m_xnew_resizer;
+ resizer_type m_resizer;
+
+ wrapped_state_type m_xnew;
+ wrapped_state_type m_err;
+ wrapped_deriv_type m_dxdt;
+
+ int_vector m_interval_sequence; // stores the successive interval counts
+ value_matrix m_coeff;
+ int_vector m_cost; // costs for interval count
+
+ state_table_type m_table; // sequence of states for extrapolation
+
+ const value_type STEPFAC1 , STEPFAC2 , STEPFAC3 , STEPFAC4 , KFAC1 , KFAC2;
+};
+
+
+}
+}
+}
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_BULIRSCH_STOER_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/bulirsch_stoer_dense_out.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/bulirsch_stoer_dense_out.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,830 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/bulirsch_stoer_dense_out.hpp
+
+ [begin_description]
+ Implementaiton of the Burlish-Stoer method with dense output
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_BULIRSCH_STOER_DENSE_OUT_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_BULIRSCH_STOER_DENSE_OUT_HPP_INCLUDED
+
+
+#include <iostream>
+
+#include <algorithm>
+
+#include <boost/config.hpp> // for min/max guidelines
+
+#include <boost/numeric/odeint/util/bind.hpp>
+
+#include <boost/math/special_functions/binomial.hpp>
+
+#include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp>
+#include <boost/numeric/odeint/stepper/modified_midpoint.hpp>
+#include <boost/numeric/odeint/stepper/controlled_step_result.hpp>
+#include <boost/numeric/odeint/algebra/range_algebra.hpp>
+#include <boost/numeric/odeint/algebra/default_operations.hpp>
+
+#include <boost/numeric/odeint/util/state_wrapper.hpp>
+#include <boost/numeric/odeint/util/is_resizeable.hpp>
+#include <boost/numeric/odeint/util/resizer.hpp>
+#include <boost/numeric/odeint/util/unit_helper.hpp>
+
+#include <boost/type_traits.hpp>
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+/*
+
+template< class T , size_t N >
+std::ostream& operator<<( std::ostream& output , const boost::array< T , N >& a ) {
+ output << "[ " << a[0] ;
+ for( size_t n = 1 ; n<N ; ++n )
+ output << " , " << a[n];
+ output << " ]";
+ return output; // for multiple << operators.
+}
+
+*/
+
+
+
+
+template<
+ class State ,
+ class Value = double ,
+ class Deriv = State ,
+ class Time = Value ,
+ class Algebra = range_algebra ,
+ class Operations = default_operations ,
+ class Resizer = initially_resizer
+ >
+class bulirsch_stoer_dense_out {
+
+
+public:
+
+ typedef State state_type;
+ typedef Value value_type;
+ typedef Deriv deriv_type;
+ typedef Time time_type;
+ typedef Algebra algebra_type;
+ typedef Operations operations_type;
+ typedef Resizer resizer_type;
+ typedef state_wrapper< state_type > wrapped_state_type;
+ typedef state_wrapper< deriv_type > wrapped_deriv_type;
+ typedef dense_output_stepper_tag stepper_category;
+
+ typedef bulirsch_stoer_dense_out< State , Value , Deriv , Time , Algebra , Operations , Resizer > controlled_error_bs_type;
+
+ typedef typename inverse_time< time_type >::type inv_time_type;
+
+ typedef std::vector< value_type > value_vector;
+ typedef std::vector< time_type > time_vector;
+ typedef std::vector< inv_time_type > inv_time_vector; //should be 1/time_type for boost.units
+ typedef std::vector< value_vector > value_matrix;
+ typedef std::vector< size_t > int_vector;
+ typedef std::vector< wrapped_state_type > state_vector_type;
+ typedef std::vector< wrapped_deriv_type > deriv_vector_type;
+ typedef std::vector< deriv_vector_type > deriv_table_type;
+
+ const static size_t m_k_max = 8;
+
+
+
+
+ bulirsch_stoer_dense_out(
+ value_type eps_abs = 1E-6 , value_type eps_rel = 1E-6 ,
+ value_type factor_x = 1.0 , value_type factor_dxdt = 1.0 ,
+ bool control_interpolation = false )
+ : m_error_checker( eps_abs , eps_rel , factor_x, factor_dxdt ) ,
+ m_control_interpolation( control_interpolation) ,
+ m_last_step_rejected( false ) , m_first( true ) ,
+ m_current_state_x1( true ) ,
+ m_error( m_k_max ) ,
+ m_interval_sequence( m_k_max+1 ) ,
+ m_coeff( m_k_max+1 ) ,
+ m_cost( m_k_max+1 ) ,
+ m_table( m_k_max ) ,
+ m_mp_states( m_k_max+1 ) ,
+ m_derivs( m_k_max+1 ) ,
+ m_diffs( 2*m_k_max+1 ) ,
+ STEPFAC1( 0.65 ) , STEPFAC2( 0.94 ) , STEPFAC3( 0.02 ) , STEPFAC4( 4.0 ) , KFAC1( 0.8 ) , KFAC2( 0.9 )
+ {
+ BOOST_USING_STD_MIN();
+ BOOST_USING_STD_MAX();
+
+ for( unsigned short i = 0; i < m_k_max+1; i++ )
+ {
+ m_interval_sequence[i] = 2 + 4*i; // 2 6 10 14 ...
+ m_derivs[i].resize( m_interval_sequence[i] );
+ if( i == 0 )
+ m_cost[i] = m_interval_sequence[i];
+ else
+ m_cost[i] = m_cost[i-1] + m_interval_sequence[i];
+ m_coeff[i].resize(i);
+ for( size_t k = 0 ; k < i ; ++k )
+ {
+ const value_type r = static_cast< value_type >( m_interval_sequence[i] ) / static_cast< value_type >( m_interval_sequence[k] );
+ m_coeff[i][k] = 1.0 / ( r*r - static_cast< value_type >( 1.0 ) ); // coefficients for extrapolation
+ //std::cout << i << "," << k << " " << m_coeff[i][k] << '\t' ;
+ }
+ //std ::cout << std::endl;
+ // crude estimate of optimal order
+ const value_type logfact( -log10( max BOOST_PREVENT_MACRO_SUBSTITUTION( eps_rel , static_cast< value_type >( 1.0E-12 ) ) ) * 0.6 + 0.5 );
+ m_current_k_opt = max BOOST_PREVENT_MACRO_SUBSTITUTION( 1 , min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<int>( m_k_max-1 ) , static_cast<int>( logfact ) ));
+ //m_current_k_opt = m_k_max - 1;
+ //std::cout << m_cost[i] << std::endl;
+ }
+ int num = 1;
+ for( int i = 2*(m_k_max) ; i >=0 ; i-- )
+ {
+ m_diffs[i].resize( num );
+ //std::cout << "m_diffs[" << i << "] size: " << num << std::endl;
+ num += (i+1)%2;
+ }
+ }
+
+
+
+/*
+ template< class System , class StateInOut >
+ controlled_step_result try_step( System system , StateInOut &x , time_type &t , time_type &dt )
+ {
+ m_xnew_resizer.adjust_size( x , detail::bind( &controlled_error_bs_type::template resize_m_xnew< StateInOut > , detail::ref( *this ) , detail::_1 ) );
+ controlled_step_result res = try_step( system , x , t , m_xnew.m_v , dt );
+ if( ( res == success_step_size_increased ) || ( res == success_step_size_unchanged ) )
+ {
+ boost::numeric::odeint::copy( m_xnew.m_v , x );
+ }
+ return res;
+ }
+*/
+
+ template< class System , class StateIn , class DerivIn , class StateOut , class DerivOut >
+ controlled_step_result try_step( System system , const StateIn &in , const DerivIn &dxdt , time_type &t , StateOut &out , DerivOut &dxdt_new , time_type &dt )
+ {
+ BOOST_USING_STD_MIN();
+ BOOST_USING_STD_MAX();
+ using std::pow;
+
+ static const value_type val1( 1.0 );
+
+ typename odeint::unwrap_reference< System >::type &sys = system;
+// if( m_resizer.adjust_size( in , detail::bind( &controlled_error_bs_type::template resize_impl< StateIn > , detail::ref( *this ) , detail::_1 ) ) )
+// reset(); // system resized -> reset
+// if( dt != m_dt_last )
+// reset(); // step size changed from outside -> reset
+
+ bool reject( true );
+
+ time_vector h_opt( m_k_max+1 );
+ inv_time_vector work( m_k_max+1 );
+
+ m_k_final = 0;
+ time_type new_h = dt;
+
+ //std::cout << "t=" << t <<", dt=" << dt << ", k_opt=" << m_current_k_opt << ", first: " << m_first << std::endl;
+
+ for( size_t k = 0 ; k <= m_current_k_opt+1 ; k++ )
+ {
+ //std::cout << "k=" << k <<" (steps=" << m_interval_sequence[k] << "): " << std::endl;
+ m_midpoint.set_steps( m_interval_sequence[k] );
+ if( k == 0 )
+ {
+ m_midpoint.do_step( sys , in , dxdt , t , out , dt , m_mp_states[k].m_v , m_derivs[k]);
+ }
+ else
+ {
+ m_midpoint.do_step( sys , in , dxdt , t , m_table[k-1].m_v , dt , m_mp_states[k].m_v , m_derivs[k] );
+ extrapolate( k , m_table , m_coeff , out );
+ // get error estimate
+ m_algebra.for_each3( m_err.m_v , out , m_table[0].m_v ,
+ typename operations_type::template scale_sum2< value_type , value_type >( val1 , -val1 ) );
+ const value_type error = m_error_checker.error( m_algebra , in , dxdt , m_err.m_v , dt );
+ h_opt[k] = calc_h_opt( dt , error , k );
+ work[k] = static_cast<value_type>( m_cost[k] ) / h_opt[k];
+ //std::cout << '\t' << "h_opt=" << h_opt[k] << ", work=" << work[k] << std::endl;
+ //std::cout << '\t' << "error: " << error << std::endl;
+
+ m_k_final = k;
+
+ if( (k == m_current_k_opt-1) || m_first )
+ { // convergence before k_opt ?
+ if( error < 1.0 )
+ {
+ //convergence
+ reject = false;
+ if( (work[k] < KFAC2*work[k-1]) || (m_current_k_opt <= 2) )
+ {
+ // leave order as is (except we were in first round)
+ m_current_k_opt = min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<int>(m_k_max)-1 , max BOOST_PREVENT_MACRO_SUBSTITUTION( 2 , static_cast<int>(k)+1 ) );
+ new_h = h_opt[k] * static_cast<value_type>( m_cost[k+1] ) / static_cast<value_type>( m_cost[k] );
+ } else {
+ m_current_k_opt = min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<int>(m_k_max)-1 , max BOOST_PREVENT_MACRO_SUBSTITUTION( 2 , static_cast<int>(k) ) );
+ new_h = h_opt[k];
+ }
+ break;
+ }
+ else if( should_reject( error , k ) && !m_first )
+ {
+ reject = true;
+ new_h = h_opt[k];
+ break;
+ }
+ }
+ if( k == m_current_k_opt )
+ { // convergence at k_opt ?
+ if( error < 1.0 )
+ {
+ //convergence
+ reject = false;
+ if( (work[k-1] < KFAC2*work[k]) )
+ {
+ m_current_k_opt = max BOOST_PREVENT_MACRO_SUBSTITUTION( 2 , static_cast<int>(m_current_k_opt)-1 );
+ new_h = h_opt[m_current_k_opt];
+ }
+ else if( (work[k] < KFAC2*work[k-1]) && !m_last_step_rejected )
+ {
+ m_current_k_opt = min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<int>(m_k_max)-1 , static_cast<int>(m_current_k_opt)+1 );
+ new_h = h_opt[k]*static_cast<value_type>( m_cost[m_current_k_opt] ) / static_cast<value_type>( m_cost[k] );
+ } else
+ new_h = h_opt[m_current_k_opt];
+ break;
+ }
+ else if( should_reject( error , k ) )
+ {
+ reject = true;
+ new_h = h_opt[m_current_k_opt];
+ break;
+ }
+ }
+ if( k == m_current_k_opt+1 )
+ { // convergence at k_opt+1 ?
+ if( error < 1.0 )
+ { //convergence
+ reject = false;
+ if( work[k-2] < KFAC2*work[k-1] )
+ m_current_k_opt = max BOOST_PREVENT_MACRO_SUBSTITUTION( 2 , static_cast<int>(m_current_k_opt)-1 );
+ if( (work[k] < KFAC2*work[m_current_k_opt]) && !m_last_step_rejected )
+ m_current_k_opt = min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<int>(m_k_max)-1 , static_cast<int>(k) );
+ new_h = h_opt[m_current_k_opt];
+ } else
+ {
+ reject = true;
+ new_h = h_opt[m_current_k_opt];
+ }
+ break;
+ }
+ }
+ }
+
+ if( !reject )
+ {
+
+ //calculate dxdt for next step and dense output
+ sys( out , dxdt_new , t+dt );
+
+ //prepare dense output
+ value_type error = prepare_dense_output( m_k_final , in , dxdt , out , dxdt_new , dt );
+
+ if( error > static_cast<value_type>(10) ) // we are not as accurate for interpolation as for the steps
+ {
+ reject = true;
+ new_h = dt * pow BOOST_PREVENT_MACRO_SUBSTITUTION( error , static_cast<value_type>(-1)/(2*m_k_final+2) );
+ //std::cout << "####### rejected #######! (t=" << t << ") interpolation error: " << error << " , new dt: " << new_h << std::endl;
+ } else {
+ //std::cout << "####### accepted ####### - new k: " << m_current_k_opt << ", new stepsize: " << new_h << std::endl;
+ //increase time
+ t += dt;
+ }
+ }// else std::cout << "####### rejected #######!" << std::endl;
+
+ //set next stepsize
+ if( !m_last_step_rejected || (new_h < dt) )
+ dt = new_h;
+
+ m_last_step_rejected = reject;
+ if( reject )
+ return fail;
+ else
+ return success;
+ }
+
+ template< class StateType >
+ void initialize( const StateType &x0 , const time_type &t0 , const time_type &dt0 )
+ {
+ m_resizer.adjust_size( x0 , detail::bind( &controlled_error_bs_type::template resize_impl< StateType > , detail::ref( *this ) , detail::_1 ) );
+ boost::numeric::odeint::copy( x0 , get_current_state() );
+ m_t = t0;
+ m_dt = dt0;
+ reset();
+ }
+
+
+ /* =======================================================
+ * the actual step method that should be called from outside (maybe make try_step private?)
+ */
+ template< class System >
+ std::pair< time_type , time_type > do_step( System system )
+ {
+ const size_t max_count = 1000;
+
+ if( m_first )
+ {
+ typename odeint::unwrap_reference< System >::type &sys = system;
+ sys( get_current_state() , get_current_deriv() , m_t );
+ }
+
+ controlled_step_result res = fail;
+ m_t_last = m_t;
+ size_t count = 0;
+ while( res == fail )
+ {
+ res = try_step( system , get_current_state() , get_current_deriv() , m_t , get_old_state() , get_old_deriv() , m_dt );
+ m_first = false;
+ if( count++ == max_count )
+ throw std::overflow_error( "bulirsch_stoer : too much iterations!");
+ }
+ toggle_current_state();
+ return std::make_pair( m_t_last , m_t );
+ }
+
+ /* performs the interpolation from a calculated step */
+ template< class StateOut >
+ void calc_state( time_type t , StateOut &x ) const
+ {
+ //std::cout << "===========" << std::endl << "doing interpolation for t=" << t << std::endl;
+ do_interpolation( t , x );
+ //std::cout << "===========" << std::endl;
+ }
+
+
+ const state_type& current_state( void ) const
+ {
+ return get_current_state();
+ }
+
+ time_type current_time( void ) const
+ {
+ return m_t;
+ }
+
+ const state_type& previous_state( void ) const
+ {
+ return get_old_state();
+ }
+
+ time_type previous_time( void ) const
+ {
+ return m_t_last;
+ }
+
+ time_type current_time_step( void ) const
+ {
+ return m_dt;
+ }
+
+
+ void reset()
+ {
+ m_first = true;
+ m_last_step_rejected = false;
+ }
+
+
+ template< class StateIn >
+ void adjust_size( const StateIn &x )
+ {
+ resize_impl( x );
+ m_midpoint.adjust_size();
+ }
+
+
+private:
+
+ template< class StateInOut , class StateVector >
+ void extrapolate( size_t k , StateVector &table , const value_matrix &coeff , StateInOut &xest , size_t order_start_index = 0 )
+ //polynomial extrapolation, see http://www.nr.com/webnotes/nr3web21.pdf
+ {
+ static const value_type val1( 1.0 );
+ for( int j=k-1 ; j>0 ; --j )
+ {
+ m_algebra.for_each3( table[j-1].m_v , table[j].m_v , table[j-1].m_v ,
+ typename operations_type::template scale_sum2< value_type , value_type >( val1 + coeff[k + order_start_index][j + order_start_index] ,
+ -coeff[k + order_start_index][j + order_start_index] ) );
+ }
+ m_algebra.for_each3( xest , table[0].m_v , xest ,
+ typename operations_type::template scale_sum2< value_type , value_type >( val1 + coeff[k + order_start_index][0 + order_start_index] ,
+ -coeff[k + order_start_index][0 + order_start_index]) );
+ }
+
+
+ template< class StateVector >
+ void extrapolate_dense_out( size_t k , StateVector &table , const value_matrix &coeff , size_t order_start_index = 0 )
+ //polynomial extrapolation, see http://www.nr.com/webnotes/nr3web21.pdf
+ {
+ // result is written into table[0]
+ //std::cout << "extrapolate k=" << k << ":" << std::endl;
+ static const value_type val1( 1.0 );
+ for( int j=k ; j>1 ; --j )
+ {
+ //std::cout << '\t' << coeff[k + order_start_index][j + order_start_index - 1];
+ m_algebra.for_each3( table[j-1].m_v , table[j].m_v , table[j-1].m_v ,
+ typename operations_type::template scale_sum2< value_type , value_type >( val1 + coeff[k + order_start_index][j + order_start_index - 1] ,
+ -coeff[k + order_start_index][j + order_start_index - 1] ) );
+ }
+ //std::cout << std::endl << coeff[k + order_start_index][order_start_index] << std::endl;
+ m_algebra.for_each3( table[0].m_v , table[1].m_v , table[0].m_v ,
+ typename operations_type::template scale_sum2< value_type , value_type >( val1 + coeff[k + order_start_index][order_start_index] ,
+ -coeff[k + order_start_index][order_start_index]) );
+ }
+
+ time_type calc_h_opt( time_type h , value_type error , size_t k ) const
+ {
+ BOOST_USING_STD_MIN();
+ BOOST_USING_STD_MAX();
+ using std::pow;
+
+ value_type expo=1.0/(m_interval_sequence[k-1]);
+ value_type facmin = pow BOOST_PREVENT_MACRO_SUBSTITUTION( STEPFAC3 , expo );
+ value_type fac;
+ if (error == 0.0)
+ fac=1.0/facmin;
+ else
+ {
+ fac = STEPFAC2 / pow BOOST_PREVENT_MACRO_SUBSTITUTION( error / STEPFAC1 , expo );
+ fac = max BOOST_PREVENT_MACRO_SUBSTITUTION( facmin/STEPFAC4 , min BOOST_PREVENT_MACRO_SUBSTITUTION( 1.0/facmin , fac ) );
+ }
+ //return std::abs(h*fac); //std::min( 0.1 , std::abs(h*fac) );
+ return h*fac;
+ }
+
+ bool in_convergence_window( size_t k ) const
+ {
+ if( (k == m_current_k_opt-1) && !m_last_step_rejected )
+ return true; // decrease order only if last step was not rejected
+ return ( (k == m_current_k_opt) || (k == m_current_k_opt+1) );
+ }
+
+ bool should_reject( value_type error , size_t k ) const
+ {
+ if( k == m_current_k_opt-1 )
+ {
+ const value_type d = m_interval_sequence[m_current_k_opt] * m_interval_sequence[m_current_k_opt+1] /
+ (m_interval_sequence[0]*m_interval_sequence[0]);
+ //step will fail, criterion 17.3.17 in NR
+ return ( error > d*d );
+ }
+ else if( k == m_current_k_opt )
+ {
+ const value_type d = m_interval_sequence[m_current_k_opt+1] / m_interval_sequence[0];
+ return ( error > d*d );
+ } else
+ return error > 1.0;
+ }
+
+ template< class StateIn1 , class DerivIn1 , class StateIn2 , class DerivIn2 >
+ value_type prepare_dense_output( int k , const StateIn1 &x_start , const DerivIn1 &dxdt_start ,
+ const StateIn2 & /* x_end */ , const DerivIn2 & /*dxdt_end */ , time_type dt ) // k is the order to which the result was approximated
+ {
+
+ // compute the coefficients of the interpolation polynomial
+ // we parametrize the interval t .. t+dt by theta = -1 .. 1
+ // we use 2k+3 values at the interval center theta=0 to obtain the interpolation coefficients
+ // the values are x(t+dt/2) and the derivatives dx/dt , ... d^(2k+2) x / dt^(2k+2) at the midpoints
+ // the derivatives are approximated via finite differences
+ // all values are obtained from interpolation of the results from the increasing orders of the midpoint calls
+
+ // calculate finite difference approximations to derivatives at the midpoint
+ for( int j = 0 ; j<=k ; j++ )
+ {
+ /* not working with boost units... */
+ const value_type d = m_interval_sequence[j] / ( static_cast<value_type>(2) * dt );
+ value_type f = 1.0; //factor 1/2 here because our interpolation interval has length 2 !!!
+ for( int kappa = 0 ; kappa <= 2*j+1 ; ++kappa )
+ {
+ calculate_finite_difference( j , kappa , f , dxdt_start );
+ f *= d;
+ }
+ //std::cout << "x_mp[" << j << "] = " << m_mp_states[j].m_v << std::endl;
+
+ if( j > 0 )
+ extrapolate_dense_out( j , m_mp_states , m_coeff );
+ }
+
+ //std::cout << "a_0 = " << m_mp_states[0].m_v << std::endl;
+
+ time_type d = dt/2;
+
+ // extrapolate finite differences
+ for( int kappa = 0 ; kappa<=2*k+1 ; kappa++ )
+ {
+ for( int j=1 ; j<=(k-kappa/2) ; ++j )
+ extrapolate_dense_out( j , m_diffs[kappa] , m_coeff , kappa/2 );
+
+ // extrapolation results are now stored in m_diffs[kappa][0]
+ //std::cout << "extrapolation result: " << m_diffs[kappa][0].m_v << std::endl;
+
+ // divide kappa-th derivative by kappa because we need these terms for dense output interpolation
+ m_algebra.for_each1( m_diffs[kappa][0].m_v , typename operations_type::template scale< time_type >( static_cast<time_type>(d) ) );
+
+ d *= dt/(2*(kappa+2));
+
+ //std::cout << "a_" << kappa+1 << " = " << m_diffs[kappa][0].m_v << std::endl;
+ }
+
+ // dense output coefficients a_0 is stored in m_mp_states[0], a_i for i = 1...2k are stored in m_diffs[i-1][0]
+
+ // the error is just the highest order coefficient of the interpolation polynomial
+ // this is because we use only the midpoint theta=0 as support for the interpolation (remember that theta = -1 .. 1)
+
+ value_type error = 0.0;
+ if( m_control_interpolation )
+ {
+ boost::numeric::odeint::copy( m_diffs[2*k+1][0].m_v , m_err.m_v );
+ error = m_error_checker.error( m_algebra , x_start , dxdt_start , m_err.m_v , dt );
+ }
+
+ return error;
+
+ // calculate coefficient a_{2k+1} = (2k+5)/4 * x_end - (2k+5)/4 * x_start - 1/4 * dxdt_end - 1/4 * dxdt_start + sum_i=0...k-1 (i-k-2)*a_{2i+1}
+
+
+ //std::cout << std::endl << x_start << std::endl << x_end << std::endl;
+ //std::cout << std::endl << dxdt_start << std::endl << dxdt_end << std::endl << std::endl;
+
+ // we don't use additional terms in the polynomial, the following calculations are thus not required
+
+/*
+ m_algebra.for_each5( m_a1.m_v , x_end , x_start , dxdt_end , dxdt_start ,
+ typename operations_type::template scale_sum4< value_type >( static_cast<value_type>(2*k+5)/static_cast<value_type>(4),
+ static_cast<value_type>(-2*k-5)/static_cast<value_type>(4),
+ static_cast<value_type>(-dt)/static_cast<value_type>(8) ,
+ static_cast<value_type>(-dt)/static_cast<value_type>(8) ) );
+ for( int i = 0 ; i<k ; ++i )
+ m_algebra.for_each3( m_a1.m_v , m_a1.m_v , m_diffs[2*i][0].m_v ,
+ typename operations_type::template scale_sum2< value_type >( 1 , i-k-2 ) );
+
+ //std::cout << "a_" << 2*k+1 << " = " << m_a1.m_v << std::endl;
+
+ // calculate coefficient a_{2k+2} = (k+2)/2 * x_end + (k+2)/2 * x_start - 1/4 * dxdt_end + 1/4 * dxdt_start + (k+2)/2 * x_mp + sum_i=1...k (i-k-2)*a_{2i}
+ m_algebra.for_each6( m_a2.m_v , x_end , x_start , dxdt_end , dxdt_start , m_mp_states[0].m_v ,
+ typename operations_type::template scale_sum5< value_type >( static_cast<value_type>(k+2)/static_cast<value_type>(2),
+ static_cast<value_type>(k+2)/static_cast<value_type>(2),
+ static_cast<value_type>(-dt)/static_cast<value_type>(8) ,
+ static_cast<value_type>(dt)/static_cast<value_type>(8) ,
+ static_cast<value_type>(-k-2) ) );
+ for( int i = 1 ; i<=k ; ++i )
+ m_algebra.for_each3( m_a2.m_v , m_a2.m_v , m_diffs[2*i-1][0].m_v ,
+ typename operations_type::template scale_sum2< value_type >( 1 , i-k-2 ) );
+
+ //std::cout << "a_" << 2*k+2 << " = " << m_a2.m_v << std::endl;
+
+ // calculate coefficient a_{2k+3} = -(2k+3)/4 * x_end + (2k+3)/4 * x_start + 1/4 * dxdt_end + 1/4 * dxdt_start + sum_i=0...k-1 (k+1-i)*a_{2i+1}
+ m_algebra.for_each5( m_a3.m_v , x_end , x_start , dxdt_end , dxdt_start ,
+ typename operations_type::template scale_sum4< value_type >( static_cast<value_type>(-2*k-3)/static_cast<value_type>(4),
+ static_cast<value_type>(2*k+3)/static_cast<value_type>(4),
+ static_cast<value_type>(dt)/static_cast<value_type>(8) ,
+ static_cast<value_type>(dt)/static_cast<value_type>(8) ) );
+ for( int i = 0 ; i<k ; ++i )
+ m_algebra.for_each3( m_a3.m_v , m_a3.m_v , m_diffs[2*i][0].m_v ,
+ typename operations_type::template scale_sum2< value_type >( 1 , k+1-i ) );
+
+ //std::cout << "a_" << 2*k+3 << " = " << m_a3.m_v << std::endl;
+
+ // calculate coefficient a_{2k+4} = -(k+1)/2 * x_end - (k+1)/2 * x_start + 1/4 * dxdt_end - 1/4 * dxdt_start - (k+1)/2 * x_mp + sum_i=0...k-1 (k+1-i)*a_{2i}
+ m_algebra.for_each6( m_a4.m_v , x_end , x_start , dxdt_end , dxdt_start , m_mp_states[0].m_v ,
+ typename operations_type::template scale_sum5< value_type >( static_cast<value_type>(-k-1)/static_cast<value_type>(2),
+ static_cast<value_type>(-k-1)/static_cast<value_type>(2),
+ static_cast<value_type>(dt)/static_cast<value_type>(8) ,
+ static_cast<value_type>(-dt)/static_cast<value_type>(8),
+ static_cast<value_type>(k+1) ) );
+ for( int i = 1 ; i<=k ; ++i )
+ m_algebra.for_each3( m_a4.m_v , m_a4.m_v , m_diffs[2*i-1][0].m_v ,
+ typename operations_type::template scale_sum2< value_type >( 1 , k+1-i ) );
+*/
+ //std::cout << "a_" << 2*k+4 << " = " << m_a4.m_v << std::endl;
+ }
+
+ template< class DerivIn >
+ void calculate_finite_difference( size_t j , size_t kappa , value_type fac , const DerivIn &dxdt )
+ {
+ const int m = m_interval_sequence[j]/2-1;
+ if( kappa == 0) // no calculation required for 0th derivative of f
+ {
+ m_algebra.for_each2( m_diffs[0][j].m_v , m_derivs[j][m].m_v ,
+ typename operations_type::template scale_sum1< value_type >( fac ) );
+ //std::cout << "j=" << j << ", kappa=" << kappa << ", m=" << m;
+ //std::cout << ": m_diffs[" << kappa << "][" << j << "] = " << fac << " * f[" << m << "] ";
+ //std::cout << "(size(f)=" << m_derivs[j].size() << ") = " << m_diffs[0][j].m_v << std::endl;
+
+ }
+ else
+ {
+ //std::cout << m_derivs[j][1].m_v << " , " << dxdt << std::endl;
+
+ // calculate the index of m_diffs for this kappa-j-combination
+ const int j_diffs = j - kappa/2;
+
+ //std::cout << "j=" << j << ", kappa=" << kappa << ", m=" << m << ": m_diffs[" << kappa << "][" << j_diffs << "] = " << fac << " ( 1*f[" << m+kappa << "]";
+
+ m_algebra.for_each2( m_diffs[kappa][j_diffs].m_v , m_derivs[j][m+kappa].m_v ,
+ typename operations_type::template scale_sum1< value_type >( fac ) );
+ value_type sign = -1.0;
+ int c = 1;
+ //computes the j-th order finite difference for the kappa-th derivative of f at t+dt/2 using function evaluations stored in m_derivs
+ for( int i = m+static_cast<int>(kappa)-2 ; i >= m-static_cast<int>(kappa) ; i -= 2 )
+ {
+ if( i >= 0 )
+ {
+ m_algebra.for_each3( m_diffs[kappa][j_diffs].m_v , m_diffs[kappa][j_diffs].m_v , m_derivs[j][i].m_v ,
+ typename operations_type::template scale_sum2< value_type , value_type >( 1.0 ,
+ sign * fac * boost::math::binomial_coefficient< value_type >( kappa , c ) ) );
+ //std::cout << ( (sign > 0.0) ? " + " : " - " ) <<
+ // boost::math::binomial_coefficient< double >( kappa , c ) << "*f[" << i << "]";
+ }
+ else
+ {
+ m_algebra.for_each3( m_diffs[kappa][j_diffs].m_v , m_diffs[kappa][j_diffs].m_v , dxdt ,
+ typename operations_type::template scale_sum2< value_type , value_type >( 1.0 , sign * fac ) );
+ //std::cout << ( (sign > 0.0) ? " + " : " - " ) << "dxdt";
+ }
+ sign *= -1;
+ ++c;
+ }
+ //std::cout << " ) = " << m_diffs[kappa][j_diffs].m_v << std::endl;
+ }
+ }
+
+ template< class StateOut >
+ void do_interpolation( time_type t , StateOut &out ) const
+ {
+ // interpolation polynomial is defined for theta = -1 ... 1
+ // m_k_final is the number of order-iterations done for the last step - it governs the order of the interpolation polynomial
+ const value_type theta = 2 * get_unit_value( (t - m_t_last) / (m_t - m_t_last) ) - 1;
+ //std::cout << "theta=" << theta << std::endl;
+ //start with x = a0 + a_{2k+1} theta^{2k+1} + a_{2k+2} theta^{2k+2} + a_{2k+3} theta^{2k+3} + a_{2k+4} theta^{2k+4}
+ //std::cout << "x = a_0 + ";
+
+/* m_algebra.for_each6( out , m_mp_states[0].m_v , m_a1.m_v , m_a2.m_v , m_a3.m_v , m_a4.m_v ,
+ typename operations_type::template scale_sum5< time_type >(
+ static_cast<time_type>( 1 ) ,
+ std::pow( theta , 2*m_k_final+1 ) ,
+ std::pow( theta , 2*m_k_final+2 ) ,
+ std::pow( theta , 2*m_k_final+3 ) ,
+ std::pow( theta , 2*m_k_final+4 ) ) );
+*/
+
+ // we use only values at interval center, that is theta=0, for interpolation
+ // our interpolation polynomial is thus of order 2k+2, hence we have 2k+3 terms
+
+ boost::numeric::odeint::copy( m_mp_states[0].m_v , out );
+ // add remaining terms: x += a_1 theta + a2 theta^2 + ... + a_{2k} theta^{2k}
+ value_type theta_pow( theta );
+ for( size_t i=0 ; i<=2*m_k_final+1 ; ++i )
+ {
+ //std::cout << "a_" << i+1 << " theta^" << i+1 << " = " << m_diffs[i][0].m_v[0] * std::pow( theta , i+1 ) << std::endl;
+ m_algebra.for_each3( out , out , m_diffs[i][0].m_v ,
+ typename operations_type::template scale_sum2< value_type >( static_cast<value_type>(1) , theta_pow ) );
+ theta_pow *= theta;
+ }
+ }
+
+ /* Resizer methods */
+ template< class StateIn >
+ bool resize_impl( const StateIn &x )
+ {
+ bool resized( false );
+
+ resized |= adjust_size_by_resizeability( m_x1 , x , typename is_resizeable<state_type>::type() );
+ resized |= adjust_size_by_resizeability( m_x2 , x , typename is_resizeable<state_type>::type() );
+ resized |= adjust_size_by_resizeability( m_dxdt1 , x , typename is_resizeable<state_type>::type() );
+ resized |= adjust_size_by_resizeability( m_dxdt2 , x , typename is_resizeable<state_type>::type() );
+ resized |= adjust_size_by_resizeability( m_err , x , typename is_resizeable<state_type>::type() );
+
+ for( size_t i = 0 ; i < m_k_max ; ++i )
+ resized |= adjust_size_by_resizeability( m_table[i] , x , typename is_resizeable<state_type>::type() );
+ for( size_t i = 0 ; i < m_k_max+1 ; ++i )
+ resized |= adjust_size_by_resizeability( m_mp_states[i] , x , typename is_resizeable<state_type>::type() );
+ for( size_t i = 0 ; i < m_k_max+1 ; ++i )
+ for( size_t j = 0 ; j < m_derivs[i].size() ; ++j )
+ resized |= adjust_size_by_resizeability( m_derivs[i][j] , x , typename is_resizeable<deriv_type>::type() );
+ for( size_t i = 0 ; i < 2*m_k_max+1 ; ++i )
+ for( size_t j = 0 ; j < m_diffs[i].size() ; ++j )
+ resized |= adjust_size_by_resizeability( m_diffs[i][j] , x , typename is_resizeable<deriv_type>::type() );
+
+ return resized;
+ }
+
+
+ state_type& get_current_state( void )
+ {
+ return m_current_state_x1 ? m_x1.m_v : m_x2.m_v ;
+ }
+
+ const state_type& get_current_state( void ) const
+ {
+ return m_current_state_x1 ? m_x1.m_v : m_x2.m_v ;
+ }
+
+ state_type& get_old_state( void )
+ {
+ return m_current_state_x1 ? m_x2.m_v : m_x1.m_v ;
+ }
+
+ const state_type& get_old_state( void ) const
+ {
+ return m_current_state_x1 ? m_x2.m_v : m_x1.m_v ;
+ }
+
+ deriv_type& get_current_deriv( void )
+ {
+ return m_current_state_x1 ? m_dxdt1.m_v : m_dxdt2.m_v ;
+ }
+
+ const deriv_type& get_current_deriv( void ) const
+ {
+ return m_current_state_x1 ? m_dxdt1.m_v : m_dxdt2.m_v ;
+ }
+
+ deriv_type& get_old_deriv( void )
+ {
+ return m_current_state_x1 ? m_dxdt2.m_v : m_dxdt1.m_v ;
+ }
+
+ const deriv_type& get_old_deriv( void ) const
+ {
+ return m_current_state_x1 ? m_dxdt2.m_v : m_dxdt1.m_v ;
+ }
+
+
+ void toggle_current_state( void )
+ {
+ m_current_state_x1 = ! m_current_state_x1;
+ }
+
+
+
+ default_error_checker< value_type, algebra_type , operations_type > m_error_checker;
+ modified_midpoint_dense_out< state_type , value_type , deriv_type , time_type , algebra_type , operations_type , resizer_type > m_midpoint;
+
+ bool m_control_interpolation;
+
+ bool m_last_step_rejected;
+ bool m_first;
+
+ time_type m_t;
+ time_type m_dt;
+ time_type m_dt_last;
+ time_type m_t_last;
+
+ size_t m_current_k_opt;
+ size_t m_k_final;
+
+ algebra_type m_algebra;
+
+ resizer_type m_resizer;
+
+ wrapped_state_type m_x1 , m_x2;
+ wrapped_deriv_type m_dxdt1 , m_dxdt2;
+ wrapped_state_type m_err;
+ bool m_current_state_x1;
+
+
+
+ value_vector m_error; // errors of repeated midpoint steps and extrapolations
+ int_vector m_interval_sequence; // stores the successive interval counts
+ value_matrix m_coeff;
+ int_vector m_cost; // costs for interval count
+
+ state_vector_type m_table; // sequence of states for extrapolation
+
+ //for dense output:
+ state_vector_type m_mp_states; // sequence of approximations of x at distance center
+ deriv_table_type m_derivs; // table of function values
+ deriv_table_type m_diffs; // table of function values
+
+ //wrapped_state_type m_a1 , m_a2 , m_a3 , m_a4;
+
+ const value_type STEPFAC1 , STEPFAC2 , STEPFAC3 , STEPFAC4 , KFAC1 , KFAC2;
+};
+
+}
+}
+}
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_BULIRSCH_STOER_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/controlled_runge_kutta.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/controlled_runge_kutta.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,607 @@
+/* [auto_generated]
+ boost/numeric/odeint/stepper/controlled_runge_kutta.hpp
+
+ [begin_description]
+ The default controlled stepper which can be used with all explicit Runge-Kutta error steppers.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_CONTROLLED_RUNGE_KUTTA_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_CONTROLLED_RUNGE_KUTTA_HPP_INCLUDED
+
+
+
+#include <cmath>
+
+#include <boost/config.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+#include <boost/numeric/odeint/util/bind.hpp>
+#include <boost/numeric/odeint/util/unwrap_reference.hpp>
+#include <boost/numeric/odeint/util/copy.hpp>
+
+#include <boost/numeric/odeint/util/state_wrapper.hpp>
+#include <boost/numeric/odeint/util/is_resizeable.hpp>
+#include <boost/numeric/odeint/util/resizer.hpp>
+
+#include <boost/numeric/odeint/algebra/range_algebra.hpp>
+#include <boost/numeric/odeint/algebra/default_operations.hpp>
+
+#include <boost/numeric/odeint/stepper/controlled_step_result.hpp>
+#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+/*
+ * Error checker for controlled_error_stepper
+ */
+template
+<
+class Value ,
+class Algebra = range_algebra ,
+class Operations = default_operations
+>
+class default_error_checker
+{
+public:
+
+ typedef Value value_type;
+ typedef Algebra algebra_type;
+ typedef Operations operations_type;
+
+
+ default_error_checker(
+ value_type eps_abs = static_cast< value_type >( 1.0e-6 ) ,
+ value_type eps_rel = static_cast< value_type >( 1.0e-6 ) ,
+ value_type a_x = static_cast< value_type >( 1 ) ,
+ value_type a_dxdt = static_cast< value_type >( 1 ) )
+ : m_eps_abs( eps_abs ) , m_eps_rel( eps_rel ) , m_a_x( a_x ) , m_a_dxdt( a_dxdt )
+ { }
+
+
+ template< class State , class Deriv , class Err , class Time >
+ value_type error( const State &x_old , const Deriv &dxdt_old , Err &x_err , Time dt ) const
+ {
+ return error( algebra_type() , x_old , dxdt_old , x_err , dt );
+ }
+
+ template< class State , class Deriv , class Err , class Time >
+ value_type error( algebra_type &algebra , const State &x_old , const Deriv &dxdt_old , Err &x_err , Time dt ) const
+ {
+ // this overwrites x_err !
+ algebra.for_each3( x_err , x_old , dxdt_old ,
+ typename operations_type::template rel_error< value_type >( m_eps_abs , m_eps_rel , m_a_x , m_a_dxdt * get_unit_value( dt ) ) );
+
+ value_type res = algebra.reduce( x_err ,
+ typename operations_type::template maximum< value_type >() , static_cast< value_type >( 0 ) );
+ return res;
+ }
+
+private:
+
+ value_type m_eps_abs;
+ value_type m_eps_rel;
+ value_type m_a_x;
+ value_type m_a_dxdt;
+
+};
+
+
+
+
+
+
+
+
+/*
+ * error stepper category dispatcher
+ */
+template<
+class ErrorStepper ,
+class ErrorChecker = default_error_checker< typename ErrorStepper::value_type ,
+typename ErrorStepper::algebra_type ,
+typename ErrorStepper::operations_type > ,
+class Resizer = typename ErrorStepper::resizer_type ,
+class ErrorStepperCategory = typename ErrorStepper::stepper_category
+>
+class controlled_runge_kutta ;
+
+
+
+
+/*
+ * explicit stepper version
+ *
+ * this class introduces the following try_step overloads
+ * try_step( sys , x , t , dt )
+ * try_step( sys , x , dxdt , t , dt )
+ * try_step( sys , in , t , out , dt )
+ * try_step( sys , in , dxdt , t , out , dt )
+ */
+template<
+class ErrorStepper ,
+class ErrorChecker ,
+class Resizer
+>
+class controlled_runge_kutta< ErrorStepper , ErrorChecker , Resizer , explicit_error_stepper_tag >
+{
+
+public:
+
+ typedef ErrorStepper stepper_type;
+ typedef typename stepper_type::state_type state_type;
+ typedef typename stepper_type::value_type value_type;
+ typedef typename stepper_type::deriv_type deriv_type;
+ typedef typename stepper_type::time_type time_type;
+ typedef typename stepper_type::algebra_type algebra_type;
+ typedef typename stepper_type::operations_type operations_type;
+ typedef Resizer resizer_type;
+ typedef ErrorChecker error_checker_type;
+ typedef explicit_controlled_stepper_tag stepper_category;
+ typedef typename stepper_type::wrapped_state_type wrapped_state_type;
+ typedef typename stepper_type::wrapped_deriv_type wrapped_deriv_type;
+
+ typedef controlled_runge_kutta< ErrorStepper , ErrorChecker , Resizer , explicit_error_stepper_tag > controlled_stepper_type;
+
+
+
+ controlled_runge_kutta(
+ const error_checker_type &error_checker = error_checker_type( ) ,
+ const stepper_type &stepper = stepper_type( )
+ )
+ : m_stepper( stepper ) , m_error_checker( error_checker )
+ { }
+
+
+
+ /*
+ * Version 1 : try_step( sys , x , t , dt )
+ *
+ * The overloads are needed to solve the forwarding problem
+ */
+ template< class System , class StateInOut >
+ controlled_step_result try_step( System system , StateInOut &x , time_type &t , time_type &dt )
+ {
+ return try_step_v1( system , x , t, dt );
+ }
+
+ template< class System , class StateInOut >
+ controlled_step_result try_step( System system , const StateInOut &x , time_type &t , time_type &dt )
+ {
+ return try_step_v1( system , x , t, dt );
+ }
+
+
+
+ /*
+ * Version 2 : try_step( sys , x , dxdt , t , dt )
+ *
+ * this version does not solve the forwarding problem, boost.range can not be used
+ */
+ template< class System , class StateInOut , class DerivIn >
+ controlled_step_result try_step( System system , StateInOut &x , const DerivIn &dxdt , time_type &t , time_type &dt )
+ {
+ m_xnew_resizer.adjust_size( x , detail::bind( &controlled_runge_kutta::template resize_m_xnew_impl< StateInOut > , detail::ref( *this ) , detail::_1 ) );
+ controlled_step_result res = try_step( system , x , dxdt , t , m_xnew.m_v , dt );
+ if( res == success )
+ {
+ boost::numeric::odeint::copy( m_xnew.m_v , x );
+ }
+ return res;
+ }
+
+ /*
+ * Version 3 : try_step( sys , in , t , out , dt )
+ *
+ * this version does not solve the forwarding problem, boost.range can not be used
+ *
+ * the disable is needed to avoid ambiguous overloads if state_type = time_type
+ */
+ template< class System , class StateIn , class StateOut >
+ typename boost::disable_if< boost::is_same< StateIn , time_type > , controlled_step_result >::type
+ try_step( System system , const StateIn &in , time_type &t , StateOut &out , time_type &dt )
+ {
+ typename odeint::unwrap_reference< System >::type &sys = system;
+ m_dxdt_resizer.adjust_size( in , detail::bind( &controlled_runge_kutta::template resize_m_dxdt_impl< StateIn > , detail::ref( *this ) , detail::_1 ) );
+ sys( in , m_dxdt.m_v , t );
+ return try_step( system , in , m_dxdt.m_v , t , out , dt );
+ }
+
+
+ /*
+ * Version 4 : try_step( sys , in , dxdt , t , out , dt )
+ *
+ * this version does not solve the forwarding problem, boost.range can not be used
+ */
+ template< class System , class StateIn , class DerivIn , class StateOut >
+ controlled_step_result try_step( System system , const StateIn &in , const DerivIn &dxdt , time_type &t , StateOut &out , time_type &dt )
+ {
+ BOOST_USING_STD_MIN();
+ BOOST_USING_STD_MAX();
+ using std::pow;
+
+ m_xerr_resizer.adjust_size( in , detail::bind( &controlled_runge_kutta::template resize_m_xerr_impl< StateIn > , detail::ref( *this ) , detail::_1 ) );
+
+ // do one step with error calculation
+ m_stepper.do_step( system , in , dxdt , t , out , dt , m_xerr.m_v );
+
+ m_max_rel_error = m_error_checker.error( m_stepper.algebra() , in , dxdt , m_xerr.m_v , dt );
+
+ if( m_max_rel_error > 1.0 )
+ {
+ // error too large - decrease dt ,limit scaling factor to 0.2 and reset state
+ dt *= max BOOST_PREVENT_MACRO_SUBSTITUTION ( static_cast<value_type>(9)/static_cast<value_type>(10) * pow( m_max_rel_error ,
+ static_cast<value_type>(-1) / ( m_stepper.error_order() - 1 ) ) ,
+ static_cast<value_type>(1)/static_cast<value_type> (5) );
+ return fail;
+ }
+ else
+ {
+ if( m_max_rel_error < 0.5 )
+ {
+ //error too small - increase dt and keep the evolution and limit scaling factor to 5.0
+ t += dt;
+ dt *= min BOOST_PREVENT_MACRO_SUBSTITUTION ( static_cast<value_type>(9)/static_cast<value_type>(10) * pow( m_max_rel_error ,
+ static_cast<value_type>(-1) / m_stepper.stepper_order() ) ,
+ static_cast<value_type>(5) );
+ return success;
+ }
+ else
+ {
+ t += dt;
+ return success;
+ }
+ }
+ }
+
+ value_type last_error( void ) const
+ {
+ return m_max_rel_error;
+ }
+
+
+
+ template< class StateType >
+ void adjust_size( const StateType &x )
+ {
+ resize_m_xerr_impl( x );
+ resize_m_dxdt_impl( x );
+ resize_m_xnew_impl( x );
+ m_stepper.adjust_size( x );
+ }
+
+ stepper_type& stepper( void )
+ {
+ return m_stepper;
+ }
+
+ const stepper_type& stepper( void ) const
+ {
+ return m_stepper;
+ }
+
+private:
+
+
+ template< class System , class StateInOut >
+ controlled_step_result try_step_v1( System system , StateInOut &x , time_type &t , time_type &dt )
+ {
+ typename odeint::unwrap_reference< System >::type &sys = system;
+ m_dxdt_resizer.adjust_size( x , detail::bind( &controlled_runge_kutta::template resize_m_dxdt_impl< StateInOut > , detail::ref( *this ) , detail::_1 ) );
+ sys( x , m_dxdt.m_v ,t );
+ return try_step( system , x , m_dxdt.m_v , t , dt );
+ }
+
+ template< class StateIn >
+ bool resize_m_xerr_impl( const StateIn &x )
+ {
+ return adjust_size_by_resizeability( m_xerr , x , typename is_resizeable<state_type>::type() );
+ }
+
+ template< class StateIn >
+ bool resize_m_dxdt_impl( const StateIn &x )
+ {
+ return adjust_size_by_resizeability( m_dxdt , x , typename is_resizeable<deriv_type>::type() );
+ }
+
+ template< class StateIn >
+ bool resize_m_xnew_impl( const StateIn &x )
+ {
+ return adjust_size_by_resizeability( m_xnew , x , typename is_resizeable<state_type>::type() );
+ }
+
+
+
+ stepper_type m_stepper;
+ error_checker_type m_error_checker;
+
+ resizer_type m_dxdt_resizer;
+ resizer_type m_xerr_resizer;
+ resizer_type m_xnew_resizer;
+
+ wrapped_deriv_type m_dxdt;
+ wrapped_state_type m_xerr;
+ wrapped_state_type m_xnew;
+ value_type m_max_rel_error;
+};
+
+
+
+
+
+
+
+
+
+
+/*
+ * explicit stepper fsal version
+ *
+ * the class introduces the following try_step overloads
+ * try_step( sys , x , t , dt )
+ * try_step( sys , in , t , out , dt )
+ * try_step( sys , x , dxdt , t , dt )
+ * try_step( sys , in , dxdt_in , t , out , dxdt_out , dt )
+ */
+template<
+class ErrorStepper ,
+class ErrorChecker ,
+class Resizer
+>
+class controlled_runge_kutta< ErrorStepper , ErrorChecker , Resizer , explicit_error_stepper_fsal_tag >
+{
+
+public:
+
+ typedef ErrorStepper stepper_type;
+ typedef typename stepper_type::state_type state_type;
+ typedef typename stepper_type::value_type value_type;
+ typedef typename stepper_type::deriv_type deriv_type;
+ typedef typename stepper_type::time_type time_type;
+ typedef typename stepper_type::algebra_type algebra_type;
+ typedef typename stepper_type::operations_type operations_type;
+ typedef Resizer resizer_type;
+ typedef ErrorChecker error_checker_type;
+ typedef explicit_controlled_stepper_fsal_tag stepper_category;
+ typedef typename stepper_type::wrapped_state_type wrapped_state_type;
+ typedef typename stepper_type::wrapped_deriv_type wrapped_deriv_type;
+
+ typedef controlled_runge_kutta< ErrorStepper , ErrorChecker , Resizer , explicit_error_stepper_tag > controlled_stepper_type;
+
+ controlled_runge_kutta(
+ const error_checker_type &error_checker = error_checker_type() ,
+ const stepper_type &stepper = stepper_type()
+ )
+ : m_stepper( stepper ) , m_error_checker( error_checker ) ,
+ m_first_call( true )
+ { }
+
+ /*
+ * Version 1 : try_step( sys , x , t , dt )
+ *
+ * The two overloads are needed in order to solve the forwarding problem
+ */
+ template< class System , class StateInOut >
+ controlled_step_result try_step( System system , StateInOut &x , time_type &t , time_type &dt )
+ {
+ return try_step_v1( system , x , t , dt );
+ }
+
+ template< class System , class StateInOut >
+ controlled_step_result try_step( System system , const StateInOut &x , time_type &t , time_type &dt )
+ {
+ return try_step_v1( system , x , t , dt );
+ }
+
+
+
+ /*
+ * Version 2 : try_step( sys , in , t , out , dt );
+ *
+ * This version does not solve the forwarding problem, boost::range can not be used.
+ *
+ * The disabler is needed to solve ambigous overloads
+ */
+ template< class System , class StateIn , class StateOut >
+ typename boost::disable_if< boost::is_same< StateIn , time_type > , controlled_step_result >::type
+ try_step( System system , const StateIn &in , time_type &t , StateOut &out , time_type &dt )
+ {
+ if( m_dxdt_resizer.adjust_size( in , detail::bind( &controlled_runge_kutta::template resize_m_dxdt_impl< StateIn > , detail::ref( *this ) , detail::_1 ) ) || m_first_call )
+ {
+ initialize( system , in , t );
+ }
+ return try_step( system , in , m_dxdt.m_v , t , out , dt );
+ }
+
+
+ /*
+ * Version 3 : try_step( sys , x , dxdt , t , dt )
+ *
+ * This version does not solve the forwarding problem, boost::range can not be used.
+ */
+ template< class System , class StateInOut , class DerivInOut >
+ controlled_step_result try_step( System system , StateInOut &x , DerivInOut &dxdt , time_type &t , time_type &dt )
+ {
+ m_xnew_resizer.adjust_size( x , detail::bind( &controlled_runge_kutta::template resize_m_xnew_impl< StateInOut > , detail::ref( *this ) , detail::_1 ) );
+ m_dxdt_new_resizer.adjust_size( x , detail::bind( &controlled_runge_kutta::template resize_m_dxdt_new_impl< StateInOut > , detail::ref( *this ) , detail::_1 ) );
+ controlled_step_result res = try_step( system , x , dxdt , t , m_xnew.m_v , m_dxdtnew.m_v , dt );
+ if( res == success )
+ {
+ boost::numeric::odeint::copy( m_xnew.m_v , x );
+ boost::numeric::odeint::copy( m_dxdtnew.m_v , dxdt );
+ }
+ return res;
+ }
+
+
+ /*
+ * Version 4 : try_step( sys , in , dxdt_in , t , out , dxdt_out , dt )
+ *
+ * This version does not solve the forwarding problem, boost::range can not be used.
+ */
+ template< class System , class StateIn , class DerivIn , class StateOut , class DerivOut >
+ controlled_step_result try_step( System system , const StateIn &in , const DerivIn &dxdt_in , time_type &t ,
+ StateOut &out , DerivOut &dxdt_out , time_type &dt )
+ {
+ BOOST_USING_STD_MIN();
+ BOOST_USING_STD_MAX();
+
+ using std::pow;
+
+ m_xerr_resizer.adjust_size( in , detail::bind( &controlled_runge_kutta::template resize_m_xerr_impl< StateIn > , detail::ref( *this ) , detail::_1 ) );
+
+ //fsal: m_stepper.get_dxdt( dxdt );
+ //fsal: m_stepper.do_step( sys , x , dxdt , t , dt , m_x_err );
+ m_stepper.do_step( system , in , dxdt_in , t , out , dxdt_out , dt , m_xerr.m_v );
+
+ // this potentially overwrites m_x_err! (standard_error_checker does, at least)
+ value_type max_rel_err = m_error_checker.error( m_stepper.algebra() , in , dxdt_in , m_xerr.m_v , dt );
+
+ if( max_rel_err > 1.0 )
+ {
+ // error too large - decrease dt ,limit scaling factor to 0.2 and reset state
+ dt *= max BOOST_PREVENT_MACRO_SUBSTITUTION ( static_cast<value_type>( static_cast<value_type>(9)/static_cast<value_type>(10) * pow( max_rel_err , static_cast<value_type>(-1) / ( m_stepper.error_order() - 1 ) ) ) , static_cast<value_type>( static_cast<value_type>(1)/static_cast<value_type> (5)) );
+ return fail;
+ }
+ else
+ {
+ if( max_rel_err < 0.5 )
+ { //error too small - increase dt and keep the evolution and limit scaling factor to 5.0
+ t += dt;
+ dt *= min BOOST_PREVENT_MACRO_SUBSTITUTION ( static_cast<value_type>( static_cast<value_type>(9)/static_cast<value_type>(10) * pow( max_rel_err , static_cast<value_type>(-1) / m_stepper.stepper_order() ) ) , static_cast<value_type>(5) );
+ return success;
+ }
+ else
+ {
+ t += dt;
+ return success;
+ }
+ }
+ }
+
+
+
+ void reset( void )
+ {
+ m_first_call = true;
+ }
+
+ template< class DerivIn >
+ void initialize( const DerivIn &deriv )
+ {
+ boost::numeric::odeint::copy( deriv , m_dxdt.m_v );
+ m_first_call = false;
+ }
+
+ template< class System , class StateIn >
+ void initialize( System system , const StateIn &x , time_type t )
+ {
+ typename odeint::unwrap_reference< System >::type &sys = system;
+ sys( x , m_dxdt.m_v , t );
+ m_first_call = false;
+ }
+
+ bool is_initialized( void ) const
+ {
+ return ! m_first_call;
+ }
+
+
+
+ template< class StateType >
+ void adjust_size( const StateType &x )
+ {
+ resize_m_xerr_impl( x );
+ resize_m_dxdt_impl( x );
+ resize_m_dxdt_new_impl( x );
+ resize_m_xnew_impl( x );
+ }
+
+
+ stepper_type& stepper( void )
+ {
+ return m_stepper;
+ }
+
+ const stepper_type& stepper( void ) const
+ {
+ return m_stepper;
+ }
+
+
+
+private:
+
+
+ template< class StateIn >
+ bool resize_m_xerr_impl( const StateIn &x )
+ {
+ return adjust_size_by_resizeability( m_xerr , x , typename is_resizeable<state_type>::type() );
+ }
+
+ template< class StateIn >
+ bool resize_m_dxdt_impl( const StateIn &x )
+ {
+ return adjust_size_by_resizeability( m_dxdt , x , typename is_resizeable<deriv_type>::type() );
+ }
+
+ template< class StateIn >
+ bool resize_m_dxdt_new_impl( const StateIn &x )
+ {
+ return adjust_size_by_resizeability( m_dxdtnew , x , typename is_resizeable<deriv_type>::type() );
+ }
+
+ template< class StateIn >
+ bool resize_m_xnew_impl( const StateIn &x )
+ {
+ return adjust_size_by_resizeability( m_xnew , x , typename is_resizeable<state_type>::type() );
+ }
+
+
+ template< class System , class StateInOut >
+ controlled_step_result try_step_v1( System system , StateInOut &x , time_type &t , time_type &dt )
+ {
+ if( m_dxdt_resizer.adjust_size( x , detail::bind( &controlled_runge_kutta::template resize_m_dxdt_impl< StateInOut > , detail::ref( *this ) , detail::_1 ) ) || m_first_call )
+ {
+ initialize( system , x , t );
+ }
+ return try_step( system , x , m_dxdt.m_v , t , dt );
+ }
+
+
+ stepper_type m_stepper;
+ error_checker_type m_error_checker;
+
+ resizer_type m_dxdt_resizer;
+ resizer_type m_xerr_resizer;
+ resizer_type m_xnew_resizer;
+ resizer_type m_dxdt_new_resizer;
+
+ wrapped_deriv_type m_dxdt;
+ wrapped_state_type m_xerr;
+ wrapped_state_type m_xnew;
+ wrapped_deriv_type m_dxdtnew;
+ bool m_first_call;
+};
+
+
+
+
+} // odeint
+} // numeric
+} // boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_CONTROLLED_RUNGE_KUTTA_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/controlled_step_result.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/controlled_step_result.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,40 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/controlled_step_result.hpp
+
+ [begin_description]
+ Defines the result type for all controlled stepper.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_CONTROLLED_STEP_RESULT_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_CONTROLLED_STEP_RESULT_HPP_INCLUDED
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+/**
+ * \enum Enum representing the return values of the controlled steppers.
+ */
+typedef enum
+{
+ success , /** <The trial step war successful, hence the state and the time have been advanced. */
+ fail /** <The step was not succesful and might possibly be repeated with a small step size. */
+} controlled_step_result;
+
+} // namespace odeint
+} // numeric
+} // boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_CONTROLLED_STEP_RESULT_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/dense_output_runge_kutta.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/dense_output_runge_kutta.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,390 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/dense_output_runge_kutta.hpp
+
+ [begin_description]
+ Implementation of the Dense-output stepper for all steppers. Note, that this class does
+ not computes the result but serves as an interface.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_DENSE_OUTPUT_RUNGE_KUTTA_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_DENSE_OUTPUT_RUNGE_KUTTA_HPP_INCLUDED
+
+
+#include <utility>
+#include <stdexcept>
+
+#include <boost/numeric/odeint/util/bind.hpp>
+
+#include <boost/numeric/odeint/util/copy.hpp>
+
+#include <boost/numeric/odeint/util/state_wrapper.hpp>
+#include <boost/numeric/odeint/util/is_resizeable.hpp>
+#include <boost/numeric/odeint/util/resizer.hpp>
+
+#include <boost/numeric/odeint/stepper/controlled_step_result.hpp>
+#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+template< class Stepper , class StepperCategory = typename Stepper::stepper_category >
+class dense_output_runge_kutta;
+
+
+
+
+template< class Stepper >
+class dense_output_runge_kutta< Stepper , stepper_tag >
+{
+
+public:
+
+ /*
+ * We do not need all typedefs.
+ */
+ typedef Stepper stepper_type;
+ typedef typename stepper_type::state_type state_type;
+ typedef typename stepper_type::wrapped_state_type wrapped_state_type;
+ typedef typename stepper_type::value_type value_type;
+ typedef typename stepper_type::deriv_type deriv_type;
+ typedef typename stepper_type::wrapped_deriv_type wrapped_deriv_type;
+ typedef typename stepper_type::time_type time_type;
+ typedef typename stepper_type::algebra_type algebra_type;
+ typedef typename stepper_type::operations_type operations_type;
+ typedef typename stepper_type::resizer_type resizer_type;
+ typedef dense_output_stepper_tag stepper_category;
+ typedef dense_output_runge_kutta< Stepper > dense_output_stepper_type;
+
+
+
+ dense_output_runge_kutta( const stepper_type &stepper = stepper_type() )
+ : m_stepper( stepper ) , m_resizer() ,
+ m_x1() , m_x2() , m_current_state_x1( true ) ,
+ m_t() , m_t_old() , m_dt()
+ { }
+
+
+ template< class StateType >
+ void initialize( const StateType &x0 , time_type t0 , time_type dt0 )
+ {
+ m_resizer.adjust_size( x0 , detail::bind( &dense_output_stepper_type::template resize_impl< StateType > , detail::ref( *this ) , detail::_1 ) );
+ boost::numeric::odeint::copy( x0 , get_current_state() );
+ m_t = t0;
+ m_dt = dt0;
+ }
+
+ template< class System >
+ std::pair< time_type , time_type > do_step( System system )
+ {
+ m_stepper.do_step( system , get_current_state() , m_t , get_old_state() , m_dt );
+ m_t_old = m_t;
+ m_t += m_dt;
+ toggle_current_state();
+ return std::make_pair( m_t_old , m_dt );
+ }
+
+ /*
+ * The next two overloads are needed to solve the forwarding problem
+ */
+ template< class StateOut >
+ void calc_state( time_type t , StateOut &x ) const
+ {
+ m_stepper.calc_state( x , t , get_old_state() , m_t_old , get_current_state() , m_t );
+ }
+
+ template< class StateOut >
+ void calc_state( time_type t , const StateOut &x ) const
+ {
+ m_stepper.calc_state( x , t , get_old_state() , m_t_old , get_current_state() , m_t );
+ }
+
+ template< class StateType >
+ void adjust_size( const StateType &x )
+ {
+ resize_impl( x );
+ m_stepper.stepper().resize( x );
+ }
+
+ const state_type& current_state( void ) const
+ {
+ return get_current_state();
+ }
+
+ time_type current_time( void ) const
+ {
+ return m_t;
+ }
+
+ const state_type& previous_state( void ) const
+ {
+ return get_old_state();
+ }
+
+ time_type previous_time( void ) const
+ {
+ return m_t_old;
+ }
+
+
+private:
+
+ state_type& get_current_state( void )
+ {
+ return m_current_state_x1 ? m_x1.m_v : m_x2.m_v ;
+ }
+
+ const state_type& get_current_state( void ) const
+ {
+ return m_current_state_x1 ? m_x1.m_v : m_x2.m_v ;
+ }
+
+ state_type& get_old_state( void )
+ {
+ return m_current_state_x1 ? m_x2.m_v : m_x1.m_v ;
+ }
+
+ const state_type& get_old_state( void ) const
+ {
+ return m_current_state_x1 ? m_x2.m_v : m_x1.m_v ;
+ }
+
+ void toggle_current_state( void )
+ {
+ m_current_state_x1 = ! m_current_state_x1;
+ }
+
+
+ template< class StateIn >
+ bool resize_impl( const StateIn &x )
+ {
+ bool resized = false;
+ resized |= adjust_size_by_resizeability( m_x1 , x , typename is_resizeable<state_type>::type() );
+ resized |= adjust_size_by_resizeability( m_x2 , x , typename is_resizeable<state_type>::type() );
+ return resized;
+ }
+
+
+ stepper_type m_stepper;
+ resizer_type m_resizer;
+ wrapped_state_type m_x1 , m_x2;
+ bool m_current_state_x1; // if true, the current state is m_x1
+ time_type m_t , m_t_old , m_dt;
+
+};
+
+
+
+
+
+
+template< class Stepper >
+class dense_output_runge_kutta< Stepper , explicit_controlled_stepper_fsal_tag >
+{
+public:
+
+ /*
+ * We do not need all typedefs.
+ */
+ typedef Stepper controlled_stepper_type;
+
+ typedef typename controlled_stepper_type::stepper_type stepper_type;
+ typedef typename stepper_type::state_type state_type;
+ typedef typename stepper_type::wrapped_state_type wrapped_state_type;
+ typedef typename stepper_type::value_type value_type;
+ typedef typename stepper_type::deriv_type deriv_type;
+ typedef typename stepper_type::wrapped_deriv_type wrapped_deriv_type;
+ typedef typename stepper_type::time_type time_type;
+ typedef typename stepper_type::algebra_type algebra_type;
+ typedef typename stepper_type::operations_type operations_type;
+ typedef typename stepper_type::resizer_type resizer_type;
+ typedef dense_output_stepper_tag stepper_category;
+ typedef dense_output_runge_kutta< Stepper > dense_output_stepper_type;
+
+
+ dense_output_runge_kutta( const controlled_stepper_type &stepper = controlled_stepper_type() )
+ : m_stepper( stepper ) , m_resizer() ,
+ m_current_state_x1( true ) ,
+ m_x1() , m_x2() , m_dxdt1() , m_dxdt2() ,
+ m_t() , m_t_old() , m_dt() ,
+ m_is_deriv_initialized( false )
+ { }
+
+
+ template< class StateType >
+ void initialize( const StateType &x0 , time_type t0 , time_type dt0 )
+ {
+ m_resizer.adjust_size( x0 , detail::bind( &dense_output_stepper_type::template resize< StateType > , detail::ref( *this ) , detail::_1 ) );
+ boost::numeric::odeint::copy( x0 , get_current_state() );
+ m_t = t0;
+ m_dt = dt0;
+ m_is_deriv_initialized = false;
+ }
+
+ template< class System >
+ std::pair< time_type , time_type > do_step( System system )
+ {
+ const size_t max_count = 1000;
+
+ if( !m_is_deriv_initialized )
+ {
+ typename odeint::unwrap_reference< System >::type &sys = system;
+ sys( get_current_state() , get_current_deriv() , m_t );
+ m_is_deriv_initialized = true;
+ }
+
+ controlled_step_result res = fail;
+ m_t_old = m_t;
+ size_t count = 0;
+ do
+ {
+ res = m_stepper.try_step( system , get_current_state() , get_current_deriv() , m_t ,
+ get_old_state() , get_old_deriv() , m_dt );
+ if( count++ == max_count )
+ throw std::overflow_error( "dense_output_controlled_explicit : too much iterations!");
+ }
+ while( res == fail );
+ toggle_current_state();
+ return std::make_pair( m_t_old , m_t );
+ }
+
+
+ /*
+ * The two overloads are needed in order to solve the forwarding problem.
+ */
+ template< class StateOut >
+ void calc_state( time_type t , StateOut &x ) const
+ {
+ m_stepper.stepper().calc_state( t , x , get_old_state() , get_old_deriv() , m_t_old ,
+ get_current_state() , get_current_deriv() , m_t );
+ }
+
+ template< class StateOut >
+ void calc_state( time_type t , const StateOut &x ) const
+ {
+ m_stepper.stepper().calc_state( t , x , get_old_state() , get_old_deriv() , m_t_old ,
+ get_current_state() , get_current_deriv() , m_t );
+ }
+
+
+ template< class StateIn >
+ bool resize( const StateIn &x )
+ {
+ bool resized = false;
+ resized |= adjust_size_by_resizeability( m_x1 , x , typename is_resizeable<state_type>::type() );
+ resized |= adjust_size_by_resizeability( m_x2 , x , typename is_resizeable<state_type>::type() );
+ resized |= adjust_size_by_resizeability( m_dxdt1 , x , typename is_resizeable<deriv_type>::type() );
+ resized |= adjust_size_by_resizeability( m_dxdt2 , x , typename is_resizeable<deriv_type>::type() );
+ return resized;
+ }
+
+
+ template< class StateType >
+ void adjust_size( const StateType &x )
+ {
+ resize( x );
+ m_stepper.stepper().resize( x );
+ }
+
+ const state_type& current_state( void ) const
+ {
+ return get_current_state();
+ }
+
+ time_type current_time( void ) const
+ {
+ return m_t;
+ }
+
+ const state_type& previous_state( void ) const
+ {
+ return get_old_state();
+ }
+
+ time_type previous_time( void ) const
+ {
+ return m_t_old;
+ }
+
+ time_type current_time_step( void ) const
+ {
+ return m_dt;
+ }
+
+
+private:
+
+ state_type& get_current_state( void )
+ {
+ return m_current_state_x1 ? m_x1.m_v : m_x2.m_v ;
+ }
+
+ const state_type& get_current_state( void ) const
+ {
+ return m_current_state_x1 ? m_x1.m_v : m_x2.m_v ;
+ }
+
+ state_type& get_old_state( void )
+ {
+ return m_current_state_x1 ? m_x2.m_v : m_x1.m_v ;
+ }
+
+ const state_type& get_old_state( void ) const
+ {
+ return m_current_state_x1 ? m_x2.m_v : m_x1.m_v ;
+ }
+
+ deriv_type& get_current_deriv( void )
+ {
+ return m_current_state_x1 ? m_dxdt1.m_v : m_dxdt2.m_v ;
+ }
+
+ const deriv_type& get_current_deriv( void ) const
+ {
+ return m_current_state_x1 ? m_dxdt1.m_v : m_dxdt2.m_v ;
+ }
+
+ deriv_type& get_old_deriv( void )
+ {
+ return m_current_state_x1 ? m_dxdt2.m_v : m_dxdt1.m_v ;
+ }
+
+ const deriv_type& get_old_deriv( void ) const
+ {
+ return m_current_state_x1 ? m_dxdt2.m_v : m_dxdt1.m_v ;
+ }
+
+
+ void toggle_current_state( void )
+ {
+ m_current_state_x1 = ! m_current_state_x1;
+ }
+
+
+ controlled_stepper_type m_stepper;
+ resizer_type m_resizer;
+ bool m_current_state_x1;
+ wrapped_state_type m_x1 , m_x2;
+ wrapped_deriv_type m_dxdt1 , m_dxdt2;
+ time_type m_t , m_t_old , m_dt;
+ bool m_is_deriv_initialized;
+
+};
+
+} // namespace odeint
+} // namespace numeric
+} // namespace boost
+
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_DENSE_OUTPUT_RUNGE_KUTTA_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/detail/adams_bashforth_call_algebra.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/detail/adams_bashforth_call_algebra.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,151 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/detail/adams_bashforth_call_algebra.hpp
+
+ [begin_description]
+ Algebra caller for the Adams Bashforth stepper.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_BASHFORTH_CALL_ALGEBRA_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_BASHFORTH_CALL_ALGEBRA_HPP_INCLUDED
+
+#include <boost/assert.hpp>
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+namespace detail {
+
+template< size_t Step , class Algebra , class Operations >
+struct adams_bashforth_call_algebra;
+
+template< class Algebra , class Operations >
+struct adams_bashforth_call_algebra< 1 , Algebra , Operations >
+{
+ template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time >
+ void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , Time dt ) const
+ {
+ typedef typename Coefficients::value_type value_type;
+ algebra.for_each3( out , in , steps[0].m_v , typename Operations::template scale_sum2< value_type , Time >( 1.0 , dt * coef[0] ) );
+ }
+};
+
+
+template< class Algebra , class Operations >
+struct adams_bashforth_call_algebra< 2 , Algebra , Operations >
+{
+ template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time >
+ void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , Time dt ) const
+ {
+ typedef typename Coefficients::value_type value_type;
+ algebra.for_each4( out , in , steps[0].m_v , steps[1].m_v ,
+ typename Operations::template scale_sum3< value_type , Time , Time >( 1.0 , dt * coef[0] , dt * coef[1] ) );
+ }
+};
+
+
+template< class Algebra , class Operations >
+struct adams_bashforth_call_algebra< 3 , Algebra , Operations >
+{
+ template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time >
+ void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , Time dt ) const
+ {
+ typedef typename Coefficients::value_type value_type;
+ algebra.for_each5( out , in , steps[0].m_v , steps[1].m_v , steps[2].m_v ,
+ typename Operations::template scale_sum4< value_type , Time , Time , Time >( 1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] ) );
+ }
+};
+
+
+template< class Algebra , class Operations >
+struct adams_bashforth_call_algebra< 4 , Algebra , Operations >
+{
+ template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time >
+ void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , Time dt ) const
+ {
+ typedef typename Coefficients::value_type value_type;
+ algebra.for_each6( out , in , steps[0].m_v , steps[1].m_v , steps[2].m_v , steps[3].m_v ,
+ typename Operations::template scale_sum5< value_type , Time , Time , Time >(
+ 1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] ) );
+ }
+};
+
+
+template< class Algebra , class Operations >
+struct adams_bashforth_call_algebra< 5 , Algebra , Operations >
+{
+ template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time >
+ void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , Time dt ) const
+ {
+ typedef typename Coefficients::value_type value_type;
+ algebra.for_each7( out , in , steps[0].m_v , steps[1].m_v , steps[2].m_v , steps[3].m_v , steps[4].m_v ,
+ typename Operations::template scale_sum6< value_type , Time , Time , Time , Time >(
+ 1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] , dt * coef[4] ) );
+ }
+};
+
+
+template< class Algebra , class Operations >
+struct adams_bashforth_call_algebra< 6 , Algebra , Operations >
+{
+ template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time >
+ void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , Time dt ) const
+ {
+ typedef typename Coefficients::value_type value_type;
+ algebra.for_each8( out , in , steps[0].m_v , steps[1].m_v , steps[2].m_v , steps[3].m_v , steps[4].m_v , steps[5].m_v ,
+ typename Operations::template scale_sum7< value_type , Time , Time , Time , Time , Time >(
+ 1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] , dt * coef[4] , dt * coef[5] ) );
+ }
+};
+
+
+template< class Algebra , class Operations >
+struct adams_bashforth_call_algebra< 7 , Algebra , Operations >
+{
+ template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time >
+ void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , Time dt ) const
+ {
+ BOOST_ASSERT( false ); // not implemented
+ // typedef typename Coefficients::value_type value_type;
+ // Algebra::for_each9( out , in , steps[0] , steps[1] , steps[2] , steps[3] , steps[4] , steps[5] , steps[6]
+ // typename Operations::template scale_sum8< value_type , Time , Time , Time , Time , Time , Time >(
+ // 1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] , dt * coef[4] , dt * coef[5] , dt * coef[6] ) );
+ }
+};
+
+
+template< class Algebra , class Operations >
+struct adams_bashforth_call_algebra< 8 , Algebra , Operations >
+{
+ template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time >
+ void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , Time dt ) const
+ {
+ BOOST_ASSERT( false ); // not implemented
+ // typedef typename Coefficients::value_type value_type;
+ // Algebra::for_each10( out , in , steps[0] , steps[1] , steps[2] , steps[3] , steps[4] , steps[5] , steps[6] , steps[7] ,
+ // typename Operations::template scale_sum9< value_type , Time , Time , Time , Time , Time , Time , Time >(
+ // 1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] , dt * coef[4] , dt * coef[5] , dt * coef[6] , dt * coef[7] ) );
+ }
+};
+
+
+
+
+} // detail
+} // odeint
+} // numeric
+} // boost
+
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_BASHFORTH_CALL_ALGEBRA_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/detail/adams_bashforth_coefficients.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/detail/adams_bashforth_coefficients.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,168 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/detail/adams_bashforth_coefficients.hpp
+
+ [begin_description]
+ Definition of the coefficients for the Adams-Bashforth method.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_BASHFORTH_COEFFICIENTS_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_BASHFORTH_COEFFICIENTS_HPP_INCLUDED
+
+#include <boost/array.hpp>
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+namespace detail {
+
+template< class Value , size_t Steps >
+class adams_bashforth_coefficients ;
+
+template< class Value >
+class adams_bashforth_coefficients< Value , 1 > : public boost::array< Value , 1 >
+{
+public:
+ adams_bashforth_coefficients( void )
+ : boost::array< Value , 1 >()
+ {
+ (*this)[0] = static_cast< Value >( 1 );
+ }
+};
+
+
+template< class Value >
+class adams_bashforth_coefficients< Value , 2 > : public boost::array< Value , 2 >
+{
+public:
+ adams_bashforth_coefficients( void )
+ : boost::array< Value , 2 >()
+ {
+ (*this)[0] = static_cast< Value >( 3 ) / static_cast< Value >( 2 );
+ (*this)[1] = -static_cast< Value >( 1 ) / static_cast< Value >( 2 );
+ }
+};
+
+
+template< class Value >
+class adams_bashforth_coefficients< Value , 3 > : public boost::array< Value , 3 >
+{
+public:
+ adams_bashforth_coefficients( void )
+ : boost::array< Value , 3 >()
+ {
+ (*this)[0] = static_cast< Value >( 23 ) / static_cast< Value >( 12 );
+ (*this)[1] = -static_cast< Value >( 4 ) / static_cast< Value >( 3 );
+ (*this)[2] = static_cast< Value >( 5 ) / static_cast< Value >( 12 );
+ }
+};
+
+
+template< class Value >
+class adams_bashforth_coefficients< Value , 4 > : public boost::array< Value , 4 >
+{
+public:
+ adams_bashforth_coefficients( void )
+ : boost::array< Value , 4 >()
+ {
+ (*this)[0] = static_cast< Value >( 55 ) / static_cast< Value >( 24 );
+ (*this)[1] = -static_cast< Value >( 59 ) / static_cast< Value >( 24 );
+ (*this)[2] = static_cast< Value >( 37 ) / static_cast< Value >( 24 );
+ (*this)[3] = -static_cast< Value >( 3 ) / static_cast< Value >( 8 );
+ }
+};
+
+
+template< class Value >
+class adams_bashforth_coefficients< Value , 5 > : public boost::array< Value , 5 >
+{
+public:
+ adams_bashforth_coefficients( void )
+ : boost::array< Value , 5 >()
+ {
+ (*this)[0] = static_cast< Value >( 1901 ) / static_cast< Value >( 720 );
+ (*this)[1] = -static_cast< Value >( 1387 ) / static_cast< Value >( 360 );
+ (*this)[2] = static_cast< Value >( 109 ) / static_cast< Value >( 30 );
+ (*this)[3] = -static_cast< Value >( 637 ) / static_cast< Value >( 360 );
+ (*this)[4] = static_cast< Value >( 251 ) / static_cast< Value >( 720 );
+ }
+};
+
+
+template< class Value >
+class adams_bashforth_coefficients< Value , 6 > : public boost::array< Value , 6 >
+{
+public:
+ adams_bashforth_coefficients( void )
+ : boost::array< Value , 6 >()
+ {
+ (*this)[0] = static_cast< Value >( 4277 ) / static_cast< Value >( 1440 );
+ (*this)[1] = -static_cast< Value >( 2641 ) / static_cast< Value >( 480 );
+ (*this)[2] = static_cast< Value >( 4991 ) / static_cast< Value >( 720 );
+ (*this)[3] = -static_cast< Value >( 3649 ) / static_cast< Value >( 720 );
+ (*this)[4] = static_cast< Value >( 959 ) / static_cast< Value >( 480 );
+ (*this)[5] = -static_cast< Value >( 95 ) / static_cast< Value >( 288 );
+ }
+};
+
+
+template< class Value >
+class adams_bashforth_coefficients< Value , 7 > : public boost::array< Value , 7 >
+{
+public:
+ adams_bashforth_coefficients( void )
+ : boost::array< Value , 7 >()
+ {
+ (*this)[0] = static_cast< Value >( 198721 ) / static_cast< Value >( 60480 );
+ (*this)[1] = -static_cast< Value >( 18637 ) / static_cast< Value >( 2520 );
+ (*this)[2] = static_cast< Value >( 235183 ) / static_cast< Value >( 20160 );
+ (*this)[3] = -static_cast< Value >( 10754 ) / static_cast< Value >( 945 );
+ (*this)[4] = static_cast< Value >( 135713 ) / static_cast< Value >( 20160 );
+ (*this)[5] = -static_cast< Value >( 5603 ) / static_cast< Value >( 2520 );
+ (*this)[6] = static_cast< Value >( 19087 ) / static_cast< Value >( 60480 );
+ }
+};
+
+
+template< class Value >
+class adams_bashforth_coefficients< Value , 8 > : public boost::array< Value , 8 >
+{
+public:
+ adams_bashforth_coefficients( void )
+ : boost::array< Value , 8 >()
+ {
+ (*this)[0] = static_cast< Value >( 16083 ) / static_cast< Value >( 4480 );
+ (*this)[1] = -static_cast< Value >( 1152169 ) / static_cast< Value >( 120960 );
+ (*this)[2] = static_cast< Value >( 242653 ) / static_cast< Value >( 13440 );
+ (*this)[3] = -static_cast< Value >( 296053 ) / static_cast< Value >( 13440 );
+ (*this)[4] = static_cast< Value >( 2102243 ) / static_cast< Value >( 120960 );
+ (*this)[5] = -static_cast< Value >( 115747 ) / static_cast< Value >( 13440 );
+ (*this)[6] = static_cast< Value >( 32863 ) / static_cast< Value >( 13440 );
+ (*this)[7] = -static_cast< Value >( 5257 ) / static_cast< Value >( 17280 );
+ }
+};
+
+
+
+
+
+
+
+} // detail
+} // odeint
+} // numeric
+} // boost
+
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_BASHFORTH_COEFFICIENTS_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/detail/adams_moulton_call_algebra.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/detail/adams_moulton_call_algebra.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,142 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/detail/adams_moulton_call_algebra.hpp
+
+ [begin_description]
+ Algebra caller for the Adams Moulton method.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_MOULTON_CALL_ALGEBRA_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_MOULTON_CALL_ALGEBRA_HPP_INCLUDED
+
+#include <boost/assert.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+namespace detail {
+
+template< size_t Step , class Algebra , class Operations >
+struct adams_moulton_call_algebra;
+
+template< class Algebra , class Operations >
+struct adams_moulton_call_algebra< 1 , Algebra , Operations >
+{
+ template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time >
+ void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , Time dt ) const
+ {
+ typedef typename Coefficients::value_type value_type;
+ algebra.for_each3( out , in , dxdt , typename Operations::template scale_sum2< value_type , Time >( 1.0 , dt * coef[0] ) );
+ }
+};
+
+
+template< class Algebra , class Operations >
+struct adams_moulton_call_algebra< 2 , Algebra , Operations >
+{
+ template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time >
+ void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , Time dt ) const
+ {
+ typedef typename Coefficients::value_type value_type;
+ algebra.for_each4( out , in , dxdt , steps[0].m_v ,
+ typename Operations::template scale_sum3< value_type , Time , Time >( 1.0 , dt * coef[0] , dt * coef[1] ) );
+ }
+};
+
+
+template< class Algebra , class Operations >
+struct adams_moulton_call_algebra< 3 , Algebra , Operations >
+{
+ template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time >
+ void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , Time dt ) const
+ {
+ typedef typename Coefficients::value_type value_type;
+ algebra.for_each5( out , in , dxdt , steps[0].m_v , steps[1].m_v ,
+ typename Operations::template scale_sum4< value_type , Time , Time >( 1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] ) );
+ }
+};
+
+
+template< class Algebra , class Operations >
+struct adams_moulton_call_algebra< 4 , Algebra , Operations >
+{
+ template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time >
+ void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , Time dt ) const
+ {
+ typedef typename Coefficients::value_type value_type;
+ algebra.for_each6( out , in , dxdt , steps[0].m_v , steps[1].m_v , steps[2].m_v ,
+ typename Operations::template scale_sum5< value_type , Time , Time , Time >(
+ 1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] ) );
+ }
+};
+
+
+template< class Algebra , class Operations >
+struct adams_moulton_call_algebra< 5 , Algebra , Operations >
+{
+ template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time >
+ void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , Time dt ) const
+ {
+ typedef typename Coefficients::value_type value_type;
+ algebra.for_each7( out , in , dxdt , steps[0].m_v , steps[1].m_v , steps[2].m_v , steps[3].m_v ,
+ typename Operations::template scale_sum6< value_type , Time , Time , Time , Time >(
+ 1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] , dt * coef[4] ) );
+ }
+};
+
+
+template< class Algebra , class Operations >
+struct adams_moulton_call_algebra< 6 , Algebra , Operations >
+{
+ template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time >
+ void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , Time dt ) const
+ {
+ typedef typename Coefficients::value_type value_type;
+ algebra.for_each8( out , in , dxdt , steps[0].m_v , steps[1].m_v , steps[2].m_v , steps[3].m_v , steps[4].m_v ,
+ typename Operations::template scale_sum7< value_type , Time , Time , Time , Time , Time >(
+ 1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] , dt * coef[4] , dt * coef[5] ) );
+ }
+};
+
+
+template< class Algebra , class Operations >
+struct adams_moulton_call_algebra< 7 , Algebra , Operations >
+{
+ template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time >
+ void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , Time dt ) const
+ {
+ BOOST_ASSERT( false ); // not implemented
+ }
+};
+
+
+template< class Algebra , class Operations >
+struct adams_moulton_call_algebra< 8 , Algebra , Operations >
+{
+ template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time >
+ void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , Time dt ) const
+ {
+ BOOST_ASSERT( false ); // not implemented
+ }
+};
+
+
+
+
+} // detail
+} // odeint
+} // numeric
+} // boost
+
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_MOULTON_CALL_ALGEBRA_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/detail/adams_moulton_coefficients.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/detail/adams_moulton_coefficients.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,168 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/detail/adams_moulton_coefficients.hpp
+
+ [begin_description]
+ Coefficients for the Adams Moulton method.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_MOULTON_COEFFICIENTS_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_MOULTON_COEFFICIENTS_HPP_INCLUDED
+
+
+#include <boost/array.hpp>
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+namespace detail {
+
+template< class Value , size_t Steps >
+class adams_moulton_coefficients ;
+
+template< class Value >
+class adams_moulton_coefficients< Value , 1 > : public boost::array< Value , 1 >
+{
+public:
+ adams_moulton_coefficients( void )
+ : boost::array< Value , 1 >()
+ {
+ (*this)[0] = static_cast< Value >( 1 );
+ }
+};
+
+
+template< class Value >
+class adams_moulton_coefficients< Value , 2 > : public boost::array< Value , 2 >
+{
+public:
+ adams_moulton_coefficients( void )
+ : boost::array< Value , 2 >()
+ {
+ (*this)[0] = static_cast< Value >( 1 ) / static_cast< Value >( 2 );
+ (*this)[1] = static_cast< Value >( 1 ) / static_cast< Value >( 2 );
+ }
+};
+
+
+template< class Value >
+class adams_moulton_coefficients< Value , 3 > : public boost::array< Value , 3 >
+{
+public:
+ adams_moulton_coefficients( void )
+ : boost::array< Value , 3 >()
+ {
+ (*this)[0] = static_cast< Value >( 5 ) / static_cast< Value >( 12 );
+ (*this)[1] = static_cast< Value >( 2 ) / static_cast< Value >( 3 );
+ (*this)[2] = -static_cast< Value >( 1 ) / static_cast< Value >( 12 );
+ }
+};
+
+
+template< class Value >
+class adams_moulton_coefficients< Value , 4 > : public boost::array< Value , 4 >
+{
+public:
+ adams_moulton_coefficients( void )
+ : boost::array< Value , 4 >()
+ {
+ (*this)[0] = static_cast< Value >( 3 ) / static_cast< Value >( 8 );
+ (*this)[1] = static_cast< Value >( 19 ) / static_cast< Value >( 24 );
+ (*this)[2] = -static_cast< Value >( 5 ) / static_cast< Value >( 24 );
+ (*this)[3] = static_cast< Value >( 1 ) / static_cast< Value >( 24 );
+ }
+};
+
+
+template< class Value >
+class adams_moulton_coefficients< Value , 5 > : public boost::array< Value , 5 >
+{
+public:
+ adams_moulton_coefficients( void )
+ : boost::array< Value , 5 >()
+ {
+ (*this)[0] = static_cast< Value >( 251 ) / static_cast< Value >( 720 );
+ (*this)[1] = static_cast< Value >( 323 ) / static_cast< Value >( 360 );
+ (*this)[2] = -static_cast< Value >( 11 ) / static_cast< Value >( 30 );
+ (*this)[3] = static_cast< Value >( 53 ) / static_cast< Value >( 360 );
+ (*this)[4] = -static_cast< Value >( 19 ) / static_cast< Value >( 720 );
+ }
+};
+
+
+template< class Value >
+class adams_moulton_coefficients< Value , 6 > : public boost::array< Value , 6 >
+{
+public:
+ adams_moulton_coefficients( void )
+ : boost::array< Value , 6 >()
+ {
+ (*this)[0] = static_cast< Value >( 95 ) / static_cast< Value >( 288 );
+ (*this)[1] = static_cast< Value >( 1427 ) / static_cast< Value >( 1440 );
+ (*this)[2] = -static_cast< Value >( 133 ) / static_cast< Value >( 240 );
+ (*this)[3] = static_cast< Value >( 241 ) / static_cast< Value >( 720 );
+ (*this)[4] = -static_cast< Value >( 173 ) / static_cast< Value >( 1440 );
+ (*this)[5] = static_cast< Value >( 3 ) / static_cast< Value >( 160 );
+ }
+};
+
+template< class Value >
+class adams_moulton_coefficients< Value , 7 > : public boost::array< Value , 7 >
+{
+public:
+ adams_moulton_coefficients( void )
+ : boost::array< Value , 7 >()
+ {
+ (*this)[0] = static_cast< Value >( 19087 ) / static_cast< Value >( 60480 );
+ (*this)[1] = static_cast< Value >( 2713 ) / static_cast< Value >( 2520 );
+ (*this)[2] = -static_cast< Value >( 15487 ) / static_cast< Value >( 20160 );
+ (*this)[3] = static_cast< Value >( 586 ) / static_cast< Value >( 945 );
+ (*this)[4] = -static_cast< Value >( 6737 ) / static_cast< Value >( 20160 );
+ (*this)[5] = static_cast< Value >( 263 ) / static_cast< Value >( 2520 );
+ (*this)[6] = -static_cast< Value >( 863 ) / static_cast< Value >( 60480 );
+ }
+};
+
+
+template< class Value >
+class adams_moulton_coefficients< Value , 8 > : public boost::array< Value , 8 >
+{
+public:
+ adams_moulton_coefficients( void )
+ : boost::array< Value , 8 >()
+ {
+ (*this)[0] = static_cast< Value >( 5257 ) / static_cast< Value >( 17280 );
+ (*this)[1] = static_cast< Value >( 139849 ) / static_cast< Value >( 120960 );
+ (*this)[2] = -static_cast< Value >( 4511 ) / static_cast< Value >( 4480 );
+ (*this)[3] = static_cast< Value >( 123133 ) / static_cast< Value >( 120960 );
+ (*this)[4] = -static_cast< Value >( 88547 ) / static_cast< Value >( 120960 );
+ (*this)[5] = static_cast< Value >( 1537 ) / static_cast< Value >( 4480 );
+ (*this)[6] = -static_cast< Value >( 11351 ) / static_cast< Value >( 120960 );
+ (*this)[7] = static_cast< Value >( 275 ) / static_cast< Value >( 24192 );
+ }
+};
+
+
+
+
+
+
+
+} // detail
+} // odeint
+} // numeric
+} // boost
+
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_MOULTON_COEFFICIENTS_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/detail/generic_rk_algorithm.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/detail/generic_rk_algorithm.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,246 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/detail/generic_rk_algorithm.hpp
+
+ [begin_description]
+ Implementation of the generic Runge-Kutta method.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_GENERIC_RK_ALGORITHM_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_GENERIC_RK_ALGORITHM_HPP_INCLUDED
+
+#include <boost/static_assert.hpp>
+
+#include <boost/mpl/vector.hpp>
+#include <boost/mpl/push_back.hpp>
+#include <boost/mpl/for_each.hpp>
+#include <boost/mpl/range_c.hpp>
+#include <boost/mpl/copy.hpp>
+#include <boost/mpl/size_t.hpp>
+
+#include <boost/fusion/algorithm.hpp>
+#include <boost/fusion/iterator.hpp>
+#include <boost/fusion/mpl.hpp>
+#include <boost/fusion/sequence.hpp>
+
+#include <boost/array.hpp>
+
+#include <boost/numeric/odeint/algebra/range_algebra.hpp>
+#include <boost/numeric/odeint/algebra/default_operations.hpp>
+#include <boost/numeric/odeint/stepper/detail/generic_rk_call_algebra.hpp>
+#include <boost/numeric/odeint/stepper/detail/generic_rk_operations.hpp>
+#include <boost/numeric/odeint/util/bind.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+namespace detail {
+
+template< class T , class Constant >
+struct array_wrapper
+{
+ typedef const typename boost::array< T , Constant::value > type;
+};
+
+template< class T , size_t i >
+struct stage
+{
+ T c;
+ boost::array< T , i > a;
+};
+
+
+template< class T , class Constant >
+struct stage_wrapper
+{
+ typedef stage< T , Constant::value > type;
+};
+
+
+template<
+size_t StageCount,
+class Value = double ,
+class Algebra = range_algebra,
+class Operations = default_operations
+>
+class generic_rk_algorithm {
+
+public:
+ typedef mpl::range_c< size_t , 1 , StageCount > stage_indices;
+
+ typedef typename boost::fusion::result_of::as_vector
+ <
+ typename boost::mpl::copy
+ <
+ stage_indices ,
+ boost::mpl::inserter
+ <
+ boost::mpl::vector0< > ,
+ boost::mpl::push_back< boost::mpl::_1 , array_wrapper< Value , boost::mpl::_2 > >
+ >
+ >::type
+ >::type coef_a_type;
+
+ typedef boost::array< Value , StageCount > coef_b_type;
+ typedef boost::array< Value , StageCount > coef_c_type;
+
+ typedef typename boost::fusion::result_of::as_vector
+ <
+ typename boost::mpl::push_back
+ <
+ typename boost::mpl::copy
+ <
+ stage_indices,
+ boost::mpl::inserter
+ <
+ boost::mpl::vector0<> ,
+ boost::mpl::push_back< boost::mpl::_1 , stage_wrapper< Value , boost::mpl::_2 > >
+ >
+ >::type ,
+ stage< Value , StageCount >
+ >::type
+ >::type stage_vector_base;
+
+
+ struct stage_vector : public stage_vector_base
+ {
+ struct do_insertion
+ {
+ stage_vector_base &m_base;
+ const coef_a_type &m_a;
+ const coef_c_type &m_c;
+
+ do_insertion( stage_vector_base &base , const coef_a_type &a , const coef_c_type &c )
+ : m_base( base ) , m_a( a ) , m_c( c ) { }
+
+ template< class Index >
+ void operator()( Index ) const
+ {
+ //boost::fusion::at< Index >( m_base ) = stage< double , Index::value+1 , intermediate_stage >( m_c[ Index::value ] , boost::fusion::at< Index >( m_a ) );
+ boost::fusion::at< Index >( m_base ).c = m_c[ Index::value ];
+ boost::fusion::at< Index >( m_base ).a = boost::fusion::at< Index >( m_a );
+ }
+ };
+
+ struct print_butcher
+ {
+ const stage_vector_base &m_base;
+ std::ostream &m_os;
+
+ print_butcher( const stage_vector_base &base , std::ostream &os )
+ : m_base( base ) , m_os( os )
+ { }
+
+ template<class Index>
+ void operator()(Index) const {
+ m_os << boost::fusion::at<Index>(m_base).c << " | ";
+ for( size_t i=0 ; i<Index::value ; ++i )
+ m_os << boost::fusion::at<Index>(m_base).a[i] << " ";
+ m_os << std::endl;
+ }
+ };
+
+
+ stage_vector( const coef_a_type &a , const coef_b_type &b , const coef_c_type &c )
+ {
+ typedef boost::mpl::range_c< size_t , 0 , StageCount-1 > indices;
+ boost::mpl::for_each< indices >( do_insertion( *this , a , c ) );
+ boost::fusion::at_c< StageCount - 1 >( *this ).c = c[ StageCount - 1 ];
+ boost::fusion::at_c< StageCount - 1 >( *this ).a = b;
+ }
+
+ void print( std::ostream &os ) const
+ {
+ typedef boost::mpl::range_c< size_t , 0 , StageCount > indices;
+ boost::mpl::for_each< indices >( print_butcher( *this , os ) );
+ }
+ };
+
+
+
+ template< class System , class StateIn , class StateTemp , class DerivIn , class Deriv ,
+ class StateOut , class Time >
+ struct calculate_stage
+ {
+ Algebra &algebra;
+ System &system;
+ const StateIn &x;
+ StateTemp &x_tmp;
+ StateOut &x_out;
+ const DerivIn &dxdt;
+ Deriv *F;
+ Time t;
+ Time dt;
+
+ calculate_stage( Algebra &_algebra , System &_system , const StateIn &_x , const DerivIn &_dxdt , StateOut &_out ,
+ StateTemp &_x_tmp , Deriv *_F , Time _t , Time _dt )
+ : algebra( _algebra ) , system( _system ) , x( _x ) , x_tmp( _x_tmp ) , x_out( _out) , dxdt( _dxdt ) , F( _F ) , t( _t ) , dt( _dt )
+ {}
+
+
+ template< typename T , size_t stage_number >
+ void inline operator()( stage< T , stage_number > const &stage ) const
+ //typename stage_fusion_wrapper< T , mpl::size_t< stage_number > , intermediate_stage >::type const &stage ) const
+ {
+ if( stage_number > 1 )
+ {
+#ifdef BOOST_MSVC
+#pragma warning( disable : 4307 34 )
+#endif
+ system( x_tmp , F[stage_number-2].m_v , t + stage.c * dt );
+#ifdef BOOST_MSVC
+#pragma warning( default : 4307 34 )
+#endif
+ }
+ //std::cout << stage_number-2 << ", t': " << t + stage.c * dt << std::endl;
+
+ if( stage_number < StageCount )
+ detail::template generic_rk_call_algebra< stage_number , Algebra >()( algebra , x_tmp , x , dxdt , F ,
+ detail::generic_rk_scale_sum< stage_number , Operations , Value , Time >( stage.a , dt) );
+ // algebra_type::template for_eachn<stage_number>( x_tmp , x , dxdt , F ,
+ // typename operations_type::template scale_sumn< stage_number , time_type >( stage.a , dt ) );
+ else
+ detail::template generic_rk_call_algebra< stage_number , Algebra >()( algebra , x_out , x , dxdt , F ,
+ detail::generic_rk_scale_sum< stage_number , Operations , Value , Time >( stage.a , dt ) );
+ // algebra_type::template for_eachn<stage_number>( x_out , x , dxdt , F ,
+ // typename operations_type::template scale_sumn< stage_number , time_type >( stage.a , dt ) );
+ }
+
+ };
+
+ generic_rk_algorithm( const coef_a_type &a , const coef_b_type &b , const coef_c_type &c )
+ : m_stages( a , b , c )
+ { }
+
+ template< class System , class StateIn , class DerivIn , class Time , class StateOut , class StateTemp , class Deriv >
+ void inline do_step( Algebra &algebra , System system , const StateIn &in , const DerivIn &dxdt ,
+ Time t , StateOut &out , Time dt ,
+ StateTemp &x_tmp , Deriv F[StageCount-1] ) const
+ {
+ typedef typename odeint::unwrap_reference< System >::type unwrapped_system_type;
+ unwrapped_system_type &sys = system;
+ boost::fusion::for_each( m_stages , calculate_stage<
+ unwrapped_system_type , StateIn , StateTemp , DerivIn , Deriv , StateOut , Time >
+ ( algebra , sys , in , dxdt , out , x_tmp , F , t , dt ) );
+ }
+
+private:
+ stage_vector m_stages;
+};
+
+
+}
+}
+}
+}
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_GENERIC_RK_ALGORITHM_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/detail/generic_rk_call_algebra.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/detail/generic_rk_call_algebra.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,263 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/detail/generic_rk_call_algebra.hpp
+
+ [begin_description]
+ Algebra caller for the generic Runge-Kutta methods.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_GENERIC_RK_CALL_ALGEBRA_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_GENERIC_RK_CALL_ALGEBRA_HPP_INCLUDED
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+namespace detail {
+
+template< size_t StageNumber , class Algebra >
+struct generic_rk_call_algebra;
+
+template< class Algebra >
+struct generic_rk_call_algebra< 1 , Algebra >
+{
+ typedef Algebra algebra_type;
+
+ template< class S1 , class S2 , class S3 , class S4 , class Op>
+ void operator()( algebra_type &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 * /* s4_array */ , Op op ) const
+ {
+ algebra.for_each3( s1 , s2 , s3 , op );
+ }
+
+ template< class S1 , class S2 , class S4 , class Op>
+ void operator()( algebra_type &algebra , S1 &s1 , S2 &s2 , S4 * /* s4_array */ , Op op ) const
+ {
+ algebra.for_each2( s1 , s2 , op );
+ }
+};
+
+template< class Algebra >
+struct generic_rk_call_algebra< 2 , Algebra >
+{
+ template< class S1 , class S2 , class S3 , class S4 , class Op>
+ void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[1] , Op op ) const
+ {
+ algebra.for_each4( s1 , s2 , s3 , s4_array[0].m_v , op );
+ }
+
+ template< class S1 , class S2 , class S4 , class Op>
+ void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[1] , Op op ) const
+ {
+ algebra.for_each3( s1 , s2 , s4_array[0].m_v , op );
+ }
+};
+
+
+template< class Algebra >
+struct generic_rk_call_algebra< 3 , Algebra >
+{
+ template< class S1 , class S2 , class S3 , class S4 , class Op>
+ void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[2] , Op op ) const
+ {
+ algebra.for_each5( s1 , s2 , s3 , s4_array[0].m_v , s4_array[1].m_v , op );
+ }
+
+ template< class S1 , class S2 , class S4 , class Op>
+ void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[2] , Op op ) const
+ {
+ algebra.for_each4( s1 , s2 , s4_array[0].m_v , s4_array[1].m_v , op );
+ }
+};
+
+
+template< class Algebra >
+struct generic_rk_call_algebra< 4 , Algebra >
+{
+ template< class S1 , class S2 , class S3 , class S4 , class Op>
+ void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[3] , Op op ) const
+ {
+ algebra.for_each6( s1 , s2 , s3 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , op );
+ }
+
+ template< class S1 , class S2 , class S4 , class Op>
+ void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[3] , Op op ) const
+ {
+ algebra.for_each5( s1 , s2 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , op );
+ }
+};
+
+
+template< class Algebra >
+struct generic_rk_call_algebra< 5 , Algebra >
+{
+ template< class S1 , class S2 , class S3 , class S4 , class Op>
+ void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[4] , Op op ) const
+ {
+ algebra.for_each7( s1 , s2 , s3 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , op );
+ }
+
+ template< class S1 , class S2 , class S4 , class Op>
+ void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[4] , Op op ) const
+ {
+ algebra.for_each6( s1 , s2 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , op );
+ }
+};
+
+template< class Algebra >
+struct generic_rk_call_algebra< 6 , Algebra >
+{
+ template< class S1 , class S2 , class S3 , class S4 , class Op>
+ void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[5] , Op op ) const
+ {
+ algebra.for_each8( s1 , s2 , s3 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v , op );
+ }
+
+ template< class S1 , class S2 , class S4 , class Op>
+ void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[5] , Op op ) const
+ {
+ algebra.for_each7( s1 , s2 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v , op );
+ }
+};
+
+template< class Algebra >
+struct generic_rk_call_algebra< 7 , Algebra >
+{
+ template< class S1 , class S2 , class S3 , class S4 , class Op>
+ void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[6] , Op op ) const
+ {
+ algebra.for_each9( s1 , s2 , s3 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v ,
+ s4_array[5].m_v , op );
+ }
+
+ template< class S1 , class S2 , class S4 , class Op>
+ void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[6] , Op op ) const
+ {
+ algebra.for_each8( s1 , s2 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v ,
+ s4_array[5].m_v , op );
+ }
+};
+
+template< class Algebra >
+struct generic_rk_call_algebra< 8 , Algebra >
+{
+ template< class S1 , class S2 , class S3 , class S4 , class Op>
+ void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[7] , Op op ) const
+ {
+ algebra.for_each10( s1 , s2 , s3 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v ,
+ s4_array[5].m_v , s4_array[6].m_v , op );
+ }
+
+ template< class S1 , class S2 , class S4 , class Op>
+ void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[7] , Op op ) const
+ {
+ algebra.for_each9( s1 , s2 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v ,
+ s4_array[5].m_v , s4_array[6].m_v , op );
+ }
+};
+
+template< class Algebra >
+struct generic_rk_call_algebra< 9 , Algebra >
+{
+ template< class S1 , class S2 , class S3 , class S4 , class Op>
+ void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[8] , Op op ) const
+ {
+ algebra.for_each11( s1 , s2 , s3 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v ,
+ s4_array[5].m_v , s4_array[6].m_v , s4_array[7].m_v , op );
+ }
+
+ template< class S1 , class S2 , class S4 , class Op>
+ void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[8] , Op op ) const
+ {
+ algebra.for_each10( s1 , s2 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v ,
+ s4_array[5].m_v , s4_array[6].m_v , s4_array[7].m_v , op );
+ }
+};
+
+template< class Algebra >
+struct generic_rk_call_algebra< 10 , Algebra >
+{
+ template< class S1 , class S2 , class S3 , class S4 , class Op>
+ void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[9] , Op op ) const
+ {
+ algebra.for_each12( s1 , s2 , s3 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v ,
+ s4_array[5].m_v , s4_array[6].m_v , s4_array[7].m_v , s4_array[8].m_v , op );
+ }
+
+ template< class S1 , class S2 , class S4 , class Op>
+ void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[9] , Op op ) const
+ {
+ algebra.for_each11( s1 , s2 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v ,
+ s4_array[5].m_v , s4_array[6].m_v , s4_array[7].m_v , s4_array[8].m_v , op );
+ }
+};
+
+
+template< class Algebra >
+struct generic_rk_call_algebra< 11 , Algebra >
+{
+ template< class S1 , class S2 , class S3 , class S4 , class Op>
+ void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[10] , Op op ) const
+ {
+ algebra.for_each13( s1 , s2 , s3 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v ,
+ s4_array[5].m_v , s4_array[6].m_v , s4_array[7].m_v , s4_array[8].m_v , s4_array[9].m_v , op );
+ }
+
+ template< class S1 , class S2 , class S4 , class Op>
+ void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[10] , Op op ) const
+ {
+ algebra.for_each12( s1 , s2 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v ,
+ s4_array[5].m_v , s4_array[6].m_v , s4_array[7].m_v , s4_array[8].m_v , s4_array[9].m_v , op );
+ }
+};
+
+template< class Algebra >
+struct generic_rk_call_algebra< 12 , Algebra >
+{
+ template< class S1 , class S2 , class S3 , class S4 , class Op>
+ void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[11] , Op op ) const
+ {
+ algebra.for_each14( s1 , s2 , s3 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v ,
+ s4_array[5].m_v , s4_array[6].m_v , s4_array[7].m_v , s4_array[8].m_v , s4_array[9].m_v , s4_array[10].m_v , op );
+ }
+
+ template< class S1 , class S2 , class S4 , class Op>
+ void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[11] , Op op ) const
+ {
+ algebra.for_each13( s1 , s2 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v ,
+ s4_array[5].m_v , s4_array[6].m_v , s4_array[7].m_v , s4_array[8].m_v , s4_array[9].m_v , s4_array[10].m_v , op );
+ }
+};
+
+template< class Algebra >
+struct generic_rk_call_algebra< 13 , Algebra >
+{
+ template< class S1 , class S2 , class S3 , class S4 , class Op>
+ void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[12] , Op op ) const
+ {
+ algebra.for_each15( s1 , s2 , s3 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v ,
+ s4_array[5].m_v , s4_array[6].m_v , s4_array[7].m_v , s4_array[8].m_v , s4_array[9].m_v , s4_array[10].m_v , s4_array[11].m_v , op );
+ }
+
+ template< class S1 , class S2 , class S4 , class Op>
+ void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[12] , Op op ) const
+ {
+ algebra.for_each14( s1 , s2 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v ,
+ s4_array[5].m_v , s4_array[6].m_v , s4_array[7].m_v , s4_array[8].m_v , s4_array[9].m_v , s4_array[10].m_v , s4_array[11].m_v , op );
+ }
+};
+
+}
+}
+}
+}
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_GENERIC_RK_CALL_ALGEBRA_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/detail/generic_rk_operations.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/detail/generic_rk_operations.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,252 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/detail/generic_rk_operations.hpp
+
+ [begin_description]
+ Operations caller for the generic Runge Kutta method.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_GENERIC_RK_OPERATIONS_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_GENERIC_RK_OPERATIONS_HPP_INCLUDED
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+namespace detail {
+
+template< size_t StageNumber , class Operations , class Fac , class Time >
+struct generic_rk_scale_sum;
+
+template< class Operations , class Fac , class Time >
+struct generic_rk_scale_sum< 1 , Operations , Fac , Time > : public Operations::template scale_sum2< Fac , Time >
+{
+ generic_rk_scale_sum( const boost::array<Fac,1> &a , Time dt ) : Operations::template scale_sum2< Fac , Time >( 1.0 , a[0]*dt )
+ { }
+
+ typedef void result_type;
+};
+
+
+template< class Operations , class Fac , class Time >
+struct generic_rk_scale_sum< 2 , Operations , Fac , Time > : public Operations::template scale_sum3< Fac , Time >
+{
+ generic_rk_scale_sum( const boost::array<Fac,2> &a , Time dt )
+ : Operations::template scale_sum3< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt )
+ { }
+
+ typedef void result_type;
+};
+
+template< class Operations , class Fac , class Time >
+struct generic_rk_scale_sum< 3 , Operations , Fac , Time > : public Operations::template scale_sum4< Fac , Time >
+{
+ generic_rk_scale_sum( const boost::array<Fac,3> &a , Time dt )
+ : Operations::template scale_sum4< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt )
+ { }
+
+ typedef void result_type;
+};
+
+template< class Operations , class Fac , class Time >
+struct generic_rk_scale_sum< 4 , Operations , Fac , Time > : public Operations::template scale_sum5< Fac , Time >
+{
+ generic_rk_scale_sum( const boost::array<Fac,4> &a , Time dt )
+ : Operations::template scale_sum5< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt )
+ { }
+
+ typedef void result_type;
+};
+
+template< class Operations , class Fac , class Time >
+struct generic_rk_scale_sum< 5 , Operations , Fac , Time > : public Operations::template scale_sum6< Fac , Time >
+{
+ generic_rk_scale_sum( const boost::array<Fac,5> &a , Time dt )
+ : Operations::template scale_sum6< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt )
+ { }
+
+ typedef void result_type;
+};
+
+template< class Operations , class Fac , class Time >
+struct generic_rk_scale_sum< 6 , Operations , Fac , Time > : public Operations::template scale_sum7< Fac , Time >
+{
+ generic_rk_scale_sum( const boost::array<Fac,6> &a , Time dt )
+ : Operations::template scale_sum7< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt , a[5]*dt )
+ { }
+
+ typedef void result_type;
+};
+
+template< class Operations , class Fac , class Time >
+struct generic_rk_scale_sum< 7 , Operations , Fac , Time > : public Operations::template scale_sum8< Fac , Time >
+{
+ generic_rk_scale_sum( const boost::array<Fac,7> &a , Time dt )
+ : Operations::template scale_sum8< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt , a[5]*dt , a[6]*dt )
+ { }
+
+ typedef void result_type;
+};
+
+template< class Operations , class Fac , class Time >
+struct generic_rk_scale_sum< 8 , Operations , Fac , Time > : public Operations::template scale_sum9< Fac , Time >
+{
+ generic_rk_scale_sum( const boost::array<Fac,8> &a , Time dt )
+ : Operations::template scale_sum9< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt ,
+ a[5]*dt , a[6]*dt , a[7]*dt )
+ { }
+
+ typedef void result_type;
+};
+
+template< class Operations , class Fac , class Time >
+struct generic_rk_scale_sum< 9 , Operations , Fac , Time > : public Operations::template scale_sum10< Fac , Time >
+{
+ generic_rk_scale_sum( const boost::array<Fac,9> &a , Time dt )
+ : Operations::template scale_sum10< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt ,
+ a[5]*dt , a[6]*dt , a[7]*dt , a[8]*dt )
+ { }
+
+ typedef void result_type;
+};
+
+template< class Operations , class Fac , class Time >
+struct generic_rk_scale_sum< 10 , Operations , Fac , Time > : public Operations::template scale_sum11< Fac , Time >
+{
+ generic_rk_scale_sum( const boost::array<Fac,10> &a , Time dt )
+ : Operations::template scale_sum11< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt ,
+ a[5]*dt , a[6]*dt , a[7]*dt , a[8]*dt , a[9]*dt )
+ { }
+
+ typedef void result_type;
+};
+
+template< class Operations , class Fac , class Time >
+struct generic_rk_scale_sum< 11 , Operations , Fac , Time > : public Operations::template scale_sum12< Fac , Time >
+{
+ generic_rk_scale_sum( const boost::array<Fac,11> &a , Time dt )
+ : Operations::template scale_sum12< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt ,
+ a[5]*dt , a[6]*dt , a[7]*dt , a[8]*dt , a[9]*dt , a[10]*dt )
+ { }
+
+ typedef void result_type;
+};
+
+template< class Operations , class Fac , class Time >
+struct generic_rk_scale_sum< 12 , Operations , Fac , Time > : public Operations::template scale_sum13< Fac , Time >
+{
+ generic_rk_scale_sum( const boost::array<Fac,12> &a , Time dt )
+ : Operations::template scale_sum13< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt ,
+ a[5]*dt , a[6]*dt , a[7]*dt , a[8]*dt , a[9]*dt , a[10]*dt , a[11]*dt )
+ { }
+
+ typedef void result_type;
+};
+
+template< class Operations , class Fac , class Time >
+struct generic_rk_scale_sum< 13 , Operations , Fac , Time > : public Operations::template scale_sum14< Fac , Time >
+{
+ generic_rk_scale_sum( const boost::array<Fac,13> &a , Time dt )
+ : Operations::template scale_sum14< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt ,
+ a[5]*dt , a[6]*dt , a[7]*dt , a[8]*dt , a[9]*dt , a[10]*dt , a[11]*dt , a[12]*dt )
+ { }
+
+ typedef void result_type;
+};
+
+
+// for error estimates
+template< size_t StageNumber , class Operations , class Fac , class Time >
+struct generic_rk_scale_sum_err;
+
+template< class Operations , class Fac , class Time >
+struct generic_rk_scale_sum_err< 1 , Operations , Fac , Time > : public Operations::template scale_sum1< Time >
+{
+ generic_rk_scale_sum_err( const boost::array<Fac,1> &a , Time dt ) : Operations::template scale_sum1< Time >( a[0]*dt )
+ { }
+
+ typedef void result_type;
+};
+
+
+template< class Operations , class Fac , class Time >
+struct generic_rk_scale_sum_err< 2 , Operations , Fac , Time > : public Operations::template scale_sum2< Time >
+{
+ generic_rk_scale_sum_err( const boost::array<Fac,2> &a , Time dt )
+ : Operations::template scale_sum2< Time >( a[0]*dt , a[1]*dt )
+ { }
+
+ typedef void result_type;
+};
+
+template< class Operations , class Fac , class Time >
+struct generic_rk_scale_sum_err< 3 , Operations , Fac , Time > : public Operations::template scale_sum3< Time >
+{
+ generic_rk_scale_sum_err( const boost::array<Fac,3> &a , Time dt )
+ : Operations::template scale_sum3< Time >( a[0]*dt , a[1]*dt , a[2]*dt )
+ { }
+
+ typedef void result_type;
+};
+
+template< class Operations , class Fac , class Time >
+struct generic_rk_scale_sum_err< 4 , Operations , Fac , Time > : public Operations::template scale_sum4< Time >
+{
+ generic_rk_scale_sum_err( const boost::array<Fac,4> &a , Time dt )
+ : Operations::template scale_sum4< Time >( a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt )
+ { }
+
+ typedef void result_type;
+};
+
+template< class Operations , class Fac , class Time >
+struct generic_rk_scale_sum_err< 5 , Operations , Fac , Time > : public Operations::template scale_sum5< Fac >
+{
+ generic_rk_scale_sum_err( const boost::array<Fac,5> &a , Time dt )
+ : Operations::template scale_sum5< Time >( a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt )
+ { }
+
+ typedef void result_type;
+};
+
+
+template< class Operations , class Fac , class Time >
+struct generic_rk_scale_sum_err< 6 , Operations , Fac , Time > : public Operations::template scale_sum6< Time >
+{
+ generic_rk_scale_sum_err( const boost::array<Fac,6> &a , Time dt )
+ : Operations::template scale_sum6< Time >( a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt , a[5]*dt )
+ { }
+
+ typedef void result_type;
+};
+
+
+// for rk87
+template< class Operations , class Fac , class Time >
+struct generic_rk_scale_sum_err< 13 , Operations , Fac , Time > : public Operations::template scale_sum13< Time >
+{
+ generic_rk_scale_sum_err( const boost::array<Fac,13> &a , Time dt )
+ : Operations::template scale_sum13< Time >( a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt , a[5]*dt ,
+ a[6]*dt , a[7]*dt , a[8]*dt , a[9]*dt , a[10]*dt , a[11]*dt , a[12]*dt )
+ { }
+
+ typedef void result_type;
+};
+
+
+}
+}
+}
+}
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_GENERIC_RK_OPERATIONS_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/detail/rotating_buffer.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/detail/rotating_buffer.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,84 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/detail/rotating_buffer.hpp
+
+ [begin_description]
+ Implemetation of a rotating (cyclic) buffer for use in the Adam Bashforth stepper
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ROTATING_BUFFER_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ROTATING_BUFFER_HPP_INCLUDED
+
+#include <boost/array.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+namespace detail {
+
+template< class T , size_t N >
+class rotating_buffer
+{
+public:
+
+ typedef T value_type;
+ const static size_t dim = N;
+
+ rotating_buffer( void ) : m_first( 0 )
+ { }
+
+ size_t size( void ) const
+ {
+ return dim;
+ }
+
+ value_type& operator[]( size_t i )
+ {
+ return m_data[ get_index( i ) ];
+ }
+
+ const value_type& operator[]( size_t i ) const
+ {
+ return m_data[ get_index( i ) ];
+ }
+
+ void rotate( void )
+ {
+ if( m_first == 0 )
+ m_first = dim-1;
+ else
+ --m_first;
+ }
+
+protected:
+
+ value_type m_data[N];
+
+private:
+
+ size_t get_index( size_t i ) const
+ {
+ return ( ( i + m_first ) % dim );
+ }
+
+ size_t m_first;
+
+};
+
+
+} // detail
+} // odeint
+} // numeric
+} // boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ROTATING_BUFFER_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/euler.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/euler.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,154 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/euler.hpp
+
+ [begin_description]
+ Implementation of the classical explicit Euler stepper. This method is really simple and should only
+ be used for demonstration purposes.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_EULER_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_EULER_HPP_INCLUDED
+
+
+#include <boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp>
+#include <boost/numeric/odeint/util/resizer.hpp>
+#include <boost/numeric/odeint/algebra/range_algebra.hpp>
+#include <boost/numeric/odeint/algebra/default_operations.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+
+/**
+ * \class euler
+ * \brief An implementation of the Euler method.
+ *
+ * The Euler method is a very simply solver for ordinary differential equations. This method should not be used
+ * for real applications. It is only useful for demonstration purposes. Step size control is not provided but
+ * trivial continous output is available.
+ *
+ * This class derives from explicit_stepper_base and inherits its interface via CRTP (current recurring template pattern),
+ * see explicit_stepper_base
+ *
+ * \tparam State The state type.
+ * \tparam Value The value type.
+ * \tparam Deriv The type representing the time derivative of the state.
+ * \tparam Time The time representing the independent variable - the time.
+ * \tparam Algebra The algebra type.
+ * \tparam Operations The operations type.
+ * \tparam Resizer The resizer policy type.
+ */
+template<
+class State ,
+class Value = double ,
+class Deriv = State ,
+class Time = Value ,
+class Algebra = range_algebra ,
+class Operations = default_operations ,
+class Resizer = initially_resizer
+>
+#ifndef DOXYGEN_SKIP
+class euler
+: public explicit_stepper_base<
+ euler< State , Value , Deriv , Time , Algebra , Operations , Resizer > ,
+ 1 , State , Value , Deriv , Time , Algebra , Operations , Resizer >
+#else
+class euler : public explicit_stepper_base< euler< ... > , ... >
+#endif
+{
+public :
+
+ #ifndef DOXYGEN_SKIP
+ typedef explicit_stepper_base< euler< State , Value , Deriv , Time , Algebra , Operations , Resizer > , 1 , State , Value , Deriv , Time , Algebra , Operations , Resizer > stepper_base_type;
+ #else
+ typedef explicit_stepper_base< euler< ... > , ... > stepper_base_type;
+ #endif
+ typedef typename stepper_base_type::state_type state_type;
+ typedef typename stepper_base_type::value_type value_type;
+ typedef typename stepper_base_type::deriv_type deriv_type;
+ typedef typename stepper_base_type::time_type time_type;
+ typedef typename stepper_base_type::algebra_type algebra_type;
+ typedef typename stepper_base_type::operations_type operations_type;
+ typedef typename stepper_base_type::resizer_type resizer_type;
+
+ #ifndef DOXYGEN_SKIP
+ typedef typename stepper_base_type::stepper_type stepper_type;
+ typedef typename stepper_base_type::wrapped_state_type wrapped_state_type;
+ typedef typename stepper_base_type::wrapped_deriv_type wrapped_deriv_type;
+ #endif
+
+
+ /**
+ * \brief Constructs the euler class. This constructor can be used as a default
+ * constructor of the algebra has a default constructor.
+ * \param algebra A copy of algebra is made and stored inside explicit_stepper_base.
+ */
+ euler( const algebra_type &algebra = algebra_type() ) : stepper_base_type( algebra )
+ { }
+
+ /**
+ * \brief This method performs one step. The derivative `dxdt` of `in` at the time `t` is passed to the method.
+ * The result is updated out of place, hence the input is in `in` and the output in `out`. `do_step_impl` is
+ * used by explicit_stepper_base.
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ODE. It must fullfil the
+ * Simple System concept.
+ * \param in The state of the ODE which should be solved. in is not modified in this method
+ * \param dxdt The derivative of x at t.
+ * \param t The value of the time, at which the step should be performed.
+ * \param out The result of the step is written in out.
+ * \param dt The step size.
+ */
+ template< class System , class StateIn , class DerivIn , class StateOut >
+ void do_step_impl( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt )
+ {
+ stepper_base_type::m_algebra.for_each3( out , in , dxdt ,
+ typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , dt ) );
+
+ }
+
+
+ /**
+ * \brief This method is used for continous output and it calculates the state `x` at a time `t` from the
+ * knowledge of two states `old_state` and `current_state` at time points `t_old` and `t_new`.
+ */
+ template< class StateOut , class StateIn1 , class StateIn2 >
+ void calc_state( StateOut &x , time_type t , const StateIn1 &old_state , time_type t_old , const StateIn2 &current_state , time_type t_new ) const
+ {
+ const time_type delta = t - t_old;
+ stepper_base_type::m_algebra.for_each3( x , old_state , stepper_base_type::m_dxdt.m_v ,
+ typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , delta ) );
+ }
+
+ /**
+ * \brief Adjust the size of all temporaries in the stepper manually.
+ * \param x A state from which the size of the temporaries to be resized is deduced.
+ */
+ template< class StateType >
+ void adjust_size( const StateType &x )
+ {
+ stepper_base_type::adjust_size( x );
+ }
+};
+
+
+
+
+} // odeint
+} // numeric
+} // boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_EULER_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/explicit_error_generic_rk.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/explicit_error_generic_rk.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,225 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/explicit_error_generic_rk.hpp
+
+ [begin_description]
+ Implementation of the generic Runge Kutta error stepper. Base class for many RK error steppers.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_EXPLICIT_ERROR_GENERIC_RK_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_EXPLICIT_ERROR_GENERIC_RK_HPP_INCLUDED
+
+#include <boost/numeric/odeint/stepper/base/explicit_error_stepper_base.hpp>
+
+#include <boost/numeric/odeint/algebra/default_operations.hpp>
+#include <boost/numeric/odeint/algebra/range_algebra.hpp>
+#include <boost/numeric/odeint/stepper/detail/generic_rk_algorithm.hpp>
+#include <boost/numeric/odeint/stepper/detail/generic_rk_call_algebra.hpp>
+#include <boost/numeric/odeint/stepper/detail/generic_rk_operations.hpp>
+
+#include <boost/numeric/odeint/util/state_wrapper.hpp>
+#include <boost/numeric/odeint/util/is_resizeable.hpp>
+#include <boost/numeric/odeint/util/resizer.hpp>
+
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+/**
+ * \class explicit_error_generic_rk
+ * \brief A generic implementation of explicit Runge-Kutta algorithms with error estimation. This class is as a
+ * base class for all explicit Runge-Kutta steppers with error estimateion.
+ *
+ * This class implements the explicit Runge-Kutta algorithms with error estimation in a generic way.
+ * The Butcher tableau is passed to the stepper which constructs the stepper scheme with the help of a
+ * template-metaprogramming algorithm. ToDo : Add example!
+ *
+ * This class derives explicit_error_stepper_base which provides the stepper interface.
+ *
+ * \tparam StageCount The number of stages of the Runge-Kutta algorithm.
+ * \tparam Order The order of a stepper if the stepper is used without error estimation.
+ * \tparam StepperOrder The order of a step if the stepper is used with error estimation. Usually Order and StepperOrder have
+ * the same value.
+ * \tparam ErrorOrder The order of the error step if the stepper is used with error estimation.
+ * \tparam State The type representing the state of the ODE.
+ * \tparam Value The floating point type which is used in the computations.
+ * \tparam Time The type representing the independent variable - the time - of the ODE.
+ * \tparam Algebra The algebra type.
+ * \tparam Operations The operations type.
+ * \tparam Resizer The resizer policy type.
+ */
+template<
+size_t StageCount,
+size_t Order,
+size_t StepperOrder ,
+size_t ErrorOrder ,
+class State ,
+class Value = double ,
+class Deriv = State ,
+class Time = Value ,
+class Algebra = range_algebra ,
+class Operations = default_operations ,
+class Resizer = initially_resizer
+>
+class explicit_error_generic_rk
+: public explicit_error_stepper_base<
+ explicit_error_generic_rk< StageCount , Order , StepperOrder , ErrorOrder , State ,
+ Value , Deriv , Time , Algebra , Operations , Resizer > ,
+ Order , StepperOrder , ErrorOrder , State , Value , Deriv , Time , Algebra ,
+ Operations , Resizer >
+{
+
+public:
+
+ typedef explicit_error_stepper_base<
+ explicit_error_generic_rk< StageCount , Order , StepperOrder , ErrorOrder , State ,
+ Value , Deriv , Time , Algebra , Operations , Resizer > ,
+ Order , StepperOrder , ErrorOrder , State , Value , Deriv , Time , Algebra ,
+ Operations , Resizer > stepper_base_type;
+
+ typedef typename stepper_base_type::state_type state_type;
+ typedef typename stepper_base_type::wrapped_state_type wrapped_state_type;
+ typedef typename stepper_base_type::value_type value_type;
+ typedef typename stepper_base_type::deriv_type deriv_type;
+ typedef typename stepper_base_type::wrapped_deriv_type wrapped_deriv_type;
+ typedef typename stepper_base_type::time_type time_type;
+ typedef typename stepper_base_type::algebra_type algebra_type;
+ typedef typename stepper_base_type::operations_type operations_type;
+ typedef typename stepper_base_type::resizer_type resizer_type;
+ //typedef typename stepper_base_type::stepper_type stepper_type;
+ typedef explicit_error_generic_rk< StageCount , Order , StepperOrder , ErrorOrder , State ,
+ Value , Deriv , Time , Algebra , Operations , Resizer > stepper_type;
+
+ typedef detail::generic_rk_algorithm< StageCount , Value , Algebra , Operations > rk_algorithm_type;
+
+ typedef typename rk_algorithm_type::coef_a_type coef_a_type;
+ typedef typename rk_algorithm_type::coef_b_type coef_b_type;
+ typedef typename rk_algorithm_type::coef_c_type coef_c_type;
+
+ static const size_t stage_count = StageCount;
+
+private:
+
+
+public:
+
+ // we use an explicit_generic_rk to do the normal rk step
+ // and add a separate calculation of the error estimate afterwards
+ explicit_error_generic_rk( const coef_a_type &a ,
+ const coef_b_type &b ,
+ const coef_b_type &b2 ,
+ const coef_c_type &c ,
+ const algebra_type &algebra = algebra_type() )
+ : stepper_base_type( algebra ) , m_rk_algorithm( a , b , c ) , m_b2( b2 )
+ { }
+
+
+ /**
+ * \brief This method performs one step. The derivative `dxdt` of `in` at the time `t` is passed to the method.
+ * The result is updated out-of-place, hence the input is in `in` and the output in `out`. Futhermore, an
+ * estimation of the error is stored in `xerr`. `do_step_impl` is used by explicit_error_stepper_base.
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ODE. It must fullfil the
+ * Simple System concept.
+ * \param in The state of the ODE which should be solved. in is not modified in this method
+ * \param dxdt The derivative of x at t.
+ * \param t The value of the time, at which the step should be performed.
+ * \param out The result of the step is written in out.
+ * \param dt The step size.
+ * \param xerr The result of the error estimation is written in xerr.
+ */
+
+ template< class System , class StateIn , class DerivIn , class StateOut , class Err >
+ void do_step_impl( System system , const StateIn &in , const DerivIn &dxdt ,
+ time_type t , StateOut &out , time_type dt , Err &xerr )
+ {
+ // normal step
+ do_step_impl( system , in , dxdt , t , out , dt );
+
+ // additionally, perform the error calculation
+ detail::template generic_rk_call_algebra< StageCount , algebra_type >()( stepper_base_type::m_algebra ,
+ xerr , dxdt , m_F , detail::generic_rk_scale_sum_err< StageCount , operations_type , value_type , time_type >( m_b2 , dt) );
+ }
+
+
+ /**
+ * \brief This method performs one step. The derivative `dxdt` of `in` at the time `t` is passed to the method.
+ * The result is updated out-of-place, hence the input is in `in` and the output in `out`. `do_step_impl` is
+ * used by explicit_error_stepper_base.
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ODE. It must fullfil the
+ * Simple System concept.
+ * \param in The state of the ODE which should be solved. in is not modified in this method
+ * \param dxdt The derivative of x at t.
+ * \param t The value of the time, at which the step should be performed.
+ * \param out The result of the step is written in out.
+ * \param dt The step size.
+ */
+ template< class System , class StateIn , class DerivIn , class StateOut >
+ void do_step_impl( System system , const StateIn &in , const DerivIn &dxdt ,
+ time_type t , StateOut &out , time_type dt )
+ {
+ m_resizer.adjust_size( in , detail::bind( &stepper_type::template resize_impl< StateIn > , detail::ref( *this ) , detail::_1 ) );
+
+ // actual calculation done in generic_rk.hpp
+ m_rk_algorithm.do_step( stepper_base_type::m_algebra , system , in , dxdt , t , out , dt , m_x_tmp.m_v , m_F );
+ }
+
+
+
+ /**
+ * \brief Adjust the size of all temporaries in the stepper manually.
+ * \param x A state from which the size of the temporaries to be resized is deduced.
+ */
+ template< class StateType >
+ void adjust_size( const StateType &x )
+ {
+ resize_impl( x );
+ stepper_base_type::adjust_size( x );
+ }
+
+
+private:
+
+ template< class StateIn >
+ bool resize_impl( const StateIn &x )
+ {
+ bool resized( false );
+ resized |= adjust_size_by_resizeability( m_x_tmp , x , typename is_resizeable<state_type>::type() );
+ for( size_t i = 0 ; i < StageCount-1 ; ++i )
+ {
+ resized |= adjust_size_by_resizeability( m_F[i] , x , typename is_resizeable<deriv_type>::type() );
+ }
+ return resized;
+ }
+
+
+ rk_algorithm_type m_rk_algorithm;
+ coef_b_type m_b2;
+
+ resizer_type m_resizer;
+
+ wrapped_state_type m_x_tmp;
+ wrapped_deriv_type m_F[StageCount-1];
+
+
+};
+
+}
+}
+}
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_EXPLICIT_ERROR_GENERIC_RK_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/explicit_generic_rk.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/explicit_generic_rk.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,228 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/explicit_generic_rk.hpp
+
+ [begin_description]
+ Implementation of the generic Runge-Kutta steppers. This is the base class for many Runge-Kutta steppers.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_EXPLICIT_GENERIC_RK_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_EXPLICIT_GENERIC_RK_HPP_INCLUDED
+
+
+#include <boost/array.hpp>
+
+
+#include <boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp>
+#include <boost/numeric/odeint/algebra/range_algebra.hpp>
+#include <boost/numeric/odeint/algebra/default_operations.hpp>
+#include <boost/numeric/odeint/stepper/detail/generic_rk_algorithm.hpp>
+
+#include <boost/numeric/odeint/util/state_wrapper.hpp>
+#include <boost/numeric/odeint/util/is_resizeable.hpp>
+#include <boost/numeric/odeint/util/resizer.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+//forward declarations
+
+#ifndef DOXYGEN_SKIP
+template<
+size_t StageCount,
+size_t Order,
+class State ,
+class Value = double ,
+class Deriv = State ,
+class Time = Value ,
+class Algebra = range_algebra ,
+class Operations = default_operations ,
+class Resizer = initially_resizer
+>
+class explicit_generic_rk;
+
+
+struct stage_vector;
+
+template< class T , class Constant >
+struct array_wrapper
+{
+ typedef const typename boost::array< T , Constant::value > type;
+};
+
+template< class T , size_t i >
+struct stage
+{
+ T c;
+ boost::array< T , i > a;
+};
+
+
+template< class T , class Constant >
+struct stage_wrapper
+{
+ typedef stage< T , Constant::value > type;
+};
+#endif
+
+
+/**
+ * \class explicit_generic_rk
+ * \brief A generic implementation of explicit Runge-Kutta algorithms. This class is as a base class
+ * for all explicit Runge-Kutta steppers.
+ *
+ * This class implements the explicit Runge-Kutta algorithms without error estimation in a generic way.
+ * The Butcher tableau is passed to the stepper which constructs the stepper scheme with the help of a
+ * template-metaprogramming algorithm. ToDo : Add example!
+ *
+ * This class derives explicit_stepper_base which provides the stepper interface.
+ *
+ * \tparam StageCount The number of stages of the Runge-Kutta algorithm.
+ * \tparam Order The order of the stepper.
+ * \tparam State The type representing the state of the ODE.
+ * \tparam Value The floating point type which is used in the computations.
+ * \tparam Time The type representing the independent variable - the time - of the ODE.
+ * \tparam Algebra The algebra type.
+ * \tparam Operations The operations type.
+ * \tparam Resizer The resizer policy type.
+ */
+template<
+size_t StageCount,
+size_t Order,
+class State ,
+class Value ,
+class Deriv ,
+class Time ,
+class Algebra ,
+class Operations ,
+class Resizer
+>
+class explicit_generic_rk : public explicit_stepper_base<
+explicit_generic_rk< StageCount , Order , State , Value , Deriv , Time , Algebra , Operations , Resizer > ,
+Order , State , Value , Deriv , Time , Algebra , Operations , Resizer >
+{
+
+public:
+
+ #ifndef DOXYGEN_SKIP
+ typedef explicit_stepper_base<
+ explicit_generic_rk< StageCount , Order , State , Value , Deriv ,Time , Algebra , Operations , Resizer > ,
+ Order , State , Value , Deriv , Time , Algebra ,
+ Operations , Resizer > stepper_base_type;
+ #else
+ typedef explicit_stepper_base< ... > stepper_base_type;
+ #endif
+
+ typedef typename stepper_base_type::state_type state_type;
+ typedef typename stepper_base_type::wrapped_state_type wrapped_state_type;
+ typedef typename stepper_base_type::value_type value_type;
+ typedef typename stepper_base_type::deriv_type deriv_type;
+ typedef typename stepper_base_type::wrapped_deriv_type wrapped_deriv_type;
+ typedef typename stepper_base_type::time_type time_type;
+ typedef typename stepper_base_type::algebra_type algebra_type;
+ typedef typename stepper_base_type::operations_type operations_type;
+ typedef typename stepper_base_type::resizer_type resizer_type;
+
+ #ifndef DOXYGEN_SKIP
+ typedef explicit_generic_rk< StageCount , Order , State , Value , Deriv ,Time , Algebra , Operations , Resizer > stepper_type;
+ #endif
+
+ typedef detail::generic_rk_algorithm< StageCount , Value , Algebra , Operations > rk_algorithm_type;
+
+ typedef typename rk_algorithm_type::coef_a_type coef_a_type;
+ typedef typename rk_algorithm_type::coef_b_type coef_b_type;
+ typedef typename rk_algorithm_type::coef_c_type coef_c_type;
+
+ #ifndef DOXYGEN_SKIP
+ static const size_t stage_count = StageCount;
+ #endif
+
+private:
+
+public:
+
+ /**
+ * \brief Constructs the explicit_generic_rk class.
+ * \param a The coefficients a in the butcher tableau, see the details section for an example.
+ * \param b The coefficients b in the butcher tableau, see the details section for an example.
+ * \param c The coefficients c in the butcher tableau, see the details section for an example.
+ * \param algebra A copy of algebra is made and stored inside explicit_stepper_base.
+ */
+ explicit_generic_rk( const coef_a_type &a , const coef_b_type &b , const coef_c_type &c ,
+ const algebra_type &algebra = algebra_type() )
+ : stepper_base_type( algebra ) , m_rk_algorithm( a , b , c )
+ { }
+
+
+ /**
+ * \brief This method performs one step. The derivative `dxdt` of `in` at the time `t` is passed to the method.
+ * The result is updated out of place, hence the input is in `in` and the output in `out`. `do_step_impl` is
+ * used by explicit_stepper_base.
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ODE. It must fullfil the
+ * Simple System concept.
+ * \param in The state of the ODE which should be solved. in is not modified in this method
+ * \param dxdt The derivative of x at t.
+ * \param t The value of the time, at which the step should be performed.
+ * \param out The result of the step is written in out.
+ * \param dt The step size.
+ */
+ template< class System , class StateIn , class DerivIn , class StateOut >
+ void do_step_impl( System system , const StateIn &in , const DerivIn &dxdt ,
+ time_type t , StateOut &out , time_type dt )
+ {
+ m_resizer.adjust_size( in , detail::bind( &stepper_type::template resize_impl< StateIn > , detail::ref( *this ) , detail::_1 ) );
+
+ // actual calculation done in generic_rk.hpp
+ m_rk_algorithm.do_step( stepper_base_type::m_algebra , system , in , dxdt , t , out , dt , m_x_tmp.m_v , m_F );
+ }
+
+ /**
+ * \brief Adjust the size of all temporaries in the stepper manually.
+ * \param x A state from which the size of the temporaries to be resized is deduced.
+ */
+ template< class StateType >
+ void adjust_size( const StateType &x )
+ {
+ resize_impl( x );
+ stepper_base_type::adjust_size( x );
+ }
+
+private:
+
+ template< class StateIn >
+ bool resize_impl( const StateIn &x )
+ {
+ bool resized( false );
+ resized |= adjust_size_by_resizeability( m_x_tmp , x , typename is_resizeable<state_type>::type() );
+ for( size_t i = 0 ; i < StageCount-1 ; ++i )
+ {
+ resized |= adjust_size_by_resizeability( m_F[i] , x , typename is_resizeable<deriv_type>::type() );
+ }
+ return resized;
+ }
+
+
+ rk_algorithm_type m_rk_algorithm;
+
+ resizer_type m_resizer;
+
+ wrapped_state_type m_x_tmp;
+ wrapped_deriv_type m_F[StageCount-1];
+
+};
+
+}
+}
+}
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_EXPLICIT_GENERIC_RK_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/generation.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/generation.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,36 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/generation.hpp
+
+ [begin_description]
+ Forward header for the factory functions. Includes all files from the generation directory.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_HPP_INCLUDED
+
+#include <boost/numeric/odeint/stepper/generation/make_controlled.hpp>
+#include <boost/numeric/odeint/stepper/generation/make_dense_output.hpp>
+
+#include <boost/numeric/odeint/stepper/generation/generation_controlled_runge_kutta.hpp>
+#include <boost/numeric/odeint/stepper/generation/generation_dense_output_runge_kutta.hpp>
+
+#include <boost/numeric/odeint/stepper/generation/generation_runge_kutta_cash_karp54_classic.hpp>
+#include <boost/numeric/odeint/stepper/generation/generation_runge_kutta_cash_karp54.hpp>
+#include <boost/numeric/odeint/stepper/generation/generation_runge_kutta_dopri5.hpp>
+#include <boost/numeric/odeint/stepper/generation/generation_runge_kutta_fehlberg78.hpp>
+
+
+#include <boost/numeric/odeint/stepper/generation/generation_rosenbrock4.hpp>
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/generation/generation_controlled_runge_kutta.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/generation/generation_controlled_runge_kutta.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,53 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/generation/generation_controlled_runge_kutta.hpp
+
+ [begin_description]
+ Specialization of the controller factory for the controlled_runge_kutta class.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_CONTROLLED_RUNGE_KUTTA_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_CONTROLLED_RUNGE_KUTTA_HPP_INCLUDED
+
+#include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp>
+#include <boost/numeric/odeint/stepper/generation/make_controlled.hpp>
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+// controller factory for controlled_runge_kutta
+template< class Stepper >
+struct controller_factory< Stepper , controlled_runge_kutta< Stepper > >
+{
+ typedef Stepper stepper_type;
+ typedef controlled_runge_kutta< stepper_type > controller_type;
+ typedef typename controller_type::error_checker_type error_checker_type;
+ typedef typename stepper_type::value_type value_type;
+
+ controller_type operator()( value_type abs_error , value_type rel_error , const stepper_type &stepper )
+ {
+ return controller_type( error_checker_type( abs_error , rel_error ) , stepper );
+ }
+};
+
+
+
+
+} // odeint
+} // numeric
+} // boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_CONTROLLED_RUNGE_KUTTA_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/generation/generation_dense_output_runge_kutta.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/generation/generation_dense_output_runge_kutta.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,54 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/generation/generation_dense_output_runge_kutta.hpp
+
+ [begin_description]
+ Specialization of the controller factory for the dense_output_runge_kutta class.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_DENSE_OUTPUT_RUNGE_KUTTA_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_DENSE_OUTPUT_RUNGE_KUTTA_HPP_INCLUDED
+
+#include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp>
+#include <boost/numeric/odeint/stepper/dense_output_runge_kutta.hpp>
+#include <boost/numeric/odeint/stepper/generation/make_dense_output.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+// controller factory for controlled_runge_kutta
+template< class Stepper >
+struct dense_output_factory< Stepper , dense_output_runge_kutta< controlled_runge_kutta< Stepper > > >
+{
+ typedef Stepper stepper_type;
+ typedef controlled_runge_kutta< stepper_type > controller_type;
+ typedef typename controller_type::error_checker_type error_checker_type;
+ typedef typename stepper_type::value_type value_type;
+ typedef dense_output_runge_kutta< controller_type > dense_output_type;
+
+ dense_output_type operator()( value_type abs_error , value_type rel_error , const stepper_type &stepper )
+ {
+ return dense_output_type( controller_type( error_checker_type( abs_error , rel_error ) , stepper ) );
+ }
+};
+
+
+
+
+
+} // odeint
+} // numeric
+} // boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_DENSE_OUTPUT_RUNGE_KUTTA_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/generation/generation_rosenbrock4.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/generation/generation_rosenbrock4.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,72 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/generation/generation_rosenbrock4.hpp
+
+ [begin_description]
+ Enable the factory functions for the controller and the dense output of the Rosenbrock4 method.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_ROSENBROCK4_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_ROSENBROCK4_HPP_INCLUDED
+
+#include <boost/numeric/odeint/stepper/rosenbrock4.hpp>
+#include <boost/numeric/odeint/stepper/rosenbrock4_controller.hpp>
+#include <boost/numeric/odeint/stepper/rosenbrock4_dense_output.hpp>
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+template< class Value , class Coefficients , class Resize >
+struct get_controller< rosenbrock4< Value , Coefficients , Resize > >
+{
+ typedef rosenbrock4< Value , Coefficients , Resize > stepper_type;
+ typedef rosenbrock4_controller< stepper_type > type;
+};
+
+
+
+template< class Value , class Coefficients , class Resize >
+struct get_dense_output< rosenbrock4< Value , Coefficients , Resize > >
+{
+ typedef rosenbrock4< Value , Coefficients , Resize > stepper_type;
+ typedef rosenbrock4_controller< stepper_type > controller_type;
+ typedef rosenbrock4_dense_output< controller_type > type;
+};
+
+
+
+// controller factory for controlled_runge_kutta
+template< class Stepper >
+struct dense_output_factory< Stepper , rosenbrock4_dense_output< rosenbrock4_controller< Stepper > > >
+{
+ typedef Stepper stepper_type;
+ typedef rosenbrock4_controller< stepper_type > controller_type;
+ typedef typename stepper_type::value_type value_type;
+ typedef rosenbrock4_dense_output< controller_type > dense_output_type;
+
+ dense_output_type operator()( value_type abs_error , value_type rel_error , const stepper_type &stepper )
+ {
+ return dense_output_type( controller_type( abs_error , rel_error , stepper ) );
+ }
+};
+
+
+
+} // odeint
+} // numeric
+} // boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_ROSENBROCK4_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/generation/generation_runge_kutta_cash_karp54.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/generation/generation_runge_kutta_cash_karp54.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,47 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/generation/generation_runge_kutta_cash_karp54.hpp
+
+ [begin_description]
+ Enable the factory functions for the controller and the dense output of the Runge-Kutta-Cash-Karp 54 method.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_CASH_KARP54_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_CASH_KARP54_HPP_INCLUDED
+
+#include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp>
+#include <boost/numeric/odeint/stepper/runge_kutta_cash_karp54.hpp>
+#include <boost/numeric/odeint/stepper/generation/make_controlled.hpp>
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+// Specializations for runge_kutta_cash_karp54
+template< class State , class Value , class Deriv , class Time , class Algebra , class Operations , class Resize >
+struct get_controller< runge_kutta_cash_karp54< State , Value , Deriv , Time , Algebra , Operations , Resize > >
+{
+ typedef runge_kutta_cash_karp54< State , Value , Deriv , Time , Algebra , Operations , Resize > stepper_type;
+ typedef controlled_runge_kutta< stepper_type > type;
+};
+
+
+
+
+
+} // odeint
+} // numeric
+} // boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_CASH_KARP54_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/generation/generation_runge_kutta_cash_karp54_classic.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/generation/generation_runge_kutta_cash_karp54_classic.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,48 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/generation/generation_runge_kutta_cash_karp54_classic.hpp
+
+ [begin_description]
+ Enable the factory functions for the controller and the dense output of the
+ Runge-Kutta-Cash-Karp 54 method with the classical implementation.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_CASH_KARP54_CLASSIC_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_CASH_KARP54_CLASSIC_HPP_INCLUDED
+
+#include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp>
+#include <boost/numeric/odeint/stepper/runge_kutta_cash_karp54_classic.hpp>
+#include <boost/numeric/odeint/stepper/generation/make_controlled.hpp>
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+// Specializations for runge_kutta_cash_karp54
+template< class State , class Value , class Deriv , class Time , class Algebra , class Operations , class Resize >
+struct get_controller< runge_kutta_cash_karp54_classic< State , Value , Deriv , Time , Algebra , Operations , Resize > >
+{
+ typedef runge_kutta_cash_karp54_classic< State , Value , Deriv , Time , Algebra , Operations , Resize > stepper_type;
+ typedef controlled_runge_kutta< stepper_type > type;
+};
+
+
+
+
+} // odeint
+} // numeric
+} // boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_CASH_KARP54_CLASSIC_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/generation/generation_runge_kutta_dopri5.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/generation/generation_runge_kutta_dopri5.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,56 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/generation/generation_runge_kutta_dopri5.hpp
+
+ [begin_description]
+ Enable the factory functions for the controller and the dense output of the Runge-Kutta-Dormand-Prince5 method.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_DOPRI5_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_DOPRI5_HPP_INCLUDED
+
+#include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp>
+#include <boost/numeric/odeint/stepper/dense_output_runge_kutta.hpp>
+#include <boost/numeric/odeint/stepper/runge_kutta_dopri5.hpp>
+#include <boost/numeric/odeint/stepper/generation/make_controlled.hpp>
+#include <boost/numeric/odeint/stepper/generation/make_dense_output.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+template< class State , class Value , class Deriv , class Time , class Algebra , class Operations , class Resize >
+struct get_controller< runge_kutta_dopri5< State , Value , Deriv , Time , Algebra , Operations , Resize > >
+{
+ typedef runge_kutta_dopri5< State , Value , Deriv , Time , Algebra , Operations , Resize > stepper_type;
+ typedef controlled_runge_kutta< stepper_type > type;
+};
+
+
+template< class State , class Value , class Deriv , class Time , class Algebra , class Operations , class Resize >
+struct get_dense_output< runge_kutta_dopri5< State , Value , Deriv , Time , Algebra , Operations , Resize > >
+{
+ typedef runge_kutta_dopri5< State , Value , Deriv , Time , Algebra , Operations , Resize > stepper_type;
+ typedef controlled_runge_kutta< stepper_type > controller_type;
+ typedef dense_output_runge_kutta< controller_type > type;
+};
+
+
+
+
+} // odeint
+} // numeric
+} // boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_DOPRI5_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/generation/generation_runge_kutta_fehlberg78.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/generation/generation_runge_kutta_fehlberg78.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,46 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/generation/generation_runge_kutta_fehlberg78.hpp
+
+ [begin_description]
+ Enable the factory functions for the controller and the dense output of the Runge-Kutta-Fehlberg 78 method.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_FEHLBERG78_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_FEHLBERG78_HPP_INCLUDED
+
+#include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp>
+#include <boost/numeric/odeint/stepper/runge_kutta_fehlberg78.hpp>
+#include <boost/numeric/odeint/stepper/generation/make_controlled.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+template< class State , class Value , class Deriv , class Time , class Algebra , class Operations , class Resize >
+struct get_controller< runge_kutta_fehlberg78< State , Value , Deriv , Time , Algebra , Operations , Resize > >
+{
+ typedef runge_kutta_fehlberg78< State , Value , Deriv , Time , Algebra , Operations , Resize > stepper_type;
+ typedef controlled_runge_kutta< stepper_type > type;
+};
+
+
+
+
+
+} // odeint
+} // numeric
+} // boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_FEHLBERG78_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/generation/make_controlled.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/generation/make_controlled.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,81 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/generation/make_controlled.hpp
+
+ [begin_description]
+ Factory function to simplify the creation of controlled steppers from error steppers.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_MAKE_CONTROLLED_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_MAKE_CONTROLLED_HPP_INCLUDED
+
+
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+
+// default template for the controller
+template< class Stepper > struct get_controller { };
+
+
+
+// default controller factory
+template< class Stepper , class Controller >
+struct controller_factory
+{
+ Controller operator()(
+ typename Stepper::value_type abs_error ,
+ typename Stepper::value_type rel_error ,
+ const Stepper &stepper )
+ {
+ return Controller( abs_error , rel_error , stepper );
+ }
+};
+
+
+
+
+namespace result_of
+{
+ template< class Stepper >
+ struct make_controlled
+ {
+ typedef typename get_controller< Stepper >::type type;
+ };
+}
+
+
+template< class Stepper >
+typename result_of::make_controlled< Stepper >::type make_controlled(
+ typename Stepper::value_type abs_error ,
+ typename Stepper::value_type rel_error ,
+ const Stepper & stepper = Stepper() )
+{
+ typedef Stepper stepper_type;
+ typedef typename result_of::make_controlled< stepper_type >::type controller_type;
+ typedef controller_factory< stepper_type , controller_type > factory_type;
+ factory_type factory;
+ return factory( abs_error , rel_error , stepper );
+}
+
+
+
+} // odeint
+} // numeric
+} // boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_MAKE_CONTROLLED_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/generation/make_dense_output.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/generation/make_dense_output.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,78 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/generation/make_dense_output.hpp
+
+ [begin_description]
+ Factory function to simplify the creation of dense output steppers from error steppers.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_MAKE_DENSE_OUTPUT_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_MAKE_DENSE_OUTPUT_HPP_INCLUDED
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+// default template for the dense output
+template< class Stepper > struct get_dense_output { };
+
+
+
+// default dense output factory
+template< class Stepper , class DenseOutput >
+struct dense_output_factory
+{
+ DenseOutput operator()(
+ typename Stepper::value_type abs_error ,
+ typename Stepper::value_type rel_error ,
+ const Stepper &stepper )
+ {
+ return DenseOutput( abs_error , rel_error , stepper );
+ }
+};
+
+
+
+namespace result_of
+{
+ template< class Stepper >
+ struct make_dense_output
+ {
+ typedef typename get_dense_output< Stepper >::type type;
+ };
+}
+
+
+
+template< class Stepper >
+typename result_of::make_dense_output< Stepper >::type make_dense_output(
+ typename Stepper::value_type abs_error ,
+ typename Stepper::value_type rel_error ,
+ const Stepper &stepper = Stepper() )
+{
+ typedef Stepper stepper_type;
+ typedef typename result_of::make_dense_output< stepper_type >::type dense_output_type;
+ typedef dense_output_factory< stepper_type , dense_output_type > factory_type;
+ factory_type factory;
+ return factory( abs_error , rel_error , stepper );
+}
+
+
+
+
+} // odeint
+} // numeric
+} // boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_MAKE_DENSE_OUTPUT_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/implicit_euler.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/implicit_euler.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,169 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/implicit_euler.hpp
+
+ [begin_description]
+ Impementation of the implicit Euler method. Works with ublas::vector as state type.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_IMPLICIT_EULER_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_IMPLICIT_EULER_HPP_INCLUDED
+
+
+#include <utility>
+
+#include <boost/numeric/odeint/util/bind.hpp>
+#include <boost/numeric/odeint/util/unwrap_reference.hpp>
+#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
+
+#include <boost/numeric/odeint/util/ublas_wrapper.hpp>
+#include <boost/numeric/odeint/util/is_resizeable.hpp>
+#include <boost/numeric/odeint/util/resizer.hpp>
+
+#include <boost/numeric/ublas/vector.hpp>
+#include <boost/numeric/ublas/matrix.hpp>
+#include <boost/numeric/ublas/lu.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+
+
+
+
+
+
+template< class ValueType , class Resizer = initially_resizer >
+class implicit_euler
+{
+
+public:
+
+ typedef ValueType value_type;
+ typedef value_type time_type;
+ typedef boost::numeric::ublas::vector< value_type > state_type;
+ typedef state_wrapper< state_type > wrapped_state_type;
+ typedef state_type deriv_type;
+ typedef state_wrapper< deriv_type > wrapped_deriv_type;
+ typedef boost::numeric::ublas::matrix< value_type > matrix_type;
+ typedef state_wrapper< matrix_type > wrapped_matrix_type;
+ typedef boost::numeric::ublas::permutation_matrix< size_t > pmatrix_type;
+ typedef state_wrapper< pmatrix_type > wrapped_pmatrix_type;
+ typedef Resizer resizer_type;
+ typedef stepper_tag stepper_category;
+ typedef implicit_euler< ValueType , Resizer > stepper_type;
+
+ implicit_euler( value_type epsilon = 1E-6 )
+ : m_epsilon( epsilon )
+ { }
+
+
+ template< class System >
+ void do_step( System system , state_type &x , time_type t , time_type dt )
+ {
+ typedef typename odeint::unwrap_reference< System >::type system_type;
+ typedef typename odeint::unwrap_reference< typename system_type::first_type >::type deriv_func_type;
+ typedef typename odeint::unwrap_reference< typename system_type::second_type >::type jacobi_func_type;
+ system_type &sys = system;
+ deriv_func_type &deriv_func = sys.first;
+ jacobi_func_type &jacobi_func = sys.second;
+
+ m_resizer.adjust_size( x , detail::bind( &stepper_type::template resize_impl<state_type> , detail::ref( *this ) , detail::_1 ) );
+
+ for( size_t i=0 ; i<x.size() ; ++i )
+ m_pm.m_v[i] = i;
+
+ t += dt;
+
+ // apply first Newton step
+ deriv_func( x , m_dxdt.m_v , t );
+
+ m_b.m_v = dt * m_dxdt.m_v;
+
+ jacobi_func( x , m_jacobi.m_v , t );
+ m_jacobi.m_v *= dt;
+ m_jacobi.m_v -= boost::numeric::ublas::identity_matrix< value_type >( x.size() );
+
+ solve( m_b.m_v , m_jacobi.m_v );
+
+ m_x.m_v = x - m_b.m_v;
+
+ // iterate Newton until some precision is reached
+ // ToDo: maybe we should apply only one Newton step -> linear implicit one-step scheme
+ while( boost::numeric::ublas::norm_2( m_b.m_v ) > m_epsilon )
+ {
+ deriv_func( m_x.m_v , m_dxdt.m_v , t );
+ m_b.m_v = x - m_x.m_v + dt*m_dxdt.m_v;
+
+ // simplified version, only the first Jacobian is used
+ // jacobi( m_x , m_jacobi , t );
+ // m_jacobi *= dt;
+ // m_jacobi -= boost::numeric::ublas::identity_matrix< value_type >( x.size() );
+
+ solve( m_b.m_v , m_jacobi.m_v );
+
+ m_x.m_v -= m_b.m_v;
+ }
+ x = m_x.m_v;
+ }
+
+ template< class StateType >
+ void adjust_size( const StateType &x )
+ {
+ resize_impl( x );
+ }
+
+
+private:
+
+ template< class StateIn >
+ bool resize_impl( const StateIn &x )
+ {
+ bool resized = false;
+ resized |= adjust_size_by_resizeability( m_dxdt , x , typename is_resizeable<deriv_type>::type() );
+ resized |= adjust_size_by_resizeability( m_x , x , typename is_resizeable<state_type>::type() );
+ resized |= adjust_size_by_resizeability( m_b , x , typename is_resizeable<deriv_type>::type() );
+ resized |= adjust_size_by_resizeability( m_jacobi , x , typename is_resizeable<matrix_type>::type() );
+ resized |= adjust_size_by_resizeability( m_pm , x , typename is_resizeable<pmatrix_type>::type() );
+ return resized;
+ }
+
+
+ void solve( state_type &x , matrix_type &m )
+ {
+ int res = boost::numeric::ublas::lu_factorize( m , m_pm.m_v );
+ if( res != 0 ) exit(0);
+ boost::numeric::ublas::lu_substitute( m , m_pm.m_v , x );
+ }
+
+private:
+
+ value_type m_epsilon;
+ resizer_type m_resizer;
+ wrapped_deriv_type m_dxdt;
+ wrapped_state_type m_x;
+ wrapped_deriv_type m_b;
+ wrapped_matrix_type m_jacobi;
+ wrapped_pmatrix_type m_pm;
+
+
+};
+
+
+} // odeint
+} // numeric
+} // boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_IMPLICIT_EULER_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/modified_midpoint.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/modified_midpoint.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,285 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/modified_midpoint.hpp
+
+ [begin_description]
+ Modified midpoint method for the use in Burlish-Stoer stepper.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_MODIFIED_MIDPOINT_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_MODIFIED_MIDPOINT_HPP_INCLUDED
+
+#include <vector>
+
+#include <boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp>
+#include <boost/numeric/odeint/util/resizer.hpp>
+#include <boost/numeric/odeint/util/is_resizeable.hpp>
+#include <boost/numeric/odeint/algebra/range_algebra.hpp>
+#include <boost/numeric/odeint/algebra/default_operations.hpp>
+#include <boost/numeric/odeint/util/copy.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+template<
+class State ,
+class Value = double ,
+class Deriv = State ,
+class Time = Value ,
+class Algebra = range_algebra ,
+class Operations = default_operations ,
+class Resizer = initially_resizer
+>
+class modified_midpoint
+: public explicit_stepper_base<
+ modified_midpoint< State , Value , Deriv , Time , Algebra , Operations , Resizer > ,
+ 2 , State , Value , Deriv , Time , Algebra , Operations , Resizer >
+{
+
+public :
+
+ typedef explicit_stepper_base<
+ modified_midpoint< State , Value , Deriv , Time , Algebra , Operations , Resizer > ,
+ 2 , State , Value , Deriv , Time , Algebra , Operations , Resizer > stepper_base_type;
+
+ typedef typename stepper_base_type::state_type state_type;
+ typedef typename stepper_base_type::wrapped_state_type wrapped_state_type;
+ typedef typename stepper_base_type::value_type value_type;
+ typedef typename stepper_base_type::deriv_type deriv_type;
+ typedef typename stepper_base_type::wrapped_deriv_type wrapped_deriv_type;
+ typedef typename stepper_base_type::time_type time_type;
+ typedef typename stepper_base_type::algebra_type algebra_type;
+ typedef typename stepper_base_type::operations_type operations_type;
+ typedef typename stepper_base_type::resizer_type resizer_type;
+ typedef typename stepper_base_type::stepper_type stepper_type;
+
+
+ modified_midpoint( unsigned short steps = 2 , const algebra_type &algebra = algebra_type() )
+ : stepper_base_type( algebra ) , m_steps( steps )
+ { }
+
+ template< class System , class StateIn , class DerivIn , class StateOut >
+ void do_step_impl( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt )
+ {
+ static const value_type val1 = static_cast< value_type >( 1 );
+ static const value_type val05 = static_cast< value_type >( 1 ) / static_cast< value_type >( 2 );
+
+ m_resizer.adjust_size( in , detail::bind( &stepper_type::template resize_impl< StateIn > , detail::ref( *this ) , detail::_1 ) );
+
+ const time_type h = dt / static_cast<value_type>( m_steps );
+ const time_type h2 = static_cast<value_type>(2) * h;
+
+ typename odeint::unwrap_reference< System >::type &sys = system;
+
+ time_type th = t + h;
+
+ // m_x1 = x + h*dxdt
+ stepper_base_type::m_algebra.for_each3( m_x1.m_v , in , dxdt ,
+ typename operations_type::template scale_sum2< value_type , time_type >( val1 , h ) );
+
+ sys( m_x1.m_v , m_dxdt.m_v , th );
+
+ boost::numeric::odeint::copy( in , m_x0.m_v );
+
+ unsigned short i = 1;
+ while( i != m_steps )
+ {
+ // general step
+ //tmp = m_x1; m_x1 = m_x0 + h2*m_dxdt; m_x0 = tmp
+ stepper_base_type::m_algebra.for_each3( m_x1.m_v , m_x0.m_v , m_dxdt.m_v ,
+ typename operations_type::template scale_sum_swap2< value_type , time_type >( val1 , h2 ) );
+ th += h;
+ sys( m_x1.m_v , m_dxdt.m_v , th);
+ i++;
+ }
+
+ // last step
+ // x = 0.5*( m_x0 + m_x1 + h*m_dxdt )
+ stepper_base_type::m_algebra.for_each4( out , m_x0.m_v , m_x1.m_v , m_dxdt.m_v ,
+ typename operations_type::template scale_sum3< value_type , value_type , time_type >( val05 , val05 , val05*h ) );
+ }
+
+
+ void set_steps( unsigned short steps )
+ { m_steps = steps; }
+
+
+ unsigned short steps( void ) const
+ { return m_steps; }
+
+
+ template< class StateIn >
+ void adjust_size( const StateIn &x )
+ {
+ resize_impl( x );
+ stepper_base_type::adjust_size( x );
+ }
+
+private:
+
+ template< class StateIn >
+ bool resize_impl( const StateIn &x )
+ {
+ bool resized( false );
+ resized |= adjust_size_by_resizeability( m_x0 , x , typename is_resizeable<state_type>::type() );
+ resized |= adjust_size_by_resizeability( m_x1 , x , typename is_resizeable<state_type>::type() );
+ resized |= adjust_size_by_resizeability( m_dxdt , x , typename is_resizeable<deriv_type>::type() );
+ return resized;
+ }
+
+
+ unsigned short m_steps;
+
+ resizer_type m_resizer;
+
+ wrapped_state_type m_x0;
+ wrapped_state_type m_x1;
+ wrapped_deriv_type m_dxdt;
+
+};
+
+
+/* Modified midpoint which stores derivatives and state at dt/2 in some external storage for later usage in dense output calculation
+ * This Stepper is for use in Bulirsch Stoer only. It DOES NOT meet any stepper concept.
+ */
+
+template<
+class State ,
+class Value = double ,
+class Deriv = State ,
+class Time = Value ,
+class Algebra = range_algebra ,
+class Operations = default_operations ,
+class Resizer = initially_resizer
+>
+class modified_midpoint_dense_out
+{
+
+public :
+
+ typedef State state_type;
+ typedef Value value_type;
+ typedef Deriv deriv_type;
+ typedef Time time_type;
+ typedef Algebra algebra_type;
+ typedef Operations operations_type;
+ typedef Resizer resizer_type;
+ typedef state_wrapper< state_type > wrapped_state_type;
+ typedef state_wrapper< deriv_type > wrapped_deriv_type;
+
+ typedef modified_midpoint_dense_out< State , Value , Deriv , Time , Algebra , Operations , Resizer > stepper_type;
+ typedef std::vector< wrapped_deriv_type > deriv_table_type;
+
+ modified_midpoint_dense_out( unsigned short steps = 2 , const algebra_type &algebra = algebra_type() )
+ : m_algebra( algebra ) , m_steps( steps )
+ { }
+
+ /*
+ * performs a modified midpoint step with m_steps intermediate points
+ * stores approximation for x(t+dt/2) in x_mp and all evaluated function results in derivs
+ *
+ */
+
+ template< class System , class StateIn , class DerivIn , class StateOut >
+ void do_step( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt ,
+ state_type &x_mp , deriv_table_type &derivs )
+ {
+
+ static const value_type val1 = static_cast< value_type >( 1 );
+ static const value_type val05 = static_cast< value_type >( 1 ) / static_cast< value_type >( 2 );
+
+ m_resizer.adjust_size( in , detail::bind( &stepper_type::template resize< StateIn > , detail::ref( *this ) , detail::_1 ) );
+
+ const time_type h = dt / static_cast<value_type>( m_steps );
+ const time_type h2 = static_cast<value_type>( 2 ) * h;
+
+ typename odeint::unwrap_reference< System >::type &sys = system;
+
+ time_type th = t + h;
+
+ // m_x1 = x + h*dxdt
+ m_algebra.for_each3( m_x1.m_v , in , dxdt ,
+ typename operations_type::template scale_sum2< value_type , time_type >( val1 , h ) );
+
+ if( m_steps == 2 )
+ // result of first step already gives approximation at the center of the interval
+ boost::numeric::odeint::copy( m_x1.m_v , x_mp );
+
+ sys( m_x1.m_v , derivs[0].m_v , th );
+
+ boost::numeric::odeint::copy( in , m_x0.m_v );
+
+ unsigned short i = 1;
+ while( i != m_steps )
+ {
+ // general step
+ //tmp = m_x1; m_x1 = m_x0 + h2*m_dxdt; m_x0 = tmp
+ m_algebra.for_each3( m_x1.m_v , m_x0.m_v , derivs[i-1].m_v ,
+ typename operations_type::template scale_sum_swap2< value_type , time_type >( val1 , h2 ) );
+ if( i == m_steps/2-1 )
+ // save approximation at the center of the interval
+ boost::numeric::odeint::copy( m_x1.m_v , x_mp );
+
+ th += h;
+ sys( m_x1.m_v , derivs[i].m_v , th);
+ i++;
+ }
+
+ // last step
+ // x = 0.5*( m_x0 + m_x1 + h*m_dxdt )
+ m_algebra.for_each4( out , m_x0.m_v , m_x1.m_v , derivs[m_steps-1].m_v ,
+ typename operations_type::template scale_sum3< value_type , value_type , time_type >( val05 , val05 , val05*h ) );
+ }
+
+
+ void set_steps( unsigned short steps )
+ { m_steps = steps; }
+
+
+ unsigned short steps( void ) const
+ { return m_steps; }
+
+
+ template< class StateIn >
+ bool resize( const StateIn &x )
+ {
+ bool resized( false );
+ resized |= adjust_size_by_resizeability( m_x0 , x , typename is_resizeable<state_type>::type() );
+ resized |= adjust_size_by_resizeability( m_x1 , x , typename is_resizeable<state_type>::type() );
+ return resized;
+ }
+
+ template< class StateIn >
+ void adjust_size( const StateIn &x )
+ {
+ resize( x );
+ }
+
+private:
+
+ algebra_type m_algebra;
+
+ unsigned short m_steps;
+
+ resizer_type m_resizer;
+
+ wrapped_state_type m_x0;
+ wrapped_state_type m_x1;
+
+};
+
+}
+}
+}
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_MODIFIED_MIDPOINT_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/rosenbrock4.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/rosenbrock4.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,345 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/rosenbrock4.hpp
+
+ [begin_description]
+ Implementation of the Rosenbrock 4 method for solving stiff ODEs. Note, that a
+ controller and a dense-output stepper exist for this method,
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_ROSENBROCK4_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_ROSENBROCK4_HPP_INCLUDED
+
+
+#include <boost/numeric/odeint/util/bind.hpp>
+#include <boost/numeric/odeint/util/unwrap_reference.hpp>
+#include <boost/numeric/ublas/vector.hpp>
+#include <boost/numeric/ublas/matrix.hpp>
+#include <boost/numeric/ublas/lu.hpp>
+
+#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
+
+#include <boost/numeric/odeint/util/ublas_wrapper.hpp>
+#include <boost/numeric/odeint/util/is_resizeable.hpp>
+#include <boost/numeric/odeint/util/resizer.hpp>
+
+#include <boost/numeric/ublas/vector.hpp>
+#include <boost/numeric/ublas/matrix.hpp>
+#include <boost/numeric/ublas/lu.hpp>
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+/*
+ * ToDo:
+ *
+ * 2. Interfacing for odeint, check if controlled_error_stepper can be used
+ * 3. dense output
+ */
+
+
+
+template< class Value >
+struct default_rosenbrock_coefficients
+{
+ typedef Value value_type;
+ typedef unsigned short order_type;
+
+ default_rosenbrock_coefficients( void )
+ : gamma ( static_cast< value_type >( 0.25 ) ) ,
+ d1 ( static_cast< value_type >( 0.25 ) ) ,
+ d2 ( static_cast< value_type >( -0.1043 ) ) ,
+ d3 ( static_cast< value_type >( 0.1035 ) ) ,
+ d4 ( static_cast< value_type >( 0.3620000000000023e-01 ) ) ,
+ c2 ( static_cast< value_type >( 0.386 ) ) ,
+ c3 ( static_cast< value_type >( 0.21 ) ) ,
+ c4 ( static_cast< value_type >( 0.63 ) ) ,
+ c21 ( static_cast< value_type >( -0.5668800000000000e+01 ) ) ,
+ a21 ( static_cast< value_type >( 0.1544000000000000e+01 ) ) ,
+ c31 ( static_cast< value_type >( -0.2430093356833875e+01 ) ) ,
+ c32 ( static_cast< value_type >( -0.2063599157091915e+00 ) ) ,
+ a31 ( static_cast< value_type >( 0.9466785280815826e+00 ) ) ,
+ a32 ( static_cast< value_type >( 0.2557011698983284e+00 ) ) ,
+ c41 ( static_cast< value_type >( -0.1073529058151375e+00 ) ) ,
+ c42 ( static_cast< value_type >( -0.9594562251023355e+01 ) ) ,
+ c43 ( static_cast< value_type >( -0.2047028614809616e+02 ) ) ,
+ a41 ( static_cast< value_type >( 0.3314825187068521e+01 ) ) ,
+ a42 ( static_cast< value_type >( 0.2896124015972201e+01 ) ) ,
+ a43 ( static_cast< value_type >( 0.9986419139977817e+00 ) ) ,
+ c51 ( static_cast< value_type >( 0.7496443313967647e+01 ) ) ,
+ c52 ( static_cast< value_type >( -0.1024680431464352e+02 ) ) ,
+ c53 ( static_cast< value_type >( -0.3399990352819905e+02 ) ) ,
+ c54 ( static_cast< value_type >( 0.1170890893206160e+02 ) ) ,
+ a51 ( static_cast< value_type >( 0.1221224509226641e+01 ) ) ,
+ a52 ( static_cast< value_type >( 0.6019134481288629e+01 ) ) ,
+ a53 ( static_cast< value_type >( 0.1253708332932087e+02 ) ) ,
+ a54 ( static_cast< value_type >( -0.6878860361058950e+00 ) ) ,
+ c61 ( static_cast< value_type >( 0.8083246795921522e+01 ) ) ,
+ c62 ( static_cast< value_type >( -0.7981132988064893e+01 ) ) ,
+ c63 ( static_cast< value_type >( -0.3152159432874371e+02 ) ) ,
+ c64 ( static_cast< value_type >( 0.1631930543123136e+02 ) ) ,
+ c65 ( static_cast< value_type >( -0.6058818238834054e+01 ) ) ,
+ d21 ( static_cast< value_type >( 0.1012623508344586e+02 ) ) ,
+ d22 ( static_cast< value_type >( -0.7487995877610167e+01 ) ) ,
+ d23 ( static_cast< value_type >( -0.3480091861555747e+02 ) ) ,
+ d24 ( static_cast< value_type >( -0.7992771707568823e+01 ) ) ,
+ d25 ( static_cast< value_type >( 0.1025137723295662e+01 ) ) ,
+ d31 ( static_cast< value_type >( -0.6762803392801253e+00 ) ) ,
+ d32 ( static_cast< value_type >( 0.6087714651680015e+01 ) ) ,
+ d33 ( static_cast< value_type >( 0.1643084320892478e+02 ) ) ,
+ d34 ( static_cast< value_type >( 0.2476722511418386e+02 ) ) ,
+ d35 ( static_cast< value_type >( -0.6594389125716872e+01 ) )
+ {}
+
+ const value_type gamma;
+ const value_type d1 , d2 , d3 , d4;
+ const value_type c2 , c3 , c4;
+ const value_type c21 ;
+ const value_type a21;
+ const value_type c31 , c32;
+ const value_type a31 , a32;
+ const value_type c41 , c42 , c43;
+ const value_type a41 , a42 , a43;
+ const value_type c51 , c52 , c53 , c54;
+ const value_type a51 , a52 , a53 , a54;
+ const value_type c61 , c62 , c63 , c64 , c65;
+ const value_type d21 , d22 , d23 , d24 , d25;
+ const value_type d31 , d32 , d33 , d34 , d35;
+
+ static const order_type stepper_order = 4;
+ static const order_type error_order = 3;
+};
+
+
+
+template< class Value , class Coefficients = default_rosenbrock_coefficients< Value > , class Resizer = initially_resizer >
+class rosenbrock4
+{
+private:
+
+public:
+
+ typedef Value value_type;
+ typedef boost::numeric::ublas::vector< value_type > state_type;
+ typedef state_type deriv_type;
+ typedef value_type time_type;
+ typedef boost::numeric::ublas::matrix< value_type > matrix_type;
+ typedef boost::numeric::ublas::permutation_matrix< size_t > pmatrix_type;
+ typedef Resizer resizer_type;
+ typedef Coefficients rosenbrock_coefficients;
+ typedef stepper_tag stepper_category;
+ typedef unsigned short order_type;
+
+ typedef state_wrapper< state_type > wrapped_state_type;
+ typedef state_wrapper< deriv_type > wrapped_deriv_type;
+ typedef state_wrapper< matrix_type > wrapped_matrix_type;
+ typedef state_wrapper< pmatrix_type > wrapped_pmatrix_type;
+
+ typedef rosenbrock4< Value , Coefficients , Resizer > stepper_type;
+
+ const static order_type stepper_order = rosenbrock_coefficients::stepper_order;
+ const static order_type error_order = rosenbrock_coefficients::error_order;
+
+ rosenbrock4( void )
+ : m_resizer() , m_x_err_resizer() ,
+ m_jac() , m_pm() ,
+ m_dfdt() , m_dxdt() , m_dxdtnew() ,
+ m_g1() , m_g2() , m_g3() , m_g4() , m_g5() ,
+ m_cont3() , m_cont4() , m_xtmp() , m_x_err() ,
+ m_coef()
+ { }
+
+
+ order_type order() const { return stepper_order; }
+
+ template< class System >
+ void do_step( System system , const state_type &x , time_type t , state_type &xout , time_type dt , state_type &xerr )
+ {
+ // get the systen and jacobi function
+ typedef typename odeint::unwrap_reference< System >::type system_type;
+ typedef typename odeint::unwrap_reference< typename system_type::first_type >::type deriv_func_type;
+ typedef typename odeint::unwrap_reference< typename system_type::second_type >::type jacobi_func_type;
+ system_type &sys = system;
+ deriv_func_type &deriv_func = sys.first;
+ jacobi_func_type &jacobi_func = sys.second;
+
+ const size_t n = x.size();
+
+ m_resizer.adjust_size( x , detail::bind( &stepper_type::template resize_impl<state_type> , detail::ref( *this ) , detail::_1 ) );
+
+ for( size_t i=0 ; i<n ; ++i )
+ m_pm.m_v( i ) = i;
+
+ deriv_func( x , m_dxdt.m_v , t );
+ jacobi_func( x , m_jac.m_v , t , m_dfdt.m_v );
+
+ m_jac.m_v *= -1.0;
+ m_jac.m_v += 1.0 / m_coef.gamma / dt * boost::numeric::ublas::identity_matrix< value_type >( n );
+ boost::numeric::ublas::lu_factorize( m_jac.m_v , m_pm.m_v );
+
+ for( size_t i=0 ; i<n ; ++i )
+ m_g1.m_v[i] = m_dxdt.m_v[i] + dt * m_coef.d1 * m_dfdt.m_v[i];
+ boost::numeric::ublas::lu_substitute( m_jac.m_v , m_pm.m_v , m_g1.m_v );
+
+
+ for( size_t i=0 ; i<n ; ++i )
+ m_xtmp.m_v[i] = x[i] + m_coef.a21 * m_g1.m_v[i];
+ deriv_func( m_xtmp.m_v , m_dxdtnew.m_v , t + m_coef.c2 * dt );
+ for( size_t i=0 ; i<n ; ++i )
+ m_g2.m_v[i] = m_dxdtnew.m_v[i] + dt * m_coef.d2 * m_dfdt.m_v[i] + m_coef.c21 * m_g1.m_v[i] / dt;
+ boost::numeric::ublas::lu_substitute( m_jac.m_v , m_pm.m_v , m_g2.m_v );
+
+
+ for( size_t i=0 ; i<n ; ++i )
+ m_xtmp.m_v[i] = x[i] + m_coef.a31 * m_g1.m_v[i] + m_coef.a32 * m_g2.m_v[i];
+ deriv_func( m_xtmp.m_v , m_dxdtnew.m_v , t + m_coef.c3 * dt );
+ for( size_t i=0 ; i<n ; ++i )
+ m_g3.m_v[i] = m_dxdtnew.m_v[i] + dt * m_coef.d3 * m_dfdt.m_v[i] + ( m_coef.c31 * m_g1.m_v[i] + m_coef.c32 * m_g2.m_v[i] ) / dt;
+ boost::numeric::ublas::lu_substitute( m_jac.m_v , m_pm.m_v , m_g3.m_v );
+
+
+ for( size_t i=0 ; i<n ; ++i )
+ m_xtmp.m_v[i] = x[i] + m_coef.a41 * m_g1.m_v[i] + m_coef.a42 * m_g2.m_v[i] + m_coef.a43 * m_g3.m_v[i];
+ deriv_func( m_xtmp.m_v , m_dxdtnew.m_v , t + m_coef.c4 * dt );
+ for( size_t i=0 ; i<n ; ++i )
+ m_g4.m_v[i] = m_dxdtnew.m_v[i] + dt * m_coef.d4 * m_dfdt.m_v[i] + ( m_coef.c41 * m_g1.m_v[i] + m_coef.c42 * m_g2.m_v[i] + m_coef.c43 * m_g3.m_v[i] ) / dt;
+ boost::numeric::ublas::lu_substitute( m_jac.m_v , m_pm.m_v , m_g4.m_v );
+
+
+ for( size_t i=0 ; i<n ; ++i )
+ m_xtmp.m_v[i] = x[i] + m_coef.a51 * m_g1.m_v[i] + m_coef.a52 * m_g2.m_v[i] + m_coef.a53 * m_g3.m_v[i] + m_coef.a54 * m_g4.m_v[i];
+ deriv_func( m_xtmp.m_v , m_dxdtnew.m_v , t + dt );
+ for( size_t i=0 ; i<n ; ++i )
+ m_g5.m_v[i] = m_dxdtnew.m_v[i] + ( m_coef.c51 * m_g1.m_v[i] + m_coef.c52 * m_g2.m_v[i] + m_coef.c53 * m_g3.m_v[i] + m_coef.c54 * m_g4.m_v[i] ) / dt;
+ boost::numeric::ublas::lu_substitute( m_jac.m_v , m_pm.m_v , m_g5.m_v );
+
+ for( size_t i=0 ; i<n ; ++i )
+ m_xtmp.m_v[i] += m_g5.m_v[i];
+ deriv_func( m_xtmp.m_v , m_dxdtnew.m_v , t + dt );
+ for( size_t i=0 ; i<n ; ++i )
+ xerr[i] = m_dxdtnew.m_v[i] + ( m_coef.c61 * m_g1.m_v[i] + m_coef.c62 * m_g2.m_v[i] + m_coef.c63 * m_g3.m_v[i] + m_coef.c64 * m_g4.m_v[i] + m_coef.c65 * m_g5.m_v[i] ) / dt;
+ boost::numeric::ublas::lu_substitute( m_jac.m_v , m_pm.m_v , xerr );
+
+ for( size_t i=0 ; i<n ; ++i )
+ xout[i] = m_xtmp.m_v[i] + xerr[i];
+ }
+
+ template< class System >
+ void do_step( System system , state_type &x , time_type t , time_type dt , state_type &xerr )
+ {
+ do_step( system , x , t , x , dt , xerr );
+ }
+
+ /*
+ * do_step without error output - just calls above functions with and neglects the error estimate
+ */
+ template< class System >
+ void do_step( System system , const state_type &x , time_type t , state_type &xout , time_type dt )
+ {
+ m_x_err_resizer.adjust_size( x , detail::bind( &stepper_type::template resize_x_err<state_type> , detail::ref( *this ) , detail::_1 ) );
+ do_step( system , x , t , xout , dt , m_x_err.m_v );
+ }
+
+ template< class System >
+ void do_step( System system , state_type &x , time_type t , time_type dt )
+ {
+ m_x_err_resizer.adjust_size( x , detail::bind( &stepper_type::template resize_x_err<state_type> , detail::ref( *this ) , detail::_1 ) );
+ do_step( system , x , t , dt , m_x_err.m_v );
+ }
+
+ void prepare_dense_output()
+ {
+ const size_t n = m_g1.m_v.size();
+ for( size_t i=0 ; i<n ; ++i )
+ {
+ m_cont3.m_v[i] = m_coef.d21 * m_g1.m_v[i] + m_coef.d22 * m_g2.m_v[i] + m_coef.d23 * m_g3.m_v[i] + m_coef.d24 * m_g4.m_v[i] + m_coef.d25 * m_g5.m_v[i];
+ m_cont4.m_v[i] = m_coef.d31 * m_g1.m_v[i] + m_coef.d32 * m_g2.m_v[i] + m_coef.d33 * m_g3.m_v[i] + m_coef.d34 * m_g4.m_v[i] + m_coef.d35 * m_g5.m_v[i];
+ }
+ }
+
+
+ void calc_state( time_type t , state_type &x ,
+ const state_type &x_old , time_type t_old ,
+ const state_type &x_new , time_type t_new )
+ {
+ const size_t n = m_g1.m_v.size();
+ time_type dt = t_new - t_old;
+ time_type s = ( t - t_old ) / dt;
+ time_type s1 = 1.0 - s;
+ for( size_t i=0 ; i<n ; ++i )
+ x[i] = x_old[i] * s1 + s * ( x_new[i] + s1 * ( m_cont3.m_v[i] + s * m_cont4.m_v[i] ) );
+ }
+
+
+
+ template< class StateType >
+ void adjust_size( const StateType &x )
+ {
+ resize_impl( x );
+ resize_x_err( x );
+ }
+
+
+protected:
+
+ template< class StateIn >
+ bool resize_impl( const StateIn &x )
+ {
+ bool resized = false;
+ resized |= adjust_size_by_resizeability( m_dxdt , x , typename is_resizeable<deriv_type>::type() );
+ resized |= adjust_size_by_resizeability( m_dfdt , x , typename is_resizeable<deriv_type>::type() );
+ resized |= adjust_size_by_resizeability( m_dxdtnew , x , typename is_resizeable<deriv_type>::type() );
+ resized |= adjust_size_by_resizeability( m_xtmp , x , typename is_resizeable<state_type>::type() );
+ resized |= adjust_size_by_resizeability( m_g1 , x , typename is_resizeable<state_type>::type() );
+ resized |= adjust_size_by_resizeability( m_g2 , x , typename is_resizeable<state_type>::type() );
+ resized |= adjust_size_by_resizeability( m_g3 , x , typename is_resizeable<state_type>::type() );
+ resized |= adjust_size_by_resizeability( m_g4 , x , typename is_resizeable<state_type>::type() );
+ resized |= adjust_size_by_resizeability( m_g5 , x , typename is_resizeable<state_type>::type() );
+ resized |= adjust_size_by_resizeability( m_cont3 , x , typename is_resizeable<state_type>::type() );
+ resized |= adjust_size_by_resizeability( m_cont4 , x , typename is_resizeable<state_type>::type() );
+ resized |= adjust_size_by_resizeability( m_jac , x , typename is_resizeable<matrix_type>::type() );
+ resized |= adjust_size_by_resizeability( m_pm , x , typename is_resizeable<pmatrix_type>::type() );
+ return resized;
+ }
+
+ template< class StateIn >
+ bool resize_x_err( const StateIn &x )
+ {
+ return adjust_size_by_resizeability( m_x_err , x , typename is_resizeable<state_type>::type() );
+ }
+
+private:
+
+
+ resizer_type m_resizer;
+ resizer_type m_x_err_resizer;
+
+ wrapped_matrix_type m_jac;
+ wrapped_pmatrix_type m_pm;
+ wrapped_deriv_type m_dfdt , m_dxdt , m_dxdtnew;
+ wrapped_state_type m_g1 , m_g2 , m_g3 , m_g4 , m_g5;
+ wrapped_state_type m_cont3 , m_cont4;
+ wrapped_state_type m_xtmp;
+ wrapped_state_type m_x_err;
+
+ const rosenbrock_coefficients m_coef;
+};
+
+
+} // namespace odeint
+} // namespace numeric
+} // namespace boost
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_ROSENBROCK4_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/rosenbrock4_controller.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/rosenbrock4_controller.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,208 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/rosenbrock4_controller.hpp
+
+ [begin_description]
+ Controller for the Rosenbrock4 method.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_ROSENBROCK4_CONTROLLER_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_ROSENBROCK4_CONTROLLER_HPP_INCLUDED
+
+#include <boost/config.hpp>
+#include <boost/numeric/odeint/util/bind.hpp>
+
+#include <boost/numeric/odeint/stepper/controlled_step_result.hpp>
+#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
+
+#include <boost/numeric/odeint/util/copy.hpp>
+#include <boost/numeric/odeint/util/is_resizeable.hpp>
+
+#include <boost/numeric/odeint/stepper/rosenbrock4.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+template< class Stepper >
+class rosenbrock4_controller
+{
+private:
+
+
+public:
+
+ typedef Stepper stepper_type;
+ typedef typename stepper_type::value_type value_type;
+ typedef typename stepper_type::state_type state_type;
+ typedef typename stepper_type::wrapped_state_type wrapped_state_type;
+ typedef typename stepper_type::time_type time_type;
+ typedef typename stepper_type::deriv_type deriv_type;
+ typedef typename stepper_type::wrapped_deriv_type wrapped_deriv_type;
+ typedef typename stepper_type::resizer_type resizer_type;
+ typedef controlled_stepper_tag stepper_category;
+
+ typedef rosenbrock4_controller< Stepper > controller_type;
+
+
+ rosenbrock4_controller( value_type atol = 1.0e-6 , value_type rtol = 1.0e-6 , const stepper_type &stepper = stepper_type() )
+ : m_stepper( stepper ) , m_atol( atol ) , m_rtol( rtol ) ,
+ m_first_step( true ) , m_err_old( 0.0 ) , m_dt_old( 0.0 ) ,
+ m_last_rejected( false )
+ { }
+
+
+ value_type error( const state_type &x , const state_type &xold , const state_type &xerr )
+ {
+ BOOST_USING_STD_MAX();
+ using std::abs;
+
+ const size_t n = x.size();
+ value_type err = 0.0 , sk = 0.0;
+ for( size_t i=0 ; i<n ; ++i )
+ {
+ sk = m_atol + m_rtol * max BOOST_PREVENT_MACRO_SUBSTITUTION ( abs( xold[i] ) , abs( x[i] ) );
+ err += xerr[i] * xerr[i] / sk / sk;
+ }
+ return sqrt( err / value_type( n ) );
+ }
+
+ value_type last_error( void ) const
+ {
+ return m_err_old;
+ }
+
+
+
+
+ template< class System >
+ boost::numeric::odeint::controlled_step_result
+ try_step( System sys , state_type &x , time_type &t , time_type &dt )
+ {
+ m_xnew_resizer.adjust_size( x , detail::bind( &controller_type::template resize_m_xnew< state_type > , detail::ref( *this ) , detail::_1 ) );
+ boost::numeric::odeint::controlled_step_result res = try_step( sys , x , t , m_xnew.m_v , dt );
+ if( res == success )
+ {
+ boost::numeric::odeint::copy( m_xnew.m_v , x );
+ }
+ return res;
+ }
+
+
+ template< class System >
+ boost::numeric::odeint::controlled_step_result
+ try_step( System sys , const state_type &x , time_type &t , state_type &xout , time_type &dt )
+ {
+ BOOST_USING_STD_MIN();
+ BOOST_USING_STD_MAX();
+ using std::pow;
+
+ static const value_type safe = 0.9 , fac1 = 5.0 , fac2 = 1.0 / 6.0;
+
+ m_xerr_resizer.adjust_size( x , detail::bind( &controller_type::template resize_m_xerr< state_type > , detail::ref( *this ) , detail::_1 ) );
+
+ m_stepper.do_step( sys , x , t , xout , dt , m_xerr.m_v );
+ value_type err = error( xout , x , m_xerr.m_v );
+
+ value_type fac = max BOOST_PREVENT_MACRO_SUBSTITUTION ( fac2 , min BOOST_PREVENT_MACRO_SUBSTITUTION ( fac1 , pow( err , 0.25 ) / safe ) );
+ value_type dt_new = dt / fac;
+ if ( err <= 1.0 )
+ {
+ if( m_first_step )
+ {
+ m_first_step = false;
+ }
+ else
+ {
+ value_type fac_pred = ( m_dt_old / dt ) * pow( err * err / m_err_old , 0.25 ) / safe;
+ fac_pred = max BOOST_PREVENT_MACRO_SUBSTITUTION ( fac2 , min BOOST_PREVENT_MACRO_SUBSTITUTION ( fac1 , fac_pred ) );
+ fac = max BOOST_PREVENT_MACRO_SUBSTITUTION ( fac , fac_pred );
+ dt_new = dt / fac;
+ }
+
+ m_dt_old = dt;
+ m_err_old = max BOOST_PREVENT_MACRO_SUBSTITUTION ( 0.01 , err );
+ if( m_last_rejected )
+ dt_new = ( dt >= 0.0 ? min BOOST_PREVENT_MACRO_SUBSTITUTION ( dt_new , dt ) : max BOOST_PREVENT_MACRO_SUBSTITUTION ( dt_new , dt ) );
+ t += dt;
+ dt = dt_new;
+ m_last_rejected = false;
+ return success;
+ }
+ else
+ {
+ dt = dt_new;
+ m_last_rejected = true;
+ return fail;
+ }
+ }
+
+
+ template< class StateType >
+ void adjust_size( const StateType &x )
+ {
+ resize_m_xerr( x );
+ resize_m_xnew( x );
+ }
+
+
+
+ stepper_type& stepper( void )
+ {
+ return m_stepper;
+ }
+
+ const stepper_type& stepper( void ) const
+ {
+ return m_stepper;
+ }
+
+
+
+
+private:
+
+ template< class StateIn >
+ bool resize_m_xerr( const StateIn &x )
+ {
+ return adjust_size_by_resizeability( m_xerr , x , typename is_resizeable<state_type>::type() );
+ }
+
+ template< class StateIn >
+ bool resize_m_xnew( const StateIn &x )
+ {
+ return adjust_size_by_resizeability( m_xnew , x , typename is_resizeable<state_type>::type() );
+ }
+
+
+ stepper_type m_stepper;
+ resizer_type m_xerr_resizer;
+ resizer_type m_xnew_resizer;
+ wrapped_state_type m_xerr;
+ wrapped_state_type m_xnew;
+ value_type m_atol , m_rtol;
+ bool m_first_step;
+ value_type m_err_old , m_dt_old;
+ bool m_last_rejected;
+};
+
+
+
+
+
+
+} // namespace odeint
+} // namespace numeric
+} // namespace boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_ROSENBROCK4_CONTROLLER_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/rosenbrock4_dense_output.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/rosenbrock4_dense_output.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,199 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/rosenbrock4_dense_output.hpp
+
+ [begin_description]
+ Dense output for Rosenbrock 4.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_ROSENBROCK4_DENSE_OUTPUT_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_ROSENBROCK4_DENSE_OUTPUT_HPP_INCLUDED
+
+
+#include <utility>
+
+#include <boost/numeric/odeint/util/bind.hpp>
+
+#include <boost/numeric/odeint/stepper/rosenbrock4_controller.hpp>
+#include <boost/numeric/odeint/util/is_resizeable.hpp>
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+template< class ControlledStepper >
+class rosenbrock4_dense_output
+{
+
+public:
+
+ typedef ControlledStepper controlled_stepper_type;
+ typedef typename controlled_stepper_type::stepper_type stepper_type;
+ typedef typename stepper_type::value_type value_type;
+ typedef typename stepper_type::state_type state_type;
+ typedef typename stepper_type::wrapped_state_type wrapped_state_type;
+ typedef typename stepper_type::time_type time_type;
+ typedef typename stepper_type::deriv_type deriv_type;
+ typedef typename stepper_type::wrapped_deriv_type wrapped_deriv_type;
+ typedef typename stepper_type::resizer_type resizer_type;
+ typedef dense_output_stepper_tag stepper_category;
+
+ typedef rosenbrock4_dense_output< ControlledStepper > dense_output_stepper_type;
+
+ rosenbrock4_dense_output( const controlled_stepper_type &stepper = controlled_stepper_type() )
+ : m_stepper( stepper ) ,
+ m_x1() , m_x2() ,
+ m_current_state_x1( true ) ,
+ m_t() , m_t_old() , m_dt()
+ {
+ }
+
+
+
+ template< class StateType >
+ void initialize( const StateType &x0 , time_type t0 , time_type dt0 )
+ {
+ m_resizer.adjust_size( x0 , detail::bind( &dense_output_stepper_type::template resize_impl< StateType > , detail::ref( *this ) , detail::_1 ) );
+ get_current_state() = x0;
+ m_t = t0;
+ m_dt = dt0;
+ }
+
+ template< class System >
+ std::pair< time_type , time_type > do_step( System system )
+ {
+ const size_t max_count = 1000;
+
+ controlled_step_result res = fail;
+ m_t_old = m_t;
+ size_t count = 0;
+ do
+ {
+ res = m_stepper.try_step( system , get_current_state() , m_t , get_old_state() , m_dt );
+ if( count++ == max_count )
+ throw std::overflow_error( "rosenbrock4 : too much iterations!");
+ }
+ while( res == fail );
+ m_stepper.stepper().prepare_dense_output();
+ this->toggle_current_state();
+ return std::make_pair( m_t_old , m_t );
+ }
+
+
+ /*
+ * The two overloads are needed in order to solve the forwarding problem.
+ */
+ template< class StateOut >
+ void calc_state( time_type t , StateOut &x )
+ {
+ m_stepper.stepper().calc_state( t , x , get_old_state() , m_t_old , get_current_state() , m_t );
+ }
+
+ template< class StateOut >
+ void calc_state( time_type t , const StateOut &x )
+ {
+ m_stepper.stepper().calc_state( t , x , get_old_state() , m_t_old , get_current_state() , m_t );
+ }
+
+
+ template< class StateType >
+ void adjust_size( const StateType &x )
+ {
+ m_stepper.adjust_size( x );
+ resize_impl( x );
+ }
+
+
+
+
+ const state_type& current_state( void ) const
+ {
+ return get_current_state();
+ }
+
+ time_type current_time( void ) const
+ {
+ return m_t;
+ }
+
+ const state_type& previous_state( void ) const
+ {
+ return get_old_state();
+ }
+
+ time_type previous_time( void ) const
+ {
+ return m_t_old;
+ }
+
+ time_type current_time_step( void ) const
+ {
+ return m_dt;
+ }
+
+
+
+
+private:
+
+ state_type& get_current_state( void )
+ {
+ return m_current_state_x1 ? m_x1.m_v : m_x2.m_v ;
+ }
+
+ const state_type& get_current_state( void ) const
+ {
+ return m_current_state_x1 ? m_x1.m_v : m_x2.m_v ;
+ }
+
+ state_type& get_old_state( void )
+ {
+ return m_current_state_x1 ? m_x2.m_v : m_x1.m_v ;
+ }
+
+ const state_type& get_old_state( void ) const
+ {
+ return m_current_state_x1 ? m_x2.m_v : m_x1.m_v ;
+ }
+
+ void toggle_current_state( void )
+ {
+ m_current_state_x1 = ! m_current_state_x1;
+ }
+
+
+ template< class StateIn >
+ bool resize_impl( const StateIn &x )
+ {
+ bool resized = false;
+ resized |= adjust_size_by_resizeability( m_x1 , x , typename is_resizeable<state_type>::type() );
+ resized |= adjust_size_by_resizeability( m_x2 , x , typename is_resizeable<state_type>::type() );
+ return resized;
+ }
+
+
+ controlled_stepper_type m_stepper;
+ resizer_type m_resizer;
+ wrapped_state_type m_x1 , m_x2;
+ bool m_current_state_x1;
+ time_type m_t , m_t_old , m_dt;
+};
+
+
+
+} // namespace odeint
+} // namespace numeric
+} // namespace boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_ROSENBROCK4_DENSE_OUTPUT_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/runge_kutta4.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/runge_kutta4.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,171 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/runge_kutta4.hpp
+
+ [begin_description]
+ Implementation of the classical Runge-Kutta stepper with the generic stepper.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA4_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA4_HPP_INCLUDED
+
+
+
+
+#include <boost/fusion/container/vector.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+
+#include <boost/numeric/odeint/stepper/explicit_generic_rk.hpp>
+#include <boost/numeric/odeint/algebra/range_algebra.hpp>
+#include <boost/numeric/odeint/algebra/default_operations.hpp>
+
+#include <boost/array.hpp>
+
+#include <boost/numeric/odeint/util/resizer.hpp>
+
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+#ifndef DOXYGEN_SKIP
+template< class Value = double >
+struct rk4_coefficients_a1 : boost::array< Value , 1 >
+{
+ rk4_coefficients_a1( void )
+ {
+ (*this)[0] = static_cast< Value >( 1 ) / static_cast< Value >( 2 );
+ }
+};
+
+template< class Value = double >
+struct rk4_coefficients_a2 : boost::array< Value , 2 >
+{
+ rk4_coefficients_a2( void )
+ {
+ (*this)[0] = static_cast<Value>(0);
+ (*this)[1] = static_cast< Value >( 1 ) / static_cast< Value >( 2 );
+ }
+};
+
+
+template< class Value = double >
+struct rk4_coefficients_a3 : boost::array< Value , 3 >
+{
+ rk4_coefficients_a3( void )
+ {
+ (*this)[0] = static_cast<Value>(0);
+ (*this)[1] = static_cast<Value>(0);
+ (*this)[2] = static_cast<Value>(1);
+ }
+};
+
+template< class Value = double >
+struct rk4_coefficients_b : boost::array< Value , 4 >
+{
+ rk4_coefficients_b( void )
+ {
+ (*this)[0] = static_cast<Value>(1)/static_cast<Value>(6);
+ (*this)[1] = static_cast<Value>(1)/static_cast<Value>(3);
+ (*this)[2] = static_cast<Value>(1)/static_cast<Value>(3);
+ (*this)[3] = static_cast<Value>(1)/static_cast<Value>(6);
+ }
+};
+
+template< class Value = double >
+struct rk4_coefficients_c : boost::array< Value , 4 >
+{
+ rk4_coefficients_c( void )
+ {
+ (*this)[0] = static_cast<Value>(0);
+ (*this)[1] = static_cast< Value >( 1 ) / static_cast< Value >( 2 );
+ (*this)[2] = static_cast< Value >( 1 ) / static_cast< Value >( 2 );
+ (*this)[3] = static_cast<Value>(1);
+ }
+};
+#endif
+
+
+
+/**
+ * \class runge_kutta4
+ * \brief The classical Runge-Kutta stepper of fourth order.
+ *
+ * The Runge-Kutta method of fourth order is one standard method for
+ * solving ordinary differential equations and is widely used, see also
+ * en.wikipedia.org/wiki/Runge-Kutta_methods
+ * The method is explicit and fullfils the Stepper concept. Step size control
+ * or continous output are not provided.
+ *
+ * This class derives from explicit_stepper_base and inherits its interface via CRTP (current recurring template pattern).
+ * Furthermore, it derivs from explicit_generic_rk which is a generic Runge-Kutta algorithm. For more details see
+ * explicit_stepper_base and explicit_generic_rk.
+ *
+ * \tparam State The state type.
+ * \tparam Value The value type.
+ * \tparam Deriv The type representing the time derivative of the state.
+ * \tparam Time The time representing the independent variable - the time.
+ * \tparam Algebra The algebra type.
+ * \tparam Operations The operations type.
+ * \tparam Resizer The resizer policy type.
+ */
+template<
+class State ,
+class Value = double ,
+class Deriv = State ,
+class Time = Value ,
+class Algebra = range_algebra ,
+class Operations = default_operations ,
+class Resizer = initially_resizer
+>
+class runge_kutta4 : public explicit_generic_rk< 4 , 4 , State , Value , Deriv , Time ,
+Algebra , Operations , Resizer >
+{
+
+public:
+
+ typedef explicit_generic_rk< 4 , 4 , State , Value , Deriv , Time ,
+ Algebra , Operations , Resizer > stepper_base_type;
+ typedef typename stepper_base_type::state_type state_type;
+ typedef typename stepper_base_type::value_type value_type;
+ typedef typename stepper_base_type::deriv_type deriv_type;
+ typedef typename stepper_base_type::time_type time_type;
+ typedef typename stepper_base_type::algebra_type algebra_type;
+ typedef typename stepper_base_type::operations_type operations_type;
+ typedef typename stepper_base_type::resizer_type resizer_type;
+
+ #ifndef DOXYGEN_SKIP
+ typedef typename stepper_base_type::wrapped_state_type wrapped_state_type;
+ typedef typename stepper_base_type::wrapped_deriv_type wrapped_deriv_type;
+ typedef typename stepper_base_type::stepper_type stepper_type;
+ #endif
+
+
+ /**
+ * \brief Constructs the runge_kutta4 class. This constructor can be used as a default
+ * constructor if the algebra has a default constructor.
+ * \param algebra A copy of algebra is made and stored inside explicit_stepper_base.
+ */
+ runge_kutta4( const algebra_type &algebra = algebra_type() ) : stepper_base_type(
+ boost::fusion::make_vector( rk4_coefficients_a1<Value>() , rk4_coefficients_a2<Value>() , rk4_coefficients_a3<Value>() ) ,
+ rk4_coefficients_b<Value>() , rk4_coefficients_c<Value>() , algebra )
+ { }
+
+};
+
+}
+}
+}
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA4_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/runge_kutta4_classic.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/runge_kutta4_classic.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,212 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/runge_kutta4_classic.hpp
+
+ [begin_description]
+ Implementation for the classical Runge Kutta stepper.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA4_CLASSIC_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA4_CLASSIC_HPP_INCLUDED
+
+
+
+#include <boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp>
+#include <boost/numeric/odeint/algebra/range_algebra.hpp>
+#include <boost/numeric/odeint/algebra/default_operations.hpp>
+
+#include <boost/numeric/odeint/util/state_wrapper.hpp>
+#include <boost/numeric/odeint/util/is_resizeable.hpp>
+#include <boost/numeric/odeint/util/resizer.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+/**
+ * \class runge_kutta4_classic
+ * \brief The classical Runge-Kutta stepper of fourth order.
+ *
+ * The Runge-Kutta method of fourth order is one standard method for
+ * solving ordinary differential equations and is widely used, see also
+ * en.wikipedia.org/wiki/Runge-Kutta_methods
+ * The method is explicit and fullfils the Stepper concept. Step size control
+ * or continous output are not provided. This class implements the method directly, hence the
+ * generic Runge-Kutta algorithm is not used.
+ *
+ * This class derives from explicit_stepper_base and inherits its interface via
+ * CRTP (current recurring template pattern). For more details see
+ * explicit_stepper_base.
+ *
+ * \tparam State The state type.
+ * \tparam Value The value type.
+ * \tparam Deriv The type representing the time derivative of the state.
+ * \tparam Time The time representing the independent variable - the time.
+ * \tparam Algebra The algebra type.
+ * \tparam Operations The operations type.
+ * \tparam Resizer The resizer policy type.
+ */
+template<
+class State ,
+class Value = double ,
+class Deriv = State ,
+class Time = Value ,
+class Algebra = range_algebra ,
+class Operations = default_operations ,
+class Resizer = initially_resizer
+>
+#ifndef DOXYGEN_SKIP
+class runge_kutta4_classic
+: public explicit_stepper_base<
+ runge_kutta4_classic< State , Value , Deriv , Time , Algebra , Operations , Resizer > ,
+ 4 , State , Value , Deriv , Time , Algebra , Operations , Resizer >
+#else
+class runge_kutta4_classic
+ : public explicit_stepper_base< runge_kutta4_classic< ... > , ... >
+#endif
+{
+
+public :
+
+ #ifndef DOXYGEN_SKIP
+ typedef explicit_stepper_base<
+ runge_kutta4_classic< State , Value , Deriv , Time , Algebra , Operations , Resizer > ,
+ 4 , State , Value , Deriv , Time , Algebra , Operations , Resizer > stepper_base_type;
+ #else
+ typedef explicit_stepper_base< runge_kutta4_classic< ... > , ... > stepper_base_type;
+ #endif
+
+ typedef typename stepper_base_type::state_type state_type;
+ typedef typename stepper_base_type::value_type value_type;
+ typedef typename stepper_base_type::deriv_type deriv_type;
+ typedef typename stepper_base_type::time_type time_type;
+ typedef typename stepper_base_type::algebra_type algebra_type;
+ typedef typename stepper_base_type::operations_type operations_type;
+ typedef typename stepper_base_type::resizer_type resizer_type;
+
+ #ifndef DOXYGEN_SKIP
+ typedef typename stepper_base_type::stepper_type stepper_type;
+ typedef typename stepper_base_type::wrapped_state_type wrapped_state_type;
+ typedef typename stepper_base_type::wrapped_deriv_type wrapped_deriv_type;
+ #endif // DOXYGEN_SKIP
+
+
+
+ /**
+ * \brief Constructs the runge_kutta4_classic class. This constructor can be used as a default
+ * constructor if the algebra has a default constructor.
+ * \param algebra A copy of algebra is made and stored inside explicit_stepper_base.
+ */
+ runge_kutta4_classic( const algebra_type &algebra = algebra_type() ) : stepper_base_type( algebra )
+ { }
+
+
+ /**
+ * \brief This method performs one step. The derivative `dxdt` of `in` at the time `t` is passed to the method.
+ * The result is updated out of place, hence the input is in `in` and the output in `out`. `do_step_impl` is
+ * used by explicit_stepper_base.
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ODE. It must fullfil the
+ * Simple System concept.
+ * \param in The state of the ODE which should be solved. in is not modified in this method
+ * \param dxdt The derivative of x at t.
+ * \param t The value of the time, at which the step should be performed.
+ * \param out The result of the step is written in out.
+ * \param dt The step size.
+ */
+ template< class System , class StateIn , class DerivIn , class StateOut >
+ void do_step_impl( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt )
+ {
+ // ToDo : check if size of in,dxdt,out are equal?
+
+ static const value_type val1 = static_cast< value_type >( 1 );
+
+ m_resizer.adjust_size( in , detail::bind( &stepper_type::template resize_impl< StateIn > , detail::ref( *this ) , detail::_1 ) );
+
+ typename odeint::unwrap_reference< System >::type &sys = system;
+
+ const time_type dh = dt / static_cast< value_type >( 2 );
+ const time_type th = t + dh;
+
+ // dt * dxdt = k1
+ // m_x_tmp = x + dh*dxdt
+ stepper_base_type::m_algebra.for_each3( m_x_tmp.m_v , in , dxdt ,
+ typename operations_type::template scale_sum2< value_type , time_type >( val1 , dh ) );
+
+
+ // dt * m_dxt = k2
+ sys( m_x_tmp.m_v , m_dxt.m_v , th );
+
+ // m_x_tmp = x + dh*m_dxt
+ stepper_base_type::m_algebra.for_each3( m_x_tmp.m_v , in , m_dxt.m_v ,
+ typename operations_type::template scale_sum2< value_type , time_type >( val1 , dh ) );
+
+
+ // dt * m_dxm = k3
+ sys( m_x_tmp.m_v , m_dxm.m_v , th );
+ //m_x_tmp = x + dt*m_dxm
+ stepper_base_type::m_algebra.for_each3( m_x_tmp.m_v , in , m_dxm.m_v ,
+ typename operations_type::template scale_sum2< value_type , time_type >( val1 , dt ) );
+
+
+ // dt * m_dxh = k4
+ sys( m_x_tmp.m_v , m_dxh.m_v , t + dt );
+ //x += dt/6 * ( m_dxdt + m_dxt + val2*m_dxm )
+ time_type dt6 = dt / static_cast< value_type >( 6 );
+ time_type dt3 = dt / static_cast< value_type >( 3 );
+ stepper_base_type::m_algebra.for_each6( out , in , dxdt , m_dxt.m_v , m_dxm.m_v , m_dxh.m_v ,
+ typename operations_type::template scale_sum5< value_type , time_type , time_type , time_type , time_type >( 1.0 , dt6 , dt3 , dt3 , dt6 ) );
+ }
+
+ /**
+ * \brief Adjust the size of all temporaries in the stepper manually.
+ * \param x A state from which the size of the temporaries to be resized is deduced.
+ */
+ template< class StateType >
+ void adjust_size( const StateType &x )
+ {
+ resize_impl( x );
+ stepper_base_type::adjust_size( x );
+ }
+
+private:
+
+ template< class StateIn >
+ bool resize_impl( const StateIn &x )
+ {
+ bool resized = false;
+ resized |= adjust_size_by_resizeability( m_x_tmp , x , typename is_resizeable<state_type>::type() );
+ resized |= adjust_size_by_resizeability( m_dxm , x , typename is_resizeable<deriv_type>::type() );
+ resized |= adjust_size_by_resizeability( m_dxt , x , typename is_resizeable<deriv_type>::type() );
+ resized |= adjust_size_by_resizeability( m_dxh , x , typename is_resizeable<deriv_type>::type() );
+ return resized;
+ }
+
+
+ resizer_type m_resizer;
+
+ wrapped_deriv_type m_dxt;
+ wrapped_deriv_type m_dxm;
+ wrapped_deriv_type m_dxh;
+ wrapped_state_type m_x_tmp;
+
+};
+
+
+
+
+} // odeint
+} // numeric
+} // boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA4_CLASSIC_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/runge_kutta_cash_karp54.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/runge_kutta_cash_karp54.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,219 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/runge_kutta_cash_karp54.hpp
+
+ [begin_description]
+ Implementation of the Runge Kutta Cash Karp 5(4) method. It uses the generic error stepper.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+*/
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA_CASH_KARP54_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA_CASH_KARP54_HPP_INCLUDED
+
+#include <boost/fusion/container/vector.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+
+#include <boost/numeric/odeint/stepper/explicit_error_generic_rk.hpp>
+#include <boost/numeric/odeint/algebra/range_algebra.hpp>
+#include <boost/numeric/odeint/algebra/default_operations.hpp>
+
+#include <boost/numeric/odeint/util/state_wrapper.hpp>
+#include <boost/numeric/odeint/util/is_resizeable.hpp>
+#include <boost/numeric/odeint/util/resizer.hpp>
+
+#include <boost/array.hpp>
+
+
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+#ifndef DOXYGEN_SKIP
+template< class Value = double >
+struct rk54_ck_coefficients_a1 : boost::array< Value , 1 >
+{
+ rk54_ck_coefficients_a1( void )
+ {
+ (*this)[0] = static_cast< Value >( 1 )/static_cast< Value >( 5 );
+ }
+};
+
+template< class Value = double >
+struct rk54_ck_coefficients_a2 : boost::array< Value , 2 >
+{
+ rk54_ck_coefficients_a2( void )
+ {
+ (*this)[0] = static_cast<Value>( 3 )/static_cast<Value>( 40 );
+ (*this)[1] = static_cast<Value>( 9 )/static_cast<Value>( 40 );
+ }
+};
+
+
+template< class Value = double >
+struct rk54_ck_coefficients_a3 : boost::array< Value , 3 >
+{
+ rk54_ck_coefficients_a3( void )
+ {
+ (*this)[0] = static_cast<Value>( 3 )/static_cast<Value>( 10 );
+ (*this)[1] = static_cast<Value>( -9 )/static_cast<Value>( 10 );
+ (*this)[2] = static_cast<Value>( 6 )/static_cast<Value>( 5 );
+ }
+};
+
+template< class Value = double >
+struct rk54_ck_coefficients_a4 : boost::array< Value , 4 >
+{
+ rk54_ck_coefficients_a4( void )
+ {
+ (*this)[0] = static_cast<Value>( -11 )/static_cast<Value>( 54 );
+ (*this)[1] = static_cast<Value>( 5 )/static_cast<Value>( 2 );
+ (*this)[2] = static_cast<Value>( -70 )/static_cast<Value>( 27 );
+ (*this)[3] = static_cast<Value>( 35 )/static_cast<Value>( 27 );
+ }
+};
+
+template< class Value = double >
+struct rk54_ck_coefficients_a5 : boost::array< Value , 5 >
+{
+ rk54_ck_coefficients_a5( void )
+ {
+ (*this)[0] = static_cast<Value>( 1631 )/static_cast<Value>( 55296 );
+ (*this)[1] = static_cast<Value>( 175 )/static_cast<Value>( 512 );
+ (*this)[2] = static_cast<Value>( 575 )/static_cast<Value>( 13824 );
+ (*this)[3] = static_cast<Value>( 44275 )/static_cast<Value>( 110592 );
+ (*this)[4] = static_cast<Value>( 253 )/static_cast<Value>( 4096 );
+ }
+};
+
+template< class Value = double >
+struct rk54_ck_coefficients_b : boost::array< Value , 6 >
+{
+ rk54_ck_coefficients_b( void )
+ {
+ (*this)[0] = static_cast<Value>( 37 )/static_cast<Value>( 378 );
+ (*this)[1] = static_cast<Value>( 0 );
+ (*this)[2] = static_cast<Value>( 250 )/static_cast<Value>( 621 );
+ (*this)[3] = static_cast<Value>( 125 )/static_cast<Value>( 594 );
+ (*this)[4] = static_cast<Value>( 0 );
+ (*this)[5] = static_cast<Value>( 512 )/static_cast<Value>( 1771 );
+ }
+};
+
+template< class Value = double >
+struct rk54_ck_coefficients_db : boost::array< Value , 6 >
+{
+ rk54_ck_coefficients_db( void )
+ {
+ (*this)[0] = static_cast<Value>( 37 )/static_cast<Value>( 378 ) - static_cast<Value>( 2825 )/static_cast<Value>( 27648 );
+ (*this)[1] = static_cast<Value>( 0 );
+ (*this)[2] = static_cast<Value>( 250 )/static_cast<Value>( 621 ) - static_cast<Value>( 18575 )/static_cast<Value>( 48384 );
+ (*this)[3] = static_cast<Value>( 125 )/static_cast<Value>( 594 ) - static_cast<Value>( 13525 )/static_cast<Value>( 55296 );
+ (*this)[4] = static_cast<Value>( -277 )/static_cast<Value>( 14336 );
+ (*this)[5] = static_cast<Value>( 512 )/static_cast<Value>( 1771 ) - static_cast<Value>( 1 )/static_cast<Value>( 4 );
+ }
+};
+
+
+template< class Value = double >
+struct rk54_ck_coefficients_c : boost::array< Value , 6 >
+{
+ rk54_ck_coefficients_c( void )
+ {
+ (*this)[0] = static_cast<Value>(0);
+ (*this)[1] = static_cast<Value>( 1 )/static_cast<Value>( 5 );
+ (*this)[2] = static_cast<Value>( 3 )/static_cast<Value>( 10 );
+ (*this)[3] = static_cast<Value>( 3 )/static_cast<Value>( 5 );
+ (*this)[4] = static_cast<Value>( 1 );
+ (*this)[5] = static_cast<Value>( 7 )/static_cast<Value>( 8 );
+ }
+};
+#endif
+
+
+/**
+ * \class runge_kutta_cash_karp54
+ * \brief The Runge-Kutta Cash-Karp method.
+ *
+ * The Runge-Kutta Cash-Karp method is one of the standard methods for
+ * solving ordinary differential equations, see
+ * en.wikipedia.org/wiki/Cash-Karp_methods.
+ * The method is explicit and fullfils the Error Stepper concept. Step size control
+ * is provided but continous output is not available for this method.
+ *
+ * This class derives from explicit_error_stepper_base and inherits its interface via CRTP (current recurring template pattern).
+ * Furthermore, it derivs from explicit_error_generic_rk which is a generic Runge-Kutta algorithm with error estimation.
+ * For more details see explicit_error_stepper_base and explicit_error_generic_rk.
+ *
+ * \tparam State The state type.
+ * \tparam Value The value type.
+ * \tparam Deriv The type representing the time derivative of the state.
+ * \tparam Time The time representing the independent variable - the time.
+ * \tparam Algebra The algebra type.
+ * \tparam Operations The operations type.
+ * \tparam Resizer The resizer policy type.
+ */
+template<
+ class State ,
+ class Value = double ,
+ class Deriv = State ,
+ class Time = Value ,
+ class Algebra = range_algebra ,
+ class Operations = default_operations ,
+ class Resizer = initially_resizer
+ >
+class runge_kutta_cash_karp54 : public explicit_error_generic_rk< 6 , 5 , 5 , 4 ,
+ State , Value , Deriv , Time , Algebra , Operations , Resizer >
+{
+
+public:
+
+ typedef explicit_error_generic_rk< 6 , 5 , 5 , 4 , State , Value , Deriv , Time ,
+ Algebra , Operations , Resizer > stepper_base_type;
+
+ typedef typename stepper_base_type::state_type state_type;
+ typedef typename stepper_base_type::value_type value_type;
+ typedef typename stepper_base_type::deriv_type deriv_type;
+ typedef typename stepper_base_type::time_type time_type;
+ typedef typename stepper_base_type::algebra_type algebra_type;
+ typedef typename stepper_base_type::operations_type operations_type;
+ typedef typename stepper_base_type::resizer_type resizer_typ;
+
+ #ifndef DOXYGEN_SKIP
+ typedef typename stepper_base_type::stepper_type stepper_type;
+ typedef typename stepper_base_type::wrapped_state_type wrapped_state_type;
+ typedef typename stepper_base_type::wrapped_deriv_type wrapped_deriv_type;
+ #endif
+
+
+ /**
+ * \brief Constructs the runge_kutta_cash_karp54 class. This constructor can be used as a default
+ * constructor if the algebra has a default constructor.
+ * \param algebra A copy of algebra is made and stored inside explicit_stepper_base.
+ */
+ runge_kutta_cash_karp54( const algebra_type &algebra = algebra_type() ) : stepper_base_type(
+ boost::fusion::make_vector( rk54_ck_coefficients_a1<Value>() ,
+ rk54_ck_coefficients_a2<Value>() ,
+ rk54_ck_coefficients_a3<Value>() ,
+ rk54_ck_coefficients_a4<Value>() ,
+ rk54_ck_coefficients_a5<Value>() ) ,
+ rk54_ck_coefficients_b<Value>() , rk54_ck_coefficients_db<Value>() , rk54_ck_coefficients_c<Value>() ,
+ algebra )
+ { }
+};
+
+}
+}
+}
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA_CASH_KARP54_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/runge_kutta_cash_karp54_classic.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/runge_kutta_cash_karp54_classic.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,275 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/runge_kutta_cash_karp54_classic.hpp
+
+ [begin_description]
+ Classical implementation of the Runge-Kutta Cash-Karp 5(4) method.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA_CASH_KARP54_CLASSIC_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA_CASH_KARP54_CLASSIC_HPP_INCLUDED
+
+
+#include <boost/numeric/odeint/util/bind.hpp>
+
+#include <boost/numeric/odeint/stepper/base/explicit_error_stepper_base.hpp>
+#include <boost/numeric/odeint/algebra/range_algebra.hpp>
+#include <boost/numeric/odeint/algebra/default_operations.hpp>
+#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
+#include <boost/numeric/odeint/util/state_wrapper.hpp>
+#include <boost/numeric/odeint/util/is_resizeable.hpp>
+#include <boost/numeric/odeint/util/resizer.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+
+
+/**
+ * \class runge_kutta_cash_karp54_classic
+ * \brief The Runge-Kutta Cash-Karp method implemented without the generic Runge-Kutta algorithm.
+ *
+ * The Runge-Kutta Cash-Karp method is one of the standard methods for
+ * solving ordinary differential equations, see
+ * en.wikipedia.org/wiki/Cash-Karp_method.
+ * The method is explicit and fullfils the Error Stepper concept. Step size control
+ * is provided but continous output is not available for this method.
+ *
+ * This class derives from explicit_error_stepper_base and inherits its interface via CRTP (current recurring
+ * template pattern). This class implements the method directly, hence the generic Runge-Kutta algorithm is not used.
+ *
+ * \tparam State The state type.
+ * \tparam Value The value type.
+ * \tparam Deriv The type representing the time derivative of the state.
+ * \tparam Time The time representing the independent variable - the time.
+ * \tparam Algebra The algebra type.
+ * \tparam Operations The operations type.
+ * \tparam Resizer The resizer policy type.
+ */
+template<
+class State ,
+class Value = double ,
+class Deriv = State ,
+class Time = double ,
+class Algebra = range_algebra ,
+class Operations = default_operations ,
+class Resizer = initially_resizer
+>
+#ifndef DOXYGEN_SKIP
+class runge_kutta_cash_karp54_classic
+: public explicit_error_stepper_base<
+ runge_kutta_cash_karp54_classic< State , Value , Deriv , Time , Algebra , Operations , Resizer > ,
+ 5 , 5 , 4 , State , Value , Deriv , Time , Algebra , Operations , Resizer >
+#else
+class runge_kutta_cash_karp54_classic
+ : public explicit_error_stepper_base< runge_kutta_cash_karp54_classic< ... > , ... >
+#endif
+{
+
+
+public :
+
+ #ifndef DOXYGEN_SKIP
+ typedef explicit_error_stepper_base<
+ runge_kutta_cash_karp54_classic< State , Value , Deriv , Time , Algebra , Operations , Resizer > ,
+ 5 , 5 , 4 , State , Value , Deriv , Time , Algebra , Operations , Resizer > stepper_base_type;
+ #else
+ typedef explicit_error_stepper_base< runge_kutta_cash_karp54_classic< ... > , ... > stepper_base_type;
+ #endif
+
+ typedef typename stepper_base_type::state_type state_type;
+ typedef typename stepper_base_type::value_type value_type;
+ typedef typename stepper_base_type::deriv_type deriv_type;
+ typedef typename stepper_base_type::time_type time_type;
+ typedef typename stepper_base_type::algebra_type algebra_type;
+ typedef typename stepper_base_type::operations_type operations_type;
+ typedef typename stepper_base_type::resizer_type resizer_type;
+
+ #ifndef DOXYGEN_SKIP
+ typedef typename stepper_base_type::wrapped_state_type wrapped_state_type;
+ typedef typename stepper_base_type::wrapped_deriv_type wrapped_deriv_type;
+ typedef typename stepper_base_type::stepper_type stepper_type;
+ #endif
+
+
+ /**
+ * \brief Constructs the runge_kutta_cash_karp54_classic class. This constructor can be used as a default
+ * constructor if the algebra has a default constructor.
+ * \param algebra A copy of algebra is made and stored inside explicit_stepper_base.
+ */
+ runge_kutta_cash_karp54_classic( const algebra_type &algebra = algebra_type() ) : stepper_base_type( algebra )
+ { }
+
+
+
+ /**
+ * \brief This method performs one step. The derivative `dxdt` of `in` at the time `t` is passed to the method.
+ * The result is updated out-of-place, hence the input is in `in` and the output in `out`. Futhermore, an
+ * estimation of the error is stored in `xerr`. `do_step_impl` is used by explicit_error_stepper_base.
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ODE. It must fullfil the
+ * Simple System concept.
+ * \param in The state of the ODE which should be solved. in is not modified in this method
+ * \param dxdt The derivative of x at t.
+ * \param t The value of the time, at which the step should be performed.
+ * \param out The result of the step is written in out.
+ * \param dt The step size.
+ * \param xerr The result of the error estimation is written in xerr.
+ */
+ template< class System , class StateIn , class DerivIn , class StateOut , class Err >
+ void do_step_impl( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt , Err &xerr )
+ {
+ const value_type c1 = static_cast<value_type> ( 37 ) / static_cast<value_type>( 378 );
+ const value_type c3 = static_cast<value_type> ( 250 ) / static_cast<value_type>( 621 );
+ const value_type c4 = static_cast<value_type> ( 125 ) / static_cast<value_type>( 594 );
+ const value_type c6 = static_cast<value_type> ( 512 ) / static_cast<value_type>( 1771 );
+
+ const value_type dc1 = c1 - static_cast<value_type> ( 2825 ) / static_cast<value_type>( 27648 );
+ const value_type dc3 = c3 - static_cast<value_type> ( 18575 ) / static_cast<value_type>( 48384 );
+ const value_type dc4 = c4 - static_cast<value_type> ( 13525 ) / static_cast<value_type>( 55296 );
+ const value_type dc5 = static_cast<value_type> ( -277 ) / static_cast<value_type>( 14336 );
+ const value_type dc6 = c6 - static_cast<value_type> ( 1 ) / static_cast<value_type> ( 4 );
+
+ do_step_impl( system , in , dxdt , t , out , dt );
+
+ //error estimate
+ stepper_base_type::m_algebra.for_each6( xerr , dxdt , m_k3.m_v , m_k4.m_v , m_k5.m_v , m_k6.m_v ,
+ typename operations_type::template scale_sum5< time_type , time_type , time_type , time_type , time_type >( dt*dc1 , dt*dc3 , dt*dc4 , dt*dc5 , dt*dc6 ));
+
+ }
+
+
+
+ /**
+ * \brief This method performs one step. The derivative `dxdt` of `in` at the time `t` is passed to the method.
+ * The result is updated out-of-place, hence the input is in `in` and the output in `out`. `do_step_impl` is
+ * used by explicit_error_stepper_base.
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ODE. It must fullfil the
+ * Simple System concept.
+ * \param in The state of the ODE which should be solved. in is not modified in this method
+ * \param dxdt The derivative of x at t.
+ * \param t The value of the time, at which the step should be performed.
+ * \param out The result of the step is written in out.
+ * \param dt The step size.
+ */
+ template< class System , class StateIn , class DerivIn , class StateOut >
+ void do_step_impl( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt )
+ {
+ const value_type a2 = static_cast<value_type> ( 1 ) / static_cast<value_type> ( 5 );
+ const value_type a3 = static_cast<value_type> ( 3 ) / static_cast<value_type> ( 10 );
+ const value_type a4 = static_cast<value_type> ( 3 ) / static_cast<value_type> ( 5 );
+ const value_type a5 = static_cast<value_type> ( 1 );
+ const value_type a6 = static_cast<value_type> ( 7 ) / static_cast<value_type> ( 8 );
+
+ const value_type b21 = static_cast<value_type> ( 1 ) / static_cast<value_type> ( 5 );
+ const value_type b31 = static_cast<value_type> ( 3 ) / static_cast<value_type>( 40 );
+ const value_type b32 = static_cast<value_type> ( 9 ) / static_cast<value_type>( 40 );
+ const value_type b41 = static_cast<value_type> ( 3 ) / static_cast<value_type> ( 10 );
+ const value_type b42 = static_cast<value_type> ( -9 ) / static_cast<value_type> ( 10 );
+ const value_type b43 = static_cast<value_type> ( 6 ) / static_cast<value_type> ( 5 );
+ const value_type b51 = static_cast<value_type> ( -11 ) / static_cast<value_type>( 54 );
+ const value_type b52 = static_cast<value_type> ( 5 ) / static_cast<value_type> ( 2 );
+ const value_type b53 = static_cast<value_type> ( -70 ) / static_cast<value_type>( 27 );
+ const value_type b54 = static_cast<value_type> ( 35 ) / static_cast<value_type>( 27 );
+ const value_type b61 = static_cast<value_type> ( 1631 ) / static_cast<value_type>( 55296 );
+ const value_type b62 = static_cast<value_type> ( 175 ) / static_cast<value_type>( 512 );
+ const value_type b63 = static_cast<value_type> ( 575 ) / static_cast<value_type>( 13824 );
+ const value_type b64 = static_cast<value_type> ( 44275 ) / static_cast<value_type>( 110592 );
+ const value_type b65 = static_cast<value_type> ( 253 ) / static_cast<value_type>( 4096 );
+
+ const value_type c1 = static_cast<value_type> ( 37 ) / static_cast<value_type>( 378 );
+ const value_type c3 = static_cast<value_type> ( 250 ) / static_cast<value_type>( 621 );
+ const value_type c4 = static_cast<value_type> ( 125 ) / static_cast<value_type>( 594 );
+ const value_type c6 = static_cast<value_type> ( 512 ) / static_cast<value_type>( 1771 );
+
+ typename odeint::unwrap_reference< System >::type &sys = system;
+
+ m_resizer.adjust_size( in , detail::bind( &stepper_type::template resize_impl<StateIn> , detail::ref( *this ) , detail::_1 ) );
+
+ //m_x1 = x + dt*b21*dxdt
+ stepper_base_type::m_algebra.for_each3( m_x_tmp.m_v , in , dxdt ,
+ typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , dt*b21 ) );
+
+ sys( m_x_tmp.m_v , m_k2.m_v , t + dt*a2 );
+ // m_x_tmp = x + dt*b31*dxdt + dt*b32*m_x2
+ stepper_base_type::m_algebra.for_each4( m_x_tmp.m_v , in , dxdt , m_k2.m_v ,
+ typename operations_type::template scale_sum3< value_type , time_type , time_type >( 1.0 , dt*b31 , dt*b32 ));
+
+ sys( m_x_tmp.m_v , m_k3.m_v , t + dt*a3 );
+ // m_x_tmp = x + dt * (b41*dxdt + b42*m_x2 + b43*m_x3)
+ stepper_base_type::m_algebra.for_each5( m_x_tmp.m_v , in , dxdt , m_k2.m_v , m_k3.m_v ,
+ typename operations_type::template scale_sum4< value_type , time_type , time_type , time_type >( 1.0 , dt*b41 , dt*b42 , dt*b43 ));
+
+ sys( m_x_tmp.m_v, m_k4.m_v , t + dt*a4 );
+ stepper_base_type::m_algebra.for_each6( m_x_tmp.m_v , in , dxdt , m_k2.m_v , m_k3.m_v , m_k4.m_v ,
+ typename operations_type::template scale_sum5< value_type , time_type , time_type , time_type , time_type >( 1.0 , dt*b51 , dt*b52 , dt*b53 , dt*b54 ));
+
+ sys( m_x_tmp.m_v , m_k5.m_v , t + dt*a5 );
+ stepper_base_type::m_algebra.for_each7( m_x_tmp.m_v , in , dxdt , m_k2.m_v , m_k3.m_v , m_k4.m_v , m_k5.m_v ,
+ typename operations_type::template scale_sum6< value_type , time_type , time_type , time_type , time_type , time_type >( 1.0 , dt*b61 , dt*b62 , dt*b63 , dt*b64 , dt*b65 ));
+
+ sys( m_x_tmp.m_v , m_k6.m_v , t + dt*a6 );
+ stepper_base_type::m_algebra.for_each6( out , in , dxdt , m_k3.m_v , m_k4.m_v , m_k6.m_v ,
+ typename operations_type::template scale_sum5< value_type , time_type , time_type , time_type , time_type >( 1.0 , dt*c1 , dt*c3 , dt*c4 , dt*c6 ));
+
+ }
+
+ /**
+ * \brief Adjust the size of all temporaries in the stepper manually.
+ * \param x A state from which the size of the temporaries to be resized is deduced.
+ */
+ template< class StateIn >
+ void adjust_size( const StateIn &x )
+ {
+ resize_impl( x );
+ stepper_base_type::adjust_size( x );
+ }
+
+private:
+
+ template< class StateIn >
+ bool resize_impl( const StateIn &x )
+ {
+ bool resized = false;
+ resized |= adjust_size_by_resizeability( m_x_tmp , x , typename is_resizeable<state_type>::type() );
+ resized |= adjust_size_by_resizeability( m_k2 , x , typename is_resizeable<deriv_type>::type() );
+ resized |= adjust_size_by_resizeability( m_k3 , x , typename is_resizeable<deriv_type>::type() );
+ resized |= adjust_size_by_resizeability( m_k4 , x , typename is_resizeable<deriv_type>::type() );
+ resized |= adjust_size_by_resizeability( m_k5 , x , typename is_resizeable<deriv_type>::type() );
+ resized |= adjust_size_by_resizeability( m_k6 , x , typename is_resizeable<deriv_type>::type() );
+ return resized;
+ }
+
+
+ wrapped_state_type m_x_tmp;
+ wrapped_deriv_type m_k2, m_k3, m_k4, m_k5, m_k6;
+ resizer_type m_resizer;
+
+};
+
+
+
+
+
+
+
+} // odeint
+} // numeric
+} // boost
+
+
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA_CASH_KARP54_CLASSIC_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/runge_kutta_dopri5.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/runge_kutta_dopri5.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,384 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/runge_kutta_dopri5.hpp
+
+ [begin_description]
+ Implementation of the Dormand-Prince 5(4) method. This stepper can also be used with the dense-output controlled stepper.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA_DOPRI5_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA_DOPRI5_HPP_INCLUDED
+
+
+#include <boost/numeric/odeint/util/bind.hpp>
+
+#include <boost/numeric/odeint/stepper/base/explicit_error_stepper_fsal_base.hpp>
+#include <boost/numeric/odeint/algebra/range_algebra.hpp>
+#include <boost/numeric/odeint/algebra/default_operations.hpp>
+#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
+
+#include <boost/numeric/odeint/util/state_wrapper.hpp>
+#include <boost/numeric/odeint/util/is_resizeable.hpp>
+#include <boost/numeric/odeint/util/resizer.hpp>
+#include <boost/numeric/odeint/util/same_instance.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+
+/**
+ * \class runge_kutta_dopri5
+ * \brief The Runge-Kutta Dormand-Prince 5 method.
+ *
+ * The Runge-Kutta Dormand-Prince 5 method is a very popular method for solving ODEs, see
+ * .
+ * The method is explicit and fullfils the Error Stepper concept. Step size control
+ * is provided but continous output is available which make this method favourable for many applications.
+ *
+ * This class derives from explicit_error_stepper_fsal_base and inherits its interface via CRTP (current recurring
+ * template pattern). The method possesses the FSAL (first-same-as-last) property. See
+ * explicit_error_stepper_fsal_base for more details.
+ *
+ * \tparam State The state type.
+ * \tparam Value The value type.
+ * \tparam Deriv The type representing the time derivative of the state.
+ * \tparam Time The time representing the independent variable - the time.
+ * \tparam Algebra The algebra type.
+ * \tparam Operations The operations type.
+ * \tparam Resizer The resizer policy type.
+ */
+template<
+class State ,
+class Value = double ,
+class Deriv = State ,
+class Time = Value ,
+class Algebra = range_algebra ,
+class Operations = default_operations ,
+class Resizer = initially_resizer
+>
+class runge_kutta_dopri5
+#ifndef DOXYGEN_SKIP
+: public explicit_error_stepper_fsal_base<
+ runge_kutta_dopri5< State , Value , Deriv , Time , Algebra , Operations , Resizer > ,
+ 5 , 5 , 4 , State , Value , Deriv , Time , Algebra , Operations , Resizer >
+#else
+: public explicit_error_stepper_fsal_base< runge_kutta_dopri5< ... > , ... >
+#endif
+{
+
+public :
+
+ #ifndef DOXYGEN_SKIP
+ typedef explicit_error_stepper_fsal_base<
+ runge_kutta_dopri5< State , Value , Deriv , Time , Algebra , Operations , Resizer > ,
+ 5 , 5 , 4 , State , Value , Deriv , Time , Algebra , Operations , Resizer > stepper_base_type;
+ #else
+ typedef explicit_error_stepper_fsal_base< runge_kutta_dopri5< ... > , ... > stepper_base_type;
+ #endif
+
+ typedef typename stepper_base_type::state_type state_type;
+ typedef typename stepper_base_type::value_type value_type;
+ typedef typename stepper_base_type::deriv_type deriv_type;
+ typedef typename stepper_base_type::time_type time_type;
+ typedef typename stepper_base_type::algebra_type algebra_type;
+ typedef typename stepper_base_type::operations_type operations_type;
+ typedef typename stepper_base_type::resizer_type resizer_type;
+
+ #ifndef DOXYGEN_SKIP
+ typedef typename stepper_base_type::stepper_type stepper_type;
+ typedef typename stepper_base_type::wrapped_state_type wrapped_state_type;
+ typedef typename stepper_base_type::wrapped_deriv_type wrapped_deriv_type;
+ #endif // DOXYGEN_SKIP
+
+
+ /**
+ * \brief Constructs the runge_kutta_dopri5 class. This constructor can be used as a default
+ * constructor if the algebra has a default constructor.
+ * \param algebra A copy of algebra is made and stored inside explicit_stepper_base.
+ */
+ runge_kutta_dopri5( const algebra_type &algebra = algebra_type() ) : stepper_base_type( algebra )
+ { }
+
+
+ /**
+ * \brief This method performs one step. The derivative `dxdt_in` of `in` at the time `t` is passed to the
+ * method. The result is updated out-of-place, hence the input is in `in` and the output in `out`. Furthermore,
+ * the derivative is update out-of-place, hence the input is assumed to be in `dxdt_in` and the output in
+ * `dxdt_out`. `do_step_impl` is used by explicit_error_stepper_fsalbase.
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ODE. It must fullfil the
+ * Simple System concept.
+ * \param in The state of the ODE which should be solved. in is not modified in this method
+ * \param dxdt_in The derivative of x at t. dxdt_in is not modified by this method
+ * \param t The value of the time, at which the step should be performed.
+ * \param out The result of the step is written in out.
+ * \param dxdt_out The result of the new derivative at time t+dt.
+ * \param dt The step size.
+ */
+ template< class System , class StateIn , class DerivIn , class StateOut , class DerivOut >
+ void do_step_impl( System system , const StateIn &in , const DerivIn &dxdt_in , time_type t ,
+ StateOut &out , DerivOut &dxdt_out , time_type dt )
+ {
+ const value_type a2 = static_cast<value_type> ( 1 ) / static_cast<value_type>( 5 );
+ const value_type a3 = static_cast<value_type> ( 3 ) / static_cast<value_type> ( 10 );
+ const value_type a4 = static_cast<value_type> ( 4 ) / static_cast<value_type> ( 5 );
+ const value_type a5 = static_cast<value_type> ( 8 )/static_cast<value_type> ( 9 );
+
+ const value_type b21 = static_cast<value_type> ( 1 ) / static_cast<value_type> ( 5 );
+
+ const value_type b31 = static_cast<value_type> ( 3 ) / static_cast<value_type>( 40 );
+ const value_type b32 = static_cast<value_type> ( 9 ) / static_cast<value_type>( 40 );
+
+ const value_type b41 = static_cast<value_type> ( 44 ) / static_cast<value_type> ( 45 );
+ const value_type b42 = static_cast<value_type> ( -56 ) / static_cast<value_type> ( 15 );
+ const value_type b43 = static_cast<value_type> ( 32 ) / static_cast<value_type> ( 9 );
+
+ const value_type b51 = static_cast<value_type> ( 19372 ) / static_cast<value_type>( 6561 );
+ const value_type b52 = static_cast<value_type> ( -25360 ) / static_cast<value_type> ( 2187 );
+ const value_type b53 = static_cast<value_type> ( 64448 ) / static_cast<value_type>( 6561 );
+ const value_type b54 = static_cast<value_type> ( -212 ) / static_cast<value_type>( 729 );
+
+ const value_type b61 = static_cast<value_type> ( 9017 ) / static_cast<value_type>( 3168 );
+ const value_type b62 = static_cast<value_type> ( -355 ) / static_cast<value_type>( 33 );
+ const value_type b63 = static_cast<value_type> ( 46732 ) / static_cast<value_type>( 5247 );
+ const value_type b64 = static_cast<value_type> ( 49 ) / static_cast<value_type>( 176 );
+ const value_type b65 = static_cast<value_type> ( -5103 ) / static_cast<value_type>( 18656 );
+
+ const value_type c1 = static_cast<value_type> ( 35 ) / static_cast<value_type>( 384 );
+ const value_type c3 = static_cast<value_type> ( 500 ) / static_cast<value_type>( 1113 );
+ const value_type c4 = static_cast<value_type> ( 125 ) / static_cast<value_type>( 192 );
+ const value_type c5 = static_cast<value_type> ( -2187 ) / static_cast<value_type>( 6784 );
+ const value_type c6 = static_cast<value_type> ( 11 ) / static_cast<value_type>( 84 );
+
+ typename odeint::unwrap_reference< System >::type &sys = system;
+
+ m_k_x_tmp_resizer.adjust_size( in , detail::bind( &stepper_type::template resize_k_x_tmp_impl<StateIn> , detail::ref( *this ) , detail::_1 ) );
+
+ //m_x_tmp = x + dt*b21*dxdt
+ stepper_base_type::m_algebra.for_each3( m_x_tmp.m_v , in , dxdt_in ,
+ typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , dt*b21 ) );
+
+ sys( m_x_tmp.m_v , m_k2.m_v , t + dt*a2 );
+ // m_x_tmp = x + dt*b31*dxdt + dt*b32*m_k2
+ stepper_base_type::m_algebra.for_each4( m_x_tmp.m_v , in , dxdt_in , m_k2.m_v ,
+ typename operations_type::template scale_sum3< value_type , time_type , time_type >( 1.0 , dt*b31 , dt*b32 ));
+
+ sys( m_x_tmp.m_v , m_k3.m_v , t + dt*a3 );
+ // m_x_tmp = x + dt * (b41*dxdt + b42*m_k2 + b43*m_k3)
+ stepper_base_type::m_algebra.for_each5( m_x_tmp.m_v , in , dxdt_in , m_k2.m_v , m_k3.m_v ,
+ typename operations_type::template scale_sum4< value_type , time_type , time_type , time_type >( 1.0 , dt*b41 , dt*b42 , dt*b43 ));
+
+ sys( m_x_tmp.m_v, m_k4.m_v , t + dt*a4 );
+ stepper_base_type::m_algebra.for_each6( m_x_tmp.m_v , in , dxdt_in , m_k2.m_v , m_k3.m_v , m_k4.m_v ,
+ typename operations_type::template scale_sum5< value_type , time_type , time_type , time_type , time_type >( 1.0 , dt*b51 , dt*b52 , dt*b53 , dt*b54 ));
+
+ sys( m_x_tmp.m_v , m_k5.m_v , t + dt*a5 );
+ stepper_base_type::m_algebra.for_each7( m_x_tmp.m_v , in , dxdt_in , m_k2.m_v , m_k3.m_v , m_k4.m_v , m_k5.m_v ,
+ typename operations_type::template scale_sum6< value_type , time_type , time_type , time_type , time_type , time_type >( 1.0 , dt*b61 , dt*b62 , dt*b63 , dt*b64 , dt*b65 ));
+
+ sys( m_x_tmp.m_v , m_k6.m_v , t + dt );
+ stepper_base_type::m_algebra.for_each7( out , in , dxdt_in , m_k3.m_v , m_k4.m_v , m_k5.m_v , m_k6.m_v ,
+ typename operations_type::template scale_sum6< value_type , time_type , time_type , time_type , time_type , time_type >( 1.0 , dt*c1 , dt*c3 , dt*c4 , dt*c5 , dt*c6 ));
+
+ // the new derivative
+ sys( out , dxdt_out , t + dt );
+ }
+
+
+
+ /**
+ * \brief This method performs one step. The derivative `dxdt_in` of `in` at the time `t` is passed to the
+ * method. The result is updated out-of-place, hence the input is in `in` and the output in `out`. Furthermore,
+ * the derivative is update out-of-place, hence the input is assumed to be in `dxdt_in` and the output in
+ * `dxdt_out`. `do_step_impl` is used by explicit_error_stepper_fsalbase. An estimation of the error is
+ * calculated.
+ *
+ * \param system The system function to solve, hence the r.h.s. of the ODE. It must fullfil the
+ * Simple System concept.
+ * \param in The state of the ODE which should be solved. in is not modified in this method
+ * \param dxdt_in The derivative of x at t. dxdt_in is not modified by this method
+ * \param t The value of the time, at which the step should be performed.
+ * \param out The result of the step is written in out.
+ * \param dxdt_out The result of the new derivative at time t+dt.
+ * \param dt The step size.
+ * \param xerr An estimation of the error.
+ */
+ template< class System , class StateIn , class DerivIn , class StateOut , class DerivOut , class Err >
+ void do_step_impl( System system , const StateIn &in , const DerivIn &dxdt_in , time_type t ,
+ StateOut &out , DerivOut &dxdt_out , time_type dt , Err &xerr )
+ {
+ const value_type c1 = static_cast<value_type> ( 35 ) / static_cast<value_type>( 384 );
+ const value_type c3 = static_cast<value_type> ( 500 ) / static_cast<value_type>( 1113 );
+ const value_type c4 = static_cast<value_type> ( 125 ) / static_cast<value_type>( 192 );
+ const value_type c5 = static_cast<value_type> ( -2187 ) / static_cast<value_type>( 6784 );
+ const value_type c6 = static_cast<value_type> ( 11 ) / static_cast<value_type>( 84 );
+
+ const value_type dc1 = c1 - static_cast<value_type> ( 5179 ) / static_cast<value_type>( 57600 );
+ const value_type dc3 = c3 - static_cast<value_type> ( 7571 ) / static_cast<value_type>( 16695 );
+ const value_type dc4 = c4 - static_cast<value_type> ( 393 ) / static_cast<value_type>( 640 );
+ const value_type dc5 = c5 - static_cast<value_type> ( -92097 ) / static_cast<value_type>( 339200 );
+ const value_type dc6 = c6 - static_cast<value_type> ( 187 ) / static_cast<value_type>( 2100 );
+ const value_type dc7 = static_cast<value_type>( -1 ) / static_cast<value_type> ( 40 );
+
+ /* ToDo: copy only if &dxdt_in == &dxdt_out ? */
+ if( same_instance( dxdt_in , dxdt_out ) )
+ {
+ m_dxdt_tmp_resizer.adjust_size( in , detail::bind( &stepper_type::template resize_dxdt_tmp_impl<StateIn> , detail::ref( *this ) , detail::_1 ) );
+ boost::numeric::odeint::copy( dxdt_in , m_dxdt_tmp.m_v );
+ do_step_impl( system , in , dxdt_in , t , out , dxdt_out , dt );
+ //error estimate
+ stepper_base_type::m_algebra.for_each7( xerr , m_dxdt_tmp.m_v , m_k3.m_v , m_k4.m_v , m_k5.m_v , m_k6.m_v , dxdt_out ,
+ typename operations_type::template scale_sum6< time_type , time_type , time_type , time_type , time_type , time_type >( dt*dc1 , dt*dc3 , dt*dc4 , dt*dc5 , dt*dc6 , dt*dc7 ) );
+
+ }
+ else
+ {
+ do_step_impl( system , in , dxdt_in , t , out , dxdt_out , dt );
+ //error estimate
+ stepper_base_type::m_algebra.for_each7( xerr , dxdt_in , m_k3.m_v , m_k4.m_v , m_k5.m_v , m_k6.m_v , dxdt_out ,
+ typename operations_type::template scale_sum6< time_type , time_type , time_type , time_type , time_type , time_type >( dt*dc1 , dt*dc3 , dt*dc4 , dt*dc5 , dt*dc6 , dt*dc7 ) );
+
+ }
+
+ }
+
+
+ /*
+ * Calculates Dense-Output for Dopri5
+ *
+ * See Hairer, Norsett, Wanner: Solving Ordinary Differential Equations, Nonstiff Problems. I, p.191/192
+ *
+ * y(t+theta) = y(t) + h * sum_i^7 b_i(theta) * k_i
+ *
+ * A = theta^2 * ( 3 - 2 theta )
+ * B = theta^2 * ( theta - 1 )
+ * C = theta^2 * ( theta - 1 )^2
+ * D = theta * ( theta - 1 )^2
+ *
+ * b_1( theta ) = A * b_1 - C * X1( theta ) + D
+ * b_2( theta ) = 0
+ * b_3( theta ) = A * b_3 + C * X3( theta )
+ * b_4( theta ) = A * b_4 - C * X4( theta )
+ * b_5( theta ) = A * b_5 + C * X5( theta )
+ * b_6( theta ) = A * b_6 - C * X6( theta )
+ * b_7( theta ) = B + C * X7( theta )
+ *
+ * An alternative Method is described in:
+ *
+ * www-m2.ma.tum.de/homepages/simeon/numerik3/kap3.ps
+ */
+ /**
+ * \brief This method is used for continous output and it calculates the state `x` at a time `t` from the
+ * knowledge of two states `old_state` and `current_state` at time points `t_old` and `t_new`. It also uses
+ * internal variables to calculate the result. Hence this method must be called after two successful `do_step`
+ * calls.
+ */
+ template< class StateOut , class StateIn1 , class DerivIn1 , class StateIn2 , class DerivIn2 >
+ void calc_state( time_type t , StateOut &x ,
+ const StateIn1 &x_old , const DerivIn1 &deriv_old , time_type t_old ,
+ const StateIn2 & /* x_new */ , const DerivIn2 &deriv_new , time_type t_new ) const
+ {
+ const value_type b1 = static_cast<value_type> ( 35 ) / static_cast<value_type>( 384 );
+ const value_type b3 = static_cast<value_type> ( 500 ) / static_cast<value_type>( 1113 );
+ const value_type b4 = static_cast<value_type> ( 125 ) / static_cast<value_type>( 192 );
+ const value_type b5 = static_cast<value_type> ( -2187 ) / static_cast<value_type>( 6784 );
+ const value_type b6 = static_cast<value_type> ( 11 ) / static_cast<value_type>( 84 );
+
+ const time_type dt = ( t_new - t_old );
+ const value_type theta = ( t - t_old ) / dt;
+ const value_type X1 = static_cast< value_type >( 5 ) * ( static_cast< value_type >( 2558722523LL ) - static_cast< value_type >( 31403016 ) * theta ) / static_cast< value_type >( 11282082432LL );
+ const value_type X3 = static_cast< value_type >( 100 ) * ( static_cast< value_type >( 882725551 ) - static_cast< value_type >( 15701508 ) * theta ) / static_cast< value_type >( 32700410799LL );
+ const value_type X4 = static_cast< value_type >( 25 ) * ( static_cast< value_type >( 443332067 ) - static_cast< value_type >( 31403016 ) * theta ) / static_cast< value_type >( 1880347072LL ) ;
+ const value_type X5 = static_cast< value_type >( 32805 ) * ( static_cast< value_type >( 23143187 ) - static_cast< value_type >( 3489224 ) * theta ) / static_cast< value_type >( 199316789632LL );
+ const value_type X6 = static_cast< value_type >( 55 ) * ( static_cast< value_type >( 29972135 ) - static_cast< value_type >( 7076736 ) * theta ) / static_cast< value_type >( 822651844 );
+ const value_type X7 = static_cast< value_type >( 10 ) * ( static_cast< value_type >( 7414447 ) - static_cast< value_type >( 829305 ) * theta ) / static_cast< value_type >( 29380423 );
+
+ const value_type theta_m_1 = theta - static_cast< value_type >( 1 );
+ const value_type theta_sq = theta * theta;
+ const value_type A = theta_sq * ( static_cast< value_type >( 3 ) - static_cast< value_type >( 2 ) * theta );
+ const value_type B = theta_sq * theta_m_1;
+ const value_type C = theta_sq * theta_m_1 * theta_m_1;
+ const value_type D = theta * theta_m_1 * theta_m_1;
+
+ const value_type b1_theta = A * b1 - C * X1 + D;
+ const value_type b3_theta = A * b3 + C * X3;
+ const value_type b4_theta = A * b4 - C * X4;
+ const value_type b5_theta = A * b5 + C * X5;
+ const value_type b6_theta = A * b6 - C * X6;
+ const value_type b7_theta = B + C * X7;
+
+ // const state_type &k1 = *m_old_deriv;
+ // onst state_type &k3 = dopri5().m_k3;
+ // const state_type &k4 = dopri5().m_k4;
+ // const state_type &k5 = dopri5().m_k5;
+ // const state_type &k6 = dopri5().m_k6;
+ // const state_type &k7 = *m_current_deriv;
+
+ stepper_base_type::m_algebra.for_each8( x , x_old , deriv_old , m_k3.m_v , m_k4.m_v , m_k5.m_v , m_k6.m_v , deriv_new ,
+ typename operations_type::template scale_sum7< value_type , time_type , time_type , time_type , time_type , time_type , time_type >( 1.0 , dt * b1_theta , dt * b3_theta , dt * b4_theta , dt * b5_theta , dt * b6_theta , dt * b7_theta ) );
+ }
+
+
+
+
+ /**
+ * \brief Adjust the size of all temporaries in the stepper manually.
+ * \param x A state from which the size of the temporaries to be resized is deduced.
+ */
+ template< class StateIn >
+ void adjust_size( const StateIn &x )
+ {
+ resize_k_x_tmp_impl( x );
+ resize_dxdt_tmp_impl( x );
+ stepper_base_type::adjust_size( x );
+ }
+
+
+private:
+
+ template< class StateIn >
+ bool resize_k_x_tmp_impl( const StateIn &x )
+ {
+ bool resized = false;
+ resized |= adjust_size_by_resizeability( m_x_tmp , x , typename is_resizeable<state_type>::type() );
+ resized |= adjust_size_by_resizeability( m_k2 , x , typename is_resizeable<deriv_type>::type() );
+ resized |= adjust_size_by_resizeability( m_k3 , x , typename is_resizeable<deriv_type>::type() );
+ resized |= adjust_size_by_resizeability( m_k4 , x , typename is_resizeable<deriv_type>::type() );
+ resized |= adjust_size_by_resizeability( m_k5 , x , typename is_resizeable<deriv_type>::type() );
+ resized |= adjust_size_by_resizeability( m_k6 , x , typename is_resizeable<deriv_type>::type() );
+ return resized;
+ }
+
+ template< class StateIn >
+ bool resize_dxdt_tmp_impl( const StateIn &x )
+ {
+ return adjust_size_by_resizeability( m_dxdt_tmp , x , typename is_resizeable<deriv_type>::type() );
+ }
+
+
+
+ wrapped_state_type m_x_tmp;
+ wrapped_deriv_type m_k2 , m_k3 , m_k4 , m_k5 , m_k6 ;
+ wrapped_deriv_type m_dxdt_tmp;
+ resizer_type m_k_x_tmp_resizer;
+ resizer_type m_dxdt_tmp_resizer;
+};
+
+
+} // odeint
+} // numeric
+} // boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA_DOPRI5_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/runge_kutta_fehlberg78.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/runge_kutta_fehlberg78.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,359 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/runge_kutta_fehlberg87.hpp
+
+ [begin_description]
+ Implementation of the Runge-Kutta-Fehlberg stepper with the generic stepper.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA_FEHLBERG87_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA_FEHLBERG87_HPP_INCLUDED
+
+
+#include <boost/fusion/container/vector.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+
+#include <boost/numeric/odeint/stepper/explicit_generic_rk.hpp>
+#include <boost/numeric/odeint/algebra/range_algebra.hpp>
+#include <boost/numeric/odeint/algebra/default_operations.hpp>
+
+#include <boost/array.hpp>
+
+#include <boost/numeric/odeint/util/state_wrapper.hpp>
+#include <boost/numeric/odeint/util/is_resizeable.hpp>
+#include <boost/numeric/odeint/util/resizer.hpp>
+
+
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+#ifndef DOXYGEN_SKIP
+template< class Value = double >
+struct rk78_coefficients_a1 : boost::array< Value , 1 >
+{
+ rk78_coefficients_a1( void )
+ {
+ (*this)[0] = static_cast< Value >( 2 )/static_cast< Value >( 27 );
+ }
+};
+
+template< class Value = double >
+struct rk78_coefficients_a2 : boost::array< Value , 2 >
+{
+ rk78_coefficients_a2( void )
+ {
+ (*this)[0] = static_cast< Value >( 1 )/static_cast< Value >( 36 );
+ (*this)[1] = static_cast< Value >( 1 )/static_cast< Value >( 12 );
+ }
+};
+
+
+template< class Value = double >
+struct rk78_coefficients_a3 : boost::array< Value , 3 >
+{
+ rk78_coefficients_a3( void )
+ {
+ (*this)[0] = static_cast< Value >( 1 )/static_cast< Value >( 24 );
+ (*this)[1] = static_cast< Value >( 0 );
+ (*this)[2] = static_cast< Value >( 1 )/static_cast< Value >( 8 );
+ }
+};
+
+template< class Value = double >
+struct rk78_coefficients_a4 : boost::array< Value , 4 >
+{
+ rk78_coefficients_a4( void )
+ {
+ (*this)[0] = static_cast< Value >( 5 )/static_cast< Value >( 12 );
+ (*this)[1] = static_cast< Value >( 0 );
+ (*this)[2] = static_cast< Value >( -25 )/static_cast< Value >( 16 );
+ (*this)[3] = static_cast< Value >( 25 )/static_cast< Value >( 16 );
+ }
+};
+
+template< class Value = double >
+struct rk78_coefficients_a5 : boost::array< Value , 5 >
+{
+ rk78_coefficients_a5( void )
+ {
+ (*this)[0] = static_cast< Value >( 1 )/static_cast< Value >( 20 );
+ (*this)[1] = static_cast< Value >( 0 );
+ (*this)[2] = static_cast< Value >( 0 );
+ (*this)[3] = static_cast< Value >( 1 )/static_cast< Value >( 4 );
+ (*this)[4] = static_cast< Value >( 1 )/static_cast< Value >( 5 );
+ }
+};
+
+
+template< class Value = double >
+struct rk78_coefficients_a6 : boost::array< Value , 6 >
+{
+ rk78_coefficients_a6( void )
+ {
+ (*this)[0] = static_cast< Value >( -25 )/static_cast< Value >( 108 );
+ (*this)[1] = static_cast< Value >( 0 );
+ (*this)[2] = static_cast< Value >( 0 );
+ (*this)[3] = static_cast< Value >( 125 )/static_cast< Value >( 108 );
+ (*this)[4] = static_cast< Value >( -65 )/static_cast< Value >( 27 );
+ (*this)[5] = static_cast< Value >( 125 )/static_cast< Value >( 54 );
+ }
+};
+
+template< class Value = double >
+struct rk78_coefficients_a7 : boost::array< Value , 7 >
+{
+ rk78_coefficients_a7( void )
+ {
+ (*this)[0] = static_cast< Value >( 31 )/static_cast< Value >( 300 );
+ (*this)[1] = static_cast< Value >( 0 );
+ (*this)[2] = static_cast< Value >( 0 );
+ (*this)[3] = static_cast< Value >( 0 );
+ (*this)[4] = static_cast< Value >( 61 )/static_cast< Value >( 225 );
+ (*this)[5] = static_cast< Value >( -2 )/static_cast< Value >( 9 );
+ (*this)[6] = static_cast< Value >( 13 )/static_cast< Value >( 900 );
+ }
+};
+
+template< class Value = double >
+struct rk78_coefficients_a8 : boost::array< Value , 8 >
+{
+ rk78_coefficients_a8( void )
+ {
+ (*this)[0] = static_cast< Value >( 2 );
+ (*this)[1] = static_cast< Value >( 0 );
+ (*this)[2] = static_cast< Value >( 0 );
+ (*this)[3] = static_cast< Value >( -53 )/static_cast< Value >( 6 );
+ (*this)[4] = static_cast< Value >( 704 )/static_cast< Value >( 45 );
+ (*this)[5] = static_cast< Value >( -107 )/static_cast< Value >( 9 );
+ (*this)[6] = static_cast< Value >( 67 )/static_cast< Value >( 90 );
+ (*this)[7] = static_cast< Value >( 3 );
+ }
+};
+
+template< class Value = double >
+struct rk78_coefficients_a9 : boost::array< Value , 9 >
+{
+ rk78_coefficients_a9( void )
+ {
+ (*this)[0] = static_cast< Value >( -91 )/static_cast< Value >( 108 );
+ (*this)[1] = static_cast< Value >( 0 );
+ (*this)[2] = static_cast< Value >( 0 );
+ (*this)[3] = static_cast< Value >( 23 )/static_cast< Value >( 108 );
+ (*this)[4] = static_cast< Value >( -976 )/static_cast< Value >( 135 );
+ (*this)[5] = static_cast< Value >( 311 )/static_cast< Value >( 54 );
+ (*this)[6] = static_cast< Value >( -19 )/static_cast< Value >( 60 );
+ (*this)[7] = static_cast< Value >( 17 )/static_cast< Value >( 6 );
+ (*this)[8] = static_cast< Value >( -1 )/static_cast< Value >( 12 );
+ }
+};
+
+template< class Value = double >
+struct rk78_coefficients_a10 : boost::array< Value , 10 >
+{
+ rk78_coefficients_a10( void )
+ {
+ (*this)[0] = static_cast< Value >( 2383 )/static_cast< Value >( 4100 );
+ (*this)[1] = static_cast< Value >( 0 );
+ (*this)[2] = static_cast< Value >( 0 );
+ (*this)[3] = static_cast< Value >( -341 )/static_cast< Value >( 164 );
+ (*this)[4] = static_cast< Value >( 4496 )/static_cast< Value >( 1025 );
+ (*this)[5] = static_cast< Value >( -301 )/static_cast< Value >( 82 );
+ (*this)[6] = static_cast< Value >( 2133 )/static_cast< Value >( 4100 );
+ (*this)[7] = static_cast< Value >( 45 )/static_cast< Value >( 82 );
+ (*this)[8] = static_cast< Value >( 45 )/static_cast< Value >( 164 );
+ (*this)[9] = static_cast< Value >( 18 )/static_cast< Value >( 41 );
+ }
+};
+
+template< class Value = double >
+struct rk78_coefficients_a11 : boost::array< Value , 11 >
+{
+ rk78_coefficients_a11( void )
+ {
+ (*this)[0] = static_cast< Value >( 3 )/static_cast< Value >( 205 );
+ (*this)[1] = static_cast< Value >( 0 );
+ (*this)[2] = static_cast< Value >( 0 );
+ (*this)[3] = static_cast< Value >( 0 );
+ (*this)[4] = static_cast< Value >( 0 );
+ (*this)[5] = static_cast< Value >( -6 )/static_cast< Value >( 41 );
+ (*this)[6] = static_cast< Value >( -3 )/static_cast< Value >( 205 );
+ (*this)[7] = static_cast< Value >( -3 )/static_cast< Value >( 41 );
+ (*this)[8] = static_cast< Value >( 3 )/static_cast< Value >( 41 );
+ (*this)[9] = static_cast< Value >( 6 )/static_cast< Value >( 41 );
+ (*this)[10] = static_cast< Value >( 0 );
+ }
+};
+
+template< class Value = double >
+struct rk78_coefficients_a12 : boost::array< Value , 12 >
+{
+ rk78_coefficients_a12( void )
+ {
+ (*this)[0] = static_cast< Value >( -1777 )/static_cast< Value >( 4100 );
+ (*this)[1] = static_cast< Value >( 0 );
+ (*this)[2] = static_cast< Value >( 0 );
+ (*this)[3] = static_cast< Value >( -341 )/static_cast< Value >( 164 );
+ (*this)[4] = static_cast< Value >( 4496 )/static_cast< Value >( 1025 );
+ (*this)[5] = static_cast< Value >( -289 )/static_cast< Value >( 82 );
+ (*this)[6] = static_cast< Value >( 2193 )/static_cast< Value >( 4100 );
+ (*this)[7] = static_cast< Value >( 51 )/static_cast< Value >( 82 );
+ (*this)[8] = static_cast< Value >( 33 )/static_cast< Value >( 164 );
+ (*this)[9] = static_cast< Value >( 12 )/static_cast< Value >( 41 );
+ (*this)[10] = static_cast< Value >( 0 );
+ (*this)[11] = static_cast< Value >( 1 );
+ }
+};
+
+template< class Value = double >
+struct rk78_coefficients_b : boost::array< Value , 13 >
+{
+ rk78_coefficients_b( void )
+ {
+ (*this)[0] = static_cast< Value >( 0 );
+ (*this)[1] = static_cast< Value >( 0 );
+ (*this)[2] = static_cast< Value >( 0 );
+ (*this)[3] = static_cast< Value >( 0 );
+ (*this)[4] = static_cast< Value >( 0 );
+ (*this)[5] = static_cast< Value >( 34 )/static_cast<Value>( 105 );
+ (*this)[6] = static_cast< Value >( 9 )/static_cast<Value>( 35 );
+ (*this)[7] = static_cast< Value >( 9 )/static_cast<Value>( 35 );
+ (*this)[8] = static_cast< Value >( 9 )/static_cast<Value>( 280 );
+ (*this)[9] = static_cast< Value >( 9 )/static_cast<Value>( 280 );
+ (*this)[10] = static_cast< Value >( 0 );
+ (*this)[11] = static_cast< Value >( 41 )/static_cast<Value>( 840 );
+ (*this)[12] = static_cast< Value >( 41 )/static_cast<Value>( 840 );
+ }
+};
+
+template< class Value = double >
+struct rk78_coefficients_db : boost::array< Value , 13 >
+{
+ rk78_coefficients_db( void )
+ {
+ (*this)[0] = static_cast< Value >( 0 ) - static_cast< Value >( 41 )/static_cast<Value>( 840 );
+ (*this)[1] = static_cast< Value >( 0 );
+ (*this)[2] = static_cast< Value >( 0 );
+ (*this)[3] = static_cast< Value >( 0 );
+ (*this)[4] = static_cast< Value >( 0 );
+ (*this)[5] = static_cast< Value >( 0 );
+ (*this)[6] = static_cast< Value >( 0 );
+ (*this)[7] = static_cast< Value >( 0 );
+ (*this)[8] = static_cast< Value >( 0 );
+ (*this)[9] = static_cast< Value >( 0 );
+ (*this)[10] = static_cast< Value >( 0 ) - static_cast< Value >( 41 )/static_cast<Value>( 840 );
+ (*this)[11] = static_cast< Value >( 41 )/static_cast<Value>( 840 );
+ (*this)[12] = static_cast< Value >( 41 )/static_cast<Value>( 840 );
+ }
+};
+
+
+template< class Value = double >
+struct rk78_coefficients_c : boost::array< Value , 13 >
+{
+ rk78_coefficients_c( void )
+ {
+ (*this)[0] = static_cast< Value >( 0 );
+ (*this)[1] = static_cast< Value >( 2 )/static_cast< Value >( 27 );
+ (*this)[2] = static_cast< Value >( 1 )/static_cast< Value >( 9 );
+ (*this)[3] = static_cast< Value >( 1 )/static_cast<Value>( 6 );
+ (*this)[4] = static_cast< Value >( 5 )/static_cast<Value>( 12 );
+ (*this)[5] = static_cast< Value >( 1 )/static_cast<Value>( 2 );
+ (*this)[6] = static_cast< Value >( 5 )/static_cast<Value>( 6 );
+ (*this)[7] = static_cast< Value >( 1 )/static_cast<Value>( 6 );
+ (*this)[8] = static_cast< Value >( 2 )/static_cast<Value>( 3 );
+ (*this)[9] = static_cast< Value >( 1 )/static_cast<Value>( 3 );
+ (*this)[10] = static_cast< Value >( 1 );
+ (*this)[11] = static_cast< Value >( 0 );
+ (*this)[12] = static_cast< Value >( 1 );
+ }
+};
+#endif // DOXYGEN_SKIP
+
+
+
+
+
+/**
+ * \class runge_kutta_fehlberg78
+ * \brief The Runge-Kutta Fehlberg 78 method.
+ *
+ * The Runge-Kutta Fehlberg 78 method is a standard method for high-precision applications.
+ * The method is explicit and fullfils the Error Stepper concept. Step size control
+ * is provided but continous output is not available for this method.
+ *
+ * This class derives from explicit_error_stepper_base and inherits its interface via CRTP (current recurring template pattern).
+ * Furthermore, it derivs from explicit_error_generic_rk which is a generic Runge-Kutta algorithm with error estimation.
+ * For more details see explicit_error_stepper_base and explicit_error_generic_rk.
+ *
+ * \tparam State The state type.
+ * \tparam Value The value type.
+ * \tparam Deriv The type representing the time derivative of the state.
+ * \tparam Time The time representing the independent variable - the time.
+ * \tparam Algebra The algebra type.
+ * \tparam Operations The operations type.
+ * \tparam Resizer The resizer policy type.
+ */
+template<
+class State ,
+class Value = double ,
+class Deriv = State ,
+class Time = Value ,
+class Algebra = range_algebra ,
+class Operations = default_operations ,
+class Resizer = initially_resizer
+>
+class runge_kutta_fehlberg78 : public explicit_error_generic_rk< 13 , 8 , 8 , 7 , State , Value , Deriv , Time ,
+Algebra , Operations , Resizer >
+{
+
+public:
+
+ typedef explicit_error_generic_rk< 13 , 8 , 8 , 7 , State , Value , Deriv , Time ,
+ Algebra , Operations , Resizer > stepper_base_type;
+
+ typedef typename stepper_base_type::state_type state_type;
+ typedef typename stepper_base_type::value_type value_type;
+ typedef typename stepper_base_type::deriv_type deriv_type;
+ typedef typename stepper_base_type::time_type time_type;
+ typedef typename stepper_base_type::algebra_type algebra_type;
+ typedef typename stepper_base_type::operations_type operations_type;
+ typedef typename stepper_base_type::resizer_type resizer_type;
+
+ #ifndef DOXYGEN_SKIP
+ typedef typename stepper_base_type::stepper_type stepper_type;
+ typedef typename stepper_base_type::wrapped_state_type wrapped_state_type;
+ typedef typename stepper_base_type::wrapped_deriv_type wrapped_deriv_type;
+ #endif // DOXYGEN_SKIP
+
+ /**
+ * \brief Constructs the runge_kutta_cash_fehlberg78 class. This constructor can be used as a default
+ * constructor if the algebra has a default constructor.
+ * \param algebra A copy of algebra is made and stored inside explicit_stepper_base.
+ */
+ runge_kutta_fehlberg78( const algebra_type &algebra = algebra_type() ) : stepper_base_type(
+ boost::fusion::make_vector( rk78_coefficients_a1<Value>() , rk78_coefficients_a2<Value>() , rk78_coefficients_a3<Value>() ,
+ rk78_coefficients_a4<Value>() , rk78_coefficients_a5<Value>() , rk78_coefficients_a6<Value>() ,
+ rk78_coefficients_a7<Value>() , rk78_coefficients_a8<Value>() , rk78_coefficients_a9<Value>() ,
+ rk78_coefficients_a10<Value>() , rk78_coefficients_a11<Value>() , rk78_coefficients_a12<Value>() ) ,
+ rk78_coefficients_b<Value>() , rk78_coefficients_db<Value>() , rk78_coefficients_c<Value>() , algebra )
+ { }
+};
+
+}
+}
+}
+
+#endif //BOOST_NUMERIC_ODEINT_STEPPER_RUNGE_KUTTA_FEHLBERG87_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/stepper_categories.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/stepper_categories.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,68 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/stepper_categories.hpp
+
+ [begin_description]
+ Definition of all stepper categories.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_STEPPER_CATEGORIES_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_STEPPER_CATEGORIES_HPP_INCLUDED
+
+#include <boost/type_traits/integral_constant.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+/*
+ * Tags to specify stepper types
+ *
+ * These tags are used by integrate() to choose which integration method is used
+ */
+
+struct stepper_tag {};
+// struct explicit_stepper_tag : stepper_tag {};
+// struct implicit_stepper_tag : stepper_tag {};
+
+
+struct error_stepper_tag : stepper_tag {};
+struct explicit_error_stepper_tag : error_stepper_tag {};
+struct explicit_error_stepper_fsal_tag : error_stepper_tag {};
+
+struct controlled_stepper_tag {};
+struct explicit_controlled_stepper_tag : controlled_stepper_tag {};
+struct explicit_controlled_stepper_fsal_tag : controlled_stepper_tag {};
+
+struct dense_output_stepper_tag {};
+
+
+template< class tag > struct base_tag ;
+template< > struct base_tag< stepper_tag > { typedef stepper_tag type; };
+template< > struct base_tag< error_stepper_tag > { typedef stepper_tag type; };
+template< > struct base_tag< explicit_error_stepper_tag > { typedef stepper_tag type; };
+template< > struct base_tag< explicit_error_stepper_fsal_tag > { typedef stepper_tag type; };
+
+template< > struct base_tag< controlled_stepper_tag > { typedef controlled_stepper_tag type; };
+template< > struct base_tag< explicit_controlled_stepper_tag > { typedef controlled_stepper_tag type; };
+template< > struct base_tag< explicit_controlled_stepper_fsal_tag > { typedef controlled_stepper_tag type; };
+
+template< > struct base_tag< dense_output_stepper_tag > { typedef dense_output_stepper_tag type; };
+
+
+} // odeint
+} // numeric
+} // boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_STEPPER_CATEGORIES_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/symplectic_euler.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/symplectic_euler.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,125 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/symplectic_euler.hpp
+
+ [begin_description]
+ Implementation of the symplectic Euler for separable Hamiltonian systems.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_EULER_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_EULER_HPP_INCLUDED
+
+
+#include <boost/numeric/odeint/stepper/base/symplectic_rkn_stepper_base.hpp>
+
+#include <boost/numeric/odeint/algebra/range_algebra.hpp>
+#include <boost/numeric/odeint/algebra/default_operations.hpp>
+
+#include <boost/array.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+#ifndef DOXYGEN_SKIP
+namespace detail {
+namespace symplectic_euler_coef {
+
+template< class Value >
+struct coef_a_type : public boost::array< Value , 1 >
+{
+ coef_a_type( void )
+ {
+ (*this)[0] = static_cast< Value >( 1 );
+ }
+};
+
+template< class Value >
+struct coef_b_type : public boost::array< Value , 1 >
+{
+ coef_b_type( void )
+ {
+ (*this)[0] = static_cast< Value >( 1 );
+ }
+};
+
+} // namespace symplectic_euler_coef
+} // namespace detail
+#endif
+
+
+
+/**
+ * \class symplectic_euler
+ * \brief Implementation of the symplectic Euler method.
+ *
+ * The method is of first order and has one stage. It is described HERE.
+ *
+ * \tparam Order The order of the stepper.
+ * \tparam Coor The type representing the coordinates q.
+ * \tparam Momentum The type representing the coordinates p.
+ * \tparam Value The basic value type. Should be somethink like float, double or a high-precision type.
+ * \tparam CoorDeriv The type representing the time derivative of the coordinate dq/dt.
+ * \tparam MomemtnumDeriv The type representing the time derivative of the momentum dp/dt.
+ * \tparam Time The type representing the time t.
+ * \tparam Algebra The algebra.
+ * \tparam Operations The operations.
+ * \tparam Resizer The resizer policy.
+ */
+template<
+class Coor ,
+class Momentum = Coor ,
+class Value = double ,
+class CoorDeriv = Coor ,
+class MomentumDeriv = Coor ,
+class Time = Value ,
+class Algebra = range_algebra ,
+class Operations = default_operations ,
+class Resizer = initially_resizer
+>
+class symplectic_euler :
+public symplectic_nystroem_stepper_base
+<
+1 , 1 ,
+Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer
+>
+{
+public:
+
+ typedef symplectic_nystroem_stepper_base<
+ 1 , 1 , Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer > stepper_base_type;
+
+ typedef typename stepper_base_type::algebra_type algebra_type;
+ typedef typename stepper_base_type::value_type value_type;
+
+
+ /**
+ * \brief Constructs the symplectic_euler. This constructor can be used as a default
+ * constructor if the algebra has a default constructor.
+ * \param algebra A copy of algebra is made and stored inside explicit_stepper_base.
+ */
+ symplectic_euler( const algebra_type &algebra = algebra_type() )
+ : stepper_base_type( detail::symplectic_euler_coef::coef_a_type< value_type >() ,
+ detail::symplectic_euler_coef::coef_b_type< value_type >() ,
+ algebra )
+ { }
+};
+
+
+
+} // namespace odeint
+} // namespace numeric
+} // namespace boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_EULER_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/stepper/symplectic_rkn_sb3a_m4_mclachlan.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/symplectic_rkn_sb3a_m4_mclachlan.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,146 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/symplectic_rkn_sb3a_m4_mclachlan.hpp
+
+ [begin_description]
+ tba.
+ [end_description]
+
+ Copyright 2009-2012 Karsten Ahnert
+ Copyright 2009-2012 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)
+*/
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_RKN_SB3A_M4_MCLACHLAN_HPP_DEFINED
+#define BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_RKN_SB3A_M4_MCLACHLAN_HPP_DEFINED
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+#ifndef DOXYGEN_SKIP
+namespace detail {
+namespace symplectic_rkn_sb3a_m4_mclachlan {
+
+ /*
+ exp( a1 t A ) exp( b1 t B )
+ exp( a2 t A ) exp( b2 t B )
+ exp( a3 t A )
+ exp( b2 t B ) exp( a2 t A )
+ exp( b1 t B ) exp( a1 t A )
+ */
+
+
+
+ template< class Value >
+ struct coef_a_type : public boost::array< Value , 5 >
+ {
+ coef_a_type( void )
+ {
+ using std::sqrt;
+
+ Value z = sqrt( static_cast< Value >( 7 ) / static_cast< Value >( 8 ) ) / static_cast< Value >( 3 );
+ (*this)[0] = static_cast< Value >( 1 ) / static_cast< Value >( 2 ) - z ;
+ (*this)[1] = static_cast< Value >( -1 ) / static_cast< Value >( 3 ) + z ;
+ (*this)[2] = static_cast< Value >( 2 ) / static_cast< Value >( 3 );
+ (*this)[3] = (*this)[1];
+ (*this)[4] = (*this)[0];
+ }
+ };
+
+ template< class Value >
+ struct coef_b_type : public boost::array< Value , 5 >
+ {
+ coef_b_type( void )
+ {
+ (*this)[0] = static_cast< Value >( 1 );
+ (*this)[1] = static_cast< Value >( -1 ) / static_cast< Value >( 2 );
+ (*this)[2] = (*this)[1];
+ (*this)[3] = (*this)[0];
+ (*this)[4] = static_cast< Value >( 0 );
+ }
+ };
+
+} // namespace symplectic_rkn_sb3a_m4_mclachlan
+} // namespace detail
+#endif // DOXYGEN_SKIP
+
+
+
+
+/**
+ * \class symplectic_rkn_sb3a_m4_mclachlan
+ * \brief Implementation of the symmetric B3A Runge-Kutta Nystroem method of fifth order.
+ *
+ * The method is of fourth order and has five stages. It is described HERE. This method can be used
+ * with multiprecision types since the coefficients are defined analytically.
+ *
+ * ToDo: add reference to paper.
+ *
+ * \tparam Order The order of the stepper.
+ * \tparam Coor The type representing the coordinates q.
+ * \tparam Momentum The type representing the coordinates p.
+ * \tparam Value The basic value type. Should be somethink like float, double or a high-precision type.
+ * \tparam CoorDeriv The type representing the time derivative of the coordinate dq/dt.
+ * \tparam MomemtnumDeriv The type representing the time derivative of the momentum dp/dt.
+ * \tparam Time The type representing the time t.
+ * \tparam Algebra The algebra.
+ * \tparam Operations The operations.
+ * \tparam Resizer The resizer policy.
+ */
+template<
+ class Coor ,
+ class Momentum = Coor ,
+ class Value = double ,
+ class CoorDeriv = Coor ,
+ class MomentumDeriv = Coor ,
+ class Time = Value ,
+ class Algebra = range_algebra ,
+ class Operations = default_operations ,
+ class Resizer = initially_resizer
+ >
+class symplectic_rkn_sb3a_m4_mclachlan :
+ public symplectic_nystroem_stepper_base
+<
+ 5 , 4 ,
+ Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer
+ >
+{
+public:
+
+ typedef symplectic_nystroem_stepper_base
+ <
+ 5 , 4 ,
+ Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer
+ > stepper_base_type;
+
+ typedef typename stepper_base_type::algebra_type algebra_type;
+ typedef typename stepper_base_type::value_type value_type;
+
+
+ /**
+ * \brief Constructs the symplectic_rkn_sb3a_m4_mclachlan. This constructor can be used as a default
+ * constructor if the algebra has a default constructor.
+ * \param algebra A copy of algebra is made and stored inside explicit_stepper_base.
+ */
+ symplectic_rkn_sb3a_m4_mclachlan( const algebra_type &algebra = algebra_type() )
+ : stepper_base_type(
+ detail::symplectic_rkn_sb3a_m4_mclachlan::coef_a_type< value_type >() ,
+ detail::symplectic_rkn_sb3a_m4_mclachlan::coef_b_type< value_type >() ,
+ algebra )
+ { }
+};
+
+
+
+} // namespace odeint
+} // namespace numeric
+} // namespace boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_RKN_SB3A_M4_MCLACHLAN_HPP_DEFINED

Added: trunk/boost/numeric/odeint/stepper/symplectic_rkn_sb3a_mclachlan.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/stepper/symplectic_rkn_sb3a_mclachlan.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,150 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/stepper/symplectic_rkn_sb3a_mclachlan.hpp
+
+ [begin_description]
+ Implementation of the symplectic MacLachlan stepper for separable Hamiltonian system.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+*/
+
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_RKN_SB3A_MCLACHLAN_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_RKN_SB3A_MCLACHLAN_HPP_INCLUDED
+
+
+#include <boost/numeric/odeint/stepper/base/symplectic_rkn_stepper_base.hpp>
+
+#include <boost/numeric/odeint/algebra/range_algebra.hpp>
+#include <boost/numeric/odeint/algebra/default_operations.hpp>
+
+#include <boost/array.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+#ifndef DOXYGEN_SKIP
+namespace detail {
+namespace symplectic_rkn_sb3a_mclachlan {
+
+ /*
+ exp( a1 t A ) exp( b1 t B )
+ exp( a2 t A ) exp( b2 t B )
+ exp( a3 t A ) exp( b3 t B ) exp( a3 t A )
+ exp( b2 t B ) exp( a2 t A )
+ exp( b1 t B ) exp( a1 t A )
+ */
+
+ template< class Value >
+ struct coef_a_type : public boost::array< Value , 6 >
+ {
+ coef_a_type( void )
+ {
+ (*this)[0] = static_cast< Value >( 0.40518861839525227722 );
+ (*this)[1] = static_cast< Value >( -0.28714404081652408900 );
+ (*this)[2] = static_cast< Value >( 1 ) / static_cast< Value >( 2 ) - ( (*this)[0] + (*this)[1] );
+ (*this)[3] = (*this)[2];
+ (*this)[4] = (*this)[1];
+ (*this)[5] = (*this)[0];
+
+ }
+ };
+
+ template< class Value >
+ struct coef_b_type : public boost::array< Value , 6 >
+ {
+ coef_b_type( void )
+ {
+ (*this)[0] = static_cast< Value >( -3 ) / static_cast< Value >( 73 );
+ (*this)[1] = static_cast< Value >( 17 ) / static_cast< Value >( 59 );
+ (*this)[2] = static_cast< Value >( 1 ) - static_cast< Value >( 2 ) * ( (*this)[0] + (*this)[1] );
+ (*this)[3] = (*this)[1];
+ (*this)[4] = (*this)[0];
+ (*this)[5] = static_cast< Value >( 0 );
+ }
+ };
+
+} // namespace symplectic_rkn_sb3a_mclachlan
+} // namespace detail
+#endif // DOXYGEN_SKIP
+
+
+
+/**
+ * \class symplectic_rkn_sb3a_mclachlan
+ * \brief Implement of the symetric B3A method of Runge-Kutta-Nystroem method of sixth order.
+ *
+ * The method is of fourth order and has six stages. It is described HERE. This method cannot be used
+ * with multiprecision types since the coefficients are not defined analytically.
+ *
+ * ToDo Add reference to the paper.
+ *
+ * \tparam Order The order of the stepper.
+ * \tparam Coor The type representing the coordinates q.
+ * \tparam Momentum The type representing the coordinates p.
+ * \tparam Value The basic value type. Should be somethink like float, double or a high-precision type.
+ * \tparam CoorDeriv The type representing the time derivative of the coordinate dq/dt.
+ * \tparam MomemtnumDeriv The type representing the time derivative of the momentum dp/dt.
+ * \tparam Time The type representing the time t.
+ * \tparam Algebra The algebra.
+ * \tparam Operations The operations.
+ * \tparam Resizer The resizer policy.
+ */
+template<
+ class Coor ,
+ class Momentum = Coor ,
+ class Value = double ,
+ class CoorDeriv = Coor ,
+ class MomentumDeriv = Coor ,
+ class Time = Value ,
+ class Algebra = range_algebra ,
+ class Operations = default_operations ,
+ class Resizer = initially_resizer
+ >
+class symplectic_rkn_sb3a_mclachlan :
+ public symplectic_nystroem_stepper_base
+<
+ 6 , 4 ,
+ Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer
+ >
+{
+public:
+
+ typedef symplectic_nystroem_stepper_base
+ <
+ 6 , 4 ,
+ Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer
+ > stepper_base_type;
+
+ typedef typename stepper_base_type::algebra_type algebra_type;
+ typedef typename stepper_base_type::value_type value_type;
+
+
+ /**
+ * \brief Constructs the symplectic_rkn_sb3a_mclachlan. This constructor can be used as a default
+ * constructor if the algebra has a default constructor.
+ * \param algebra A copy of algebra is made and stored inside explicit_stepper_base.
+ */
+ symplectic_rkn_sb3a_mclachlan( const algebra_type &algebra = algebra_type() )
+ : stepper_base_type(
+ detail::symplectic_rkn_sb3a_mclachlan::coef_a_type< value_type >() ,
+ detail::symplectic_rkn_sb3a_mclachlan::coef_b_type< value_type >() ,
+ algebra )
+ { }
+};
+
+
+
+} // namespace odeint
+} // namespace numeric
+} // namespace boost
+
+#endif // BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_RKN_SB3A_MCLACHLAN_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/util/bind.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/util/bind.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,53 @@
+/*
+ * [begin_description]
+ * Boost bind pull the placeholders, _1, _2, ... into global
+ * namespace. This can conflict with the C++03 TR1 and C++11
+ * std::placeholders. This header provides a workaround for
+ * this problem.
+ * [end_description]
+ *
+ * Copyright 2012 Christoph Koke
+ *
+ * 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)
+ * */
+
+#ifndef BOOST_NUMERIC_ODEINT_UTIL_BIND_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_UTIL_BIND_HPP_INCLUDED
+
+
+#include <boost/numeric/odeint/config.hpp>
+
+
+#if BOOST_NUMERIC_ODEINT_CXX11
+#include <type_traits>
+#else
+#include <boost/bind.hpp>
+#endif
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+namespace detail {
+
+#if BOOST_NUMERIC_ODEINT_CXX11
+
+using ::std::bind;
+using namespace ::std::placeholders;
+
+
+#else
+
+using ::boost::bind;
+using ::_1;
+using ::_2;
+
+#endif
+
+}
+}
+}
+}
+
+#endif // BOOST_NUMERIC_ODEINT_UTIL_BIND_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/util/copy.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/util/copy.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,75 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/util/copy.hpp
+
+ [begin_description]
+ Copy abstraction for the usage in the steppers.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_UTIL_COPY_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_UTIL_COPY_HPP_INCLUDED
+
+
+#include <boost/range/algorithm/copy.hpp>
+
+#include <boost/utility/enable_if.hpp>
+
+#include <boost/numeric/odeint/util/detail/is_range.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+namespace detail {
+
+ template< class Container1 , class Container2 >
+ void do_copying( const Container1 &from , Container2 &to , boost::mpl::true_ )
+ {
+ boost::range::copy( from , boost::begin( to ) );
+ }
+
+ template< class Container1 , class Container2 >
+ void do_copying( const Container1 &from , Container2 &to , boost::mpl::false_ )
+ {
+ to = from;
+ }
+
+} // namespace detail
+
+
+/*
+ * Default implementation of the copy operation used the assign operator
+ * gsl_vector must copied differently
+ */
+template< class Container1, class Container2 , class Enabler = void >
+struct copy_impl
+{
+ static void copy( const Container1 &from , Container2 &to )
+ {
+ typedef typename boost::numeric::odeint::detail::is_range< Container1 >::type is_range_type;
+ detail::do_copying( from , to , is_range_type() );
+ }
+};
+
+template< class Container1 , class Container2 >
+void copy( const Container1 &from , Container2 &to )
+{
+ copy_impl< Container1 , Container2 >::copy( from , to );
+}
+
+
+} // namespace odeint
+} // namespace numeric
+} // namespace boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_UTIL_COPY_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/util/detail/is_range.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/util/detail/is_range.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,133 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/util/detail/is_range.hpp
+
+ [begin_description]
+ is_range implementation. Taken from the boost::range library.
+ [end_description]
+
+ Copyright Thorsten Ottosen 2003-2004
+
+
+
+ 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_UTIL_DETAIL_IS_RANGE_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_UTIL_DETAIL_IS_RANGE_HPP_INCLUDED
+
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif
+
+#include <cstddef>
+#include <boost/range/config.hpp>
+#include <boost/mpl/has_xxx.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/and.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+
+namespace range_detail
+{
+BOOST_MPL_HAS_XXX_TRAIT_DEF(iterator)
+ BOOST_MPL_HAS_XXX_TRAIT_DEF(const_iterator)
+}
+
+namespace detail
+{
+
+template< typename Range >
+struct is_range : boost::mpl::and_<range_detail::has_iterator<Range>, range_detail::has_const_iterator<Range> >
+{
+};
+
+//////////////////////////////////////////////////////////////////////////
+// pair
+//////////////////////////////////////////////////////////////////////////
+
+template< typename iteratorT >
+struct is_range< std::pair<iteratorT,iteratorT> > : boost::mpl::true_
+{
+};
+
+template< typename iteratorT >
+struct is_range< const std::pair<iteratorT,iteratorT> > : boost::mpl::true_
+{
+};
+
+//////////////////////////////////////////////////////////////////////////
+// array
+//////////////////////////////////////////////////////////////////////////
+
+template< typename elementT, std::size_t sz >
+struct is_range< elementT[sz] > : boost::mpl::true_
+{
+};
+
+template< typename elementT, std::size_t sz >
+struct is_range< const elementT[sz] > : boost::mpl::true_
+{
+};
+
+//////////////////////////////////////////////////////////////////////////
+// string
+//////////////////////////////////////////////////////////////////////////
+
+template<>
+struct is_range< char* > : boost::mpl::true_
+{
+};
+
+template<>
+struct is_range< wchar_t* > : boost::mpl::true_
+{
+};
+
+template<>
+struct is_range< const char* > : boost::mpl::true_
+{
+};
+
+template<>
+struct is_range< const wchar_t* > : boost::mpl::true_
+{
+};
+
+template<>
+struct is_range< char* const > : boost::mpl::true_
+{
+};
+
+template<>
+struct is_range< wchar_t* const > : boost::mpl::true_
+{
+};
+
+template<>
+struct is_range< const char* const > : boost::mpl::true_
+{
+};
+
+template<>
+struct is_range< const wchar_t* const > : boost::mpl::true_
+{
+};
+
+} // namespace detail
+
+} // namespaec odeint
+} // namespace numeric
+} // namespace boost
+
+
+
+#endif // BOOST_NUMERIC_ODEINT_UTIL_DETAIL_IS_RANGE_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/util/detail/less_with_sign.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/util/detail/less_with_sign.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,53 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/integrate/detail/less_with_sign.hpp
+
+ [begin_description]
+ Helper function to compare times taking into account the sign of dt
+ [end_description]
+
+ Copyright 2009-2012 Karsten Ahnert
+ Copyright 2009-2012 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)
+ */
+
+#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_LESS_WITH_SIGN_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_LESS_WITH_SIGN_HPP_INCLUDED
+
+#include <boost/numeric/odeint/util/unit_helper.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+namespace detail {
+
+/**
+ * return t1 < t2 if dt > 0 and t1 > t2 if dt < 0
+ */
+template< typename T1 , typename T2 , typename T3 >
+bool less_with_sign( T1 t1 , T2 t2 , T3 dt )
+{
+ if( get_unit_value(dt) > 0 )
+ return t1 < t2;
+ else
+ return t1 > t2;
+}
+
+/**
+ * return t1 <= t2 if dt > 0 and t1 => t2 if dt < 0
+ */
+template< typename T1 , typename T2 , typename T3>
+bool less_eq_with_sign( T1 t1 , T2 t2 , T3 dt )
+{
+ if( get_unit_value(dt) > 0 )
+ return t1 <= t2;
+ else
+ return t1 >= t2;
+}
+
+} } } }
+
+#endif

Added: trunk/boost/numeric/odeint/util/is_pair.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/util/is_pair.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,45 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/util/is_pair.hpp
+
+ [begin_description]
+ Metafunction to determine if a type is a std::pair<>.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_UTIL_IS_PAIR_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_UTIL_IS_PAIR_HPP_INCLUDED
+
+
+#include <boost/mpl/bool.hpp>
+#include <utility>
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+template< class T >
+struct is_pair : public boost::mpl::false_
+{
+};
+
+template< class T1 , class T2 >
+struct is_pair< std::pair< T1 , T2 > > : public boost::mpl::true_
+{
+};
+
+} // namespace odeint
+} // namespace numeric
+} // namespace boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_UTIL_IS_PAIR_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/util/is_resizeable.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/util/is_resizeable.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,84 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/util/is_resizeable.hpp
+
+ [begin_description]
+ Metafunction to determine if a state type can resized. For usage in the steppers.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_UTIL_IS_RESIZEABLE_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_UTIL_IS_RESIZEABLE_HPP_INCLUDED
+
+
+#include <vector>
+
+#include <boost/type_traits/integral_constant.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/fusion/include/front.hpp>
+#include <boost/fusion/include/is_sequence.hpp>
+
+#include <boost/mpl/find_if.hpp>
+#include <boost/mpl/end.hpp>
+#include <boost/mpl/placeholders.hpp>
+// #include <boost/mpl/not.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+/*
+ * by default any type is not resizable
+ */
+template< class Container , class Enabler = void >
+struct is_resizeable
+{
+ //struct type : public boost::false_type { };
+ typedef boost::false_type type;
+ const static bool value = type::value;
+};
+
+/*
+ * specialization for std::vector
+ */
+template< class V, class A >
+struct is_resizeable< std::vector< V , A > >
+{
+ //struct type : public boost::true_type { };
+ typedef boost::true_type type;
+ const static bool value = type::value;
+};
+
+
+/*
+ * specialization for fusion sequences
+ */
+template< class FusionSequence >
+struct is_resizeable< FusionSequence , typename boost::enable_if< typename boost::fusion::traits::is_sequence< FusionSequence >::type >::type >
+{
+ typedef typename boost::mpl::find_if< FusionSequence , is_resizeable< boost::mpl::_1 > >::type iter;
+ typedef typename boost::mpl::end< FusionSequence >::type last;
+
+ typedef typename boost::mpl::if_< boost::is_same< iter , last > , boost::false_type , boost::true_type >::type type;
+ const static bool value = type::value;
+};
+
+
+
+} // namespace odeint
+} // namespace numeric
+} // namespace boost
+
+
+
+#endif // BOOST_NUMERIC_ODEINT_UTIL_IS_RESIZEABLE_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/util/resize.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/util/resize.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,107 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/util/state_wrapper.hpp
+
+ [begin_description]
+ State wrapper for the state type in all stepper. The state wrappers are responsible for contruction,
+ destruction, copying contruction, assignment and resizing.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_UTIL_RESIZE_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_UTIL_RESIZE_HPP_INCLUDED
+
+#include <boost/range.hpp>
+
+#include <boost/utility/enable_if.hpp>
+#include <boost/fusion/include/is_sequence.hpp>
+#include <boost/fusion/include/zip_view.hpp>
+#include <boost/fusion/include/vector.hpp>
+#include <boost/fusion/include/make_fused.hpp>
+#include <boost/fusion/include/for_each.hpp>
+
+#include <boost/numeric/odeint/util/is_resizeable.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+// resize function
+// standard implementation relies on boost.range and resize member function
+template< class StateOut , class StateIn , class Enabler = void >
+struct resize_impl
+{
+ static void resize( StateOut &x1 , const StateIn &x2 )
+ {
+ x1.resize( boost::size( x2 ) );
+ }
+};
+
+
+// do not overload or specialize this function, specialize resize_impl<> instead
+template< class StateOut , class StateIn >
+void resize( StateOut &x1 , const StateIn &x2 )
+{
+ resize_impl< StateOut , StateIn >::resize( x1 , x2 );
+}
+
+
+namespace detail {
+
+ struct resizer
+ {
+ typedef void result_type;
+
+ template< class StateOut , class StateIn >
+ void operator()( StateOut &x1 , const StateIn &x2 ) const
+ {
+ resize_op( x1 , x2 , typename is_resizeable< StateOut >::type() );
+ }
+
+ template< class StateOut , class StateIn >
+ void resize_op( StateOut &x1 , const StateIn &x2 , boost::true_type ) const
+ {
+ resize( x1 , x2 );
+ }
+
+ template< class StateOut , class StateIn >
+ void resize_op( StateOut &x1 , const StateIn &x2 , boost::false_type ) const
+ {
+ }
+
+ };
+} // nanespace detail
+
+
+/*
+ * specialization for fusion sequences
+ */
+template< class FusionSeq >
+struct resize_impl< FusionSeq , FusionSeq , typename boost::enable_if< typename boost::fusion::traits::is_sequence< FusionSeq >::type >::type >
+{
+ static void resize( FusionSeq &x1 , const FusionSeq &x2 )
+ {
+ typedef boost::fusion::vector< FusionSeq& , const FusionSeq& > Sequences;
+ Sequences sequences( x1 , x2 );
+ boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( detail::resizer() ) );
+ }
+};
+
+
+
+
+}
+}
+}
+
+
+
+#endif // BOOST_NUMERIC_ODEINT_UTIL_RESIZE_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/util/resizer.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/util/resizer.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,93 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/util/resizer.hpp
+
+ [begin_description]
+ Implementation of the resizers.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_UTIL_RESIZER_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_UTIL_RESIZER_HPP_INCLUDED
+
+
+#include <boost/numeric/odeint/util/is_resizeable.hpp>
+#include <boost/numeric/odeint/util/same_size.hpp>
+#include <boost/numeric/odeint/util/resize.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+template< class ResizeWrappedState , class State >
+bool adjust_size_by_resizeability( ResizeWrappedState &x , const State &y , boost::true_type )
+{
+ if ( !same_size( x.m_v , y ) )
+ {
+ resize( x.m_v , y );
+ return true;
+ }
+ else
+ return false;
+}
+
+template< class ResizeWrappedState , class State >
+bool adjust_size_by_resizeability( ResizeWrappedState & /* x */ , const State & /* y */ , boost::false_type )
+{
+ return false;
+}
+
+struct always_resizer
+{
+ template< class State , class ResizeFunction >
+ bool adjust_size( const State &x , ResizeFunction f )
+ {
+ return f( x );
+ }
+};
+
+
+struct initially_resizer
+{
+
+ bool m_initialized;
+
+ initially_resizer() : m_initialized( false )
+ { }
+
+ template< class State , class ResizeFunction >
+ bool adjust_size( const State &x , ResizeFunction f )
+ {
+ if( !m_initialized )
+ {
+ m_initialized = true;
+ return f( x );
+ } else
+ return false;
+ }
+};
+
+
+struct never_resizer
+{
+ template< class State , class ResizeFunction >
+ bool adjust_size( const State &x , ResizeFunction f )
+ {
+ return false;
+ }
+};
+
+
+}
+}
+}
+
+#endif // BOOST_NUMERIC_ODEINT_UTIL_RESIZER_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/util/same_instance.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/util/same_instance.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,56 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/util/same_instance.hpp
+
+ [begin_description]
+ Basic check if two variables are the same instance
+ [end_description]
+
+ Copyright 2009-2012 Karsten Ahnert
+ Copyright 2009-2012 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_UTIL_SAME_INSTANCE_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_UTIL_SAME_INSTANCE_HPP_INCLUDED
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+template< class T1 , class T2 , class Enabler=void >
+struct same_instance_impl
+{
+ static bool same_instance( const T1 &x1 , const T2 &x2 )
+ {
+ return false;
+ }
+};
+
+template< class T >
+struct same_instance_impl< T , T >
+{
+ static bool same_instance( const T &x1 , const T &x2 )
+ {
+ // check pointers
+ return (&x1 == &x2);
+ }
+};
+
+
+template< class T1 , class T2 >
+bool same_instance( const T1 &x1 , const T2 &x2 )
+{
+ return same_instance_impl< T1 , T2 >::same_instance( x1 , x2 );
+}
+
+
+} // namespace odeint
+} // namespace numeric
+} // namespace boost
+
+#endif

Added: trunk/boost/numeric/odeint/util/same_size.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/util/same_size.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,105 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/util/state_wrapper.hpp
+
+ [begin_description]
+ State wrapper for the state type in all stepper. The state wrappers are responsible for contruction,
+ destruction, copying contruction, assignment and resizing.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_UTIL_SAME_SIZE_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_UTIL_SAME_SIZE_HPP_INCLUDED
+
+#include <boost/numeric/odeint/util/is_resizeable.hpp>
+
+#include <boost/utility/enable_if.hpp>
+#include <boost/fusion/include/is_sequence.hpp>
+#include <boost/fusion/include/zip_view.hpp>
+#include <boost/fusion/include/vector.hpp>
+#include <boost/fusion/include/make_fused.hpp>
+#include <boost/fusion/include/all.hpp>
+
+#include <boost/range.hpp>
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+// same_size function
+// standard implementation relies on boost.range
+template< class State1 , class State2 , class Enabler = void >
+struct same_size_impl
+{
+ static bool same_size( const State1 &x1 , const State2 &x2 )
+ {
+ return ( boost::size( x1 ) == boost::size( x2 ) );
+ }
+};
+
+
+// do not overload or specialize this function, specialize resize_impl<> instead
+template< class State1 , class State2 >
+bool same_size( const State1 &x1 , const State2 &x2 )
+{
+ return same_size_impl< State1 , State2 >::same_size( x1 , x2 );
+}
+
+namespace detail {
+
+struct same_size_fusion
+{
+ typedef bool result_type;
+
+ template< class S1 , class S2 >
+ bool operator()( const S1 &x1 , const S2 &x2 ) const
+ {
+ return same_size_op( x1 , x2 , typename is_resizeable< S1 >::type() );
+ }
+
+ template< class S1 , class S2 >
+ bool same_size_op( const S1 &x1 , const S2 &x2 , boost::true_type ) const
+ {
+ return same_size( x1 , x2 );
+ }
+
+ template< class S1 , class S2 >
+ bool same_size_op( const S1 &x1 , const S2 &x2 , boost::false_type ) const
+ {
+ return true;
+ }
+};
+
+} // namespace detail
+
+
+
+template< class FusionSeq >
+struct same_size_impl< FusionSeq , FusionSeq , typename boost::enable_if< typename boost::fusion::traits::is_sequence< FusionSeq >::type >::type >
+{
+ static bool same_size( const FusionSeq &x1 , const FusionSeq &x2 )
+ {
+ typedef boost::fusion::vector< const FusionSeq& , const FusionSeq& > Sequences;
+ Sequences sequences( x1 , x2 );
+ return boost::fusion::all( boost::fusion::zip_view< Sequences >( sequences ) ,
+ boost::fusion::make_fused( detail::same_size_fusion() ) );
+ }
+};
+
+
+}
+}
+}
+
+
+
+#endif // BOOST_NUMERIC_ODEINT_UTIL_SAME_SIZE_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/util/state_wrapper.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/util/state_wrapper.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,50 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/util/state_wrapper.hpp
+
+ [begin_description]
+ State wrapper for the state type in all stepper. The state wrappers are responsible for contruction,
+ destruction, copying contruction, assignment and resizing.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_UTIL_STATE_WRAPPER_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_UTIL_STATE_WRAPPER_HPP_INCLUDED
+
+
+#include <boost/type_traits/integral_constant.hpp>
+
+#include <boost/numeric/odeint/util/is_resizeable.hpp>
+#include <boost/numeric/odeint/util/resize.hpp>
+#include <boost/numeric/odeint/util/same_size.hpp>
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+template< class V , class Enabler = void >
+struct state_wrapper
+{
+ typedef state_wrapper< V > state_wrapper_type;
+
+ V m_v;
+};
+
+
+}
+}
+}
+
+
+
+#endif // BOOST_NUMERIC_ODEINT_UTIL_STATE_WRAPPER_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/util/ublas_wrapper.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/util/ublas_wrapper.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,260 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/util/ublas_wrapper.hpp
+
+ [begin_description]
+ Resizing for ublas::vector and ublas::matrix
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_UTIL_UBLAS_WRAPPER_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_UTIL_UBLAS_WRAPPER_HPP_INCLUDED
+
+
+#include <boost/type_traits/integral_constant.hpp>
+#include <boost/numeric/ublas/vector.hpp>
+#include <boost/numeric/ublas/matrix.hpp>
+#include <boost/numeric/ublas/lu.hpp>
+
+#include <boost/numeric/odeint/util/is_resizeable.hpp>
+#include <boost/numeric/odeint/util/state_wrapper.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+/*
+ * resizeable specialization for boost::numeric::ublas::vector
+ */
+template< class T , class A >
+struct is_resizeable< boost::numeric::ublas::vector< T , A > >
+{
+ typedef boost::true_type type;
+ const static bool value = type::value;
+};
+
+
+/*
+ * resizeable specialization for boost::numeric::ublas::matrix
+ */
+template< class T , class L , class A >
+struct is_resizeable< boost::numeric::ublas::matrix< T , L , A > >
+{
+ typedef boost::true_type type;
+ const static bool value = type::value;
+};
+
+
+/*
+ * resizeable specialization for boost::numeric::ublas::permutation_matrix
+ */
+template< class T , class A >
+struct is_resizeable< boost::numeric::ublas::permutation_matrix< T , A > >
+{
+ typedef boost::true_type type;
+ const static bool value = type::value;
+};
+
+
+// specialization for ublas::matrix
+// same size and resize specialization for matrix-matrix resizing
+template< class T , class L , class A , class T2 , class L2 , class A2 >
+struct same_size_impl< boost::numeric::ublas::matrix< T , L , A > , boost::numeric::ublas::matrix< T2 , L2 , A2 > >
+{
+ static bool same_size( const boost::numeric::ublas::matrix< T , L , A > &m1 ,
+ const boost::numeric::ublas::matrix< T2 , L2 , A2 > &m2 )
+ {
+ return ( ( m1.size1() == m2.size1() ) && ( m1.size2() == m2.size2() ) );
+ }
+};
+
+template< class T , class L , class A , class T2 , class L2 , class A2 >
+struct resize_impl< boost::numeric::ublas::matrix< T , L , A > , boost::numeric::ublas::matrix< T2 , L2 , A2 > >
+{
+ static void resize( boost::numeric::ublas::matrix< T , L , A > &m1 ,
+ const boost::numeric::ublas::matrix< T2 , L2 , A2 > &m2 )
+ {
+ m1.resize( m2.size1() , m2.size2() );
+ }
+};
+
+
+
+// same size and resize specialization for matrix-vector resizing
+template< class T , class L , class A , class T_V , class A_V >
+struct same_size_impl< boost::numeric::ublas::matrix< T , L , A > , boost::numeric::ublas::vector< T_V , A_V > >
+{
+ static bool same_size( const boost::numeric::ublas::matrix< T , L , A > &m ,
+ const boost::numeric::ublas::vector< T_V , A_V > &v )
+ {
+ return ( ( m.size1() == v.size() ) && ( m.size2() == v.size() ) );
+ }
+};
+
+template< class T , class L , class A , class T_V , class A_V >
+struct resize_impl< boost::numeric::ublas::matrix< T , L , A > , boost::numeric::ublas::vector< T_V , A_V > >
+{
+ static void resize( boost::numeric::ublas::matrix< T , L , A > &m ,
+ const boost::numeric::ublas::vector< T_V , A_V > &v )
+ {
+ m.resize( v.size() , v.size() );
+ }
+};
+
+
+
+// specialization for ublas::permutation_matrix
+// same size and resize specialization for matrix-vector resizing
+template< class T , class A , class T_V , class A_V >
+struct same_size_impl< boost::numeric::ublas::permutation_matrix< T , A > , boost::numeric::ublas::vector< T_V , A_V > >
+{
+ static bool same_size( const boost::numeric::ublas::permutation_matrix< T , A > &m ,
+ const boost::numeric::ublas::vector< T_V , A_V > &v )
+ {
+ return ( m.size() == v.size() ); // && ( m.size2() == v.size() ) );
+ }
+};
+
+template< class T , class A , class T_V , class A_V >
+struct resize_impl< boost::numeric::ublas::vector< T_V , A_V > , boost::numeric::ublas::permutation_matrix< T , A > >
+{
+ static void resize( const boost::numeric::ublas::vector< T_V , A_V > &v,
+ boost::numeric::ublas::permutation_matrix< T , A > &m )
+ {
+ m.resize( v.size() , v.size() );
+ }
+};
+
+
+
+
+
+
+
+template< class T , class A >
+struct state_wrapper< boost::numeric::ublas::permutation_matrix< T , A > > // with resizing
+{
+ typedef boost::numeric::ublas::permutation_matrix< T , A > state_type;
+ typedef state_wrapper< state_type > state_wrapper_type;
+
+ state_type m_v;
+
+ state_wrapper() : m_v( 1 ) // permutation matrix constructor requires a size, choose 1 as default
+ { }
+
+};
+
+
+
+
+} } }
+
+//// all specializations done, ready to include state_wrapper
+//
+//#include <boost/numeric/odeint/util/state_wrapper.hpp>
+//
+//namespace boost {
+//namespace numeric {
+//namespace odeint {
+//
+///* specialization for permutation matrizes wrapper because we need to change the construction */
+//template< class T , class A >
+//struct state_wrapper< boost::numeric::ublas::permutation_matrix< T , A > , true > // with resizing
+//{
+// typedef boost::numeric::ublas::permutation_matrix< T , A > state_type;
+// typedef state_wrapper< state_type > state_wrapper_type;
+// //typedef typename V::value_type value_type;
+// typedef boost::true_type is_resizeable;
+//
+// state_type m_v;
+//
+// state_wrapper() : m_v( 1 ) // permutation matrix constructor requires a size, choose 1 as default
+// { }
+//
+// template< class T_V , class A_V >
+// bool same_size( const boost::numeric::ublas::vector< T_V , A_V > &x )
+// {
+// return boost::numeric::odeint::same_size( m_v , x );
+// }
+//
+// template< class T_V , class A_V >
+// bool resize( const boost::numeric::ublas::vector< T_V , A_V > &x )
+// {
+// //standard resizing done like for std::vector
+// if( !same_size( x ) )
+// {
+// boost::numeric::odeint::resize( m_v , x );
+// return true;
+// } else
+// return false;
+// }
+//};
+//
+//}
+//}
+//}
+
+
+/*
+ * preparing ublas::matrix for boost::range, such that ublas::matrix can be used in all steppers with the range algebra
+ */
+
+namespace boost
+{
+template< class T , class L , class A >
+struct range_mutable_iterator< boost::numeric::ublas::matrix< T , L , A > >
+{
+ typedef typename boost::numeric::ublas::matrix< T , L , A >::array_type::iterator type;
+};
+
+template< class T , class L , class A >
+struct range_const_iterator< boost::numeric::ublas::matrix< T , L , A > >
+{
+ typedef typename boost::numeric::ublas::matrix< T , L , A >::array_type::const_iterator type;
+};
+
+} // namespace boost
+
+
+namespace boost { namespace numeric { namespace ublas {
+
+template< class T , class L , class A >
+inline typename matrix< T , L , A >::array_type::iterator
+range_begin( matrix< T , L , A > &x )
+{
+ return x.data().begin();
+}
+
+template< class T , class L , class A >
+inline typename matrix< T , L , A >::array_type::const_iterator
+range_begin( const matrix< T , L , A > &x )
+{
+ return x.data().begin();
+}
+
+template< class T , class L , class A >
+inline typename matrix< T , L , A >::array_type::iterator
+range_end( matrix< T , L , A > &x )
+{
+ return x.data().end();
+}
+
+template< class T , class L , class A >
+inline typename matrix< T , L , A >::array_type::const_iterator
+range_end( const matrix< T , L , A > &x )
+{
+ return x.data().end();
+}
+
+} } } // nampespace boost::numeric::ublas
+
+
+#endif // BOOST_NUMERIC_ODEINT_UTIL_UBLAS_WRAPPER_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/util/unit_helper.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/util/unit_helper.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,152 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/util/unit_helper.hpp
+
+ [begin_description]
+ Get and set the the value of a unit.
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+*/
+
+
+#ifndef BOOST_NUMERIC_ODEINT_UTIL_UNIT_HELPER_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_UTIL_UNIT_HELPER_HPP_INCLUDED
+
+
+#ifndef __CUDACC__
+#include <boost/units/quantity.hpp>
+#include <boost/units/get_dimension.hpp>
+#include <boost/units/get_system.hpp>
+#endif
+
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+
+namespace detail {
+
+ template<class T , class Enabler = void >
+ struct get_unit_value_impl
+ {
+ static T value(const T &t)
+ {
+ return t;
+ }
+ typedef T result_type;
+ };
+
+#ifndef __CUDACC__
+ template<class Unit , class T>
+ struct get_unit_value_impl< boost::units::quantity< Unit , T> >
+ {
+ static T value( const boost::units::quantity< Unit , T> &t )
+ {
+ return t.value();
+ }
+ typedef T result_type;
+ };
+#endif
+
+
+
+
+
+ template<class T , class V , class Enabler = void >
+ struct set_unit_value_impl
+ {
+ static void set_value(T &t , const V &v)
+ {
+ t = v;
+ }
+ };
+
+#ifndef __CUDACC__
+ template<class Unit , class T , class V>
+ struct set_unit_value_impl<boost::units::quantity<Unit , T> , V>
+ {
+ static void set_value(boost::units::quantity<Unit , T> &t , const V &v)
+ {
+ t = boost::units::quantity<Unit , T>::from_value(v);
+ }
+ };
+#endif
+
+
+
+} // namespace detail
+
+
+ template<class T>
+ typename detail::get_unit_value_impl<T>::result_type get_unit_value(const T &t)
+ {
+ return detail::get_unit_value_impl<T>::value(t);
+ }
+
+
+ template<class T , class V>
+
+ void set_unit_value(T &t , const V &v)
+ {
+ return detail::set_unit_value_impl<T , V>::set_value(t , v);
+ }
+
+
+
+ template< class T >
+ struct unit_value_type
+ {
+ typedef T type;
+ };
+
+#ifndef __CUDACC__
+ template< class Unit , class Y >
+ struct unit_value_type< boost::units::quantity< Unit , Y > >
+ {
+ typedef Y type;
+ };
+#endif
+
+
+
+
+
+
+
+
+
+
+ template< typename Time >
+ struct inverse_time
+ {
+ typedef Time type;
+ };
+
+#ifndef __CUDACC__
+ template< typename Unit , typename Value >
+ struct inverse_time< boost::units::quantity< Unit , Value > >
+ {
+ typedef boost::units::quantity< Unit , Value > time_type;
+ typedef typename boost::units::get_dimension< time_type >::type dimension;
+ typedef typename boost::units::get_system< time_type >::type system;
+ typedef typename boost::mpl::divides< boost::units::dimensionless_type , dimension >::type inv_dimension;
+ typedef boost::units::unit< inv_dimension , system > inv_unit;
+ typedef boost::units::quantity< inv_unit , Value > type;
+ };
+#endif
+
+
+} // namespace odeint
+} // namespace numeric
+} // namespace boost
+
+
+#endif // BOOST_NUMERIC_ODEINT_UTIL_UNIT_HELPER_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/util/unwrap_reference.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/util/unwrap_reference.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,87 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/util/unwrap_reference.hpp
+
+ [begin_description]
+ unwrap_reference
+ [end_description]
+
+ Copyright 2009-2011 Karsten Ahnert
+ Copyright 2009-2011 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)
+ */
+
+
+#ifndef BOOST_NUMERIC_ODEINT_UTIL_UNWRAP_REFERENCE_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_UTIL_UNWRAP_REFERENCE_HPP_INCLUDED
+
+
+#include <boost/numeric/odeint/config.hpp>
+
+
+#if BOOST_NUMERIC_ODEINT_CXX11
+#include <functional>
+#else
+#include <boost/ref.hpp>
+#endif
+
+namespace boost {
+
+#if BOOST_NUMERIC_ODEINT_CXX11
+template<typename T> class reference_wrapper;
+
+template<typename T> class unwrap_reference;
+#endif
+
+namespace numeric {
+namespace odeint {
+
+
+#if BOOST_NUMERIC_ODEINT_CXX11
+
+template<typename T>
+struct unwrap_reference
+{
+ typedef typename std::remove_reference<T>::type type;
+};
+
+template<typename T>
+struct unwrap_reference< std::reference_wrapper<T> >
+{
+ typedef typename std::remove_reference<T>::type type;
+};
+
+template<typename T>
+struct unwrap_reference< boost::reference_wrapper<T> >
+{
+ typedef typename boost::unwrap_reference<T>::type type;
+};
+
+#else
+
+using ::boost::unwrap_reference;
+
+#endif
+
+namespace detail
+{
+
+#if BOOST_NUMERIC_ODEINT_CXX11
+
+using ::std::ref;
+
+#else
+
+using ::boost::ref;
+
+#endif
+}
+
+}
+}
+}
+
+#endif // BOOST_NUMERIC_ODEINT_UTIL_UNWRAP_REFERENCE_HPP_INCLUDED

Added: trunk/boost/numeric/odeint/version.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/numeric/odeint/version.hpp 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,55 @@
+/*
+ [auto_generated]
+ boost/numeric/odeint/version.hpp
+
+ [begin_description]
+ Defines the current version of odeint.
+ [end_description]
+
+ Copyright 2009-2012 Karsten Ahnert
+ Copyright 2009-2012 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)
+ */
+
+#ifndef BOOST_NUMERIC_ODEINT_VERSION_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_VERSION_HPP_INCLUDED
+
+#include <string>
+#include <sstream>
+
+
+#define ODEINT_MAJOR_VERSION 2
+#define ODEINT_MINOR_VERSION 2
+#define ODEINT_PATCH_LEVEL 0
+#define ODEINT_VERSION ( ODEINT_MAJOR_VERSION * 100000 + ODEINT_MINOR_VERSION * 100 + ODEINT_PATCH_LEVEL )
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+namespace version {
+
+const int major = ODEINT_MAJOR_VERSION ;
+const int minor = ODEINT_MINOR_VERSION ;
+const int patch_level = ODEINT_PATCH_LEVEL ;
+
+}
+
+inline std::string get_version_string( void )
+{
+ std::ostringstream str;
+ str << "v" << version::major << "." << version::minor;
+ if( version::patch_level != 0 ) str << "_" << version::patch_level;
+ return str.str();
+}
+
+
+}
+}
+}
+
+#endif // BOOST_NUMERIC_ODEINT_VERSION_HPP_INCLUDED

Added: trunk/libs/numeric/odeint/doc/Jamfile.v2
==============================================================================
--- (empty file)
+++ trunk/libs/numeric/odeint/doc/Jamfile.v2 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,283 @@
+# (C) Copyright 2009 - 2012 : Karsten Ahnert, 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)
+
+
+import quickbook ;
+import boostbook ;
+import doxygen ;
+import modules ;
+
+project : requirements
+ <include>$(BOOST_ROOT)/tools/auto_index/include
+ ;
+
+if --enable-index in [ modules.peek : ARGV ]
+{
+ ECHO "Building the odeint docs with automatic index generation enabled." ;
+
+ using auto-index ;
+
+ project : requirements
+
+ <auto-index>on
+ <auto-index-verbose>on
+
+ # Choose indexing method (separately for html and pdf):
+ <format>html:<auto-index-internal>on # on (or off) to use internally generated indexes.
+ # <format>html:<xsl:param>generate.index=0 # Don't let the XSL stylesheets generate indexes.
+
+ <format>pdf:<auto-index-internal>off # on (or off) to use internally generated indexes.
+ # <auto-index-type>index # Use <index>...</index> as the XML wrapper.
+
+ <format>pdf:<xsl:param>index.on.type=1 # For the native stylesheets to generate the different indexes.
+ # PDF native index support is probably better for PDFs as then you actually get page numbers.
+
+ <auto-index-script>odeint.idx # Specifies the name of the index script to load.
+ <auto-index-prefix>../../../..
+
+ # Inform Quickbook that there is to be an index(es).
+ <quickbook-define>enable_index
+ ;
+}
+else
+{
+ ECHO "Building the odeint docs with automatic index generation disabled. To get an auto-index, try building with --enable-index." ;
+}
+
+
+
+doxygen reference
+ :
+# [ glob ../../../../boost/numeric/odeint/*.hpp ]
+ [ glob ../../../../boost/numeric/odeint/stepper/*.hpp ]
+ [ glob ../../../../boost/numeric/odeint/stepper/base/*.hpp ]
+# [ glob ../../../../boost/numeric/odeint/stepper/generation/*.hpp ]
+# [ glob ../../../../boost/numeric/odeint/integrate/*.hpp ]
+# [ glob ../../../../boost/numeric/odeint/iterator/*.hpp ]
+# [ glob ../../../../boost/numeric/odeint/algebra/*.hpp ]
+# [ glob ../../../../boost/numeric/odeint/util/*.hpp ]
+# ../../../../boost/numeric/odeint.hpp
+ :
+
+ # Lots of parameters passed to Doxygen. You can see these in the doxygen docs, or the Wizard Expert tab displays them.
+ # If you have successfuly built your Doxygen docs standalone using the Wizard (strongly recommended as it is much quicker).
+ # The values in your project's doxyfile are what to put as the Doxygen parameters passed below.
+ <doxygen:param>WARNINGS=YES
+ <doxygen:param>WARN_LOGFILE=AutoDoxywarnings.log
+ <doxygen:param>WARN_IF_UNDOCUMENTED=NO # Default NO but useful if you aim to Doxygen document *all* members.
+ <doxygen:param>QUIET=NO
+ <doxygen:param>WARN_NO_PARAMDOC=NO # Default no, but YES useful if you aim to document all function parameters.
+ <doxygen:param>DOXYFILE_ENCODING=UTF-8
+ <doxygen:param>PROJECT_NAME="odeint"
+ <doxygen:param>PROJECT_NUMBER=2.2
+ <doxygen:param>TAB_SIZE=2
+ <doxygen:param>SORT_MEMBER_DOCS=NO
+ <doxygen:param>SORT_BRIEF_DOCS=NO
+ <doxygen:param>SORT_MEMBERS_CTORS_1ST=NO
+ <doxygen:param>EXTRACT_PRIVATE=NO
+ <doxygen:param>INLINE_INHERITED_MEMB=YES
+ <doxygen:param>INHERIT_DOCS=YES
+ <doxygen:param>EXTRACT_STATIC=YES
+ <doxygen:param>EXTRACT_ANON_NSPACES=NO
+ <doxygen:param>EXTRACT_LOCAL_CLASSES=YES
+ <doxygen:param>EXTRACT_LOCAL_METHODS=YES
+ <doxygen:param>HIDE_UNDOC_MEMBERS=NO
+ <doxygen:param>HIDE_UNDOC_CLASSES=YES
+ <doxygen:param>HIDE_FRIEND_COMPOUNDS=NO
+ #<doxygen:param>HIDE_INBODY_DOCS=NO
+ <doxygen:param>INTERNAL_DOCS=YES
+ <doxygen:param>CASE_SENSE_NAMES=NO
+ <doxygen:param>HIDE_SCOPE_NAMES=NO
+
+ # Preprocessor settings.
+ # Some ugly examples of predefined macro calls (from Boost.Units library) :(
+ <doxygen:param>"PREDEFINED= \\
+ \"BOOST_UNITS_STATIC_CONSTANT(a,b)=static const b a\" \\
+ \"BOOST_UNITS_TYPEOF(a)=typeof(a)\" \\
+ \"BOOST_PREVENT_MACRO_SUBSTITUTION=\" \\
+ \"BOOST_UNITS_HAS_TYPEOF=1\" \\
+ \"DOXYGEN_SKIP=1\" "
+ <doxygen:param>ENABLE_PREPROCESSING=YES # Evaluates all C-preprocessor directives found in files.
+ <doxygen:param>MACRO_EXPANSION=YES # Will expand all macro names.
+ <doxygen:param>EXPAND_ONLY_PREDEF=YES # Only predefined macros expanded. See units library for an example.
+ <doxygen:param>SEARCH_INCLUDES=YES # Search #include files found.
+ <doxygen:param>INLINE_INFO=YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] is inserted in the documentation for inline members.
+
+ <doxygen:param>SHOW_INCLUDE_FILES=NO # List of the files that are included by a file in the documentation of that file.
+ <doxygen:param>REPEAT_BRIEF=YES # Prepend the brief description of a member or function before the detailed description
+ <doxygen:param>BRIEF_MEMBER_DESC=YES # Include brief member descriptions after the members that are listed in the file and class
+ <doxygen:param>MULTILINE_CPP_IS_BRIEF=YES # Treat a multi-line C++ special comment block (i.e. a block of //! or /// comments) as a brief description.
+ # May be best to always use \brief and \details to avoid ambiguity?
+ # <doxygen:param>STRIP_FROM_PATH=NO # Most useful to leave default to strip just the directory from which Doxygen is run.
+ # Yes gives the full path, but NO is more useful, only giving enough to be
+ # <doxygen:param>CPP_CLI_SUPPORT=NO # unless, most unusually, you are compiled for a 'managed' CLI application.
+ <doxygen:param>SHOW_USED_FILES=YES # Default YES to show a list files used to generate documention.
+ <doxygen:param>SHOW_DIRECTORIES=YES # Default NO, but useful to show directory heirarchy.
+ <doxygen:param>SHOW_FILES=YES # Default YES is to include a tab for a page of files listed. Useful.
+ <doxygen:param>SHOW_NAMESPACES=YES # Default YES to include tab for list of namespaces. Useful if you have namespacess other than boost::
+ <doxygen:param>FILE_PATTERNS= # Types of files to be used as input. Default includes *.c *.cc *.cxx *.cpp *.c++ *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp *.h++ *.py
+ # Might include .qbk?
+
+ <doxygen:param>RECURSIVE=YES # Search recursively down subdirectories.
+ <doxygen:param>EXCLUDE= # Files or directories that should be excluded from INPUT source files.
+ # Headers and footers are actually rather attractive,
+ # <doxygen:param>HTML_HEADER="doxygen/checks_doxygen_header.html" # A sample including a draft stamp and 'Not_Yet_In_Boost' logo.
+ # Take care that if you use this (recommended), you need to ensure that the html
+ # <doxygen:param>HTML_FOOTER="doxygen/checks_doxygen_footer.html" # This is very useful to add copyright, date of revision, versioning etc.
+
+ # A custom stylesheet is also useful, as the default syntax coloring is 'unusual' ;-)
+ <doxygen:param>HTML_STYLESHEET="doxygen/doxygen.css" # Placed in the doxygen directory,
+ # this will change to your choice of C++ syntax coloring when viewing source from Doxygen.
+ # Users can place (or edit) their own personal choice CSS file here.
+
+ # Default is just Reference but you can provide your own title for reference section here.
+ <xsl:param>"boost.doxygen.reftitle=odeint Reference"
+;
+
+
+xml odeint
+ :
+ odeint.qbk
+ :
+;
+
+boostbook standalone
+ :
+ odeint
+ :
+
+ # Path for links to Boost:
+ #<xsl:param>boost.root=\$(local-boost-root) # Link to Boost logo boost.png
+ # Links are relative and trying to make absolute does NOT work.
+ # And remember that all links MUST (unless in quotes) use backslash, not forward that is trip char.
+
+ <xsl:param>boost.root=../../../.. # OK but link to I:/boost_trunk/boost.png
+
+ # Also control links to admonitions, so need to set separately.
+ #<xsl:param>boost.root=../../../../../../../boost_1_47_0 # OK file:///I:/boost_1_48_0/boost.png
+ # Quickbook [@boost:/boost/units/detail/utility.hpp] should make it relative to xsl parameter boost.root.
+
+ # Path for libraries index:
+ <xsl:param>boost.libraries=../../../../../../../boost_1_47_0/libs/libraries.htm
+ # Use the main Boost stylesheet:
+ <xsl:param>html.stylesheet=./boostbook.css # in /doc folder.
+
+ # Use the your own local Boost stylesheet:
+ # <xsl:param>html.stylesheet=../html/boostbook.css
+
+ # Some general style settings:
+ # see http://docbook.sourceforge.net/release/xsl/current/doc/html/index.html
+ <xsl:param>table.footnote.number.format=1 # Identifies the format used for footnote numbers in tables.
+ <xsl:param>footnote.number.format=1 # Identifies the format used for text footnote numbers.
+
+ # Default to not including the Boost logo in the navbar, when one expressly asks to include the navbar.
+ # Boost jamroot now includes
+ # Default to not include a navbar.
+ #<xsl:param>nav.layout=none # No navigation bar (home, prev, next).
+ # defining creates a runtime error: Global parameter nav.layout already defined
+ #<xsl:param>nav.layout=horizontal # to get a horizontal navigation bar (you probably DO want this).
+
+ <xsl:param>boost.image=Boost # options are: none (no logo), Boost (for boost.png), or your own logo like proposed_for_boost.png
+ <xsl:param>boost.image.src=logo.jpg #
+ <xsl:param>boost.image.width=294 # Width of logo in pixels.
+ <xsl:param>boost.image.height=127 # Height of logo in pixels.
+
+
+ # HTML options:
+ # ------------
+ <xsl:param>navig.graphics=1 # Use graphics not text for navigation.
+ <xsl:param>chunk.section.depth=2 # How far down we chunk nested sections, basically all of them.
+ <xsl:param>chunk.first.sections=1 # Don't put the first section on the same page as the TOC.
+ <xsl:param>toc.section.depth=2 # How far down sections get TOCs.
+ <xsl:param>toc.max.depth=2 # Max depth in each TOC.
+ <xsl:param>generate.section.toc.level=3 # How far down we go with TOCs.
+
+ #<format>html:<xsl:param>admon.graphics.extension=".png" # default type for admonitions (important, warning, note ...)
+ #<format>html:<xsl:param>admon.graphics.path=$(nav-images)/ # path to admonition (warning, note...) image (.png) files.
+
+ # <xsl:param name="draft.watermark.image">http://docbook.sourceforge.net/release/images/draft.png>
+ # but use a local copy of draft.png.
+
+ # PDF Options:
+ # -----------
+ # TOC Generation
+ <xsl:param>fop1.extensions=0 # DISable extensions for FOP version 0.90 and later .
+ <format>pdf:<xsl:param>fop.extensions=0 # DISable extensions for FOP version 0.20.5 and earlier.
+ <format>pdf:<xsl:param>xep.extensions=1 # Use XEP extension- PDF bookmarks, document information and better index processing.
+
+ # No indent on body text:
+ <format>pdf:<xsl:param>body.start.indent=0pt #
+ <format>pdf:<xsl:param>paper.type=A4 # Paper type = A4
+ #
http://xml.resource.org/public/rfc/html/rfc2346.html
+ # Making Postscript and PDF International, J Palme, RFC 2346 recommends
+ # If you are using US letter paper format, ensure that both left and right margins are at least 21 mm (0.8 in).
+ # If you are using A4 paper, ensure that both the top and bottom margins are at least 33 mm (1.3 in).
+ # Margins sizes:
+ #<format>pdf:<xsl:param>page.margin.top=1.3in
+ #<format>pdf:<xsl:param>page.margin.inner=0.8in
+ #<format>pdf:<xsl:param>page.margin.bottom=1.3in
+ #<format>pdf:<xsl:param>page.margin.outer=0.8in
+
+ # http://docbook.sourceforge.net/release/xsl/current/doc/index.html
+ # DocBook XSL Stylesheets: Reference Documentation.
+
+ # Yes, we want graphics for admonishments:
+ <xsl:param>admon.graphics=1
+ # Set these one for PDF generation *only*:
+ # In PDF format, default PNG graphics are awful, so better use SVG images (type .svg) instead.
+ <format>pdf:<xsl:param>admon.graphics.extension=".svg" #
+ <format>pdf:<xsl:param>use.role.for.mediaobject=1 # Use print role on next line.
+ <format>pdf:<xsl:param>preferred.mediaobject.role=print # pdf role is to be printed.
+ <format>pdf:<xsl:param>img.src.path=$(images_location)/ # Path of image (.svg) files. (Note trailing /) ?
+ <format>pdf:<xsl:param>admon.graphics.path=$(nav_images)/ # path to admonition (warning, note...) image (.svg) files.
+ <format>pdf:<xsl:param>draft.mode="yes" # Yes if draft watermark wanted!
+ #<format>pdf:<xsl:param>draft.watermark.image="draft.png" # Watermark (local copy).
+ #<format>pdf:<xsl:param>draft.watermark.image=http://docbook.sourceforge.net/release/images/draft.png # Watermark.
+
+ <dependency>reference # Doxygen reference section
+ # <dependency>pdf-install # final pdf
+ # <dependency>png-install # Boost standard icons in both png
+ # <dependency>svg-install # and svg.
+;
+
+
+# To install a copy of 'master' boostbook.css and logo.
+# install html : ../../../doc/html/boostbook.css ;
+# install ../ : ../../../boost.png ;
+
+
+
+# Install (copy) the 'master' copy of boostbook Cascading Style sheet
+# from your current Boost-root to the /doc/html folder.
+# path-constant boost-root : [ modules.peek : BOOST ] ;
+# install css-install : $(boost-root)/doc/src/boostbook.css : <location>html ;
+
+# path-constant boost-root : [ modules.peek : BOOST ] ;
+
+
+# Install (copy) the 'master' copies of all icon images (both PNG and SVG)
+# and the Boost logo from your current Boost-root
+# to the local /doc/html/images folder so that html is complete and standalone.
+# install png-install : [ glob $(boost-root)/doc/src/images/*.png $(boost-root)/boost.png ] : <location>html/images ;
+# install svg-install : [ glob $(boost-root)/doc/src/images/*.svg ] : <location>html/images ;
+
+# install unordered_pdf : standalone/<format>pdf : <location>. ;
+# explicit unordered_pdf ;
+# The explicit rule is there so that it's only installed when the target is explicitly named.
+
+# Effectively copies the file from \bin folder to the \doc folder.
+# install pdf-install : standalone : <location>. <install-type>PDF ;
+# But will not work as expected if doxygen and/or autoindex is used
+# because a modified pdf file is created, so this command below
+# will rename the file to the expected filename, here quick_auto_dox_index.pdf.
+# <location>. means installed in same place as this jamfile, /doc.
+
+install pdf-install : standalone : <install-type>PDF <location>. <name>checks.pdf ;
+
+install callouts : [ glob src/images/callouts/*.png ] : <location>html/images/callouts ;
+
+
+
+
+

Added: trunk/libs/numeric/odeint/doc/acknowledgements.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/numeric/odeint/doc/acknowledgements.qbk 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,37 @@
+[/============================================================================
+ Boost.odeint
+
+ Copyright (c) 2009-2012 Karsten Ahnert
+ Copyright (c) 2009-2012 Mario Mulansky
+
+ Use, modification and distribution is subject to 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)
+=============================================================================/]
+
+
+[section Acknowledgments]
+
+
+[/
+
+* Steven Watanabe for managing the Boost review process.
+* All people who participated in the odeint review process on the Boost mailing list.
+* Paul Bristow for helping with the documentation.
+* The Google Summer Of Code (GSOC) program for funding and Andrew Sutton for supervising us during the GSOC and for lots of useful discussions and feedback about many implementation details..
+* Joachim Faulhaber for motivating us to participate in the Boost review process and many detailed comments about the library.
+* All users of odeint. They are the main motivation for our efforts.
+
+
+[h3 Contributers]
+
+* Andreas Angelopoulos implemented the sparse matrix implicit Euler stepper using the MTL4 library.
+* Rajeev Singh implemented the stiff Van der Pol oscillator example.
+* Sylwester Arabas improved the documentation.
+* Denis Demidov provided the adaption to the VexCL and Viennacl libraries.
+* Christoph Koke provided improved binders.
+* Lee Hodgkinson provided the black hole example.
+]
+
+
+[endsect]

Added: trunk/libs/numeric/odeint/doc/concepts.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/numeric/odeint/doc/concepts.qbk 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,26 @@
+[/============================================================================
+ Boost.odeint
+
+ Copyright (c) 2009-2012 Karsten Ahnert
+ Copyright (c) 2009-2012 Mario Mulansky
+
+ Use, modification and distribution is subject to 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)
+=============================================================================/]
+
+
+[section:concepts Concepts]
+[# odeint.concepts]
+
+[include concepts/system.qbk]
+[include concepts/symplectic_system.qbk]
+[include concepts/implicit_system.qbk]
+[include concepts/stepper.qbk]
+[include concepts/error_stepper.qbk]
+[include concepts/controlled_stepper.qbk]
+[include concepts/dense_output_stepper.qbk]
+[include concepts/state_algebra_operations.qbk]
+[include concepts/state_wrapper.qbk]
+
+[endsect]
\ No newline at end of file

Added: trunk/libs/numeric/odeint/doc/concepts/controlled_stepper.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/numeric/odeint/doc/concepts/controlled_stepper.qbk 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,74 @@
+[/============================================================================
+ Boost.odeint
+
+ Copyright (c) 2009-2012 Karsten Ahnert
+ Copyright (c) 2009-2012 Mario Mulansky
+
+ Use, modification and distribution is subject to 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)
+=============================================================================/]
+
+
+[section Controlled Stepper]
+
+This concept specifies the interface a controlled stepper has to fulfill to be used within __integrate_functions.
+
+[heading Description]
+
+A controlled stepper following this Controlled Stepper concept provides the possibility to perform one step of the solution /x(t)/ of an ODE with step-size /dt/ to obtain /x(t+dt)/ with a given step-size /dt/.
+Depending on an error estimate of the solution the step might be rejected and a smaller step-size is suggested.
+
+[heading Associated types]
+
+* '''<para>'''[*state_type]'''</para>'''
+'''<para>'''`Stepper::state_type`'''</para>'''
+'''<para>'''The type characterizing the state of the ODE, hence ['x].'''</para>'''
+
+* '''<para>'''[*deriv_type]'''</para>'''
+'''<para>'''`Stepper::deriv_type`'''</para>'''
+'''<para>'''The type characterizing the derivative of the ODE, hence ['d x/dt].'''</para>'''
+
+* '''<para>'''[*time_type]'''</para>'''
+'''<para>'''`Stepper::time_type`'''</para>'''
+'''<para>'''The type characterizing the dependent variable of the ODE, hence the time ['t].'''</para>'''
+
+* '''<para>'''[*value_type]'''</para>'''
+'''<para>'''`Stepper::value_type`'''</para>'''
+'''<para>'''The numerical data type which is used within the stepper, something like `float`, `double`, `complex&lt; double &gt;`.'''</para>'''
+
+* '''<para>'''[*stepper_category]'''</para>'''
+'''<para>'''`Stepper::stepper_category`'''</para>'''
+'''<para>'''A tag type characterizing the category of the stepper. This type must be convertible to `controlled_stepper_tag`.'''</para>'''
+
+
+
+[heading Notation]
+
+[variablelist
+ [[`ControlledStepper`] [A type that is a model of Controlled Stepper]]
+ [[`State`] [A type representing the state /x/ of the ODE]]
+ [[`Time`] [A type representing the time /t/ of the ODE]]
+ [[`stepper`] [An object of type `ControlledStepper`]]
+ [[`x`] [Object of type `State`]]
+ [[`t`, `dt`] [Objects of type `Time`]]
+ [[`sys`] [An object defining the ODE, should be a model of __system, __symplectic_system, __simple_symplectic_system or __implicit_system.]]
+]
+
+[heading Valid Expressions]
+
+[table
+ [[Name] [Expression] [Type] [Semantics]]
+ [[Do step] [``stepper.try_step( sys , x , t , dt )``] [`controlled_step_result`] [Tries one step of step size `dt`. If the step was successful, `success` is returned, the resulting state is written to `x`, the new time is stored in `t` and `dt` now contains a new (possibly larger) step-size for the next step. If the error was too big, `rejected` is returned and the results are neglected - `x` and `t` are unchanged and `dt` now contains a reduced step-size to be used for the next try.] ]
+ [/ [Do step with reference] [`stepper.try_step( boost::ref(sys) , x , t , dt )`] [`void`] [Same as above with `System` as reference] ]
+]
+
+[heading Models]
+
+* `controlled_error_stepper< runge_kutta_cash_karp54 >`
+* `controlled_error_stepper_fsal< runge_kutta_dopri5 >`
+* `controlled_error_stepper< runge_kutta_fehlberg78 >`
+* `rosenbrock4_controller`
+* `bulirsch_stoer`
+
+[endsect]
\ No newline at end of file

Added: trunk/libs/numeric/odeint/doc/concepts/dense_output_stepper.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/numeric/odeint/doc/concepts/dense_output_stepper.qbk 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,81 @@
+[/============================================================================
+ Boost.odeint
+
+ Copyright (c) 2009-2012 Karsten Ahnert
+ Copyright (c) 2009-2012 Mario Mulansky
+
+ Use, modification and distribution is subject to 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)
+=============================================================================/]
+
+
+
+[section Dense Output Stepper]
+
+This concept specifies the interface a dense output stepper has to fulfill to be used within __integrate_functions.
+
+[heading Description]
+A dense output stepper following this Dense Output Stepper concept provides the possibility to perform a single step of the solution /x(t)/ of an ODE to obtain /x(t+dt)/.
+The step-size `dt` might be adjusted automatically due to error control.
+Dense output steppers also can interpolate the solution to calculate the state /x(t')/ at any point /t <= t' <= t+dt/.
+
+[heading Associated types]
+
+* '''<para>'''[*state_type]'''</para>'''
+'''<para>'''`Stepper::state_type`'''</para>'''
+'''<para>'''The type characterizing the state of the ODE, hence ['x].'''</para>'''
+
+* '''<para>'''[*deriv_type]'''</para>'''
+'''<para>'''`Stepper::deriv_type`'''</para>'''
+'''<para>'''The type characterizing the derivative of the ODE, hence ['d x/dt].'''</para>'''
+
+* '''<para>'''[*time_type]'''</para>'''
+'''<para>'''`Stepper::time_type`'''</para>'''
+'''<para>'''The type characterizing the dependent variable of the ODE, hence the time ['t].'''</para>'''
+
+* '''<para>'''[*value_type]'''</para>'''
+'''<para>'''`Stepper::value_type`'''</para>'''
+'''<para>'''The numerical data type which is used within the stepper, something like `float`, `double`, `complex&lt; double &gt;`.'''</para>'''
+
+* '''<para>'''[*stepper_category]'''</para>'''
+'''<para>'''`Stepper::stepper_category`'''</para>'''
+'''<para>'''A tag type characterizing the category of the stepper. This type must be convertible to `dense_output_stepper_tag`.'''</para>'''
+
+
+[heading Notation]
+
+[variablelist
+ [[`Stepper`] [A type that is a model of Dense Output Stepper]]
+ [[`State`] [A type representing the state /x/ of the ODE]]
+ [[`stepper`] [An object of type `Stepper`]]
+ [[`x0`, `x`] [Object of type `State`]]
+ [[`t0`, `dt0`, `t`] [Objects of type `Stepper::time_type`]]
+ [[`sys`] [An object defining the ODE, should be a model of __system, __symplectic_system, __simple_symplectic_system or __implicit_system.]]
+]
+
+[heading Valid Expressions]
+
+[table
+ [[Name] [Expression] [Type] [Semantics]]
+
+ [[Initialize integration] [`stepper.initialize( x0 , t0 , dt0 )`] [void] [Initializes the stepper with initial values `x0`, `t0` and `dt0`.]]
+
+ [[Do step] [`stepper.do_step( sys )`] [`std::pair< Stepper::time_type , Stepper::time_type >`] [Performs one step using the ODE defined by `sys`. The step-size might be changed internally due to error control. This function returns a pair containing `t` and `t+dt` representing the interval for which interpolation can be performed.] ]
+
+ [/ [Do step with reference] [`stepper.do_step( boost::ref( sys ) )`] [`std::pair< Stepper::time_type , Stepper::time_type >`] [Same as above with `System` as reference] ]
+
+ [[Do interpolation] [`stepper.calc_state( t_inter , x )`] [`void`] [Performs the interpolation to calculate /x(t[sub inter]/) where /t <= t[sub inter] <= t+dt/.]]
+
+ [[Get current time] [`stepper.current_time()`] [`const Stepper::time_type&`] [Returns the current time /t+dt/ of the stepper, that is the end time of the last step and the starting time for the next call of `do_step`]]
+
+ [[Get current state] [`stepper.current_state()`] [`const Stepper::state_type&`] [Returns the current state of the stepper, that is /x(t+dt)/, the state at the time returned by `stepper.current_time()`]]
+]
+
+[heading Models]
+
+* `dense_output_controlled_explicit_fsal< controlled_error_stepper_fsal< runge_kutta_dopri5 >`
+* `bulirsch_stoer_dense_out`
+* `rosenbrock4_dense_output`
+
+[endsect]
\ No newline at end of file

Added: trunk/libs/numeric/odeint/doc/concepts/error_stepper.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/numeric/odeint/doc/concepts/error_stepper.qbk 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,100 @@
+[/============================================================================
+ Boost.odeint
+
+ Copyright (c) 2009-2012 Karsten Ahnert
+ Copyright (c) 2009-2012 Mario Mulansky
+
+ Use, modification and distribution is subject to 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)
+=============================================================================/]
+
+
+
+[section Error Stepper]
+
+This concepts specifies the interface an error stepper has to fulfill to be used within a ControlledErrorStepper. An error stepper must always fullfil the stepper concept. This can trivially implemented by
+
+``
+template< class System >
+error_stepper::do_step( System sys , state_type &x , time_type t , time_type dt )
+{
+ state_type xerr;
+ // allocate xerr
+ do_step( sys , x , t , dt , xerr );
+}
+``
+
+[heading Description]
+
+An error stepper following this Error Stepper concept is capable of doing one step of the solution /x(t)/ of an ODE with step-size /dt/ to obtain /x(t+dt)/ and also computing an error estimate ['x[sub err]] of the result.
+Error Steppers can be Runge-Kutta steppers, symplectic steppers as well as implicit steppers.
+Based on the stepper type, the ODE is defined as __system, __symplectic_system, __simple_symplectic_system or __implicit_system.
+
+[heading Refinement of]
+
+* DefaultConstructable
+* CopyConstructable
+* Stepper
+
+[heading Associated types]
+
+* '''<para>'''[*state_type]'''</para>'''
+'''<para>'''`Stepper::state_type`'''</para>'''
+'''<para>'''The type characterizing the state of the ODE, hence ['x].'''</para>'''
+
+* '''<para>'''[*deriv_type]'''</para>'''
+'''<para>'''`Stepper::deriv_type`'''</para>'''
+'''<para>'''The type characterizing the derivative of the ODE, hence ['d x/dt].'''</para>'''
+
+* '''<para>'''[*time_type]'''</para>'''
+'''<para>'''`Stepper::time_type`'''</para>'''
+'''<para>'''The type characterizing the dependent variable of the ODE, hence the time ['t].'''</para>'''
+
+* '''<para>'''[*value_type]'''</para>'''
+'''<para>'''`Stepper::value_type`'''</para>'''
+'''<para>'''The numerical data type which is used within the stepper, something like `float`, `double`, `complex&lt; double &gt;`.'''</para>'''
+
+* '''<para>'''[*order_type]'''</para>'''
+'''<para>'''`Stepper::order_type`'''</para>'''
+'''<para>'''The type characterizing the order of the ODE, typically `unsigned short`.'''</para>'''
+
+* '''<para>'''[*stepper_category]'''</para>'''
+'''<para>'''`Stepper::stepper_category`'''</para>'''
+'''<para>'''A tag type characterizing the category of the stepper. This type must be convertible to `error_stepper_tag`.'''</para>'''
+
+
+[heading Notation]
+
+[variablelist
+ [[`ErrorStepper`] [A type that is a model of Error Stepper]]
+ [[`State`] [A type representing the state /x/ of the ODE]]
+ [[`Error`] [A type representing the error calculated by the stepper, usually same as `State`]]
+ [[`Time`] [A type representing the time /t/ of the ODE]]
+ [[`stepper`] [An object of type `ErrorStepper`]]
+ [[`x`] [Object of type `State`]]
+ [[`xerr`] [Object of type `Error`]]
+ [[`t`, `dt`] [Objects of type `Time`]]
+ [[`sys`] [An object defining the ODE, should be a model of either __system, __symplectic_system, __simple_symplectic_system or __implicit_system.]]
+]
+
+[heading Valid Expressions]
+
+[table
+ [[Name] [Expression] [Type] [Semantics]]
+ [[Get the stepper order] [`stepper.order()`] [`order_type`] [Returns the order of the stepper for one step without error estimation.]]
+ [[Get the stepper order] [`stepper.stepper_order()`] [`order_type`] [Returns the order of the stepper for one error estimation step which is used for error calculation.]]
+ [[Get the error order] [`stepper.errorr_order()`] [`order_type`] [Returns the order of the error step which is used for error calculation.]]
+ [[Do step] [`stepper.do_step( sys , x , t , dt )`] [`void`] [Performs one step of step size `dt`. The newly obtained state is written in-place to `x`.] ]
+ [[Do step with error estimation] [`stepper.do_step( sys , x , t , dt , xerr )`] [`void`] [Performs one step of step size `dt` with error estimation. The newly obtained state is written in-place to `x` and the estimated error to `xerr`.] ]
+ [/ [Do step with reference] [`stepper.do_step( boost::ref(sys) , x , t , dt , xerr )`] [`void`] [Performs one step of step size `dt`. The newly obtained state is written in-place to `x` and the estimated error to `xerr`.] ]
+]
+
+[heading Models]
+
+* `runge_kutta_cash_karp54`
+* `runge_kutta_dopri5`
+* `runge_kutta_fehlberg78`
+* `rosenbrock4`
+
+[endsect]

Added: trunk/libs/numeric/odeint/doc/concepts/implicit_system.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/numeric/odeint/doc/concepts/implicit_system.qbk 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,43 @@
+[/============================================================================
+ Boost.odeint
+
+ Copyright (c) 2009-2012 Karsten Ahnert
+ Copyright (c) 2009-2012 Mario Mulansky
+
+ Use, modification and distribution is subject to 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)
+=============================================================================/]
+
+
+
+[section Implicit System]
+
+[heading Description]
+
+This concept describes how to define a ODE that can be solved by an implicit routine.
+Implicit routines need not only the function /f(x,t)/ but also the Jacobian /df/dx = A(x,t)/.
+/A/ is a matrix and implicit routines need to solve the linear problem /Ax = b/.
+In odeint this is implemented with use of __ublas, therefore, the ['state_type] implicit routines is ['ublas::vector] and the matrix is defined as ['ublas::matrix].
+
+[heading Notation]
+
+[variablelist
+ [[`System`] [A type that is a model of `Implicit System`]]
+ [[`Time`] [A type representing the time of the ODE]]
+ [[`sys`] [An object of type `System`]]
+ [[`x`] [Object of type ublas::vector]]
+ [[`dxdt`] [Object of type ublas::vector]]
+ [[`jacobi`] [Object of type ublas::matrix]]
+ [[`t`] [Object of type `Time`]]
+]
+
+[heading Valid Expressions]
+
+[table
+ [[Name] [Expression] [Type] [Semantics]]
+ [[Calculate ['dx/dt := f(x,t)]] [`sys.first( x , dxdt , t )`] [`void`] [Calculates `f(x,t)`, the result is stored into dxdt] ]
+ [[Calculate ['A := df/dx (x,t)]] [`sys.second( x , jacobi , t )`] [`void`] [Calculates the Jacobian of /f/ at /x/,/t/, the result is stored into `jacobi`] ]
+]
+
+[endsect]
\ No newline at end of file

Added: trunk/libs/numeric/odeint/doc/concepts/state_algebra_operations.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/numeric/odeint/doc/concepts/state_algebra_operations.qbk 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,123 @@
+[/============================================================================
+ Boost.odeint
+
+ Copyright (c) 2009-2012 Karsten Ahnert
+ Copyright (c) 2009-2012 Mario Mulansky
+
+ Use, modification and distribution is subject to 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)
+=============================================================================/]
+
+
+
+[section State Algebra Operations]
+
+[note The following does not apply to implicit steppers like implicit_euler or Rosenbrock 4 as there the `state_type` can not be changed from `ublas::vector` and no algebra/operations are used.]
+
+[heading Description]
+
+The `State`, `Algebra` and `Operations` together define a concept describing how the mathematical vector operations required for the stepper algorithms are performed.
+The typical vector operation done within steppers is
+
+['*y* = __Sigma __alpha[sub i] [*x[sub i]]].
+
+The `State` represents the state variable of an ODE, usually denoted with /x/.
+Algorithmically, the state is often realized as a `vector< double >` or `array< double , N >`, however, the genericity of odeint enables you to basically use anything as a state type.
+The algorithmic counterpart of such mathematical expressions is divided into two parts.
+First, the `Algebra` is used to account for the vector character of the equation.
+In the case of a `vector` as state type this means the `Algebra` is responsible for iteration over all vector elements.
+Second, the `Operations` are used to represent the actual operation applied to each of the vector elements.
+So the `Algebra` iterates over all elements of the `State`s and calls an operation taken from the `Operations` for each element.
+This is where `State`, `Algebra` and `Operations` have to work together to make odeint running.
+Please have a look at the `range_algebra` and `default_operations` to see an example how this is implemented.
+
+In the following we describe how `State`, `Algebra` and `Operations` are used together within the stepper implementations.
+
+[section Operations]
+
+[heading Notation]
+
+[variablelist
+ [[`Operations`] [The operations type]]
+ [/[`Time`] [A type representing the time type of steppers]]
+ [[`Value1`, ... , `ValueN`] [Types representing the value or time type of stepper]]
+ [[`Scale`] [Type of the scale operation]]
+ [[`scale`] [Object of type `Scale`]]
+ [[[^ScaleSum['N]]] [Type that represents a general scale_sum operation, [^/N/] should be replaced by a number from 1 to 14.]]
+ [[[^scale_sum['N]]] [Object of type [^ScaleSum['N]], [^/N/] should be replaced by a number from 1 to 14.]]
+ [[`ScaleSumSwap2`] [Type of the scale sum swap operation]]
+ [[`scale_sum_swap2`] [Object of type `ScaleSumSwap2`]]
+ [[`a1, a2, ...`] [Objects of type `Value1`, `Value2`, ...]]
+ [[`y, x1, x2, ...`] [Objects of `State`'s value type]]
+]
+
+[heading Valid Expressions]
+
+[table
+ [[Name] [Expression] [Type] [Semantics]]
+ [[Get scale operation] [`Operations::scale< Value >`] [`Scale`] [Get `Scale` from `Operations`]]
+ [[`Scale` constructor] [`Scale< Value >( a )`] [`Scale`] [Constructs a `Scale` object]]
+ [[`Scale` operation] [`scale( x )`] [`void`] [Calculates `x *= a`]]
+ [[Get general `scale_sum` operation] [[^Operations::scale_sum['N]< Value1 , ... , ValueN >]] [[^ScaleSum['N]]] [Get the [^ScaleSum['N]] type from `Operations`, [^/N/] should be replaced by a number from 1 to 14.]]
+ [[`scale_sum` constructor] [[^ScaleSum['N]< Value1 , ... , ValueN >( a1 , ... , aN )]] [[^ScaleSum['N]]] [Constructs a `scale_sum` object given [^/N/] parameter values with [^/N/] between 1 and 14.]]
+ [[`scale_sum` operation] [[^scale_sum['N]( y , x1 , ... , xN )]] [`void`] [Calculates `y = a1*x1 + a2*x2 + ... + aN*xN`. Note that this is an [^/N/+1]-ary function call.]]
+ [[Get scale sum swap operation] [`Operations::scale_sum_swap2< Value1 , Value2 >`] [`ScaleSumSwap2`] [Get scale sum swap from operations]]
+ [[`ScaleSumSwap2` constructor] [`ScaleSumSwap2< Value1 , Value2 >( a1 , a2 )`] [`ScaleSumSwap2`] [Constructor]]
+ [[`ScaleSumSwap2` operation] [`scale_sum_swap2( x1 , x2 , x3 )`] [`void`] [Calculates `tmp = x1`, `x1 = a1*x2 + a2*x3` and `x2 = tmp`.]]
+]
+
+[endsect]
+
+[section Algebra]
+
+[heading Notation]
+
+[variablelist
+ [[`State`] [The state type]]
+ [[`Algebra`] [The algebra type]]
+ [[[^Operation['N]]] [An [^/N/]-ary operation type, [^/N/] should be a number from 1 to 14.]]
+ [[`algebra`] [Object of type `Algebra`]]
+ [[[^operation['N]]] [Object of type [^Operation['N]]]]
+ [[`y, x1, x2, ...`] [Objects of type `State`]]
+]
+
+
+[heading Valid Expressions]
+
+[table
+ [[Name] [Expression] [Type] [Semantics]]
+ [[Vector Operation with arity 2] [`algebra.for_each2( y , x , operation2 )`] [void] [Calls `operation2( y_i , x_i )` for each element `y_i` of `y` and `x_i` of `x`.]]
+ [[Vector Operation with arity 3] [`algebra.for_each3( y , x1 , x2 , operation3 )`] [void] [Calls `operation3( y_i , x1_i , x2_i )` for each element `y_i` of `y` and `x1_i` of `x1` and `x2_i` of `x2`.]]
+ [[Vector Operation with arity [^/N/]] [[^algebra.for_each['N]( y , x1 , ... , xN , operation['N] )]] [void] [Calls [^operation['N]( y_i , x1_i , ... , xN_i )] for each element `y_i` of `y` and `x1_i` of `x1` and so on. [^/N/] should be replaced by a number between 1 and 14.]]
+]
+
+[endsect]
+
+[section Pre-Defined implementations]
+
+As standard configuration odeint uses the `range_algebra` and `default_operations` which suffices most situations.
+However, a few more possibilities exist either to gain better performance or to ensure interoperability with other libraries.
+In the following we list the existing `Algebra`/`Operations` configurations that can be used in the steppers.
+
+[table
+ [[`State`] [`Algebra`] [`Operations`] [Remarks]]
+ [[Anything supporting __boost_range, like `std::vector`, `std::list`, `boost::array`,... based on a `value_type` that supports operators +,* (typically `double`)] [`range_algebra`] [`default_operations`] [Standard implementation, applicable for most typical situations.]]
+ [[`boost::array` based on a `value_type` that supports operators +,*] [`array_algebra`] [`default_operations`] [Special implementation for boost::array with better performance than `range_algebra`]]
+ [[Anything that defines operators + within itself and * with scalar (Mathematically spoken, anything that is a vector space).] [`vector_space_algebra`] [`default_operations`] [For the use of __controlled_stepper, the template `vector_space_reduce` has to be instantiated.]]
+ [[`thrust::device_vector`, `thrust::host_vector`] [`thrust_algebra`] [`thrust_operations`] [For running odeint on CUDA devices by using __thrust]]
+ [[`boost::array` or anything which allocates the elements in a C-like manner] [`vector_space_algebra`] [`mkl_operations`] [Using the __intel_mkl in odeint for maximum performance. Currently, only the RK4 stepper is supported.]]
+]
+
+[endsect]
+
+[section Example expressions]
+
+[table
+ [[Name] [Expression] [Type] [Semantics]]
+ [[Vector operation] [`algebra.for_each3( y , x1 , x2 , Operations::scale_sum2< Value1 , Value2 >( a1 , a2 ) )`] [void] [Calculates ['*y* = a1 *x1* + a2 *x2*]]]
+]
+
+[endsect]
+
+[endsect]
\ No newline at end of file

Added: trunk/libs/numeric/odeint/doc/concepts/state_wrapper.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/numeric/odeint/doc/concepts/state_wrapper.qbk 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,39 @@
+[/============================================================================
+ Boost.odeint
+
+ Copyright (c) 2009-2012 Karsten Ahnert
+ Copyright (c) 2009-2012 Mario Mulansky
+
+ Use, modification and distribution is subject to 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)
+=============================================================================/]
+
+
+[section State Wrapper]
+
+[heading Description]
+
+The `State Wrapper` concept describes the way odeint creates temporary state objects to store intermediate results within the stepper's `do_step` methods.
+
+[heading Notation]
+
+[variablelist
+ [[`State`] [A type that is the `state_type` of the ODE]]
+ [[`WrappedState`] [A type that is a model of State Wrapper for the state type `State`.]]
+ [[`x`] [Object of type `State`]]
+ [[`w`] [Object of type `WrappedState`]]
+]
+
+[heading Valid Expressions]
+
+[table
+ [[Name] [Expression] [Type] [Semantics]]
+ [[Get resizeability] [`is_resizeable< State >`] [`boost::false_type` or `boost::true_type`] [Returns `boost::true_type` if the `State` is resizeable, `boost::false_type` otherwise.]]
+ [[Create `WrappedState` type] [`state_wrapper< State >`] [`WrappedState`] [Creates the type for a `WrappedState` for the state type `State`]]
+ [[Constructor] [`WrappedState()`] [`WrappedState`] [Constructs a state wrapper with an empty state]]
+ [[Copy Constructor] [`WrappedState( w )`] [`WrappedState`] [Constructs a state wrapper with a state of the same size as the state in `w`]]
+ [[Get state] [`w.m_v`] [`State`] [Returns the `State` object of this state wrapper.]]
+]
+
+[endsect]
\ No newline at end of file

Added: trunk/libs/numeric/odeint/doc/concepts/stepper.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/numeric/odeint/doc/concepts/stepper.qbk 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,92 @@
+[/============================================================================
+ Boost.odeint
+
+ Copyright (c) 2009-2012 Karsten Ahnert
+ Copyright (c) 2009-2012 Mario Mulansky
+
+ Use, modification and distribution is subject to 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)
+=============================================================================/]
+
+
+[section Stepper]
+
+This concepts specifies the interface a simple stepper has to fulfill to be used within the __integrate_functions.
+
+[heading Description]
+
+The basic stepper concept.
+A basic stepper following this Stepper concept is able to perform a single step of the solution /x(t)/ of an ODE to obtain /x(t+dt)/ using a given step size /dt/.
+Basic steppers can be Runge-Kutta steppers, symplectic steppers as well as implicit steppers.
+Depending on the actual stepper, the ODE is defined as __system, __symplectic_system, __simple_symplectic_system or __implicit_system.
+Note that all error steppers are also basic steppers.
+
+[heading Refinement of]
+
+* DefaultConstructable
+* CopyConstructable
+
+
+[heading Associated types]
+
+* '''<para>'''[*state_type]'''</para>'''
+'''<para>'''`Stepper::state_type`'''</para>'''
+'''<para>'''The type characterizing the state of the ODE, hence ['x].'''</para>'''
+
+* '''<para>'''[*deriv_type]'''</para>'''
+'''<para>'''`Stepper::deriv_type`'''</para>'''
+'''<para>'''The type characterizing the derivative of the ODE, hence ['d x/dt].'''</para>'''
+
+* '''<para>'''[*time_type]'''</para>'''
+'''<para>'''`Stepper::time_type`'''</para>'''
+'''<para>'''The type characterizing the dependent variable of the ODE, hence the time ['t].'''</para>'''
+
+* '''<para>'''[*value_type]'''</para>'''
+'''<para>'''`Stepper::value_type`'''</para>'''
+'''<para>'''The numerical data type which is used within the stepper, something like `float`, `double`, `complex&lt; double &gt;`.'''</para>'''
+
+* '''<para>'''[*order_type]'''</para>'''
+'''<para>'''`Stepper::order_type`'''</para>'''
+'''<para>'''The type characterizing the order of the ODE, typically `unsigned short`.'''</para>'''
+
+* '''<para>'''[*stepper_category]'''</para>'''
+'''<para>'''`Stepper::stepper_category`'''</para>'''
+'''<para>'''A tag type characterizing the category of the stepper. This type must be convertible to `stepper_tag`.'''</para>'''
+
+
+[heading Notation]
+
+[variablelist
+ [[`Stepper`] [A type that is a model of Stepper]]
+ [[`State`] [A type representing the state /x/ of the ODE]]
+ [[`Time`] [A type representing the time /t/ of the ODE]]
+ [[`stepper`] [An object of type `Stepper`]]
+ [[`x`] [Object of type `State`]]
+ [[`t`, `dt`] [Objects of type `Time`]]
+ [[`sys`] [An object defining the ODE. Depending on the Stepper this might be a model of __system, __symplectic_system, __simple_symplectic_system or __implicit_system ]]
+]
+
+[heading Valid Expressions]
+
+[table
+ [[Name] [Expression] [Type] [Semantics]]
+ [[Get the order] [`stepper.order()`] [`order_type`] [Returns the order of the stepper.]]
+ [[Do step] [`stepper.do_step( sys , x , t , dt )`] [`void`] [Performs one step of step size `dt`. The newly obtained state is written in place in `x`.] ]
+
+ [/ [Do step with reference] [`stepper.do_step( boost::ref(sys) , x , t , dt )`] [`void`] [Performs one step of step size `dt`. The newly obtained state is written in place in `x`.] ]
+
+ [/ [Do step out-of-place] [`stepper.do_step( sys , in , t , out , dt )`] [`void`] [Performs one step. The newly obtained state is written to `out`] ]
+]
+
+[heading Models]
+
+* `runge_kutta4`
+* `euler`
+* `runge_kutta_cash_karp54`
+* `runge_kutta_dopri5`
+* `runge_kutta_fehlberg78`
+* `modified_midpoint`
+* `rosenbrock4`
+
+[endsect]

Added: trunk/libs/numeric/odeint/doc/concepts/symplectic_system.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/numeric/odeint/doc/concepts/symplectic_system.qbk 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,99 @@
+[/============================================================================
+ Boost.odeint
+
+ Copyright (c) 2009-2012 Karsten Ahnert
+ Copyright (c) 2009-2012 Mario Mulansky
+
+ Use, modification and distribution is subject to 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)
+=============================================================================/]
+
+
+[section Symplectic System]
+
+[heading Description]
+
+This concept describes how to define a symplectic system written with generalized coordinate `q` and generalized momentum `p`:
+
+[' q'(t) = f(p) ]
+
+[' p'(t) = g(q) ]
+
+Such a situation is typically found for Hamiltonian systems with a separable Hamiltonian:
+
+[' H(p,q) = H[sub kin](p) + V(q) ]
+
+which gives the equations of motion:
+
+[' q'(t) = dH[sub kin] / dp = f(p) ]
+
+[' p'(t) = dV / dq = g(q) ]
+
+
+The algorithmic implementation of this situation is described by a pair of callable objects for /f/ and /g/ with a specific parameter signature.
+Such a system should be implemented as a std::pair of functions or a functors.
+Symplectic systems are used in symplectic steppers like `symplectic_rkn_sb3a_mclachlan`.
+
+[heading Notation]
+
+[variablelist
+ [[`System`] [A type that is a model of SymplecticSystem]]
+ [[`Coor`] [The type of the coordinate ['q]]]
+ [[`Momentum`] [The type of the momentum ['p]]]
+ [[`CoorDeriv`] [The type of the derivative of coordinate ['q']]]
+ [[`MomentumDeriv`] [The type of the derivative of momentum ['p']]]
+ [[`sys`] [An object of the type `System`]]
+ [[`q`] [Object of type Coor]]
+ [[`p`] [Object of type Momentum]]
+ [[`dqdt`] [Object of type CoorDeriv]]
+ [[`dpdt`] [Object of type MomentumDeriv]]
+]
+
+[heading Valid expressions]
+
+[table
+ [[Name] [Expression] [Type] [Semantics]]
+ [[Check for pair] [`boost::is_pair< System >::type`] [`boost::mpl::true_`] [Check if System is a pair]]
+ [[Calculate ['dq/dt = f(p)]] [`sys.first( p , dqdt )`] [`void`] [Calculates ['f(p)], the result is stored into `dqdt`] ]
+ [[Calculate ['dp/dt = g(q)]] [`sys.second( q , dpdt )`] [`void`] [Calculates ['g(q)], the result is stored into `dpdt`] ]
+]
+
+[endsect]
+
+
+[section Simple Symplectic System]
+
+[heading Description]
+
+In most Hamiltonian systems the kinetic term is a quadratic term in the momentum ['H[sub kin] = p^2 / 2m] and in many cases it is possible to rescale coordinates and set /m=1/ which leads to a trivial equation of motion:
+
+[' q'(t) = f(p) = p. ]
+
+while for /p'/ we still have the general form
+
+[' p'(t) = g(q) ]
+
+As this case is very frequent we introduced a concept where only the nontrivial equation for /p'/ has to be provided to the symplectic stepper.
+We call this concept ['SimpleSymplecticSystem]
+
+[heading Notation]
+
+[variablelist
+ [[System] [A type that is a model of SimpleSymplecticSystem]]
+ [[Coor] [The type of the coordinate ['q]]]
+ [[MomentumDeriv] [The type of the derivative of momentum ['p']]]
+ [[sys] [An object that models System]]
+ [[q] [Object of type Coor]]
+ [[dpdt] [Object of type MomentumDeriv]]
+]
+
+[heading Valid Expressions]
+
+[table
+ [[Name] [Expression] [Type] [Semantics]]
+ [[Check for pair] [`boost::is_pair< System >::type`] [`boost::mpl::false_`] [Check if System is a pair, should be evaluated to false in this case.]]
+ [[Calculate ['dp/dt = g(q)]] [`sys( q , dpdt )`] [`void`] [Calculates ['g(q)], the result is stored into `dpdt`] ]
+]
+
+[endsect]
\ No newline at end of file

Added: trunk/libs/numeric/odeint/doc/concepts/system.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/numeric/odeint/doc/concepts/system.qbk 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,43 @@
+[/============================================================================
+ Boost.odeint
+
+ Copyright (c) 2009-2012 Karsten Ahnert
+ Copyright (c) 2009-2012 Mario Mulansky
+
+ Use, modification and distribution is subject to 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)
+=============================================================================/]
+
+
+[section System]
+
+[heading Description]
+
+The System concept models the algorithmic implementation of the rhs. of the ODE ['x' = f(x,t)].
+The only requirement for this concept is that it should be callable with a specific parameter syntax (see below).
+A System is typically implemented as a function or a functor.
+Systems fulfilling this concept are required by all Runge-Kutta steppers as well as the Bulirsch-Stoer steppers.
+However, symplectic and implicit steppers work with other system concepts, see __symplectic_system and __implicit_system.
+
+[heading Notation]
+
+[variablelist
+ [[`System`] [A type that is a model of System]]
+ [[`State`] [A type representing the state /x/ of the ODE]]
+ [[`Deriv`] [A type representing the derivative /x'/ of the ODE]]
+ [[`Time`] [A type representing the time]]
+ [[`sys`] [An object of type `System`]]
+ [[`x`] [Object of type `State`]]
+ [[`dxdt`] [Object of type `Deriv`]]
+ [[`t`] [Object of type `Time`]]
+]
+
+[heading Valid expressions]
+
+[table
+ [[Name] [Expression] [Type] [Semantics]]
+ [[Calculate ['dx/dt := f(x,t)]] [`sys( x , dxdt , t )`] [`void`] [Calculates f(x,t), the result is stored into dxdt] ]
+]
+
+[endsect]
\ No newline at end of file

Added: trunk/libs/numeric/odeint/doc/controlled_stepper_table.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/numeric/odeint/doc/controlled_stepper_table.qbk 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,55 @@
+[/============================================================================
+ Boost.odeint
+
+ Copyright (c) 2009-2012 Karsten Ahnert
+ Copyright (c) 2009-2012 Mario Mulansky
+
+ Use, modification and distribution is subject to 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)
+=============================================================================/]
+
+[table Adaptive step size algorithms
+ [ [Stepper] [Tolerance formula] [Norm] [Step size adaption] ]
+ [ [`controlled_runge_kutta`]
+ [
+ ['val = || | err[subl i] | / ( __epsilon[subl abs] + __epsilon[subl rel] * ( a[subl x] | x[subl i] | + a[subl dxdt] | | dxdt[subl i] | )|| ]
+ ]
+ [['||x|| = max( x[subl i] )]]
+ [
+ ['val > 1 : dt[subl new] = dt[subl current] max( 0.9 pow( val , -1 / ( O[subl E] - 1 ) ) , 0.2 )]
+
+ ['val < 0.5 : dt[subl new] = dt[subl current] min( 0.9 pow( val , -1 / O[subl S] ) , 5 )]
+
+ ['else : dt[subl new] = dt[subl current]]
+ ] ]
+ [ [`rosenbrock4_controller`]
+ [
+ ['val = || err[subl i] / ( __epsilon[subl abs] + __epsilon[subl rel] max( | x[subl i] | , | xold[subl i] | ) ) || ]
+ ]
+ [['||x||=(__Sigma[subl i] x[subl i][super 2])[super 1/2]]]
+ [
+ ['fac = max( 1 / 6 , min( 5 , pow( val , 1 / 4 ) / 0.9 ) ]
+
+ ['fac2 = max( 1 / 6 , min( 5 , dt[subl old] / dt[subl current] pow( val[super 2] / val[subl old] , 1 / 4 ) / 0.9 ) ]
+
+ ['val > 1 : dt[subl new] = dt[subl current] / fac ]
+
+ ['val < 1 : dt[subl new] = dt[subl current] / max( fac , fac2 ) ]
+ ]
+ ]
+ [ [bulirsch_stoer] [['tol=1/2]] [-] [['dt[subl new] = dt[subl old][super 1/a]]] ]
+]
+
+[/
+
+safe = 0.9 , fac1 = 5.0 , fac2 = 1.0 / 6.0
+
+value_type fac_pred = ( m_dt_old / dt ) * pow( err * err / m_err_old , 0.25 ) / safe;
+ fac_pred = std::max( fac2 , std::min( fac1 , fac_pred ) );
+ fac = std::max( fac , fac_pred );
+ dt_new = dt / fac;
+
+
+fac = max( fac2 , min( fac1 , pow( err , 0.25 ) / safe ) )
+]
\ No newline at end of file

Added: trunk/libs/numeric/odeint/doc/details.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/numeric/odeint/doc/details.qbk 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,30 @@
+[/============================================================================
+ Boost.odeint
+
+ Copyright (c) 2009-2012 Karsten Ahnert
+ Copyright (c) 2009-2012 Mario Mulansky
+
+ Use, modification and distribution is subject to 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)
+=============================================================================/]
+
+[section odeint in detail]
+
+[include details_steppers.qbk]
+
+[include details_generation_functions.qbk]
+
+[include details_integrate_functions.qbk]
+
+[include details_iterators.qbk]
+
+[include details_state_types_algebras_operations.qbk]
+
+[include details_boost_ref.qbk]
+
+[include details_boost_range.qbk]
+
+[include details_bind_member_functions.qbk]
+
+[endsect]

Added: trunk/libs/numeric/odeint/doc/details_bind_member_functions.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/numeric/odeint/doc/details_bind_member_functions.qbk 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,36 @@
+[/============================================================================
+ Boost.odeint
+
+ Copyright (c) 2009-2012 Karsten Ahnert
+ Copyright (c) 2009-2012 Mario Mulansky
+
+ Use, modification and distribution is subject to 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)
+=============================================================================/]
+
+
+[section Binding member functions]
+
+[import ../examples/bind_member_functions.cpp]
+
+Binding member functions to a function objects suitable for odeint system function is not easy, at least in C++03. The usual way of using __boost_bind does not work because of the forwarding problem. odeint provides two `do_step` method which only differ in the const specifiers of the arguments and __boost_bind binders only provide the specializations up to two argument which is not enough for odeint.
+
+But one can easily implement the according binders themself:
+
+[ode_wrapper]
+
+One can use this binder as follows
+
+[bind_member_function]
+
+[section Binding member functions in C++11]
+
+[import ../examples/bind_member_functions_cpp11.cpp]
+In C++11 one can use `std::bind` and one does not need to implement the bind themself:
+
+[bind_member_function_cpp11]
+
+[endsect]
+
+[endsect]

Added: trunk/libs/numeric/odeint/doc/details_boost_range.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/numeric/odeint/doc/details_boost_range.qbk 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,60 @@
+[/============================================================================
+ Boost.odeint
+
+ Copyright (c) 2009-2012 Karsten Ahnert
+ Copyright (c) 2009-2012 Mario Mulansky
+
+ Use, modification and distribution is subject to 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)
+=============================================================================/]
+
+[section Using boost::range]
+
+Most steppers in odeint also accept the state give as a range. A range is
+sequence of values modeled by a range concept. See __boost_range for an
+overview over existing concepts and examples of ranges. This means that the
+`state_type` of the stepper need not necessarily be used to call the `do_step` method.
+
+One use-case for __boost_range in odeint has been shown in __tut_chaotic_system where the state consists of two parts: one for the original system and one for the perturbations. The ranges are used to initialize (solve) only the system part where the perturbation part is not touched, that is a range consisting only of the system part is used. After that the complete state including the perturbations is solved.
+
+Another use case is a system consisting of coupled units where you want to initialize each unit separately with the ODE of the uncoupled unit. An example is a chain of coupled van-der-Pol-oscillators which are initialized uniformly from the uncoupled van-der-Pol-oscillator. Then you can use __boost_range to solve only one individual oscillator in the chain.
+
+In short, you can __boost_range to use one state within two system functions which expect states with different sizes.
+
+An example was given in the __tut_chaotic_system tutorial. Using Boost.Range usually means that your system function needs to adapt to the iterators of Boost.Range. That is, your function is called with a range and you need to get the iterators from that range. This can easily be done. You have to implement your system as a class or a struct and you have to templatize the `operator()`. Then you can use the `range_iterator`-meta function and `boost::begin` and `boost::end` to obtain the iterators of your range:
+
+``
+class sys
+{
+ template< class State , class Deriv >
+ void operator()( const State &x_ , Deriv &dxdt_ , double t ) const
+ {
+ typename boost::range_iterator< const State >::type x = boost::begin( x_ );
+ typename boost::range_iterator< Deriv >::type dxdt = boost::begin( dxdt_ );
+
+ // fill dxdt
+ }
+};
+``
+
+If your range is a random access-range you can also apply the bracket operator to the iterator to access the elements in the range:
+``
+class sys
+{
+ template< class State , class Deriv >
+ void operator()( const State &x_ , Deriv &dxdt_ , double t ) const
+ {
+ typename boost::range_iterator< const State >::type x = boost::begin( x_ );
+ typename boost::range_iterator< Deriv >::type dxdt = boost::begin( dxdt_ );
+
+ dxdt[0] = f1( x[0] , x[1] );
+ dxdt[1] = f2( x[0] , x[1] );
+ }
+};
+``
+
+The following two tables show which steppers and which algebras are compatible with __boost_range.
+[include range_table.qbk]
+
+[endsect]

Added: trunk/libs/numeric/odeint/doc/details_boost_ref.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/numeric/odeint/doc/details_boost_ref.qbk 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,35 @@
+[/============================================================================
+ Boost.odeint
+
+ Copyright (c) 2009-2012 Karsten Ahnert
+ Copyright (c) 2009-2012 Mario Mulansky
+
+ Use, modification and distribution is subject to 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)
+=============================================================================/]
+
+[section Using boost::ref]
+
+In odeint all system functions and observers are passed by value. For example, if you call a `do_step` method of a particular stepper or the integration functions, your system and your stepper will be passed by value:
+
+[c++]
+``
+rk4.do_step( sys , x , t , dt ); // pass sys by value
+``
+
+This behavior is suitable for most systems, especially if your system does not contain any data or only a few parameters. However, in some cases you might contain some large amount of data with you system function and passing them by value is not desired since the data would be copied.
+
+In such cases you can easily use `boost::ref` (and its relative `boost::cref`)
+which passes its argument by reference (or constant reference). odeint will
+unpack the arguments and no copying at all of your system object will take place:
+
+``
+rk4.do_step( boost::ref( sys ) , x , t , dt ); // pass sys as references
+``
+
+The same mechanism can be used for the observers in the integrate functions.
+
+[tip If you are using C++11 you can also use `std::ref` and `std::cref`]
+
+[endsect]

Added: trunk/libs/numeric/odeint/doc/details_generation_functions.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/numeric/odeint/doc/details_generation_functions.qbk 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,43 @@
+[/============================================================================
+ Boost.odeint
+
+ Copyright (c) 2009-2012 Karsten Ahnert
+ Copyright (c) 2009-2012 Mario Mulansky
+
+ Use, modification and distribution is subject to 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)
+=============================================================================/]
+
+[section Generation functions]
+
+[import ../examples/generation_functions.cpp]
+
+In the __tutorial we have learned how we can use the generation functions `make_controlled` and `make_dense_output` to create controlled and dense output stepper from a simple stepper or an error stepper. The syntax of these two functions is very simple:
+
+[generation_functions_syntax_auto]
+
+The first two parameters are the absolute and the relative error tolerances and the third parameter is the stepper. In C++03 you can infer the type from the `result_of` mechanism:
+
+[generation_functions_syntax_result_of]
+
+To use your own steppers with the `make_controlled` or `make_dense_output` you need to specialize two class templates. Suppose your steppers are called `custom_stepper`, `custom_controller` and `custom_dense_output`. Then, the first class you need to specialize is `boost::numeric::get_controller`, a meta function returning the type of the controller:
+
+[generation_functions_get_controller]
+
+The second one is a factory class `boost::numeric::odeint::controller_factory` which constructs the controller from the tolerances and the stepper. In our dummy implementation this class is
+
+[generation_functions_controller_factory]
+
+This is all to use the `make_controlled` mechanism. Now you can use your controller via
+
+[generation_functions_example_custom_controller]
+
+For the dense_output_stepper everything works similar. Here you have to specialize `boost::numeric::odeint::get_dense_output` and `boost::numeric::odeint::dense_output_factory`. These two classes have the same syntax as their relatives `get_controller` and `controller_factory`.
+
+All controllers and dense-output steppers in odeint can be used with these mechanisms. In the table below you will find, which steppers is constructed from `make_controlled` or `make_dense_output` if applied on a stepper from odeint:
+
+[include make_controlled_table.qbk]
+[include make_dense_output_table.qbk]
+
+[endsect]

Added: trunk/libs/numeric/odeint/doc/details_integrate_functions.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/numeric/odeint/doc/details_integrate_functions.qbk 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,124 @@
+[/============================================================================
+ Boost.odeint
+
+ Copyright (c) 2009-2012 Karsten Ahnert
+ Copyright (c) 2009-2012 Mario Mulansky
+
+ Use, modification and distribution is subject to 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)
+=============================================================================/]
+
+[section Integrate functions]
+
+Integrate functions perform the time evolution of a given ODE from some
+starting time ['t[sub 0]] to a given end time ['t[sub 1]] and starting at state ['x[sub 0]] by subsequent calls of a given stepper's `do_step` function.
+Additionally, the user can provide an __observer to analyze the state during time evolution.
+There are five different integrate functions which have different strategies on when to call the observer function during integration.
+All of the integrate functions except `integrate_n_steps` can be called with any stepper following one of the stepper concepts: __stepper , __error_stepper , __controlled_stepper , __dense_output_stepper.
+Depending on the abilities of the stepper, the integrate functions make use of step-size control or dense output.
+
+[heading Equidistant observer calls]
+
+If observer calls at equidistant time intervals /dt/ are needed, the
+`integrate_const` or `integrate_n_steps` function should be used.
+We start with explaining `integrate_const`:
+
+`integrate_const( stepper , system , x0 , t0 , t1 , dt )`
+
+`integrate_const( stepper , system , x0 , t0 , t1 , dt , observer )`
+
+These integrate the ODE given by `system` with subsequent steps from `stepper`.
+Integration start at `t0` and `x0` and ends at some ['t' = t[sub 0] + n dt] with /n/ such that ['t[sub 1] - dt < t' <= t[sub 1]].
+`x0` is changed to the approximative solution ['x(t')] at the end of integration.
+If provided, the `observer` is invoked at times ['t[sub 0]], ['t[sub 0] + dt], ['t[sub 0] + 2dt], ... ,['t'].
+`integrate_const` returns the number of steps performed during the integration.
+Note that if you are using a simple __stepper or __error_stepper and want to make exactly `n` steps you should prefer the `integrate_n_steps` function below.
+
+* If `stepper` is a __stepper or __error_stepper then `dt` is also the step size used for integration and the observer is called just after every step.
+* If `stepper` is a __controlled_stepper then `dt` is the initial step size.
+The actual step size will change due to error control during time evolution.
+However, if an observer is provided the step size will be adjusted such that the algorithm always calculates /x(t)/ at ['t = t[sub 0] + n dt] and calls the observer at that point.
+Note that the use of __controlled_stepper is reasonable here only if `dt` is considerably larger than typical step sizes used by the stepper.
+* If `stepper` is a __dense_output_stepper then `dt` is the initial step size.
+The actual step size will be adjusted during integration due to error control.
+If an observer is provided dense output is used to calculate /x(t)/ at ['t = t[sub 0] + n dt].
+
+[heading Integrate a given number of steps]
+
+This function is very similar to `integrate_const` above. The only difference
+is that it does not take the end time as parameter, but rather the number of
+steps. The integration is then performed until the time `t0+n*dt`.
+
+`integrate_n_steps( stepper , system , x0 , t0 , dt , n )`
+
+`integrate_n_steps( stepper , system , x0 , t0 , dt , n , observer )`
+
+Integrates the ODE given by `system` with subsequent steps from `stepper` starting at ['x[sub 0]] and ['t[sub 0]].
+If provided, `observer` is called after every step and at the beginning with
+`t0`, similar as above.
+The approximate result for ['x( t[sub 0] + n dt )] is stored in `x0`.
+This function returns the end time `t0 + n*dt`.
+
+
+[heading Observer calls at each step]
+
+If the observer should be called at each time step then the `integrate_adaptive` function should be used.
+Note that in the case of __controlled_stepper or __dense_output_stepper this leads to non-equidistant observer calls as the step size changes.
+
+`integrate_adaptive( stepper , system , x0 , t0 , t1 , dt )`
+
+`integrate_adaptive( stepper , system , x0 , t0 , t1 , dt , observer )`
+
+Integrates the ODE given by `system` with subsequent steps from `stepper`.
+Integration start at `t0` and `x0` and ends at ['t[sub 1]].
+`x0` is changed to the approximative solution ['x(t[sub 1])] at the end of integration.
+If provided, the `observer` is called after each step (and before the first step at `t0`).
+`integrate_adaptive` returns the number of steps performed during the integration.
+
+* If `stepper` is a __stepper or __error_stepper then `dt` is the step size used for integration and `integrate_adaptive` behaves like `integrate_const` except that for the last step the step size is reduced to ensure we end exactly at `t1`.
+If provided, the observer is called at each step.
+* If `stepper` is a __controlled_stepper then `dt` is the initial step size.
+The actual step size is changed according to error control of the stepper.
+For the last step, the step size will be reduced to ensure we end exactly at `t1`.
+If provided, the observer is called after each time step (and before the first step at `t0`).
+* If stepper is a __dense_output_stepper then `dt` is the initial step size and `integrate_adaptive` behaves just like for __controlled_stepper above. No dense output is used.
+
+[heading Observer calls at given time points]
+
+If the observer should be called at some user given time points the `integrate_times` function should be used.
+The times for observer calls are provided as a sequence of time values.
+The sequence is either defined via two iterators pointing to begin and end of the sequence or in terms of a __boost_range object.
+
+`integrate_times( stepper , system , x0 , times_start , times_end , dt , observer )`
+
+`integrate_times( stepper , system , x0 , time_range , dt , observer )`
+
+Integrates the ODE given by `system` with subsequent steps from `stepper`.
+Integration starts at `*times_start` and ends exactly at `*(times_end-1)`.
+`x0` contains the approximate solution at the end point of integration.
+This function requires an observer which is invoked at the subsequent times `*times_start++` until `times_start == times_end`.
+If called with a __boost_range `time_range` the function behaves the same with `times_start = boost::begin( time_range )` and `times_end = boost::end( time_range )`.
+`integrate_times` returns the number of steps performed during the integration.
+
+* If `stepper` is a __stepper or __error_stepper `dt` is the step size used for integration.
+However, whenever a time point from the sequence is approached the step size `dt` will be reduced to obtain the state /x(t)/ exactly at the time point.
+* If `stepper` is a __controlled_stepper then `dt` is the initial step size.
+The actual step size is adjusted during integration according to error control.
+However, if a time point from the sequence is approached the step size is reduced to obtain the state /x(t)/ exactly at the time point.
+* If `stepper` is a __dense_output_stepper then `dt` is the initial step size.
+The actual step size is adjusted during integration according to error control.
+Dense output is used to obtain the states /x(t)/ at the time points from the sequence.
+
+[heading Convenience integrate function]
+
+Additionally to the sophisticated integrate function above odeint also provides a simple `integrate` routine which uses a dense output stepper based on `runge_kutta_dopri5` with standard error bounds ['10[super -6]] for the steps.
+
+`integrate( system , x0 , t0 , t1 , dt )`
+
+`integrate( system , x0 , t0 , t1 , dt , observer )`
+
+This function behaves exactly like `integrate_adaptive` above but no stepper has to be provided.
+It also returns the number of steps performed during the integration.
+
+[endsect]

Added: trunk/libs/numeric/odeint/doc/details_iterators.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/numeric/odeint/doc/details_iterators.qbk 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,106 @@
+[/============================================================================
+ Boost.odeint
+
+ Copyright (c) 2009-2012 Karsten Ahnert
+ Copyright (c) 2009-2012 Mario Mulansky
+
+ Use, modification and distribution is subject to 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)
+=============================================================================/]
+
+
+[section Iterators and Ranges]
+
+
+
+odeint supports iterators for iterating through an ordinary differential equation. They offer you an alternative to the integrate functions. Furthermore, many of the standard algorithms in the C++ standard library and Boost.Range can be used with the odeint's iterators.
+
+[import ../examples/const_step_iterator.cpp]
+
+Four iterators are provided. They are all single pass iterators. The first one is a iterator which solves the odeint with constant step size. An example is
+
+[const_step_iterator_accumulate]
+
+In this example all x-values of the solution are accumulated. The iterator itself does not occur directly in this example but it is generated by the factory functions `make_const_step_iterator_begin` and `make_const_step_iterator_end`. odeint also supports Boost.Range, that is you write the above example in a more succinct form with the factory function `make_const_step_range`
+
+[const_step_iterator_accumulate_range]
+
+The second iterator type is also a iterator with const step size. But the value type of this iterator consists here of a pair of the time and the state of the solution of the ODE. An example is
+
+[const_step_time_iterator_accumulate_range]
+
+The factory functions are now `make_const_step_time_iterator_begin`, `make_const_step_time_iterator_end` and `make_const_step_time_range`.
+
+
+[import ../examples/adaptive_iterator.cpp]
+
+The other two iterator types adaptive iterators which are completely analogous to the const step iterators. Examples are
+
+[adaptive_iterator_accumulate_range]
+
+[adaptive_time_iterator_accumulate_range]
+
+
+[section const_step_iterator]
+
+* Definition: `const_step_iterator< Stepper , System >`
+* `value_type` is `Stepper::state_type`
+* Factory functions
+ * `make_const_step_iterator_begin( stepper , system , state , t_start , t_end , dt )`
+ * `make_const_step_iterator_end( stepper , system , state )`
+ * `make_const_step_range( stepper , system , state , t_start , t_end , dt )`
+* This stepper works with all steppers fulfilling the Stepper concept or the DenseOutputStepper concept.
+* This stepper updates the value of `state`. The value of `state` is the current state of the ODE during the iteration.
+
+[endsect]
+
+[section const_step_time_iterator]
+
+* Definition: `const_step_iterator< Stepper , System >`
+* `value_type` is `std::pair< Stepper::state_type& , Stepper::time_type >`
+* Factory functions
+ * `make_const_step_time_iterator_begin( stepper , system , state , t_start , t_end , dt )`
+ * `make_const_step_time_iterator_end( stepper , system , state )`
+ * `make_const_step_time_range( stepper , system , state , t_start , t_end , dt )`
+* This stepper works with all steppers fulfilling the Stepper concept or the DenseOutputStepper concept.
+* This stepper updates the value of `state`. The value of `state` is the current state of the ODE during the iteration.
+
+
+[endsect]
+
+
+[section adaptive_step_iterator]
+
+* Definition: `adaptive_iterator< Stepper , System >`
+* `value_type` is `Stepper::state_type`
+* Factory functions
+ * `make_adaptive_iterator_begin( stepper , system , state , t_start , t_end , dt )`
+ * `make_adaptive_iterator_end( stepper , system , state )`
+ * `make_adaptive_range( stepper , system , state , t_start , t_end , dt )`
+* This stepper works with all steppers fulfilling the ControlledStepper concept or the DenseOutputStepper concept.
+* For steppers fulfilling the ControlledStepper concept `state` is modified according to the current state of the ODE. For DenseOutputStepper the state is not modified due to performance optimizations.
+
+
+[endsect]
+
+[section adaptive_step_time_iterator]
+
+* Definition: `adaptive_iterator< Stepper , System >`
+* `value_type` is `std::pair< Stepper::state_type& , Stepper::time_type >`
+* Factory functions
+ * `make_adaptive_time_iterator_begin( stepper , system , state , t_start , t_end , dt )`
+ * `make_adaptive_time_iterator_end( stepper , system , state )`
+ * `make_adaptive_time_range( stepper , system , state , t_start , t_end , dt )`
+* This stepper works with all steppers fulfilling the ControlledStepper concept or the DenseOutputStepper concept.
+* This stepper updates the value of `state`. The value of `state` is the current state of the ODE during the iteration.
+
+
+[endsect]
+
+
+
+
+
+
+[endsect]

Added: trunk/libs/numeric/odeint/doc/details_state_types_algebras_operations.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/numeric/odeint/doc/details_state_types_algebras_operations.qbk 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,473 @@
+[/============================================================================
+ Boost.odeint
+
+ Copyright (c) 2009-2012 Karsten Ahnert
+ Copyright (c) 2009-2012 Mario Mulansky
+
+ Use, modification and distribution is subject to 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)
+=============================================================================/]
+
+[section State types, algebras and operations]
+
+In odeint the stepper algorithms are implemented independently of the
+underlying fundamental mathematical operations.
+This is realized by giving the user full control over the state type and the
+mathematical operations for this state type.
+Technically, this is done by introducing three concepts: StateType, Algebra,
+Operations.
+Most of the steppers in odeint expect three class types fulfilling these
+concepts as template parameters.
+Note that these concepts are not fully independent of each other but rather a
+valid combination must be provided in order to make the steppers work.
+In the following we will give some examples on reasonable
+state_type-algebra-operations combinations.
+For the most common state types, like `vector<double>` or `array<double,N>`
+the default values range_algebra and default_operations are perfectly fine and
+odeint can be used as is without worrying about algebra/operations at all.
+
+[important state_type, algebra and operations are not independent, a valid
+combination must be provided to make odeint work properly]
+
+Moreover, as odeint handles the memory required for intermediate temporary
+objects itself, it also needs knowledge about how to create state_type objects
+and maybe how to allocate memory (resizing).
+All in all, the following things have to be taken care of when odeint is used
+with non-standard state types:
+
+* construction/destruction
+* resizing (if possible/required)
+* algebraic operations
+
+Again, odeint already provides basic interfaces for most of the usual state
+types.
+So if you use a `std::vector`, or a `boost::array` as state type no additional
+work is required, they just work out of the box.
+
+[section Construction/Resizing]
+
+We distinguish between two basic state types: fixed sized and dynamically
+sized.
+For fixed size state types the default constructor `state_type()` already
+allocates the required memory, prominent example is `boost::array<T,N>`.
+Dynamically sized types have to be resized to make sure enough memory is
+allocated, the standard constructor does not take care of the resizing.
+Examples for this are the STL containers like `vector<double>`.
+
+The most easy way of getting your own state type to work with odeint is to use
+a fixed size state, base calculations on the range_algebra and provide the
+following functionality:
+[table
+ [[Name] [Expression] [Type] [Semantics]]
+ [[Construct State] [`State x()`] [`void`] [Creates an instance of `State`
+ and allocates memory.] ]
+ [[Begin of the sequence] [boost::begin(x)] [Iterator] [Returns an iterator
+ pointing to the begin of the sequence]]
+ [[End of the sequence] [boost::end(x)] [Iterator] [Returns an iterator
+ pointing to the end of the sequence]]
+]
+
+[warning If your state type does not allocate memory by default construction,
+you [*must define it as resizeable] and provide resize functionality (see
+below). Otherwise segmentation faults will occur.]
+
+So fixed sized arrays supported by __boost_range immediately work with odeint.
+For dynamically sized arrays one has to additionally supply the resize
+functionality.
+First, the state has to be tagged as resizeable by specializing the struct
+`is_resizeable` which consists of one typedef and one bool value:
+[table
+ [[Name] [Expression] [Type] [Semantics]]
+ [[Resizability] [`is_resizeable<State>::type`]
+ [`boost::true_type` or `boost::false_type`]
+ [Determines resizeability of the state type, returns `boost::true_type` if
+ the state is resizeable.]]
+ [[Resizability] [`is_resizeable<State>::value`]
+ [`bool`]
+ [Same as above, but with `bool` value.]]
+]
+
+Defining `type` to be `true_type` and `value` as `true` tells odeint that your
+state is resizeable.
+By default, odeint now expects the support of `boost::size(x)` and a
+`x.resize( boost::size(y) )` member function for resizing:
+[table
+ [[Name] [Expression] [Type] [Semantics]]
+ [[Get size] [`boost::size( x )`]
+ [`size_type`] [Returns the current size of x.]]
+ [[Resize] [`x.resize( boost::size( y ) )`]
+ [`void`] [Resizes x to have the same size as y.]]
+]
+
+[section Using the container interface]
+[import ../examples/my_vector.cpp]
+
+As a first example we take the most simple case and implement our own vector
+`my_vector` which will provide a container interface.
+This makes __boost_range working out-of-box.
+We add a little functionality to our vector which makes it allocate some
+default capacity by construction.
+This is helpful when using resizing as then a resize can be assured to not
+require a new allocation.
+
+[my_vector]
+
+
+The only thing that has to be done other than defining is thus declaring
+my_vector as resizeable:
+
+[my_vector_resizeable]
+
+If we wouldn't specialize the `is_resizeable` template, the code would still
+compile but odeint would not adjust the size of temporary internal instances
+of my_vector and hence try to fill zero-sized vectors resulting in
+segmentation faults!
+The full example can be found in [github_link libs/numeric/odeint/examples/my_vector.cpp my_vector.cpp]
+
+[endsect]
+
+[section std::list]
+
+If your state type does work with __boost_range, but handles resizing
+differently you are required to specialize two implementations used by odeint
+to check a state's size and to resize:
+[table
+ [[Name] [Expression] [Type] [Semantics]]
+ [[Check size] [`same_size_impl<State,State>::same_size(x , y)`]
+ [`bool`] [Returns true if the size of x equals the size of y.]]
+ [[Resize] [`resize_impl<State,State>::resize(x , y)`]
+ [`void`] [Resizes x to have the same size as y.]]
+]
+
+As an example we will use a `std::list` as state type in odeint.
+Because `std::list` is not supported by `boost::size` we have to replace the
+same_size and resize implementation to get list to work with odeint.
+The following code shows the required template specializations:
+
+[import ../examples/list_lattice.cpp]
+
+[list_bindings]
+
+With these definitions odeint knows how to resize `std::list`s and so they can
+be used as state types.
+A complete example can be found in [github_link libs/numeric/odeint/examples/list_lattice.cpp list_lattice.cpp].
+
+[endsect]
+
+[endsect]
+
+[section Algebras and Operations]
+
+To provide maximum flexibility odeint is implemented in a highly modularized
+way. This means it is possible to change the underlying mathematical
+operations without touching the integration algorithms.
+The fundamental mathematical operations are those of a vector space, that is
+addition of `state_types` and multiplication of `state_type`s with a scalar
+(`time_type`). In odeint this is realized in two concepts: _Algebra_ and
+_Operations_.
+The standard way how this works is by the range algebra which provides
+functions that apply a specific operation to each of the individual elements
+of a container based on the __boost_range library.
+If your state type is not supported by __boost_range there are several
+possibilities to tell odeint how to do algebraic operations:
+
+* Implement `boost::begin` and `boost::end` for your state type so it works
+with __boost_range.
+* Implement vector-vector addition operator `+` and scalar-vector
+multiplication operator `*` and use the non-standard `vector_space_algebra`.
+* Implement your own algebra that implements the required functions.
+
+[section GSL Vector]
+
+In the following example we will try to use the `gsl_vector` type from __gsl (GNU
+Scientific Library) as state type in odeint.
+We will realize this by implementing a wrapper around the gsl_vector that
+takes care of construction/destruction.
+Also, __boost_range is extended such that it works with `gsl_vector`s as well
+which required also the implementation of a new `gsl_iterator`.
+
+[note odeint already includes all the code presented here, see [github_link
+boost/numeric/odeint/external/gsl/gsl_wrapper.hpp gsl_wrapper.hpp], so `gsl_vector`s
+can be used straight out-of-box.
+The following description is just for educational purpose.]
+
+The GSL is a C library, so `gsl_vector` has neither constructor, nor
+destructor or any `begin` or `end` function, no iterators at all.
+So to make it work with odeint plenty of things have to be implemented.
+Note that all of the work shown here is already included in odeint, so using
+`gsl_vector`s in odeint doesn't require any further adjustments.
+We present it here just as an educational example.
+We start with defining appropriate constructors and destructors.
+This is done by specializing the `state_wrapper` for `gsl_vector`.
+State wrappers are used by the steppers internally to create and manage
+temporary instances of state types:
+
+``
+template<>
+struct state_wrapper< gsl_vector* >
+{
+ typedef double value_type;
+ typedef gsl_vector* state_type;
+ typedef state_wrapper< gsl_vector* > state_wrapper_type;
+
+ state_type m_v;
+
+ state_wrapper( )
+ {
+ m_v = gsl_vector_alloc( 1 );
+ }
+
+ state_wrapper( const state_wrapper_type &x )
+ {
+ resize( m_v , x.m_v );
+ gsl_vector_memcpy( m_v , x.m_v );
+ }
+
+
+ ~state_wrapper()
+ {
+ gsl_vector_free( m_v );
+ }
+
+};
+``
+
+This `state_wrapper` specialization tells odeint how gsl_vectors are created,
+copied and destroyed.
+Next we need resizing, this is required because gsl_vectors are dynamically
+sized objects:
+``
+template<>
+struct is_resizeable< gsl_vector* >
+{
+ typedef boost::true_type type;
+ const static bool value = type::value;
+};
+
+template <>
+struct same_size_impl< gsl_vector* , gsl_vector* >
+{
+ static bool same_size( const gsl_vector* x , const gsl_vector* y )
+ {
+ return x->size == y->size;
+ }
+};
+
+template <>
+struct resize_impl< gsl_vector* , gsl_vector* >
+{
+ static void resize( gsl_vector* x , const gsl_vector* y )
+ {
+ gsl_vector_free( x );
+ x = gsl_vector_alloc( y->size );
+ }
+};
+``
+
+Up to now, we defined creation/destruction and resizing, but gsl_vectors also
+don't support iterators, so we first implement a gsl iterator:
+
+``
+/*
+ * defines an iterator for gsl_vector
+ */
+class gsl_vector_iterator
+ : public boost::iterator_facade< gsl_vector_iterator , double ,
+ boost::random_access_traversal_tag >
+{
+public :
+
+ gsl_vector_iterator( void ): m_p(0) , m_stride( 0 ) { }
+ explicit gsl_vector_iterator( gsl_vector *p ) : m_p( p->data ) , m_stride( p->stride ) { }
+ friend gsl_vector_iterator end_iterator( gsl_vector * );
+
+private :
+
+ friend class boost::iterator_core_access;
+ friend class const_gsl_vector_iterator;
+
+ void increment( void ) { m_p += m_stride; }
+ void decrement( void ) { m_p -= m_stride; }
+ void advance( ptrdiff_t n ) { m_p += n*m_stride; }
+ bool equal( const gsl_vector_iterator &other ) const { return this->m_p == other.m_p; }
+ bool equal( const const_gsl_vector_iterator &other ) const;
+ double& dereference( void ) const { return *m_p; }
+
+ double *m_p;
+ size_t m_stride;
+};
+``
+A similar class exists for the `const` version of the iterator.
+Then we have a function returning the end iterator (similarly for `const` again):
+``
+gsl_vector_iterator end_iterator( gsl_vector *x )
+{
+ gsl_vector_iterator iter( x );
+ iter.m_p += iter.m_stride * x->size;
+ return iter;
+}
+``
+
+Finally, the bindings for __boost_range are added:
+``
+// template<>
+inline gsl_vector_iterator range_begin( gsl_vector *x )
+{
+ return gsl_vector_iterator( x );
+}
+
+// template<>
+inline gsl_vector_iterator range_end( gsl_vector *x )
+{
+ return end_iterator( x );
+}
+``
+Again with similar definitions for the `const` versions.
+This eventually makes odeint work with gsl vectors as state types.
+The full code for these bindings is found in [github_link
+boost/numeric/odeint/external/gsl/gsl_wrapper.hpp gsl_wrapper.hpp].
+It might look rather complicated but keep in mind that gsl is a pre-compiled C
+library.
+[endsect]
+
+
+[section Vector Space Algebra]
+
+As seen above, the standard way of performing algebraic operations on
+container-like state types in odeint is to iterate through the elements of the
+container and perform the operations element-wise on the underlying value type.
+This is realized by means of the `range_algebra` that uses __boost_range for
+obtaining iterators of the state types.
+However, there are other ways to implement the algebraic operations on
+containers, one of which is defining the addition/multiplication operators for
+the containers directly and then using the `vector_space_algebra`.
+If you use this algebra, the following operators have to be defined for the
+state_type:
+
+[table
+ [[Name] [Expression] [Type] [Semantics]]
+ [[Addition] [`x + y`] [`state_type`] [Calculates the vector sum 'x+y'.]]
+ [[Assign addition] [`x += y`] [`state_type`] [Performs x+y in place.]]
+ [[Scalar multiplication] [`a * x `] [`state_type`] [Performs multiplication of vector x with scalar a.]]
+ [[Assign scalar multiplication] [`x *= a`] [`state_type`] [Performs in-place multiplication of vector x with scalar a.]]
+]
+
+Defining these operators makes your state type work with any basic Runge-Kutta
+stepper.
+However, if you want to use step-size control, some more functionality is
+required.
+Specifically, operations like
+[' max[sub i]( |err[sub i]| / (alpha * |s[sub i]|) )]
+have to be performed.
+['err] and ['s] are state_types, alpha is a scalar.
+As you can see, we need element wise absolute value and division as well as an
+reduce operation to get the maximum value.
+So for controlled steppers the following things have to be implemented:
+
+[table
+ [[Name] [Expression] [Type] [Semantics]]
+ [[Division] [`x / y`] [`state_type`] [Calculates the element-wise division 'x/y']]
+ [[Absolute value] [`abs( x )`] [`state_type`] [Element wise absolute value]]
+ [[Reduce] [`vector_space_reduce_impl< state_type >::reduce( state , operation , init )`] [`value_type`]
+ [Performs the `operation` for subsequently each element of `state` and returns the aggregate value.
+ E.g.
+
+`init = operator( init , state[0] );`
+
+`init = operator( init , state[1] )`
+
+`...`
+ ]]
+]
+
+[endsect]
+
+[section Boost.Ublas]
+As an example for the employment of the `vector_space_algebra` we will adopt
+`ublas::vector` from __ublas to work as a state type in odeint.
+This is particularly easy because `ublas::vector` supports vector-vector
+addition and scalar-vector multiplication described above as well as `boost::size`.
+It also has a resize member function so all that has to be done in this case
+is to declare resizability:
+
+[import ../examples/ublas/lorenz_ublas.cpp]
+
+[ublas_resizeable]
+
+Now ublas::vector can be used as state type for simple Runge-Kutta steppers
+in odeint by specifying the `vector_space_algebra` as algebra in the template
+parameter list of the stepper.
+The following code shows the corresponding definitions:
+
+[ublas_main]
+
+Note again, that we haven't supported the requirements for controlled steppers,
+but only for simple Runge-Kutta methods.
+You can find the full example in [github_link
+libs/numeric/odeint/examples/ublas/lorenz_ublas.cpp lorenz_ublas.cpp].
+
+[endsect]
+
+[section Point type]
+
+[import ../examples/lorenz_point.cpp]
+
+Here we show how to implement the required operators on a state type.
+As example we define a new class `point3D` representing a three-dimensional
+vector with components x,y,z and define addition and scalar multiplication
+operators for it.
+We use __boost_operators to reduce the amount of code to be written.
+The class for the point type looks as follows:
+
+[point3D]
+
+By deriving from __boost_operators classes we don't have to define outer class
+operators like `operator+( point3D , point3D )` because that is taken care of
+by the operators library.
+Note that for simple Runge-Kutta schemes (like `runge_kutta4`) only the `+`
+and `*` operators are required.
+If, however, a controlled stepper is used one also needs to specify the
+division operator `/` because calculation of the error term involves an
+element wise division of the state types.
+Additionally, controlled steppers require an `abs` function calculating the
+element-wise absolute value for the state type:
+
+[point3D_abs_div]
+
+Finally, we have to add a specialization for `reduce` implementing a reduction
+over the state type:
+
+[point3D_reduce]
+
+Again, note that the two last steps were only required if you want to use
+controlled steppers.
+For simple steppers definition of the simple `+=` and `*=` operators are
+sufficient.
+Having defined such a point type, we can easily perform the integration on a Lorenz
+system by using the `vector_space_algebra` again:
+
+[point3D_main]
+
+The whole example can be found in [github_link
+libs/numeric/odeint/examples/lorenz_point.cpp lorenz_point.cpp]
+
+[endsect]
+
+[endsect]
+
+gsl_vector, gsl_matrix, ublas::matrix, blitz::matrix, thrust
+
+[section Adapt your own operations]
+
+to be continued
+
+*thrust
+*gsl_complex
+*min, max, pow
+
+[endsect]
+
+
+
+[endsect]

Added: trunk/libs/numeric/odeint/doc/details_steppers.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/numeric/odeint/doc/details_steppers.qbk 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,420 @@
+[/============================================================================
+ Boost.odeint
+
+ Copyright (c) 2009-2012 Karsten Ahnert
+ Copyright (c) 2009-2012 Mario Mulansky
+
+ Use, modification and distribution is subject to 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)
+=============================================================================/]
+
+[section Steppers]
+
+[import ../examples/stepper_details.cpp]
+
+Solving ordinary differential equation numerically is usually done iteratively, that is a given state of an ordinary differential equation is iterated forward ['x(t) -> x(t+dt) -> x(t+2dt)]. The steppers in odeint perform one single step. The most general stepper type is described by the __stepper concept. The stepper concepts of odeint are described in detail in section __concepts, here we briefly present the mathematical and numerical details of the steppers. The __stepper has two versions of the `do_step` method, one with an in-place transform of the current state and one with an out-of-place transform:
+
+`do_step( sys , inout , t , dt )`
+
+`do_step( sys , in , t , out , dt )`
+
+The first parameter is always the system function - a function describing the
+ODE. In the first version the second parameter is the step which is here
+updated in-place and the third and the fourth parameters are the time and step
+size (the time step). After a call to `do_step` the state `inout` is updated
+and now represents an approximate solution of the ODE at time ['t+dt]. In the
+second version the second argument is the state of the ODE at time ['t], the
+third argument is t, the fourth argument is the approximate solution at time
+['t+dt] which is filled by `do_step` and the fifth argument is the time step.
+Note that these functions do not change the time `t`.
+
+[* System functions]
+
+Up to now, we have nothing said about the system function. This function
+depends on the stepper. For the explicit Runge-Kutta steppers this function
+can be a simple callable object hence a simple (global) C-function or a
+functor. The parameter syntax is `sys( x , dxdt , t )` and it is assumed that
+it calculates ['dx/dt = f(x,t)].
+The function structure in most cases looks like:
+
+[system_function_structure]
+
+Other types of system functions might represent Hamiltonian systems or systems which also compute the Jacobian needed in implicit steppers. For information which stepper uses which system function see the stepper table below. It might be possible that odeint will introduce new system types in near future. Since the system function is strongly related to the stepper type, such an introduction of a new stepper might result in a new type of system function.
+
+[section Explicit steppers]
+
+A first specialization are the explicit steppers. Explicit means that the new
+state of the ode can be computed explicitly from the current state without
+solving implicit equations. Such steppers have in common that they evaluate the system at time ['t] such that the result of ['f(x,t)] can be passed to the stepper. In odeint, the explicit stepper have two additional methods
+
+`do_step( sys , inout , dxdtin , t , dt )`
+
+`do_step( sys , in , dxdtin , t , out , dt )`
+
+Here, the additional parameter is the value of the function ['f] at state ['x] and time ['t]. An example is the Runge-Kutta stepper of fourth order:
+
+[explicit_stepper_detail_example]
+
+In fact, you do not need to call these two methods. You can always use the
+simpler `do_step( sys , inout , t , dt )`, but sometimes the derivative of the
+state is needed externally to do some external computations or to perform some statistical analysis.
+
+A special class of the explicit steppers are the FSAL (first-same-as-last)
+steppers, where the last evaluation of the system function is also the first
+evaluation of the following step. For such steppers the `do_step` method are
+slightly different:
+
+`do_step( sys , inout , dxdtinout , t , dt )`
+
+`do_step( sys , in , dxdtin , out , dxdtout , t , dt )`
+
+This method takes the derivative at time `t` and also also stores
+the derivative at time ['t+dt]. Calling these functions subsequently iterating
+along the solution one saves one function call by passing the result for dxdt
+into the next function call.
+However, when using FSAL steppers without supplying derivatives:
+
+`do_step( sys , inout , t , dt )`
+
+the stepper internally satisfies the FSAL property which means it remembers
+the last `dxdt` and uses it for the next step.
+An example for a FSAL stepper is the Runge-Kutta-Dopri5 stepper. The FSAL trick is sometimes also referred as the Fehlberg trick. An example how the FSAL steppers can be used is
+
+[fsal_stepper_detail_example]
+
+[caution The FSAL-steppers save the derivative at time ['t+dt] internally if
+they are called via `do_step( sys , in , out , t , dt )`. The first call of
+`do_step` will initialize `dxdt` and for all following calls it is assumed
+that the same system and the same state are used. If you use the FSAL stepper
+within the integrate functions this is taken care of automatically. See the __using_steppers section for more details or look into the table below to see which stepper have an internal state.]
+
+
+[endsect]
+
+[section Symplectic solvers]
+
+As mentioned above symplectic solvers are used for Hamiltonian systems. Symplectic solvers conserve the phase space volume exactly and if the Hamiltonian system is energy conservative they also conserve the energy approximately. A special class of symplectic systems are separable systems which can be written in the form ['dqdt/dt = f1(p)], ['dpdt/dt = f2(q)], where ['(q,p)] are the state of system. The space of ['(q,p)] is sometimes referred as the phase space and ['q] and ['p] are said the be the phase space variables. Symplectic systems in this special form occur widely in nature. For example the complete classical mechanics as written down by Newton, Lagrange and Hamilton can be formulated in this framework. The separability of the system depends on the specific choice of coordinates.
+
+Symplectic systems can be solved by odeint by means of the symplectic_euler stepper and a symplectic Runge-Kutta-Nystrom method of fourth order. These steppers assume that the system is autonomous, hence the time will not explicitly occur. Further they fulfill in principle the default Stepper concept, but they expect the system to be a pair of callable objects. The first entry of this pair calculates ['f1(p)] while the second calculates ['f2(q)]. The syntax is `sys.first(p,dqdt)` and `sys.second(q,dpdt)`, where the first and second part can be again simple C-functions of functors. An example is the harmonic oscillator:
+
+[symplectic_stepper_detail_system_function]
+
+The state of such an ODE consist now also of two parts, the part for q (also called the coordinates) and the part for p (the momenta). The full example for the harmonic oscillator is now:
+
+[symplectic_stepper_detail_example]
+
+If you like to represent the system with one class you can easily bind two public method:
+
+[symplectic_stepper_detail_system_class]
+
+[symplectic_stepper_detail_system_class_example]
+
+Many Hamiltonian system can be written as ['dq/dt=p], ['dp/dt=f(q)] which is computationally much easier than the full separable system. Very often, it is also possible to transform the original equations of motion to bring the system in this simplified form. This kind of system can be used in the symplectic solvers, by simply passing ['f(p)] to the `do_step` method, again ['f(p)] will be represented by a simple C-function or a functor. Here, the above example of the harmonic oscillator can be written as
+
+[simplified_symplectic_stepper_example]
+
+In this example the function `harm_osc_f1` is exactly the same function as in the above examples.
+
+Note, that the state of the ODE must not be constructed explicitly via `pair< vector_type , vector_type > x`. One can also use a combination of `make_pair` and `ref`. Furthermore, a convenience version of `do_step` exists which takes q and p without combining them into a pair:
+
+[symplectic_stepper_detail_ref_usage]
+
+[endsect]
+
+[section Implicit solvers]
+
+[caution This section is not up-to-date.]
+
+For some kind of systems the stability properties of the classical Runge-Kutta are not sufficient, especially if the system is said to be stiff. A stiff system possesses two or more time scales of very different order. Solvers for stiff systems are usually implicit, meaning that they solve equations like ['x(t+dt) = x(t) + dt * f(x(t+1))]. This particular scheme is the implicit Euler method. Implicit methods usually solve the system of equations by a root finding algorithm like the Newton method and therefore need to know the Jacobian of the system ['J[subl ij] = df[subl i] / dx[subl j]].
+
+For implicit solvers the system is again a pair, where the first component computes ['f(x,t)] and the second the Jacobian. The syntax is `sys.first( x , dxdt , t )` and `sys.second( x , J , t )`. For the implicit solver the `state_type` is `ublas::vector` and the Jacobian is represented by `ublas::matrix`.
+
+[important Implicit solvers only work with ublas::vector as state type. At
+the moment, no other state types are supported.]
+
+[endsect]
+
+[section Multistep methods]
+
+Another large class of solvers are multi-step method. They save a small part of the history of the solution and compute the next step with the help of this history. Since multi-step methods know a part of their history they do not need to compute the system function very often, usually it is only computed once. This makes multi-step methods preferable if a call of the system function is expensive. Examples are ODEs defined on networks, where the computation of the interaction is usually where expensive (and might be of order O(N^2)).
+
+Multi-step methods differ from the normal steppers. They save a part of their history and this part has to be explicitly calculated and initialized. In the following example an Adams-Bashforth-stepper with a history of 5 steps is instantiated and initialized;
+
+[multistep_detail_example]
+
+The initialization uses a fourth-order Runge-Kutta stepper and after the call
+of `initialize` the state of `inout` has changed to the current state, such
+that it can be immediately used by passing it to following calls of `do_step`. You can also use you own steppers to initialize the internal state of the Adams-Bashforth-Stepper:
+
+[multistep_detail_own_stepper_initialization]
+
+Many multi-step methods are also explicit steppers, hence the parameter of `do_step` method do not differ from the explicit steppers.
+
+[caution The multi-step methods have some internal variables which depend on
+the explicit solution. Hence after any external changes of your state (e.g. size) or
+system the initialize function has to be called again to adjust the internal
+state of the stepper. If you use the integrate functions this will
+be taken into account. See the __using_steppers section for more details.]
+
+
+[endsect]
+
+[section Controlled steppers]
+
+Many of the above introduced steppers possess the possibility to use adaptive step-size control. Adaptive step size integration works in principle as follows:
+
+# The error of one step is calculated. This is usually done by performing two steps with different orders. The difference between these two steps is then used as a measure for the error. Stepper which can calculate the error are __error_stepper and they form an own class with an separate concept.
+# This error is compared against some predefined error tolerances. Are the tolerance violated the step is reject and the step-size is decreases. Otherwise the step is accepted and possibly the step-size is increased.
+
+The class of controlled steppers has their own concept in odeint - the __controlled_stepper concept. They are usually constructed from the underlying error steppers. An example is the controller for the explicit Runge-Kutta steppers. The Runge-Kutta steppers enter the controller as a template argument. Additionally one can pass the Runge-Kutta stepper to the constructor, but this step is not necessary; the stepper is default-constructed if possible.
+
+Different step size controlling mechanism exist. They all have in common that
+they somehow compare predefined error tolerance against the error and that
+they might reject or accept a step. If a step is rejected the step size is
+usually decreased and the step is made again with the reduced step size. This
+procedure is repeated until the step is accepted. This algorithm is
+implemented in the integration functions.
+
+A classical way to decide whether a step is rejected or accepted is to calculate
+
+['val = || | err[subl i] | / ( __epsilon[subl abs] + __epsilon[subl rel] * ( a[subl x] | x[subl i] | + a[subl dxdt] | | dxdt[subl i] | )|| ]
+
+['__epsilon[subl abs]] and ['__epsilon[subl rel]] are the absolute and the relative error tolerances, and ['|| x ||] is a norm, typically ['||x||=(__Sigma[subl i] x[subl i][super 2])[super 1/2]] or the maximum norm. The step is rejected if ['val] is greater then 1, otherwise it is accepted. For details of the used norms and error tolerance see the table below.
+
+For the `controlled_runge_kutta` stepper the new step size is then calculated via
+
+['val > 1 : dt[subl new] = dt[subl current] max( 0.9 pow( val , -1 / ( O[subl E] - 1 ) ) , 0.2 )]
+
+['val < 0.5 : dt[subl new] = dt[subl current] min( 0.9 pow( val , -1 / O[subl S] ) , 5 )]
+
+['else : dt[subl new] = dt[subl current]]
+
+Here, ['O[subl S]] and ['O[subl E]] are the order of the stepper and the error stepper. These formulas also contain some safety factors, avoiding that the step size is reduced or increased to much. For details of the implementations of the controlled steppers in odeint see the table below.
+
+[include controlled_stepper_table.qbk]
+
+To ease to generation of the controlled stepper, generation functions exist which take the absolute and relative error tolerances and a predefined error stepper and construct from this knowledge an appropriate controlled stepper. The generation functions are explained in detail in __generation_functions.
+
+[endsect]
+
+[section Dense output steppers]
+
+A fourth class of stepper exists which are the so called dense output steppers. Dense-output steppers might take larger steps and interpolate the solution between two consecutive points. This interpolated points have usually the same order as the order of the stepper. Dense-output steppers are often composite stepper which take the underlying method as a template parameter. An example is the `dense_output_runge_kutta` stepper which takes a Runge-Kutta stepper with dense-output facilities as argument. Not all Runge-Kutta steppers provide dense-output calculation; at the moment only the Dormand-Prince 5 stepper provides dense output. An example is
+
+[dense_output_detail_example]
+
+Dense output stepper have their own concept. The main difference to usual
+steppers is that they manage the state and time internally. If you call
+`do_step`, only the ODE is passed as argument. Furthermore `do_step` return
+the last time interval: `t` and `t+dt`, hence you can interpolate the solution between these two times points. Another difference is that they must be initialized with `initialize`, otherwise the internal state of the stepper is default constructed which might produce funny errors or bugs.
+
+The construction of the dense output stepper looks a little bit nasty, since in the case of the `dense_output_runge_kutta` stepper a controlled stepper and an error stepper have to be nested. To simplify the generation of the dense output stepper generation functions exist:
+
+[dense_output_detail_generation1]
+
+This statement is also lengthy; it demonstrates how `make_dense_output` can be used with the `result_of` protocol. The parameters to `make_dense_output` are the absolute error tolerance, the relative error tolerance and the stepper. This explicitly assumes that the underlying stepper is a controlled stepper and that this stepper has an absolute and a relative error tolerance. For details about the generation functions see __generation_functions. The generation functions have been designed for easy use with the integrate functions:
+
+[dense_output_detail_generation2]
+
+[endsect]
+
+[section Using steppers]
+
+This section contains some general information about the usage of the steppers in odeint.
+
+[* Steppers are copied by value]
+
+The stepper in odeint are always copied by values. They are copied for the creation of the controlled steppers or the dense output steppers as well as in the integrate functions.
+
+[* Steppers might have a internal state]
+
+[caution Some of the features described in this section are not yet implemented]
+
+Some steppers require to store some information about the state of the ODE between two steps. Examples are the multi-step methods which store a part of the solution during the evolution of the ODE, or the FSAL steppers which store the last derivative at time ['t+dt], to be used in the next step. In both cases the steppers expect that consecutive calls of `do_step` are from the same solution and the same ODE. In this case it is absolutely necessary that you call `do_step` with the same system function and the same state, see also the examples for the FSAL steppers above.
+
+Stepper with an internal state support two additional methods: `reset` which resets the state and `initialize` which initializes the internal state. The parameters of `initialize` depend on the specific stepper. For example the Adams-Bashforth-Moulton stepper provides two initialize methods: `initialize( system , inout , t , dt )` which initializes the internal states with the help of the Runge-Kutta 4 stepper, and `initialize( stepper , system , inout , t , dt )` which initializes with the help of `stepper`. For the case of the FSAL steppers, `initialize` is `initialize( sys , in , t )` which simply calculates the r.h.s. of the ODE and assigns its value to the internal derivative.
+
+All these steppers have in common, that they initially fill their internal state by themselves. Hence you are not required to call initialize. See how this works for the Adams-Bashforth-Moulton stepper: in the example we instantiate a fourth order Adams-Bashforth-Moulton stepper, meaning that it will store 4 internal derivatives of the solution at times `(t-dt,t-2*dt,t-3*dt,t-4*dt)`.
+
+``
+adams_bashforth_moulton< 4 , state_type > stepper;
+stepper.do_step( sys , x , t , dt ); // make one step with the classical Runge-Kutta stepper and initialize the first internal state
+ // the internal array is now [x(t-dt)]
+
+stepper.do_step( sys , x , t , dt ); // make one step with the classical Runge-Kutta stepper and initialize the second internal state
+ // the internal state array is now [x(t-dt), x(t-2*dt)]
+
+stepper.do_step( sys , x , t , dt ); // make one step with the classical Runge-Kutta stepper and initialize the third internal state
+ // the internal state array is now [x(t-dt), x(t-2*dt), x(t-3*dt)]
+
+stepper.do_step( sys , x , t , dt ); // make one step with the classical Runge-Kutta stepper and initialize the fourth internal state
+ // the internal state array is now [x(t-dt), x(t-2*dt), x(t-3*dt), x(t-4*dt)]
+
+stepper.do_step( sys , x , t , dt ); // make one step with Adam-Bashforth-Moulton, the internal array of states is now rotated
+``
+
+In the stepper table at the bottom of this page one can see which stepper have an internal state and hence provide the `reset` and `initialize` methods.
+
+
+[* Stepper might be resizable]
+
+Nearly all steppers in odeint need to store some intermediate results of the
+type `state_type` or `deriv_type`. To do so odeint need some memory management
+for the internal temporaries. As this memory management is typically related
+to adjusting the size of vector-like types, it is called resizing in
+odeint. So, most steppers in odeint provide an additional template parameter
+which controls the size adjustment of the internal variables - the resizer. In
+detail odeint provides three policy classes (resizers) `always_resizer`,
+`initially_resizer`, and `never_resizer`. Furthermore, all stepper have a
+method `adjust_size` which takes a parameter representing a state type and
+which manually adjusts the size of the internal variables matching the size of
+the given instance. Before performing the actual resizing odeint always checks
+if the sizes of the state and the internal variable differ and only resizes if
+they are different.
+
+[note You only have to worry about memory allocation when using dynamically
+sized vector types. If your state type is heap allocated, like `boost::array`,
+no memory allocation is required whatsoever.]
+
+By default the resizing parameter is `initially_resizer`, meaning that the
+first call to `do_step` performs the resizing, hence memory allocation.
+If you have changed the size of your system and your state you have to
+call `adjust_size` by hand in this case. The second resizer is the
+`always_resizer` which tries to resize the internal variables at every call of
+`do_step`. Typical use cases for this kind of resizer are self expanding
+lattices like shown in the tutorial (__resizing_lattice_example) or partial differential equations with an
+adaptive grid. Here, no calls of `adjust_size` are required, the steppers manage
+everything themselves. The third class of resizer is the `never_resizer` which
+means that the internal variables are never adjusted automatically and always
+have to be adjusted by hand .
+
+There is a second mechanism which influences the resizing and which controls if a state type is at least resizeable - a meta-function `is_resizeable`. This meta-function returns a static Boolean value if any type is resizable. For example it will return `true` for `std::vector< T >` but `false` for `boost::array< T >`. By default and for unknown types `is_resizeable` returns `false`, so if you have your own type you need to specialize this meta-function. For more details on the resizing mechanism see the section __adapt_state_types.
+
+
+
+[* Which steppers should be used in which situation]
+
+odeint provides a quite large number of different steppers such that the user is left with the question of which stepper fits his needs. Our personal recommendations are:
+
+* `runge_kutta_dopri5` is maybe the best default stepper. It has step size control as well as dense-output functionality. Simple create a dense-output stepper by `make_dense_output( 1.0e-6 , 1.0e-5 , runge_kutta_dopri5< state_type >() )`.
+* `runge_kutta4` is a good stepper for constant step sizes. It is widely used and very well known. If you need to create artificial time series this stepper should be the first choice.
+* 'runge_kutta_fehlberg78' is similar to the 'runge_kutta4' with the advantage that it has higher precision. It can also be used with step size control.
+* `adams_bashforth_moulton` is very well suited for ODEs where the r.h.s. is expensive (in terms of computation time). It will calculate the system function only once during each step.
+
+[endsect]
+
+[section Stepper overview]
+
+[include stepper_table.qbk]
+
+[endsect]
+
+
+[section Custom steppers]
+
+[import ../examples/stochastic_euler.cpp]
+
+Finally, one can also write new steppers which are fully compatible with odeint. They only have to fulfill one or several of the stepper __concepts of odeint.
+
+We will illustrate how to write your own stepper with the example of the stochastic Euler method. This method is suited to solve stochastic differential equations (SDEs). A SDE has the form
+
+['dx/dt = f(x) + g(x) __xi(t)]
+
+where ['__xi] is Gaussian white noise with zero mean and a standard deviation ['__sigma(t)]. ['f(x)] is said to be the deterministic part while [' g(x) __xi] is the noisy part. In case ['g(x)] is independent of ['x] the SDE is said to have additive noise. It is not possible to solve SDE with the classical solvers for ODEs since the noisy part of the SDE has to be scaled differently then the deterministic part with respect to the time step. But there exist many solvers for SDEs. A classical and easy method is the stochastic Euler solver. It works by iterating
+
+['x(t+__Delta t) = x(t) + __Delta t f(x(t)) + __Delta t[super 1/2] g(x) __xi(t)]
+
+where __xi(t) is an independent normal distributed random variable.
+
+Now we will implement this method. We will call the stepper
+`stochastic_euler`. It models the __stepper concept. For simplicity, we fix
+the state type to be an `array< double , N >` The class definition looks like
+
+[stochastic_euler_class_definition]
+
+The types are needed in order to fulfill the stepper concept. As internal state and deriv type we use simple arrays in the stochastic Euler, they are needed for the temporaries. The stepper has the order one which is returned from the `order()` function.
+
+The system functions needs to calculate the deterministic and the stochastic part of our stochastic differential equation. So it might be suitable that the system function is a pair of functions. The first element of the pair computes the deterministic part and the second the stochastic one. Then, the second part also needs to calculate the random numbers in order to simulate the stochastic process. We can now implement the `do_step` method
+
+[stochastic_euler_do_step]
+
+This is all. It is quite simple and the stochastic Euler stepper implement here is quite general. Of course it can be enhanced, for example
+
+* use of operations and algebras as well as the resizing mechanism for maximal flexibility and portability
+* use of `boost::ref` for the system functions
+* use of `boost::range` for the state type in the `do_step` method
+* ...
+
+Now, lets look how we use the new stepper. A nice example is the Ornstein-Uhlenbeck process. It consists of a simple Brownian motion overlapped with an relaxation process. Its SDE reads
+
+['dx/dt = - x + __xi]
+
+where __xi is Gaussian white noise with standard deviation ['__sigma]. Implementing the Ornstein-Uhlenbeck process is quite simple. We need two functions or functors - one for the deterministic and one for the stochastic part:
+
+[stochastic_euler_ornstein_uhlenbeck_def]
+
+In the stochastic part we have used the Mersenne twister for the random number generation and a Gaussian white noise generator `normal_distribution` with standard deviation ['__sigma]. Now, we can use the stochastic Euler stepper with the integrate functions:
+
+[ornstein_uhlenbeck_main]
+
+Note, how we have used the `make_pair` function for the generation of the system function.
+
+[endsect]
+
+[section Custom Runge-Kutta steppers]
+
+[import ../examples/heun.cpp]
+
+odeint provides a C++ template meta-algorithm for constructing arbitrary
+Runge-Kutta schemes [footnote M. Mulansky, K. Ahnert, Template-Metaprogramming
+applied to numerical problems, [@http://arxiv.org/abs/1110.3233 arxiv:1110.3233]]. Some schemes are predefined in odeint, for
+example the classical Runge-Kutta of fourth order, or the
+Runge-Kutta-Cash-Karp 54 and the Runge-Kutta-Fehlberg 78 method.
+You can use this meta algorithm to construct you own solvers. This has the
+advantage that you can make full use of odeint's algebra and operation system.
+
+Consider for example the method of Heun, defined by the following Butcher tableau:
+
+[pre
+c1 = 0
+
+c2 = 1/3, a21 = 1/3
+
+c3 = 2/3, a31 = 0 , a32 = 2/3
+
+ b1 = 1/4, b2 = 0 , b3 = 3/4
+]
+
+Implementing this method is very easy. First you have to define the constants:
+
+[heun_define_coefficients]
+
+While this might look cumbersome, packing all
+parameters into a templatized class which is not immediately evaluated has the
+advantage that you can change the `value_type` of your stepper to any type you
+like - presumably arbitrary precision types. One could also instantiate
+the coefficients directly
+
+``
+const boost::array< double , 1 > heun_a1 = {{ 1.0 / 3.0 }};
+const boost::array< double , 2 > heun_a2 = {{ 0.0 , 2.0 / 3.0 }};
+const boost::array< double , 3 > heun_b = {{ 1.0 / 4.0 , 0.0 , 3.0 / 4.0 }};
+const boost::array< double , 3 > heun_c = {{ 0.0 , 1.0 / 3.0 , 2.0 / 3.0 }};
+``
+
+But then you are nailed down to use doubles.
+
+Next, you need to define your stepper, note that the Heun method has 3 stages
+and produces approximations of order 3:
+
+[heun_stepper_definition]
+
+That's it. Now, we have a new stepper method and we can use it, for example with the Lorenz system:
+
+[heun_example]
+
+[endsect]
+
+
+[endsect]

Added: trunk/libs/numeric/odeint/doc/examples_table.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/numeric/odeint/doc/examples_table.qbk 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,125 @@
+[/============================================================================
+ Boost.odeint
+
+ Copyright (c) 2009-2012 Karsten Ahnert
+ Copyright (c) 2009-2012 Mario Mulansky
+
+ Use, modification and distribution is subject to 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)
+=============================================================================/]
+
+
+[table Examples Overview
+ [[File] [Brief Description]]
+
+ [[[github_link libs/numeric/odeint/examples/adaptive_iterator.cpp adaptive_iterator.cpp]]
+ [The adaptive iterator examples shows the usage of the adaptive iterators and how they can be used with C++11 lambdas.]]
+
+ [[[github_link libs/numeric/odeint/examples/bind_member_functions.cpp bind_member_functions.cpp]]
+ [This examples shows how member functions can be used as system functions in odeint.]]
+
+ [[[github_link libs/numeric/odeint/examples/bind_member_functions.cpp bind_member_functions_cpp11.cpp]]
+ [This examples shows how member functions can be used as system functions in odeint with `std::bind` in C++11.]]
+
+ [[[github_link libs/numeric/odeint/examples/bulirsch_stoer.cpp bulirsch_stoer.cpp]]
+ [Shows the usage of the Bulirsch-Stoer method.]]
+
+ [[[github_link libs/numeric/odeint/examples/chaotic_system.cpp chaotic_system.cpp]]
+ [The chaotic system examples integrates the Lorenz system and calculates the Lyapunov exponents.]]
+
+ [[[github_link libs/numeric/odeint/examples/const_step_iterator.cpp const_step_iterator.cpp]]
+ [The adaptive iterator examples shows the usage of the const step iterators and how they can be used with C++11 lambdas.]]
+
+ [[[github_link libs/numeric/odeint/examples/elliptic_functions.cpp elliptic_functions.cpp]]
+ [Example calculating the elliptic functions using Bulirsch-Stoer and Runge-Kutta-Dopri5 Steppers with dense output.]]
+
+ [[[github_link libs/numeric/odeint/examples/fpu.cpp fpu.cpp]]
+ [The Fermi-Pasta-Ulam (FPU) example shows how odeint can be used to integrate lattice systems.]]
+
+ [[[github_link libs/numeric/odeint/examples/generation_functions.cpp generation_functions.cpp]]
+ [Shows skeletal code on how to implemente own factory functions.]]
+
+ [[[github_link libs/numeric/odeint/examples/harmonic_oscillator.cpp harmonic_oscillator.cpp]]
+ [The harmonic oscillator examples gives a brief introduction to odeint and shows the usage of the classical Runge-Kutta-solvers.]]
+
+ [[[github_link libs/numeric/odeint/examples/harmonic_oscillator_units.cpp harmonic_oscillator_units.cpp]]
+ [This examples shows how __boost_units can be used with odeint.]]
+
+ [[[github_link libs/numeric/odeint/examples/heun.cpp heun.cpp]]
+ [The Heun example shows how an custom Runge-Kutta stepper can be created with odeint generic Runge-Kutta method.]]
+
+ [[[github_link libs/numeric/odeint/examples/list_lattice.cpp list_lattice.cpp]]
+ [Example of a phase lattice integration using `std::list` as state type.]]
+
+ [[[github_link libs/numeric/odeint/examples/lorenz_point.cpp lorenz_point.cpp]]
+ [Alternative way of integrating lorenz by using a self defined point3d data type as state type.]]
+
+ [[[github_link libs/numeric/odeint/examples/my_vector.cpp my_vector.cpp]]
+ [Simple example showing how to get odeint to work with a self-defined vector type.]]
+
+ [[[github_link libs/numeric/odeint/examples/phase_oscillator_ensemble.cpp phase_oscillator_ensemble.cpp]]
+ [The phase oscillator ensemble example shows how globally coupled oscillators can be analyzed and how statistical measures can be computed during integration.]]
+
+ [[[github_link libs/numeric/odeint/examples/resizing_lattice.cpp resizing_lattice.cpp]]
+ [Shows the strength of odeint's memory management by simulating a Hamiltonian system on an expanding lattice.]]
+
+ [[[github_link libs/numeric/odeint/examples/simple1d.cpp simple1d.cpp]]
+ [Integrating a simple, one-dimensional ODE showing the usage of integrate- and generate-functions.]]
+
+ [[[github_link libs/numeric/odeint/examples/solar_system.cpp solar_system.cpp]]
+ [The solar system example shows the usage of the symplectic solvers.]]
+
+ [[[github_link libs/numeric/odeint/examples/stepper_details.cpp stepper_details.cpp]]
+ [Trivial example showing the usability of the several stepper classes.]]
+
+ [[[github_link libs/numeric/odeint/examples/stiff_system.cpp stiff_system.cpp]]
+ [The stiff system example shows the usage of the stiff solvers using the Jacobian of the system function.]]
+
+ [[[github_link libs/numeric/odeint/examples/stochastic_euler.cpp stochastic_euler.cpp]]
+ [Implementation of a custom stepper - the stochastic euler - for solving stochastic differential equations.]]
+
+ [[[github_link libs/numeric/odeint/examples/stuart_landau.cpp stuart_landau.cpp]]
+ [The Stuart-Landau example shows how odeint can be used with complex state types.]]
+
+ [[[github_link libs/numeric/odeint/examples/two_dimensional_phase_lattice.cpp two_dimensional_phase_lattice.cpp]]
+ [The 2D phase oscillator example shows how a two-dimensional lattice works with odeint and how matrix types can be used as state types in odeint.]]
+
+ [[[github_link libs/numeric/odeint/examples/van_der_pol_stiff.cpp van_der_pol_stiff.cpp]]
+ [This stiff system example again shows the usage of the stiff solvers by integrating the van der Pol oscillator.]]
+
+ [[[github_link libs/numeric/odeint/examples/gmpxx/lorenz_gmpxx.cpp gmpxx/lorenz_gmpxx.cpp]]
+ [This examples integrates the Lorenz system by means of an arbitrary precision type.]]
+
+ [[[github_link libs/numeric/odeint/examples/mtl/gauss_packet.cpp mtl/gauss_packet.cpp]]
+ [The MTL-Gauss-packet example shows how the MTL can be easily used with odeint.]]
+
+ [[[github_link libs/numeric/odeint/examples/mtl/implicit_euler_mtl.cpp mtl/implicit_euler_mtl.cpp]]
+ [This examples shows the usage of the MTL implicit Euler method with a sparse matrix type.]]
+
+ [[[github_link libs/numeric/odeint/examples/thrust/phase_oscillator_ensemble.cu thrust/phase_oscillator_ensemble.cu]]
+ [The Thrust phase oscillator ensemble example shows how globally coupled oscillators can be analyzed with Thrust and CUDA, employing the power of modern graphic devices.]]
+
+ [[[github_link libs/numeric/odeint/examples/thrust/phase_oscillator_chain.cu thrust/phase_oscillator_chain.cu]]
+ [The Thrust phase oscillator chain example shows how chains of nearest neighbor coupled oscillators can be integrated with Thrust and odeint.]]
+
+ [[[github_link libs/numeric/odeint/examples/thrust/lorenz_parameters.cu thrust/lorenz_parameters.cu]]
+ [The Lorenz parameters examples show how ensembles of ordinary differential equations can be solved by means of Thrust to study
+ the dependence of an ODE on some parameters.]]
+
+ [[[github_link libs/numeric/odeint/examples/thrust/relaxation.cu thrust/relaxation.cu]]
+ [Another examples for the usage of Thrust.]]
+
+ [[[github_link libs/numeric/odeint/examples/ublas/lorenz_ublas.cpp ublas/lorenz_ublas.cpp]]
+ [This example shows how the ublas vector types can be used with odeint.]]
+
+ [[[github_link libs/numeric/odeint/examples/vexcl/lorenz_ensemble.cpp vexcl/lorenz_ensemble.cpp]]
+ [This example shows how the VexCL - a framework for OpenCL computation - can be used with odeint.]]
+
+ [[[github_link libs/numeric/odeint/examples/2d_lattice/spreading.cpp 2d_lattice/spreading.cpp]]
+ [This examples shows how a `vector< vector< T > >` can be used a state type for odeint and how a resizing mechanism of this state can be implemented.]]
+
+ [[[github_link libs/numeric/odeint/examples/quadmath/black_hole.cpp quadmath/black_hole.cpp]]
+ [This examples shows how gcc libquadmath can be used with odeint. It provides a high precision floating point type which is adapted to odeint in this example.]]
+
+]

Added: trunk/libs/numeric/odeint/doc/getting_started.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/numeric/odeint/doc/getting_started.qbk 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,143 @@
+[/============================================================================
+ Boost.odeint
+
+ Copyright (c) 2009-2012 Karsten Ahnert
+ Copyright (c) 2009-2012 Mario Mulansky
+
+ Use, modification and distribution is subject to 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)
+=============================================================================/]
+
+
+
+[section Getting started]
+
+[section Overview]
+
+[caution Boost.Numeric.Odeint is not an official boost library!]
+
+odeint is a library for solving initial value problems (IVP) of ordinary
+differential equations. Mathematically, these problems are formulated as
+follows:
+
+['x'(t) = f(x,t)], ['x(0) = x0].
+
+['x] and ['f] can be vectors and the solution is some function ['x(t)] fulfilling both equations above. In the following we will refer to ['x'(t)] also `dxdt` which is also our notation for the derivative in the source code.
+
+Ordinary differential equations occur nearly everywhere in natural sciences. For example, the whole Newtonian mechanics are described by second order differential equations. Be sure, you will find them in every discipline. They also occur if partial differential equations (PDEs) are discretized. Then, a system of coupled ordinary differential occurs, sometimes also referred as lattices ODEs.
+
+Numerical approximations for the solution ['x(t)] are calculated iteratively. The easiest algorithm is the Euler scheme, where starting at ['x(0)] one finds ['x(dt) = x(0) + dt f(x(0),0)]. Now one can use ['x(dt)] and obtain ['x(2dt)] in a similar way and so on. The Euler method is of order 1, that means the error at each step is ['~ dt[super 2]]. This is, of course, not very satisfying, which is why the Euler method is rarely used for real life problems and serves just as illustrative example.
+
+The main focus of odeint is to provide numerical methods implemented in a way where the algorithm is completely independent on the data structure used to represent the state /x/.
+In doing so, odeint is applicable for a broad variety of situations and it can be used with many other libraries. Besides the usual case where the state is defined as a `std::vector` or a `boost::array`, we provide native support for the following libraries:
+
+* __ublas
+* __thrust, making odeint naturally running on CUDA devices
+* gsl_vector for compatibility with the many numerical function in the GSL
+* __boost_range
+* __boost_fusion (the state type can be a fusion vector)
+* __boost_units
+* __intel_mkl for maximum performance
+* __vexcl for OpenCL
+* __boost_graph (still experimentally)
+
+In odeint, the following algorithms are implemented:
+
+[include stepper_table.qbk]
+
+[endsect]
+
+
+
+[section Usage, Compilation, Headers]
+
+odeint is a header-only library, no linking against pre-compiled code is required. It can be included by
+
+``
+#include <boost/numeric/odeint.hpp>
+``
+
+which includes all headers of the library. All functions and classes from odeint live in the namespace
+
+``
+ using namespace boost::numeric::odeint;
+``
+
+It is also possible to include only parts of the library. This is the recommended way since it saves a lot of compilation time.
+
+* `#include <boost/numeric/odeint/stepper/XYZ.hpp>` - the include path for all steppers, XYZ is a placeholder for a stepper.
+* `#include <boost/numeric/odeint/algebra/XYZ.hpp>` - all algebras.
+* `#include <boost/numeric/odeint/util/XYZ.hpp>` - the utility functions like `is_resizeable`, `same_size`, or `resize`.
+* `#include <boost/numeric/odeint/integrate/XYZ.hpp>` - the integrate routines.
+* `#include <boost/numeric/odeint/iterator/XYZ.hpp>` - the range and iterator functions.
+* `#include <boost/numeric/odeint/external/XYZ.hpp>` - any binders to external libraries.
+
+
+
+[endsect]
+
+[section Short Example]
+
+Imaging, you want to numerically integrate a harmonic oscillator with
+friction. The equations of motion are given by ['x'' = -x + __gamma x'].
+Odeint only deals with first order ODEs that have no higher derivatives than
+x' involved. However, any higher order ODE can be transformed to a system of
+first order ODEs by introducing the new variables ['q=x] and ['p=x'] such that ['w=(q,p)]. To apply numerical integration one first has to design the right hand side of the equation ['w' = f(w) = (p,-q+__gamma p)]:
+
+[import ../examples/harmonic_oscillator.cpp]
+[rhs_function]
+
+Here we chose `vector<double>` as the state type, but others are also
+possible, for example `boost::array<double,2>`. odeint is designed in such a
+way that you can easily use your own state types. Next, the ODE is defined
+which is in this case a simple function calculating ['f(x)]. The parameter
+signature of this function is crucial: the integration methods will always
+call them in the form `f(x, dxdt, t)` (there are exceptions for some special routines). So, even if there is no explicit time dependence, one has to define `t` as a function parameter.
+
+Now, we have to define the initial state from which the integration should start:
+
+[state_initialization]
+
+For the integration itself we'll use the `integrate` function, which is a convenient way to get quick results. It is based on the error-controlled `runge_kutta54_cash_karp` stepper (5th order) and uses adaptive step-size.
+
+[integration]
+
+The integrate function expects as parameters the rhs of the ode as defined
+above, the initial state `x`, the start-and end-time of the integration as
+well as the initial time step=size. Note, that `integrate` uses an adaptive step-size during
+the integration steps so the time points will not be equally spaced. The
+integration returns the number of steps that were applied and updates x which
+is set to the approximate solution of the ODE at the end of integration.
+
+It is also possible to represent the ode system as a class. The
+rhs must then be implemented as a functor - a class with an overloaded function call operator:
+
+[rhs_class]
+
+which can be used via
+
+[integration_class]
+
+In order to observe the solution
+during the integration steps all you have to do is
+to provide a reasonable observer. An example is
+
+[integrate_observer]
+
+which stores the intermediate steps in a container.
+Note, the argument structure of the ()-operator: odeint calls the observer
+exactly in this way, providing the current state and time. Now, you only have
+to pass this container to the integration function:
+
+[integrate_observ]
+
+That is all. You can use functional libraries like __boost_lambda or __boost_phoenix to ease the creation of observer functions.
+
+The full cpp file for this example can be found here: [github_link libs/numeric/odeint/examples/harmonic_oscillator.cpp harmonic_oscillator.cpp]
+
+
+
+[endsect]
+
+[endsect]

Added: trunk/libs/numeric/odeint/doc/html/logo.jpg
==============================================================================
Binary file. No diff available.

Added: trunk/libs/numeric/odeint/doc/html/phase_lattice_2d_0000.jpg
==============================================================================
Binary file. No diff available.

Added: trunk/libs/numeric/odeint/doc/html/phase_lattice_2d_0100.jpg
==============================================================================
Binary file. No diff available.

Added: trunk/libs/numeric/odeint/doc/html/phase_lattice_2d_1000.jpg
==============================================================================
Binary file. No diff available.

Added: trunk/libs/numeric/odeint/doc/html/solar_system.jpg
==============================================================================
Binary file. No diff available.

Added: trunk/libs/numeric/odeint/doc/literature.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/numeric/odeint/doc/literature.qbk 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,53 @@
+[/============================================================================
+ Boost.odeint
+
+ Copyright (c) 2009-2012 Karsten Ahnert
+ Copyright (c) 2009-2012 Mario Mulansky
+
+ Use, modification and distribution is subject to 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)
+=============================================================================/]
+
+
+[section Literature]
+
+[*General information about numerical integration of ordinary differential equations:]
+
+[#numerical_recipies]
+[1] Press William H et al., Numerical Recipes 3rd Edition: The Art of Scientific Computing, 3rd ed. (Cambridge University Press, 2007).
+
+[#hairer_solving_odes_1]
+[2] Ernst Hairer, Syvert P. Nørsett, and Gerhard Wanner, Solving Ordinary Differential Equations I: Nonstiff Problems, 2nd ed. (Springer, Berlin, 2009).
+
+[#hairer_solving_odes_2]
+[3] Ernst Hairer and Gerhard Wanner, Solving Ordinary Differential Equations II: Stiff and Differential-Algebraic Problems, 2nd ed. (Springer, Berlin, 2010).
+
+
+[*Symplectic integration of numerical integration:]
+
+[#hairer_geometrical_numeric_integration]
+[4] Ernst Hairer, Gerhard Wanner, and Christian Lubich, Geometric Numerical Integration: Structure-Preserving Algorithms for Ordinary Differential Equations, 2nd ed. (Springer-Verlag Gmbh, 2006).
+
+[#leimkuhler_reich_simulating_hamiltonian_dynamics]
+[5] Leimkuhler Benedict and Reich Sebastian, Simulating Hamiltonian Dynamics (Cambridge University Press, 2005).
+
+
+[*Special symplectic methods:]
+
+[#symplectic_yoshida_symplectic_integrators]
+[6] Haruo Yoshida, “Construction of higher order symplectic integrators,” Physics Letters A 150, no. 5 (November 12, 1990): 262-268.
+
+[#symplectic_mylachlan_symmetric_composition_mehtods]
+[7] Robert I. McLachlan, “On the numerical integration of ordinary differential equations by symmetric composition methods,” SIAM J. Sci. Comput. 16, no. 1 (1995): 151-168.
+
+
+[*Special systems:]
+
+[#fpu_scholarpedia]
+[8] [@http://www.scholarpedia.org/article/Fermi-Pasta-Ulam_nonlinear_lattice_oscillations Fermi-Pasta-Ulam nonlinear lattice oscillations]
+
+[#synchronization_pikovsky_rosenblum]
+[9] Arkady Pikovsky, Michael Rosemblum, and Jürgen Kurths, Synchronization: A Universal Concept in Nonlinear Sciences. (Cambridge University Press, 2001).
+
+[endsect]

Added: trunk/libs/numeric/odeint/doc/make_controlled_table.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/numeric/odeint/doc/make_controlled_table.qbk 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,20 @@
+[/============================================================================
+ Boost.odeint
+
+ Copyright (c) 2009-2012 Karsten Ahnert
+ Copyright (c) 2009-2012 Mario Mulansky
+
+ Use, modification and distribution is subject to 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)
+=============================================================================/]
+
+
+
+[table Generation functions make_controlled( abs_error , rel_error , stepper )
+ [[Stepper] [Result of make_controlled] [Remarks]]
+ [[`runge_kutta_cash_karp54`] [`controlled_runge_kutta< runge_kutta_cash_karp54 , default_error_checker<...> >`] [['a[sub x]=1], ['a[sub dxdt]=1]]]
+ [[`runge_kutta_fehlberg78`] [`controlled_runge_kutta< runge_kutta_fehlberg78 , default_error_checker<...> >`] [['a[sub x]=1], ['a[sub dxdt]=1]]]
+ [[`runge_kutta_dopri5`] [`controlled_runge_kutta< runge_kutta_dopri5 , default_error_checker<...> >`] [['a [sub x]=1], ['a[sub dxdt]=1]]]
+ [[`rosenbrock4`] [`rosenbrock4_controlled< rosenbrock4 >`] [-]]
+]

Added: trunk/libs/numeric/odeint/doc/make_dense_output_table.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/numeric/odeint/doc/make_dense_output_table.qbk 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,19 @@
+[/============================================================================
+ Boost.odeint
+
+ Copyright (c) 2009-2012 Karsten Ahnert
+ Copyright (c) 2009-2012 Mario Mulansky
+
+ Use, modification and distribution is subject to 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)
+=============================================================================/]
+
+
+
+[table Generation functions make_dense_output( abs_error , rel_error , stepper )
+ [[Stepper] [Result of make_dense_output] [Remarks]]
+ [[`runge_kutta_dopri5`] [`dense_output_runge_kutta< controlled_runge_kutta< runge_kutta_dopri5 , default_error_checker<...> > >`] [['a [sub x]=1], ['a[sub dxdt]=1]]]
+ [[`rosenbrock4`] [`rosenbrock4_dense_output< rosenbrock4_controller< rosenbrock4 > >`] [-]]
+]
+

Added: trunk/libs/numeric/odeint/doc/odeint.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/numeric/odeint/doc/odeint.qbk 2012-11-23 09:22:23 EST (Fri, 23 Nov 2012)
@@ -0,0 +1,237 @@
+[/============================================================================
+ Boost.odeint
+
+ Copyright (c) 2009-2012 Karsten Ahnert
+ Copyright (c) 2009-2012 Mario Mulansky
+
+ Use, modification and distribution is subject to 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)
+=============================================================================/]
+
+
+
+[library Boost.Numeric.Odeint
+ [quickbook 1.5]
+ [id odeint]
+ [dirname odeint]
+ [authors [Ahnert, Karsten], [Mulansky, Mario]]
+ [copyright 2009-2012 Karsten Ahnert and Mario Mulansky]
+ [category math]
+ [purpose
+ Numerical integration of ordinary differential equations.
+ ]
+ [license
+ 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 auto_index_helpers.qbk]
+
+
+
+[def __boost_lambda
+ [@http://www.boost.org/doc/libs/release/doc/html/lambda.html Boost.Lambda]]
+[def __boost_phoenix
+ [@http://www.boost.org/doc/libs/1_46_1/libs/spirit/phoenix/doc/html/index.html Boost.Phoenix]]
+[def __boost_operators
+ [@http://www.boost.org/doc/libs/release/doc/html/operators.html Boost.Operators]]
+[def __boost_ref
+ [@http://www.boost.org/doc/libs/release/doc/html/ref.html Boost.Ref]]
+[def __boost_range
+ [@http://www.boost.org/doc/libs/release/libs/range/index.html Boost.Range]]
+[def __boost_units
+ [@http://www.boost.org/doc/libs/release/libs/units/index.html Boost.Units]]
+[def __boost_fusion
+ [@http://www.boost.org/doc/libs/release/libs/fusion/index.html Boost.Fusion]]
+[def __boost_graph
+ [@http://www.boost.org/doc/libs/1_47_0/libs/graph/doc/table_of_contents.html Boost.Graph]]
+
+[def __thrust
+ [@http://code.google.com/p/thrust/ Thrust]]
+[def __ublas
+ [@http://www.boost.org/doc/libs/release/libs/numeric/ublas/index.html Boost.uBLAS]]
+[def __intel_mkl
+ [@http://software.intel.com/en-us/articles/intel-mkl/ Intel Math Kernel Library]]
+[def __gsl
+ [@http://www.gsl.org GSL]]
+[def __vexcl
+ [@https://github.com/ddemidov/vexcl VexCL]]
+
+[def __concepts
+ [link boost_numeric_odeint.concepts Concepts]]
+[def __system
+ [link boost_numeric_odeint.concepts.system System]]
+[def __symplectic_system
+ [link boost_numeric_odeint.concepts.symplectic_system Symplectic System]]
+[def __simple_symplectic_system
+ [link boost_numeric_odeint.concepts.simple_symplectic_system Simple Symplectic System]]
+[def __implicit_system
+ [link boost_numeric_odeint.concepts.implicit_system Implicit System]]
+[def __stepper
+ [link boost_numeric_odeint.concepts.stepper Stepper]]
+[def __error_stepper
+ [link boost_numeric_odeint.concepts.error_stepper Error Stepper]]
+[def __controlled_stepper
+ [link boost_numeric_odeint.concepts.controlled_stepper Controlled Stepper]]
+[def __dense_output_stepper
+ [link boost_numeric_odeint.concepts.dense_output_stepper Dense Output Stepper]]
+[def __integrate_functions
+ [link boost_numeric_odeint.odeint_in_detail.integrate_functions integrate functions]]
+[def __tutorial
+ [link boost_numeric_odeint.tutorial Tutorial]]
+[def __tut_solar_system
+ [link boost_numeric_odeint.tutorial.solar_system Solar System]]
+[def __tut_chaotic_system
+ [link boost_numeric_odeint.tutorial.chaotic_systems_and_lyapunov_exponents Chaotic System]]
+[def __tut_harmonic_oscillator
+ [link boost_numeric_odeint.tutorial.harmonic_oscillator Harmonic Oscillator]]
+[def __using_steppers
+ [link boost_numeric_odeint.odeint_in_detail.steppers.using_steppers Using steppers]]
+[def __generation_functions
+ [link boost_numeric_odeint.odeint_in_detail.generation_functions Generation functions]]
+[def __adapt_state_types
+ [link boost_numeric_odeint.odeint_in_detail.state_types__algebras_and_operations Adapt your own state types]]
+[def __resizing_lattice_example
+ [link boost_numeric_odeint.tutorial.self_expanding_lattices Self expanding lattices]]
+[def __odeint_stepper_table
+ [link boost_numeric_odeint.odeint_in_detail.steppers.stepper_overview Stepper overview]]
+
+
+
+[def __nr_ref [link numerical_recipies \[1\] ]]
+[def __hairer_1_ref [link hairer_solving_odes_1 \[2\] ]]
+[def __hairer_2_ref [link hairer_solving_odes_2 \[3\] ]]
+[def __hairer_geom_ref [link hairer_geometrical_numeric_integration \[4\] ]]
+[def __leimkuhler_reich_ref [link leimkuhler_reich_simulating_hamiltonian_dynamics \[5\] ]]
+[def __symplectic_integrator_1_ref [link symplectic_yoshida_symplectic_integrators \[6\] ]]
+[def __symplectic_integrator_2_ref [link symplectic_mylachlan_symmetric_composition_mehtods \[7\] ]]
+[def __fpu_scholarpedia_ref [link fpu_scholarpedia \[8\] ]]
+[def __synchronization_pikovsky_ref [link synchronization_pikovsky_rosenblum \[9\] ]]
+
+
+
+
+
+[def __alpha '''&#945;''']
+[def __beta '''&#946;''']
+[def __delta '''&#948;''']
+[def __Delta '''&#916;''']
+[def __lambda '''&#955;'''][/lower case]
+[def __Lambda '''&#923;'''][/upper case]
+[def __gamma '''&#947;''']
+[def __Gamma '''&#915;''']
+[def __sigma '''&#963;''']
+[def __Sigma '''&#931;''']
+[def __Omega '''&#937;''']
+[def __omega '''&#969;''']
+[def __phi '''&#966;''']
+[def __psi '''&ä968;''']
+[def __Phi '''&#934;''']
+[def __Psi '''&#936;''']
+[def __epsilon '''&#949;''']
+[def __eta '''&#951;''']
+[def __theta '''&#952;''']
+[def __Theta '''&#920;''']
+[def __xi '''&#958;''']
+
+[def __space '''&#8203;''']
+
+
+
+[template super[x]'''<superscript>'''[x]'''</superscript>''']
+[template sub[x]'''<subscript>'''[x]'''</subscript>''']
+[template subl[x]'''<subscript>'''__space[x]'''</subscript>''']
+
+[/ [template github_link[url text]'''<ulink url="https://github.com/headmyshoulder/odeint-v2/tree/master/'''[url]'''" target="_blank">'''[text]'''</ulink>''']]
+[template github_link[url text]'''<ulink url="../../../../../'''[url]'''" target="_blank">'''[text]'''</ulink>''']
+
+
+
+
+[include getting_started.qbk]
+
+[include tutorial.qbk]
+
+[include details.qbk]
+
+[include concepts.qbk]
+
+[include literature.qbk]
+
+[include acknowledgements.qbk]
+
+[xinclude reference.xml]
+
+[section:indexes Indexes]
+
+[named_index class_name Class Index]
+[named_index function_name Function Index]
+[/
+[named_index typedef_name Typedef Index]
+[named_index macro_name Macro Index]
+]
+[index]
+
+[endsect]
+
+
+
+
+[/
+# &Alpha; Α &#913; U+0391 Greek capital letter alpha
+# &Beta; Î’ &#914; U+0392 Greek capital letter beta
+# &Gamma; Γ &#915; U+0393 Greek capital letter gamma ISOgrk3
+# &Delta; Δ &#916; U+0394 Greek capital letter delta ISOgrk3
+# &Epsilon; Ε &#917; U+0395 Greek capital letter epsilon
+# &Zeta; Ζ &#918; U+0396 Greek capital letter zeta
+# &Eta; Η &#919; U+0397 Greek capital letter eta
+# &Theta; Θ &#920; U+0398 Greek capital letter theta ISOgrk3
+# &Iota; Ι &#921; U+0399 Greek capital letter iota
+# &Kappa; Κ &#922; U+039A Greek capital letter kappa
+# &Lambda; Λ &#923; U+039B Greek capital letter lambda ISOgrk3
+# &Mu; Μ &#924; U+039C Greek capital letter mu
+# &Nu; Ν &#925; U+039D Greek capital letter nu
+# &Xi; Ξ &#926; U+039E Greek capital letter xi ISOgrk3
+# &Omicron; Ο &#927; U+039F Greek capital letter omicron
+# &Pi; Π &#928; U+03A0 Greek capital letter pi ISOgrk3
+# &Rho; Ρ &#929; U+03A1 Greek capital letter rho
+# &Sigma; Σ &#931; U+03A3 Greek capital letter sigma ISOgrk3
+# &Tau; Τ &#932; U+03A4 Greek capital letter tau
+# &Upsilon; Υ &#933; U+03A5 Greek capital letter upsilon ISOgrk3
+# &Phi; Φ &#934; U+03A6 Greek capital letter phi ISOgrk3
+# &Chi; Χ &#935; U+03A7 Greek capital letter chi
+# &Psi; Ψ &#936; U+03A8 Greek capital letter psi ISOgrk3
+# &Omega; Ω &#937; U+03A9 Greek capital letter omega ISOgrk3
+# &alpha; α &#945; U+03B1 Greek small letter alpha ISOgrk3
+# &beta; β &#946; U+03B2 Greek small letter beta ISOgrk3
+# &gamma; γ &#947; U+03B3 Greek small letter gamma ISOgrk3
+# &delta; δ &#948; U+03B4 Greek small letter delta ISOgrk3
+# &epsilon; ε &#949; U+03B5 Greek small letter epsilon ISOgrk3
+# &zeta; ζ &#950; U+03B6 Greek small letter zeta ISOgrk3
+# &eta; η &#951; U+03B7 Greek small letter eta ISOgrk3
+# &theta; θ &#952; U+03B8 Greek small letter theta ISOgrk3
+# &iota; ι &#953; U+03B9 Greek small letter iota ISOgrk3
+# &kappa; κ &#954; U+03BA Greek small letter kappa ISOgrk3
+# &lambda; λ &#955; U+03BB Greek small letter lambda ISOgrk3 <