Skip to main content

ExplicitRk

Struct ExplicitRk 

Source
pub struct ExplicitRk<'a, Eqn, M = <<Eqn as Op>::V as DefaultDenseMatrix>::M, AugmentedEqn = NoAug<Eqn>>
where Eqn: OdeEquations, M: DenseMatrix<V = Eqn::V, T = Eqn::T>, Eqn::V: DefaultDenseMatrix<T = Eqn::T, C = Eqn::C>, AugmentedEqn: AugmentedOdeEquations<Eqn>,
{ /* private fields */ }
Expand description

An explicit Runge-Kutta method.

The particular method is defined by the Tableau used to create the solver. If the beta matrix of the Tableau is present this is used for interpolation, otherwise hermite interpolation is used.

Restrictions:

  • The upper triangular and diagonal parts of the a matrix must be zero (i.e. explicit).
  • The last row of the a matrix must be the same as the b vector, and the last element of the c vector must be 1 (i.e. a stiffly accurate method)

Implementations§

Source§

impl<'a, Eqn, M, AugmentedEqn> ExplicitRk<'a, Eqn, M, AugmentedEqn>
where Eqn: OdeEquations, M: DenseMatrix<V = Eqn::V, T = Eqn::T, C = Eqn::C>, AugmentedEqn: AugmentedOdeEquations<Eqn>, Eqn::V: DefaultDenseMatrix<T = Eqn::T, C = Eqn::C>,

Source

