From 8d4cfdeef3c4e9402b2b8a08b4d556333ea69d63 Mon Sep 17 00:00:00 2001 From: mariomulansky Date: Wed, 9 Jan 2013 22:49:32 +0100 Subject: [PATCH] adjustments in tutorial doc regarding algebra_dispatcher --- .../odeint/doc/tutorial_chaotic_system.qbk | 7 ++++++- .../odeint/doc/tutorial_special_topics.qbk | 21 +++++++++---------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/libs/numeric/odeint/doc/tutorial_chaotic_system.qbk b/libs/numeric/odeint/doc/tutorial_chaotic_system.qbk index b90d8c13..11297f3b 100644 --- a/libs/numeric/odeint/doc/tutorial_chaotic_system.qbk +++ b/libs/numeric/odeint/doc/tutorial_chaotic_system.qbk @@ -102,7 +102,8 @@ void lorenz_with_lyap( const state_type &x , state_type &dxdt , double t ) This works fine and `lorenz_with_lyap` can be used for example via `` state_type x; -// initialize x +// initialize x.. + explicit_rk4< state_type > rk4; integrate_n_steps( rk4 , lorenz_with_lyap , x , 0.0 , 0.01 , 1000 ); `` @@ -142,6 +143,10 @@ range including only the first 3 components of ['x]: [integrate_transients_with_range] +Note that when using __boost_range, we have to explicitly configure the +stepper to use the `range_algebra` as otherwise odeint would automatically +chose the `array_algebra` because the original state_type is an `array`. + Having integrated a sufficient number of transients steps we are now able to calculate the Lyapunov exponents: # Initialize the perturbations. They are stored linearly behind the state of the Lorenz system. The perturbations are initialized such that [' p [subl ij] = __delta [subl ij]], where ['p [subl ij]] is the ['j]-component of the ['i].-th perturbation and ['__delta [subl ij]] is the Kronecker symbol. diff --git a/libs/numeric/odeint/doc/tutorial_special_topics.qbk b/libs/numeric/odeint/doc/tutorial_special_topics.qbk index f8f8e9ec..0f2b7768 100644 --- a/libs/numeric/odeint/doc/tutorial_special_topics.qbk +++ b/libs/numeric/odeint/doc/tutorial_special_topics.qbk @@ -36,20 +36,17 @@ We strongly recommend to use the first ansatz. In this case you have explicit co When choosing the stepper type one has to account for the "unusual" state type: it is a single `complex` opposed to the vector types used in the previous examples. This means that no iterations over vector elements have to -be performed inside the stepper algorithm. You can enforce this by supplying -additional template arguments to the stepper including the -`vector_space_algebra`. Details on the usage of algebras can be found in the -section __adapt_state_types. +be performed inside the stepper algorithm. Odeint already detects that and +automatically uses the `vector_space_algebra` for computation. +You can enforce this by supplying additional template arguments to the stepper +including the `vector_space_algebra`. Details on the usage of algebras can be +found in the section __adapt_state_types. [stuart_landau_integration] The full cpp file for the Stuart-Landau example can be found here [github_link libs/numeric/odeint/examples/stuart_landau.cpp stuart_landau.cpp] -[note The fact that we have to configure a different algebra is solely due to -the fact that we use a non-vector state type and not to the usage of complex -values. So for, e.g. `vector< complex >`, this would not be required.] - [endsect] [section Lattice systems] @@ -145,12 +142,14 @@ differential equation which is completely equivalent to the example in __tut_har [units_define_ode] Next, we instantiate an appropriate stepper. We must explicitly parametrize -the stepper with the `state_type`, `deriv_type`, `time_type`. Furthermore, the -iteration over vector elements is now done by the `fusion_algebra` which must -also be given. For more on the state types / algebras see chapter __adapt_state_types. +the stepper with the `state_type`, `deriv_type`, `time_type`. [units_define_stepper] +[note When using compile-time sequences, the iteration over vector elements is +done by the `fusion_algebra`, which is automatically chosen by odeint. For +more on the state types / algebras see chapter __adapt_state_types.] + It is quite easy but the compilation time might take very long. Furthermore, the observer is defined a bit different [units_observer]