Trait eom::Explicit

source ·
pub trait Explicit: ModelSpec {
    // Required method
    fn rhs<'a, S>(
        &mut self,
        x: &'a mut ArrayBase<S, Self::Dim>
    ) -> &'a mut ArrayBase<S, Self::Dim>
       where S: DataMut<Elem = Self::Scalar>;
}
Expand description

Abstraction for implementing explicit schemes

Consider equation of motion of an autonomous system described as an initial value problem of ODE: $$ \frac{dx}{dt} = f(x),\space x(0) = x_0 $$ where $x = x(t)$ describes the system state specified by ModelSpec trait at a time $t$. This trait specifies $f$ itself, i.e. this trait will be implemented for structs corresponds to equations like Lorenz63, and used while implementing integrate algorithms like Euler, Heun, and RK4 algorithms. Since these algorithms are independent from the detail of $f$, this trait abstracts this part.

Required Methods§

source

fn rhs<'a, S>( &mut self, x: &'a mut ArrayBase<S, Self::Dim> ) -> &'a mut ArrayBase<S, Self::Dim>where S: DataMut<Elem = Self::Scalar>,

Evaluate $f(x)$ for a given state $x$

This requires &mut self because evaluating $f$ may require additional internal memory allocated in Self.

Implementors§