1 #ifndef MEDUSA_BITS_INTEGRATORS_ADAMSBASHFORTH_HPP_
2 #define MEDUSA_BITS_INTEGRATORS_ADAMSBASHFORTH_HPP_
14 template <
typename Scalar,
int num_steps>
15 template <
typename func_t,
typename initial_method_t>
16 typename AdamsBashforth<Scalar, num_steps>::template
17 Integrator<func_t, initial_method_t>::IterationStep&
18 AdamsBashforth<Scalar, num_steps>::Integrator<func_t,
19 initial_method_t>::IterationStep::operator++() {
22 if (cur_step < steps) {
23 next = integrator.initial_method_.step(
24 integrator.func_, t, last_ys.col(steps - 1), integrator.dt_);
26 next = integrator.method_.step(integrator.func_, t, last_ys, integrator.dt_);
30 for (
int i = 0; i < steps-1; ++i) {
31 last_ys.col(i) = last_ys.col(i+1);
33 last_ys.col(steps-1) = next;
38 template <
typename scalar_t,
int num_steps>
40 os <<
"AdamsBashforth with " << num_steps <<
" stages and "
41 <<
"b = " << method.
b_.transpose();
45 namespace integrators {
46 namespace ExplicitMultistep {
48 namespace of_order_internal {
50 template <
int order,
class scalar_t>
52 static_assert(order > 0,
"Order must be positive.");
53 static_assert(order < 6,
"Methods of so high orders are not implemented yet, but it's"
54 " very simple to add them!");
59 template <
class scalar_t>
65 template <
class scalar_t>
71 template <
class scalar_t>
77 template <
class scalar_t>
83 template <
class scalar_t>
94 #endif // MEDUSA_BITS_INTEGRATORS_ADAMSBASHFORTH_HPP_