pub fn new( problem: &'a OdeSolverProblem<Eqn>, state: RkState<Eqn::V>, tableau: Tableau<M>, ) -> Result<Self, DiffsolError>

Source

pub fn new_augmented( problem: &'a OdeSolverProblem<Eqn>, state: RkState<Eqn::V>, tableau: Tableau<M>, augmented_eqn: AugmentedEqn, ) -> Result<Self, DiffsolError>

Source

pub fn get_statistics(&self) -> &BdfStatistics

Trait Implementations§

Source§

impl<'a, Eqn, M, Solver> AdjointOdeSolverMethod<'a, Eqn, Solver> for ExplicitRk<'a, Eqn, M, AdjointEquations<'a, Eqn, Solver>>
where Eqn: OdeEquationsImplicitAdjoint + 'a, Solver: OdeSolverMethod<'a, Eqn>, M: DenseMatrix<V = Eqn::V, T = Eqn::T, C = Eqn::C>, Eqn::V: DefaultDenseMatrix<T = Eqn::T, C = Eqn::C>, for<'b> &'b Eqn::V: VectorRef<Eqn::V>,

Source§

fn solve_adjoint_backwards_pass( self, t0: Option<Eqn::T>, t_eval: &[Eqn::T], dgdu_eval: &[&<Eqn::V as DefaultDenseMatrix>::M], ) -> Result<Self::State, DiffsolError>
where Eqn::V: DefaultDenseMatrix, Eqn::M: DefaultSolver,

Backwards pass for adjoint sensitivity analysis Read more
Source§

impl<'a, Eqn, M, AugEqn> AugmentedOdeSolverMethod<'a, Eqn, AugEqn> for ExplicitRk<'a, Eqn, M, AugEqn>
where Eqn: OdeEquations, AugEqn: AugmentedOdeEquations<Eqn>, M: DenseMatrix<V = Eqn::V, T = Eqn::T, C = Eqn::C>, Eqn::V: DefaultDenseMatrix<T = Eqn::T, C = Eqn::C>, for<'b> &'b Eqn::V: VectorRef<Eqn::V>,

Source§

impl<Eqn, M, AugmentedEqn> Clone for ExplicitRk<'_, Eqn, M, AugmentedEqn>
where Eqn: OdeEquations, M: DenseMatrix<V = Eqn::V, T = Eqn::T>, AugmentedEqn: AugmentedOdeEquations<Eqn>, Eqn::V: DefaultDenseMatrix<T = Eqn::T, C = Eqn::C>,

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, Eqn, M, AugmentedEqn> OdeSolverMethod<'a, Eqn> for ExplicitRk<'a, Eqn, M, AugmentedEqn>
where Eqn: OdeEquations, M: DenseMatrix<V = Eqn::V, T = Eqn::T, C = Eqn::C>, AugmentedEqn: AugmentedOdeEquations<Eqn>, Eqn::V: DefaultDenseMatrix<T = Eqn::T, C = Eqn::C>,

Source§

type State = RkState<<Eqn as Op>::V>

The state type used by the solver
Source§

type Config = ExplicitRkConfig<<Eqn as Op>::T>

The configuration type used by the solver
Source§

fn config(&self) -> &ExplicitRkConfig<Eqn::T>

Get a reference to the current configuration of the solver
Source§

fn config_mut(&mut self) -> &mut ExplicitRkConfig<Eqn::T>

Get a mutable reference to the current configuration of the solver
Source§

fn problem(&self) -> &'a OdeSolverProblem<Eqn>

Get the current problem
Source§

fn jacobian(&self) -> Option<Ref<'_, Eqn::M>>

Returns the current jacobian matrix of the solver, if it has one Note that this will force a full recalculation of the Jacobian.
Source§

fn mass(&self) -> Option<Ref<'_, Eqn::M>>

Returns the current mass matrix of the solver, if it has one Note that this will force a full recalculation of the mass matrix.
Source§

fn order(&self) -> usize

Get the current order of accuracy of the solver (e.g. explict euler method is first-order)
Source§

fn set_state(&mut self, state: Self::State)

Replace the current state of the solver with a new state.
Source§

fn into_state(self) -> RkState<Eqn::V>

Take the current state of the solver, if it exists, returning it to the user. This is useful if you want to use this state in another solver or problem. Note that this will unset the current problem and solver state, so you will need to call set_problem again before calling step or solve.
Source§

fn checkpoint(&mut self) -> Self::State

Take a checkpoint of the current state of the solver, returning it to the user. This is useful if you want to use this state in another solver or problem but want to keep this solver active. If you don’t need to use this solver again, you can use take_state instead. Note that this will force a reinitialisation of the internal Jacobian for the solver, if it has one.
Source§

fn state_clone(&self) -> Self::State

Clone the current state of the solver without triggering any internal Jacobian reset.
Source§

fn step(&mut self) -> Result<OdeSolverStopReason<Eqn::T>, DiffsolError>

Step the solution forward by one step, altering the internal state of the solver. The return value is a Result containing the reason for stopping the solver, possible reasons are: Read more
Source§

fn set_stop_time(&mut self, tstop: <Eqn as Op>::T) -> Result<(), DiffsolError>

Set a stop time for the solver. The solver will stop when the internal time reaches this time. Once it stops, the stop time is unset. If tstop is at or before the current internal time, an error is returned.
Source§

fn interpolate_sens_inplace( &self, t: <Eqn as Op>::T, sens: &mut [Eqn::V], ) -> Result<(), DiffsolError>

Interpolate the sensitivity vectors at a given time and place in sens. This time should be between the current time and the last solver time step
Source§

fn interpolate_inplace( &self, t: Eqn::T, y: &mut Eqn::V, ) -> Result<(), DiffsolError>

Interpolate the solution at a given time and place in y. This time should be between the current time and the last solver time step
Source§

fn interpolate_dy_inplace( &self, t: Eqn::T, dy: &mut Eqn::V, ) -> Result<(), DiffsolError>

Interpolate the time derivative dy/dt at a given time and place in dy. This time should be between the current time and the last solver time step
Source§

fn interpolate_out_inplace( &self, t: Eqn::T, g: &mut Eqn::V, ) -> Result<(), DiffsolError>

Interpolate the integral of the output function at a given time and place in g. This time should be between the current time and the last solver time step
Source§

fn state(&self) -> StateRef<'_, Eqn::V>

Get the current state of the solver
Source§

fn state_mut(&mut self) -> StateRefMut<'_, Eqn::V>

Get a mutable reference to the current state of the solver Note that calling this will cause the next call to step to perform some reinitialisation to take into account the mutated state, this could be expensive for multi-step methods.
Source§

fn state_mut_back(&mut self, t: Eqn::T) -> Result<(), DiffsolError>

Move the solver state back to time t by interpolating y, dy, and (if integrate_out is set) g to that time and writing them into the current state. If the state contains sensitivity vectors they are also interpolated to time t. This is typically called after a root is found to pin the state to the root time.
Source§

fn interpolate(&self, t: Eqn::T) -> Result<Eqn::V, DiffsolError>

Interpolate the solution at a given time. This time should be between the current time and the last solver time step
Source§

fn interpolate_dy(&self, t: Eqn::T) -> Result<Eqn::V, DiffsolError>

Interpolate the time derivative dy/dt at a given time. This time should be between the current time and the last solver time step
Source§

fn interpolate_out(&self, t: Eqn::T) -> Result<Eqn::V, DiffsolError>

Interpolate the integral of the output function at a given time. This time should be between the current time and the last solver time step
Source§

fn interpolate_sens(&self, t: Eqn::T) -> Result<Vec<Eqn::V>, DiffsolError>

Interpolate the sensitivity vectors at a given time. This time should be between the current time and the last solver time step
Source§

fn solve( &mut self, final_time: Eqn::T, ) -> Result<(<Eqn::V as DefaultDenseMatrix>::M, Vec<Eqn::T>, OdeSolverStopReason<Eqn::T>), DiffsolError>
where Eqn::V: DefaultDenseMatrix, Self: Sized,

Solve the ODE from the current time to final_time. Read more
Source§

fn solve_soln(self, soln: &mut Solution<Eqn::V>) -> Result<Self, DiffsolError>
where Eqn::V: DefaultDenseMatrix, Self: Sized,

Continue solving into an existing Solution, appending newly computed output. Read more
Source§

fn solve_dense( &mut self, t_eval: &[Eqn::T], ) -> Result<(<Eqn::V as DefaultDenseMatrix>::M, OdeSolverStopReason<Eqn::T>), DiffsolError>
where Eqn::V: DefaultDenseMatrix, Self: Sized,

Solve the ODE from the current time to t_eval[t_eval.len()-1], evaluating at specified times. Read more
Source§

fn solve_with_checkpointing( &mut self, final_time: Eqn::T, max_steps_between_checkpoints: Option<usize>, ) -> Result<(Checkpointing<'a, Eqn, Self>, <Eqn::V as DefaultDenseMatrix>::M, Vec<Eqn::T>, OdeSolverStopReason<Eqn::T>), DiffsolError>
where Eqn::V: DefaultDenseMatrix, Self: Sized,

Solve the ODE from the current time to final_time, saving checkpoints at regular intervals. Read more
Source§

fn solve_dense_with_checkpointing( &mut self, t_eval: &[Eqn::T], max_steps_between_checkpoints: Option<usize>, ) -> Result<(Checkpointing<'a, Eqn, Self>, <Eqn::V as DefaultDenseMatrix>::M, OdeSolverStopReason<Eqn::T>), DiffsolError>
where Eqn::V: DefaultDenseMatrix, Self: Sized,

Solve the ODE from the current time to t_eval[t_eval.len()-1] with checkpointing, evaluating at specified times. Read more
Source§

impl<'a, Eqn, M> SensitivitiesOdeSolverMethod<'a, Eqn> for ExplicitRk<'a, Eqn, M, SensEquations<'a, Eqn>>
where Eqn: OdeEquationsImplicitSens + 'a, M: DenseMatrix<V = Eqn::V, T = Eqn::T, C = Eqn::C>, Eqn::V: DefaultDenseMatrix<T = Eqn::T, C = Eqn::C>, for<'b> &'b Eqn::V: VectorRef<Eqn::V>,

Source§

fn solve_soln_sensitivities( self, soln: &mut Solution<Eqn::V>, ) -> Result<Self, DiffsolError>
where Eqn::V: DefaultDenseMatrix, Self: Sized,

Continue solving ODE and forward sensitivities into an existing dense Solution. Read more
Source§

fn solve_dense_sensitivities( &mut self, t_eval: &[Eqn::T], ) -> Result<(<Eqn::V as DefaultDenseMatrix>::M, Vec<<Eqn::V as DefaultDenseMatrix>::M>, OdeSolverStopReason<Eqn::T>), DiffsolError>

Solve the ODE and the forward sensitivity equations from the current time to t_eval[t_eval.len()-1], evaluating at specified times. Read more

Auto Trait Implementations§

§

impl<'a, Eqn, M = <<Eqn as Op>::V as DefaultDenseMatrix>::M, AugmentedEqn = NoAug<Eqn>> !Freeze for ExplicitRk<'a, Eqn, M, AugmentedEqn>

§

impl<'a, Eqn, M = <<Eqn as Op>::V as DefaultDenseMatrix>::M, AugmentedEqn = NoAug<Eqn>> !RefUnwindSafe for ExplicitRk<'a, Eqn, M, AugmentedEqn>

§

impl<'a, Eqn, M, AugmentedEqn> Send for ExplicitRk<'a, Eqn, M, AugmentedEqn>
where <Eqn as Op>::V: Sized + Send + Sync, M: Send, AugmentedEqn: Send, Eqn: Sync,

§

impl<'a, Eqn, M = <<Eqn as Op>::V as DefaultDenseMatrix>::M, AugmentedEqn = NoAug<Eqn>> !Sync for ExplicitRk<'a, Eqn, M, AugmentedEqn>

§

impl<'a, Eqn, M, AugmentedEqn> Unpin for ExplicitRk<'a, Eqn, M, AugmentedEqn>
where <Eqn as Op>::V: Sized + Unpin, M: Unpin, AugmentedEqn: Unpin, <Eqn as Op>::T: Unpin,

§

impl<'a, Eqn, M, AugmentedEqn> UnsafeUnpin for ExplicitRk<'a, Eqn, M, AugmentedEqn>
where <Eqn as Op>::V: Sized + UnsafeUnpin, M: UnsafeUnpin, AugmentedEqn: UnsafeUnpin, <Eqn as Op>::T: UnsafeUnpin,

§

impl<'a, Eqn, M, AugmentedEqn> UnwindSafe for ExplicitRk<'a, Eqn, M, AugmentedEqn>
where <Eqn as Op>::V: Sized + UnwindSafe + RefUnwindSafe, M: UnwindSafe, AugmentedEqn: UnwindSafe, <Eqn as Op>::T: UnwindSafe + RefUnwindSafe, Eqn: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ByRef<T> for T

Source§

fn by_ref(&self) -> &T

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DistributionExt for T
where T: ?Sized,

Source§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,