1 /* 2 [auto_generated] 3 boost/numeric/odeint/stepper/bulirsch_stoer.hpp 4 5 [begin_description] 6 Implementation of the Burlish-Stoer method. As described in 7 Ernst Hairer, Syvert Paul Norsett, Gerhard Wanner 8 Solving Ordinary Differential Equations I. Nonstiff Problems. 9 Springer Series in Comput. Mathematics, Vol. 8, Springer-Verlag 1987, Second revised edition 1993. 10 [end_description] 11 12 Copyright 2011-2013 Mario Mulansky 13 Copyright 2011-2013 Karsten Ahnert 14 Copyright 2012 Christoph Koke 15 16 Distributed under the Boost Software License, Version 1.0. 17 (See accompanying file LICENSE_1_0.txt or 18 copy at http://www.boost.org/LICENSE_1_0.txt) 19 */ 20 21 22 #ifndef BOOST_NUMERIC_ODEINT_STEPPER_BULIRSCH_STOER_HPP_INCLUDED 23 #define BOOST_NUMERIC_ODEINT_STEPPER_BULIRSCH_STOER_HPP_INCLUDED 24 25 26 #include <iostream> 27 28 #include <algorithm> 29 30 #include <boost/config.hpp> // for min/max guidelines 31 32 #include <boost/numeric/odeint/util/bind.hpp> 33 #include <boost/numeric/odeint/util/unwrap_reference.hpp> 34 35 #include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp> 36 #include <boost/numeric/odeint/stepper/modified_midpoint.hpp> 37 #include <boost/numeric/odeint/stepper/controlled_step_result.hpp> 38 #include <boost/numeric/odeint/algebra/range_algebra.hpp> 39 #include <boost/numeric/odeint/algebra/default_operations.hpp> 40 #include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp> 41 #include <boost/numeric/odeint/algebra/operations_dispatcher.hpp> 42 43 #include <boost/numeric/odeint/util/state_wrapper.hpp> 44 #include <boost/numeric/odeint/util/is_resizeable.hpp> 45 #include <boost/numeric/odeint/util/resizer.hpp> 46 #include <boost/numeric/odeint/util/unit_helper.hpp> 47 #include <boost/numeric/odeint/util/detail/less_with_sign.hpp> 48 49 namespace boost { 50 namespace numeric { 51 namespace odeint { 52 53 template< 54 class State , 55 class Value = double , 56 class Deriv = State , 57 class Time = Value , 58 class Algebra = typename algebra_dispatcher< State >::algebra_type , 59 class Operations = typename operations_dispatcher< State >::operations_type , 60 class Resizer = initially_resizer 61 > 62 class bulirsch_stoer { 63 64 public: 65 66 typedef State state_type; 67 typedef Value value_type; 68 typedef Deriv deriv_type; 69 typedef Time time_type; 70 typedef Algebra algebra_type; 71 typedef Operations operations_type; 72 typedef Resizer resizer_type; 73 #ifndef DOXYGEN_SKIP 74 typedef state_wrapper< state_type > wrapped_state_type; 75 typedef state_wrapper< deriv_type > wrapped_deriv_type; 76 typedef controlled_stepper_tag stepper_category; 77 78 typedef bulirsch_stoer< State , Value , Deriv , Time , Algebra , Operations , Resizer > controlled_error_bs_type; 79 80 typedef typename inverse_time< time_type >::type inv_time_type; 81 82 typedef std::vector< value_type > value_vector; 83 typedef std::vector< time_type > time_vector; 84 typedef std::vector< inv_time_type > inv_time_vector; //should be 1/time_type for boost.units 85 typedef std::vector< value_vector > value_matrix; 86 typedef std::vector< size_t > int_vector; 87 typedef std::vector< wrapped_state_type > state_table_type; 88 #endif //DOXYGEN_SKIP 89 const static size_t m_k_max = 8; 90 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)91 bulirsch_stoer( 92 value_type eps_abs = 1E-6 , value_type eps_rel = 1E-6 , 93 value_type factor_x = 1.0 , value_type factor_dxdt = 1.0 ) 94 : m_error_checker( eps_abs , eps_rel , factor_x, factor_dxdt ) , m_midpoint() , 95 m_last_step_rejected( false ) , m_first( true ) , 96 m_interval_sequence( m_k_max+1 ) , 97 m_coeff( m_k_max+1 ) , 98 m_cost( m_k_max+1 ) , 99 m_table( m_k_max ) , 100 STEPFAC1( 0.65 ) , STEPFAC2( 0.94 ) , STEPFAC3( 0.02 ) , STEPFAC4( 4.0 ) , KFAC1( 0.8 ) , KFAC2( 0.9 ) 101 { 102 BOOST_USING_STD_MIN(); 103 BOOST_USING_STD_MAX(); 104 /* initialize sequence of stage numbers and work */ 105 for( unsigned short i = 0; i < m_k_max+1; i++ ) 106 { 107 m_interval_sequence[i] = 2 * (i+1); 108 if( i == 0 ) 109 m_cost[i] = m_interval_sequence[i]; 110 else 111 m_cost[i] = m_cost[i-1] + m_interval_sequence[i]; 112 m_coeff[i].resize(i); 113 for( size_t k = 0 ; k < i ; ++k ) 114 { 115 const value_type r = static_cast< value_type >( m_interval_sequence[i] ) / static_cast< value_type >( m_interval_sequence[k] ); 116 m_coeff[i][k] = 1.0 / ( r*r - static_cast< value_type >( 1.0 ) ); // coefficients for extrapolation 117 } 118 119 // crude estimate of optimal order 120 121 m_current_k_opt = 4; 122 /* no calculation because log10 might not exist for value_type! 123 const value_type logfact( -log10( max BOOST_PREVENT_MACRO_SUBSTITUTION( eps_rel , static_cast< value_type >(1.0E-12) ) ) * 0.6 + 0.5 ); 124 m_current_k_opt = max BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<value_type>( 1 ) , min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<value_type>( m_k_max-1 ) , logfact )); 125 */ 126 } 127 128 } 129 130 131 /* 132 * Version 1 : try_step( sys , x , t , dt ) 133 * 134 * The overloads are needed to solve the forwarding problem 135 */ 136 template< class System , class StateInOut > try_step(System system,StateInOut & x,time_type & t,time_type & dt)137 controlled_step_result try_step( System system , StateInOut &x , time_type &t , time_type &dt ) 138 { 139 return try_step_v1( system , x , t, dt ); 140 } 141 142 /** 143 * \brief Second version to solve the forwarding problem, can be used with Boost.Range as StateInOut. 144 */ 145 template< class System , class StateInOut > try_step(System system,const StateInOut & x,time_type & t,time_type & dt)146 controlled_step_result try_step( System system , const StateInOut &x , time_type &t , time_type &dt ) 147 { 148 return try_step_v1( system , x , t, dt ); 149 } 150 151 /* 152 * Version 2 : try_step( sys , x , dxdt , t , dt ) 153 * 154 * this version does not solve the forwarding problem, boost.range can not be used 155 */ 156 template< class System , class StateInOut , class DerivIn > try_step(System system,StateInOut & x,const DerivIn & dxdt,time_type & t,time_type & dt)157 controlled_step_result try_step( System system , StateInOut &x , const DerivIn &dxdt , time_type &t , time_type &dt ) 158 { 159 m_xnew_resizer.adjust_size( x , detail::bind( &controlled_error_bs_type::template resize_m_xnew< StateInOut > , detail::ref( *this ) , detail::_1 ) ); 160 controlled_step_result res = try_step( system , x , dxdt , t , m_xnew.m_v , dt ); 161 if( res == success ) 162 { 163 boost::numeric::odeint::copy( m_xnew.m_v , x ); 164 } 165 return res; 166 } 167 168 /* 169 * Version 3 : try_step( sys , in , t , out , dt ) 170 * 171 * this version does not solve the forwarding problem, boost.range can not be used 172 */ 173 template< class System , class StateIn , class StateOut > 174 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)175 try_step( System system , const StateIn &in , time_type &t , StateOut &out , time_type &dt ) 176 { 177 typename odeint::unwrap_reference< System >::type &sys = system; 178 m_dxdt_resizer.adjust_size( in , detail::bind( &controlled_error_bs_type::template resize_m_dxdt< StateIn > , detail::ref( *this ) , detail::_1 ) ); 179 sys( in , m_dxdt.m_v , t ); 180 return try_step( system , in , m_dxdt.m_v , t , out , dt ); 181 } 182 183 184 /* 185 * Full version : try_step( sys , in , dxdt_in , t , out , dt ) 186 * 187 * contains the actual implementation 188 */ 189 template< class System , class StateIn , class DerivIn , class StateOut > try_step(System system,const StateIn & in,const DerivIn & dxdt,time_type & t,StateOut & out,time_type & dt)190 controlled_step_result try_step( System system , const StateIn &in , const DerivIn &dxdt , time_type &t , StateOut &out , time_type &dt ) 191 { 192 BOOST_USING_STD_MIN(); 193 BOOST_USING_STD_MAX(); 194 195 static const value_type val1( 1.0 ); 196 197 if( m_resizer.adjust_size( in , detail::bind( &controlled_error_bs_type::template resize_impl< StateIn > , detail::ref( *this ) , detail::_1 ) ) ) 198 { 199 reset(); // system resized -> reset 200 } 201 202 if( dt != m_dt_last ) 203 { 204 reset(); // step size changed from outside -> reset 205 } 206 207 bool reject( true ); 208 209 time_vector h_opt( m_k_max+1 ); 210 inv_time_vector work( m_k_max+1 ); 211 212 time_type new_h = dt; 213 214 /* m_current_k_opt is the estimated current optimal stage number */ 215 for( size_t k = 0 ; k <= m_current_k_opt+1 ; k++ ) 216 { 217 /* the stage counts are stored in m_interval_sequence */ 218 m_midpoint.set_steps( m_interval_sequence[k] ); 219 if( k == 0 ) 220 { 221 m_midpoint.do_step( system , in , dxdt , t , out , dt ); 222 /* the first step, nothing more to do */ 223 } 224 else 225 { 226 m_midpoint.do_step( system , in , dxdt , t , m_table[k-1].m_v , dt ); 227 extrapolate( k , m_table , m_coeff , out ); 228 // get error estimate 229 m_algebra.for_each3( m_err.m_v , out , m_table[0].m_v , 230 typename operations_type::template scale_sum2< value_type , value_type >( val1 , -val1 ) ); 231 const value_type error = m_error_checker.error( m_algebra , in , dxdt , m_err.m_v , dt ); 232 h_opt[k] = calc_h_opt( dt , error , k ); 233 work[k] = static_cast<value_type>( m_cost[k] ) / h_opt[k]; 234 235 if( (k == m_current_k_opt-1) || m_first ) 236 { // convergence before k_opt ? 237 if( error < 1.0 ) 238 { 239 //convergence 240 reject = false; 241 if( (work[k] < KFAC2*work[k-1]) || (m_current_k_opt <= 2) ) 242 { 243 // leave order as is (except we were in first round) 244 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 ) ); 245 new_h = h_opt[k]; 246 new_h *= static_cast<value_type>( m_cost[k+1] ) / static_cast<value_type>( m_cost[k] ); 247 } else { 248 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) ) ); 249 new_h = h_opt[k]; 250 } 251 break; 252 } 253 else if( should_reject( error , k ) && !m_first ) 254 { 255 reject = true; 256 new_h = h_opt[k]; 257 break; 258 } 259 } 260 if( k == m_current_k_opt ) 261 { // convergence at k_opt ? 262 if( error < 1.0 ) 263 { 264 //convergence 265 reject = false; 266 if( (work[k-1] < KFAC2*work[k]) ) 267 { 268 m_current_k_opt = max BOOST_PREVENT_MACRO_SUBSTITUTION( 2 , static_cast<int>(m_current_k_opt)-1 ); 269 new_h = h_opt[m_current_k_opt]; 270 } 271 else if( (work[k] < KFAC2*work[k-1]) && !m_last_step_rejected ) 272 { 273 m_current_k_opt = min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<int>(m_k_max-1) , static_cast<int>(m_current_k_opt)+1 ); 274 new_h = h_opt[k]; 275 new_h *= m_cost[m_current_k_opt]/m_cost[k]; 276 } else 277 new_h = h_opt[m_current_k_opt]; 278 break; 279 } 280 else if( should_reject( error , k ) ) 281 { 282 reject = true; 283 new_h = h_opt[m_current_k_opt]; 284 break; 285 } 286 } 287 if( k == m_current_k_opt+1 ) 288 { // convergence at k_opt+1 ? 289 if( error < 1.0 ) 290 { //convergence 291 reject = false; 292 if( work[k-2] < KFAC2*work[k-1] ) 293 m_current_k_opt = max BOOST_PREVENT_MACRO_SUBSTITUTION( 2 , static_cast<int>(m_current_k_opt)-1 ); 294 if( (work[k] < KFAC2*work[m_current_k_opt]) && !m_last_step_rejected ) 295 m_current_k_opt = min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<int>(m_k_max)-1 , static_cast<int>(k) ); 296 new_h = h_opt[m_current_k_opt]; 297 } else 298 { 299 reject = true; 300 new_h = h_opt[m_current_k_opt]; 301 } 302 break; 303 } 304 } 305 } 306 307 if( !reject ) 308 { 309 t += dt; 310 } 311 312 if( !m_last_step_rejected || boost::numeric::odeint::detail::less_with_sign(new_h, dt, dt) ) 313 { 314 m_dt_last = new_h; 315 dt = new_h; 316 } 317 318 m_last_step_rejected = reject; 319 m_first = false; 320 321 if( reject ) 322 return fail; 323 else 324 return success; 325 } 326 327 /** \brief Resets the internal state of the stepper */ reset()328 void reset() 329 { 330 m_first = true; 331 m_last_step_rejected = false; 332 } 333 334 335 /* Resizer methods */ 336 337 template< class StateIn > adjust_size(const StateIn & x)338 void adjust_size( const StateIn &x ) 339 { 340 resize_m_dxdt( x ); 341 resize_m_xnew( x ); 342 resize_impl( x ); 343 m_midpoint.adjust_size( x ); 344 } 345 346 347 private: 348 349 template< class StateIn > resize_m_dxdt(const StateIn & x)350 bool resize_m_dxdt( const StateIn &x ) 351 { 352 return adjust_size_by_resizeability( m_dxdt , x , typename is_resizeable<deriv_type>::type() ); 353 } 354 355 template< class StateIn > resize_m_xnew(const StateIn & x)356 bool resize_m_xnew( const StateIn &x ) 357 { 358 return adjust_size_by_resizeability( m_xnew , x , typename is_resizeable<state_type>::type() ); 359 } 360 361 template< class StateIn > resize_impl(const StateIn & x)362 bool resize_impl( const StateIn &x ) 363 { 364 bool resized( false ); 365 for( size_t i = 0 ; i < m_k_max ; ++i ) 366 resized |= adjust_size_by_resizeability( m_table[i] , x , typename is_resizeable<state_type>::type() ); 367 resized |= adjust_size_by_resizeability( m_err , x , typename is_resizeable<state_type>::type() ); 368 return resized; 369 } 370 371 372 template< class System , class StateInOut > try_step_v1(System system,StateInOut & x,time_type & t,time_type & dt)373 controlled_step_result try_step_v1( System system , StateInOut &x , time_type &t , time_type &dt ) 374 { 375 typename odeint::unwrap_reference< System >::type &sys = system; 376 m_dxdt_resizer.adjust_size( x , detail::bind( &controlled_error_bs_type::template resize_m_dxdt< StateInOut > , detail::ref( *this ) , detail::_1 ) ); 377 sys( x , m_dxdt.m_v ,t ); 378 return try_step( system , x , m_dxdt.m_v , t , dt ); 379 } 380 381 382 template< class StateInOut > extrapolate(size_t k,state_table_type & table,const value_matrix & coeff,StateInOut & xest)383 void extrapolate( size_t k , state_table_type &table , const value_matrix &coeff , StateInOut &xest ) 384 /* polynomial extrapolation, see http://www.nr.com/webnotes/nr3web21.pdf 385 uses the obtained intermediate results to extrapolate to dt->0 386 */ 387 { 388 static const value_type val1 = static_cast< value_type >( 1.0 ); 389 for( int j=k-1 ; j>0 ; --j ) 390 { 391 m_algebra.for_each3( table[j-1].m_v , table[j].m_v , table[j-1].m_v , 392 typename operations_type::template scale_sum2< value_type , value_type >( val1 + coeff[k][j] , -coeff[k][j] ) ); 393 } 394 m_algebra.for_each3( xest , table[0].m_v , xest , 395 typename operations_type::template scale_sum2< value_type , value_type >( val1 + coeff[k][0] , -coeff[k][0]) ); 396 } 397 calc_h_opt(time_type h,value_type error,size_t k) const398 time_type calc_h_opt( time_type h , value_type error , size_t k ) const 399 /* calculates the optimal step size for a given error and stage number */ 400 { 401 BOOST_USING_STD_MIN(); 402 BOOST_USING_STD_MAX(); 403 using std::pow; 404 value_type expo( 1.0/(2*k+1) ); 405 value_type facmin = pow BOOST_PREVENT_MACRO_SUBSTITUTION( STEPFAC3 , expo ); 406 value_type fac; 407 if (error == 0.0) 408 fac=1.0/facmin; 409 else 410 { 411 fac = STEPFAC2 / pow BOOST_PREVENT_MACRO_SUBSTITUTION( error / STEPFAC1 , expo ); 412 fac = max BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<value_type>(facmin/STEPFAC4) , min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<value_type>(1.0/facmin) , fac ) ); 413 } 414 return h*fac; 415 } 416 set_k_opt(size_t k,const inv_time_vector & work,const time_vector & h_opt,time_type & dt)417 controlled_step_result set_k_opt( size_t k , const inv_time_vector &work , const time_vector &h_opt , time_type &dt ) 418 /* calculates the optimal stage number */ 419 { 420 if( k == 1 ) 421 { 422 m_current_k_opt = 2; 423 return success; 424 } 425 if( (work[k-1] < KFAC1*work[k]) || (k == m_k_max) ) 426 { // order decrease 427 m_current_k_opt = k-1; 428 dt = h_opt[ m_current_k_opt ]; 429 return success; 430 } 431 else if( (work[k] < KFAC2*work[k-1]) || m_last_step_rejected || (k == m_k_max-1) ) 432 { // same order - also do this if last step got rejected 433 m_current_k_opt = k; 434 dt = h_opt[ m_current_k_opt ]; 435 return success; 436 } 437 else 438 { // order increase - only if last step was not rejected 439 m_current_k_opt = k+1; 440 dt = h_opt[ m_current_k_opt-1 ] * m_cost[ m_current_k_opt ] / m_cost[ m_current_k_opt-1 ] ; 441 return success; 442 } 443 } 444 in_convergence_window(size_t k) const445 bool in_convergence_window( size_t k ) const 446 { 447 if( (k == m_current_k_opt-1) && !m_last_step_rejected ) 448 return true; // decrease stepsize only if last step was not rejected 449 return ( (k == m_current_k_opt) || (k == m_current_k_opt+1) ); 450 } 451 should_reject(value_type error,size_t k) const452 bool should_reject( value_type error , size_t k ) const 453 { 454 if( k == m_current_k_opt-1 ) 455 { 456 const value_type d = m_interval_sequence[m_current_k_opt] * m_interval_sequence[m_current_k_opt+1] / 457 (m_interval_sequence[0]*m_interval_sequence[0]); 458 //step will fail, criterion 17.3.17 in NR 459 return ( error > d*d ); 460 } 461 else if( k == m_current_k_opt ) 462 { 463 const value_type d = m_interval_sequence[m_current_k_opt] / m_interval_sequence[0]; 464 return ( error > d*d ); 465 } else 466 return error > 1.0; 467 } 468 469 default_error_checker< value_type, algebra_type , operations_type > m_error_checker; 470 modified_midpoint< state_type , value_type , deriv_type , time_type , algebra_type , operations_type , resizer_type > m_midpoint; 471 472 bool m_last_step_rejected; 473 bool m_first; 474 475 time_type m_dt_last; 476 time_type m_t_last; 477 478 size_t m_current_k_opt; 479 480 algebra_type m_algebra; 481 482 resizer_type m_dxdt_resizer; 483 resizer_type m_xnew_resizer; 484 resizer_type m_resizer; 485 486 wrapped_state_type m_xnew; 487 wrapped_state_type m_err; 488 wrapped_deriv_type m_dxdt; 489 490 int_vector m_interval_sequence; // stores the successive interval counts 491 value_matrix m_coeff; 492 int_vector m_cost; // costs for interval count 493 494 state_table_type m_table; // sequence of states for extrapolation 495 496 const value_type STEPFAC1 , STEPFAC2 , STEPFAC3 , STEPFAC4 , KFAC1 , KFAC2; 497 }; 498 499 500 /******** DOXYGEN ********/ 501 /** 502 * \class bulirsch_stoer 503 * \brief The Bulirsch-Stoer algorithm. 504 * 505 * The Bulirsch-Stoer is a controlled stepper that adjusts both step size 506 * and order of the method. The algorithm uses the modified midpoint and 507 * a polynomial extrapolation compute the solution. 508 * 509 * \tparam State The state type. 510 * \tparam Value The value type. 511 * \tparam Deriv The type representing the time derivative of the state. 512 * \tparam Time The time representing the independent variable - the time. 513 * \tparam Algebra The algebra type. 514 * \tparam Operations The operations type. 515 * \tparam Resizer The resizer policy type. 516 */ 517 518 /** 519 * \fn bulirsch_stoer::bulirsch_stoer( value_type eps_abs , value_type eps_rel , value_type factor_x , value_type factor_dxdt ) 520 * \brief Constructs the bulirsch_stoer class, including initialization of 521 * the error bounds. 522 * 523 * \param eps_abs Absolute tolerance level. 524 * \param eps_rel Relative tolerance level. 525 * \param factor_x Factor for the weight of the state. 526 * \param factor_dxdt Factor for the weight of the derivative. 527 */ 528 529 /** 530 * \fn bulirsch_stoer::try_step( System system , StateInOut &x , time_type &t , time_type &dt ) 531 * \brief Tries to perform one step. 532 * 533 * This method tries to do one step with step size dt. If the error estimate 534 * is to large, the step is rejected and the method returns fail and the 535 * step size dt is reduced. If the error estimate is acceptably small, the 536 * step is performed, success is returned and dt might be increased to make 537 * the steps as large as possible. This method also updates t if a step is 538 * performed. Also, the internal order of the stepper is adjusted if required. 539 * 540 * \param system The system function to solve, hence the r.h.s. of the ODE. 541 * It must fulfill the Simple System concept. 542 * \param x The state of the ODE which should be solved. Overwritten if 543 * the step is successful. 544 * \param t The value of the time. Updated if the step is successful. 545 * \param dt The step size. Updated. 546 * \return success if the step was accepted, fail otherwise. 547 */ 548 549 /** 550 * \fn bulirsch_stoer::try_step( System system , StateInOut &x , const DerivIn &dxdt , time_type &t , time_type &dt ) 551 * \brief Tries to perform one step. 552 * 553 * This method tries to do one step with step size dt. If the error estimate 554 * is to large, the step is rejected and the method returns fail and the 555 * step size dt is reduced. If the error estimate is acceptably small, the 556 * step is performed, success is returned and dt might be increased to make 557 * the steps as large as possible. This method also updates t if a step is 558 * performed. Also, the internal order of the stepper is adjusted if required. 559 * 560 * \param system The system function to solve, hence the r.h.s. of the ODE. 561 * It must fulfill the Simple System concept. 562 * \param x The state of the ODE which should be solved. Overwritten if 563 * the step is successful. 564 * \param dxdt The derivative of state. 565 * \param t The value of the time. Updated if the step is successful. 566 * \param dt The step size. Updated. 567 * \return success if the step was accepted, fail otherwise. 568 */ 569 570 /** 571 * \fn bulirsch_stoer::try_step( System system , const StateIn &in , time_type &t , StateOut &out , time_type &dt ) 572 * \brief Tries to perform one step. 573 * 574 * \note This method is disabled if state_type=time_type to avoid ambiguity. 575 * 576 * This method tries to do one step with step size dt. If the error estimate 577 * is to large, the step is rejected and the method returns fail and the 578 * step size dt is reduced. If the error estimate is acceptably small, the 579 * step is performed, success is returned and dt might be increased to make 580 * the steps as large as possible. This method also updates t if a step is 581 * performed. Also, the internal order of the stepper is adjusted if required. 582 * 583 * \param system The system function to solve, hence the r.h.s. of the ODE. 584 * It must fulfill the Simple System concept. 585 * \param in The state of the ODE which should be solved. 586 * \param t The value of the time. Updated if the step is successful. 587 * \param out Used to store the result of the step. 588 * \param dt The step size. Updated. 589 * \return success if the step was accepted, fail otherwise. 590 */ 591 592 593 /** 594 * \fn bulirsch_stoer::try_step( System system , const StateIn &in , const DerivIn &dxdt , time_type &t , StateOut &out , time_type &dt ) 595 * \brief Tries to perform one step. 596 * 597 * This method tries to do one step with step size dt. If the error estimate 598 * is to large, the step is rejected and the method returns fail and the 599 * step size dt is reduced. If the error estimate is acceptably small, the 600 * step is performed, success is returned and dt might be increased to make 601 * the steps as large as possible. This method also updates t if a step is 602 * performed. Also, the internal order of the stepper is adjusted if required. 603 * 604 * \param system The system function to solve, hence the r.h.s. of the ODE. 605 * It must fulfill the Simple System concept. 606 * \param in The state of the ODE which should be solved. 607 * \param dxdt The derivative of state. 608 * \param t The value of the time. Updated if the step is successful. 609 * \param out Used to store the result of the step. 610 * \param dt The step size. Updated. 611 * \return success if the step was accepted, fail otherwise. 612 */ 613 614 615 /** 616 * \fn bulirsch_stoer::adjust_size( const StateIn &x ) 617 * \brief Adjust the size of all temporaries in the stepper manually. 618 * \param x A state from which the size of the temporaries to be resized is deduced. 619 */ 620 621 } 622 } 623 } 624 625 #endif // BOOST_NUMERIC_ODEINT_STEPPER_BULIRSCH_STOER_HPP_INCLUDED 626