BDFSolver

Trait BDFSolver 

Source
pub trait BDFSolver<N: ComplexField, S: DimName, O: DimName>: Sized{
    // Required methods
    fn higher_coefficients() -> VectorN<N::RealField, O>;
    fn lower_coefficients() -> VectorN<N::RealField, O>;
    fn solve_ivp<T: Clone, F: FnMut(N::RealField, &[N], &mut T) -> Result<VectorN<N, S>, String>>(
        self,
        f: F,
        params: &mut T,
    ) -> Result<Vec<(N::RealField, VectorN<N, S>)>, String>;
    fn with_tolerance(self, tol: N::RealField) -> Result<Self, String>;
    fn with_dt_max(self, max: N::RealField) -> Result<Self, String>;
    fn with_dt_min(self, min: N::RealField) -> Result<Self, String>;
    fn with_start(self, t_initial: N::RealField) -> Result<Self, String>;
    fn with_end(self, t_final: N::RealField) -> Result<Self, String>;
    fn with_initial_conditions(self, start: &[N]) -> Result<Self, String>;
    fn build(self) -> Self;
}
Expand description

This trait allows a struct to be used in the BDF

Types implementing BDFSolver should have a BDFInfo to handle the actual IVP solving. O should be one more than the order of the higher-order solver (to allow room for the coefficient on f).

§Examples

See struct BDF6 for an example of implementing this trait.

Required Methods§

Source

fn higher_coefficients() -> VectorN<N::RealField, O>

The polynomial interpolation coefficients for the higher-order method. Should start with the coefficient for the derivative function without h, then n - 1. The coefficients for the previous terms should have the sign as if they’re on the same side of the = as the next state.

Source

fn lower_coefficients() -> VectorN<N::RealField, O>

The polynomial interpolation coefficients for the lower-order method. Must be one less in length than higher_coefficients. Should start with the coefficient for the derivative function without h, then n-1. The coefficients for the previous terms should have the sign as if they’re on the same side of the = as the next state.

Source

fn solve_ivp<T: Clone, F: FnMut(N::RealField, &[N], &mut T) -> Result<VectorN<N, S>, String>>( self, f: F, params: &mut T, ) -> Result<Vec<(N::RealField, VectorN<N, S>)>, String>

Use BDFInfo to solve an initial value problem

Source

fn with_tolerance(self, tol: N::RealField) -> Result<Self, String>

Set the error tolerance for this solver.

Source

fn with_dt_max(self, max: N::RealField) -> Result<Self, String>

Set the maximum time step for this solver.

Source

fn with_dt_min(self, min: N::RealField) -> Result<Self, String>

Set the minimum time step for this solver.

Source

fn with_start(self, t_initial: N::RealField) -> Result<Self, String>

Set the initial time for this solver.

Source

fn with_end(self, t_final: N::RealField) -> Result<Self, String>

Set the end time for this solver.

Source

fn with_initial_conditions(self, start: &[N]) -> Result<Self, String>

Set the initial conditions for this solver.

Source

fn build(self) -> Self

Build this solver.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<N, S> BDFSolver<N, S, U3> for BDF2<N, S>
where N: ComplexField, S: DimName + DimMin<S, Output = S>, DefaultAllocator: Allocator<N, S> + Allocator<N, U3> + Allocator<N, S, S> + Allocator<N, U1, S> + Allocator<(usize, usize), S>,

Source§

impl<N, S> BDFSolver<N, S, U7> for BDF6<N, S>
where N: ComplexField, S: DimName + DimMin<S, Output = S>, DefaultAllocator: Allocator<N, S> + Allocator<N, U7> + Allocator<N, S, S> + Allocator<N, U1, S> + Allocator<(usize, usize), S>,