...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Home  Libraries  People  FAQ  More 
boost::numeric::odeint::bulirsch_stoer — The BulirschStoer algorithm.
// In header: <boost/numeric/odeint/stepper/bulirsch_stoer.hpp> template<typename State, typename Value = double, typename Deriv = State, typename Time = Value, typename Algebra = range_algebra, typename Operations = default_operations, typename Resizer = initially_resizer> class bulirsch_stoer { public: // types 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; // construct/copy/destruct bulirsch_stoer(value_type = 1E6, value_type = 1E6, value_type = 1.0, value_type = 1.0); // public member functions template<typename System, typename StateInOut> controlled_step_result try_step(System, StateInOut &, time_type &, time_type &); template<typename System, typename StateInOut> controlled_step_result try_step(System, const StateInOut &, time_type &, time_type &); template<typename System, typename StateInOut, typename DerivIn> controlled_step_result try_step(System, StateInOut &, const DerivIn &, time_type &, time_type &); template<typename System, typename StateIn, typename StateOut> boost::disable_if< boost::is_same< StateIn, time_type >, controlled_step_result >::type try_step(System, const StateIn &, time_type &, StateOut &, time_type &); template<typename System, typename StateIn, typename DerivIn, typename StateOut> controlled_step_result try_step(System, const StateIn &, const DerivIn &, time_type &, StateOut &, time_type &); void reset(); template<typename StateIn> void adjust_size(const StateIn &); // private member functions template<typename StateIn> bool resize_m_dxdt(const StateIn &); template<typename StateIn> bool resize_m_xnew(const StateIn &); template<typename StateIn> bool resize_impl(const StateIn &); template<typename System, typename StateInOut> controlled_step_result try_step_v1(System, StateInOut &, time_type &, time_type &); template<typename StateInOut> void extrapolate(size_t, state_table_type &, const value_matrix &, StateInOut &); time_type calc_h_opt(time_type, value_type, size_t) const; controlled_step_result set_k_opt(size_t, const inv_time_vector &, const time_vector &, time_type &); bool in_convergence_window(size_t) const; bool should_reject(value_type, size_t) const; // public data members static const size_t m_k_max; };
The BulirschStoer is a controlled stepper that adjusts both step size and order of the method. The algorithm uses the modified midpoint and a polynomial extrapolation compute the solution.
typename State
The state type.
typename Value = double
The value type.
typename Deriv = State
The type representing the time derivative of the state.
typename Time = Value
The time representing the independent variable  the time.
typename Algebra = range_algebra
The algebra type.
typename Operations = default_operations
The operations type.
typename Resizer = initially_resizer
The resizer policy type.
bulirsch_stoer
public
construct/copy/destructbulirsch_stoer(value_type eps_abs = 1E6, value_type eps_rel = 1E6, value_type factor_x = 1.0, value_type factor_dxdt = 1.0);Constructs the
bulirsch_stoer
class, including initialization of the error bounds.
Parameters: 

bulirsch_stoer
public member functionstemplate<typename System, typename StateInOut> controlled_step_result try_step(System system, StateInOut & x, time_type & t, time_type & dt);Tries to perform one step.
This method tries to do one step with step size dt. If the error estimate is to large, the step is rejected and the method returns fail and the step size dt is reduced. If the error estimate is acceptably small, the step is performed, success is returned and dt might be increased to make the steps as large as possible. This method also updates t if a step is performed. Also, the internal order of the stepper is adjusted if required.
Parameters: 


Returns: 
success if the step was accepted, fail otherwise. 
template<typename System, typename StateInOut> controlled_step_result try_step(System system, const StateInOut & x, time_type & t, time_type & dt);Second version to solve the forwarding problem, can be used with Boost.Range as StateInOut.
template<typename System, typename StateInOut, typename DerivIn> controlled_step_result try_step(System system, StateInOut & x, const DerivIn & dxdt, time_type & t, time_type & dt);Tries to perform one step.
This method tries to do one step with step size dt. If the error estimate is to large, the step is rejected and the method returns fail and the step size dt is reduced. If the error estimate is acceptably small, the step is performed, success is returned and dt might be increased to make the steps as large as possible. This method also updates t if a step is performed. Also, the internal order of the stepper is adjusted if required.
Parameters: 


Returns: 
success if the step was accepted, fail otherwise. 
template<typename System, typename StateIn, typename StateOut> 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);Tries to perform one step.
Note  

This method is disabled if state_type=time_type to avoid ambiguity. 
This method tries to do one step with step size dt. If the error estimate is to large, the step is rejected and the method returns fail and the step size dt is reduced. If the error estimate is acceptably small, the step is performed, success is returned and dt might be increased to make the steps as large as possible. This method also updates t if a step is performed. Also, the internal order of the stepper is adjusted if required.
Parameters: 


Returns: 
success if the step was accepted, fail otherwise. 
template<typename System, typename StateIn, typename DerivIn, typename StateOut> controlled_step_result try_step(System system, const StateIn & in, const DerivIn & dxdt, time_type & t, StateOut & out, time_type & dt);Tries to perform one step.
This method tries to do one step with step size dt. If the error estimate is to large, the step is rejected and the method returns fail and the step size dt is reduced. If the error estimate is acceptably small, the step is performed, success is returned and dt might be increased to make the steps as large as possible. This method also updates t if a step is performed. Also, the internal order of the stepper is adjusted if required.
Parameters: 


Returns: 
success if the step was accepted, fail otherwise. 
void reset();Resets the internal state of the stepper.
template<typename StateIn> void adjust_size(const StateIn & x);Adjust the size of all temporaries in the stepper manually.
Parameters: 

bulirsch_stoer
private member functionstemplate<typename StateIn> bool resize_m_dxdt(const StateIn & x);
template<typename StateIn> bool resize_m_xnew(const StateIn & x);
template<typename StateIn> bool resize_impl(const StateIn & x);
template<typename System, typename StateInOut> controlled_step_result try_step_v1(System system, StateInOut & x, time_type & t, time_type & dt);
template<typename StateInOut> void extrapolate(size_t k, state_table_type & table, const value_matrix & coeff, StateInOut & xest);
time_type calc_h_opt(time_type h, value_type error, size_t k) const;
controlled_step_result set_k_opt(size_t k, const inv_time_vector & work, const time_vector & h_opt, time_type & dt);
bool in_convergence_window(size_t k) const;
bool should_reject(value_type error, size_t k) const;