| Home | Libraries | People | FAQ | More

## Class template bulirsch_stoer

boost::numeric::odeint::bulirsch_stoer — The Bulirsch-Stoer algorithm.

## Synopsis

    // In header: <boost/numeric/odeint/stepper/bulirsch_stoer.hpp>

    template<typename State, typename Value = double, typename Deriv = State,
             typename Time = Value,
             typename Algebra = typename algebra_dispatcher< State >::algebra_type,
             typename Operations = typename operations_dispatcher< State >::operations_type,
             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 = 1E-6, value_type = 1E-6, value_type = 1.0,
                     value_type = 1.0, time_type = static_cast< time_type >(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;
    };

## Description

The Bulirsch-Stoer 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.

### Template Parameters

1.     typename State

   The state type.

2.     typename Value = double

   The value type.

3.     typename Deriv = State

   The type representing the time derivative of the state.

4.     typename Time = Value

   The time representing the independent variable - the time.

5.     typename Algebra = typename algebra_dispatcher< State >::algebra_type

   The algebra type.

6.     typename Operations = typename operations_dispatcher< State >::operations_type

   The operations type.

7.     typename Resizer = initially_resizer

   The resizer policy type.

### `bulirsch_stoer` public construct/copy/destruct

1.     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,
                      time_type max_dt = static_cast< time_type >(0));

   Constructs the `bulirsch_stoer` class, including initialization of the error bounds.

   Parameters: |
   `eps_abs` | Absolute tolerance level.
   `eps_rel` | Relative tolerance level.
   `factor_dxdt` | Factor for the weight of the derivative.
   `factor_x` | Factor for the weight of the state.

### `bulirsch_stoer` public member functions

1.     template<typename System, typename StateInOut>
         controlled_step_result
         try_step(System system, StateInOut & x, time_type & t, time_type & dt);

2.     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.

3.     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);

4.     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);

5.     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);

6.     void reset();

   Resets the internal state of the stepper.

7.     template<typename StateIn> void adjust_size(const StateIn & x);

   Adjust the size of all temporaries in the stepper manually.

   Parameters: |
   `x` | A state from which the size of the temporaries to be resized is deduced.

### `bulirsch_stoer` private member functions

1.     template<typename StateIn> bool resize_m_dxdt(const StateIn & x);

2.     template<typename StateIn> bool resize_m_xnew(const StateIn & x);

3.     template<typename StateIn> bool resize_impl(const StateIn & x);

4.     template<typename System, typename StateInOut>
         controlled_step_result
         try_step_v1(System system, StateInOut & x, time_type & t, time_type & dt);

5.     template<typename StateInOut>
         void extrapolate(size_t k, state_table_type & table,
                          const value_matrix & coeff, StateInOut & xest);

6.     time_type calc_h_opt(time_type h, value_type error, size_t k) const;

7.     controlled_step_result
       set_k_opt(size_t k, const inv_time_vector & work, const time_vector & h_opt,
                 time_type & dt);

8.     bool in_convergence_window(size_t k) const;

9.     bool should_reject(value_type error, size_t k) const;