pub struct HermiteInterpolator<V>where
V: Vector,{ /* private fields */ }Expand description
Hermite interpolator for ODE solution trajectories.
This interpolator uses cubic Hermite interpolation based on solution values and derivatives at discrete time points. It provides smooth interpolation between checkpoints and is used internally by the checkpointing system for adjoint sensitivity analysis.
Implementations§
Source§impl<V> HermiteInterpolator<V>where
V: Vector,
impl<V> HermiteInterpolator<V>where
V: Vector,
Sourcepub fn new(ys: Vec<V>, ydots: Vec<V>, ts: Vec<V::T>) -> Self
pub fn new(ys: Vec<V>, ydots: Vec<V>, ts: Vec<V::T>) -> Self
Create a new Hermite interpolator with the given solution data.
§Arguments
ys: Vector of solution values at each time pointydots: Vector of solution derivatives (dy/dt) at each time pointts: Vector of time points (must be sorted)
§Notes
All three vectors must have the same length. The time points should be sorted in increasing or decreasing order for proper interpolation.
Sourcepub fn last_t(&self) -> Option<V::T>
pub fn last_t(&self) -> Option<V::T>
Get the last time point in the interpolator.
§Returns
The last time value, or None if the interpolator is empty.
Sourcepub fn last_h(&self) -> Option<V::T>
pub fn last_h(&self) -> Option<V::T>
Get the last time step size in the interpolator.
§Returns
The difference between the last two time points, or None if there are
fewer than two time points.
Sourcepub fn reset<'a, Eqn, Method, State>(
&mut self,
solver: &mut Method,
state0: &State,
state1: &State,
) -> Result<(), DiffsolError>where
Eqn: OdeEquations<V = V, T = V::T> + 'a,
Method: OdeSolverMethod<'a, Eqn, State = State>,
State: OdeSolverState<V>,
pub fn reset<'a, Eqn, Method, State>(
&mut self,
solver: &mut Method,
state0: &State,
state1: &State,
) -> Result<(), DiffsolError>where
Eqn: OdeEquations<V = V, T = V::T> + 'a,
Method: OdeSolverMethod<'a, Eqn, State = State>,
State: OdeSolverState<V>,
Reset the interpolator by solving the ODE between two checkpointed states.
This method clears the current interpolation data and re-solves the ODE
from state0 to state1, storing all intermediate solution points.
§Arguments
solver: The ODE solver to use for integrationstate0: The initial state (starting point)state1: The final state (target point)
§Returns
Ok(()) on success, or an error if the solver fails.
Sourcepub fn interpolate(&self, t: V::T, y: &mut V) -> Option<()>
pub fn interpolate(&self, t: V::T, y: &mut V) -> Option<()>
Interpolate the solution at a given time point.
Uses cubic Hermite interpolation to compute the solution value at time t.
§Arguments
t: The time at which to interpolatey: Output vector to store the interpolated solution
§Returns
Some(()) if the interpolation succeeded (t is within range), None if
t is outside the range of stored time points.
Trait Implementations§
Source§impl<V> Clone for HermiteInterpolator<V>
impl<V> Clone for HermiteInterpolator<V>
Source§fn clone(&self) -> HermiteInterpolator<V>
fn clone(&self) -> HermiteInterpolator<V>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<V> Freeze for HermiteInterpolator<V>
impl<V> RefUnwindSafe for HermiteInterpolator<V>
impl<V> Send for HermiteInterpolator<V>
impl<V> Sync for HermiteInterpolator<V>where
V: Sync,
impl<V> Unpin for HermiteInterpolator<V>
impl<V> UnsafeUnpin for HermiteInterpolator<V>
impl<V> UnwindSafe for HermiteInterpolator<V>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Context for T
impl<T> Context for T
fn vector_from_element<V: Vector<C = Self>>(&self, len: usize, value: V::T) -> V
fn vector_from_vec<V: Vector<C = Self>>(&self, vec: Vec<V::T>) -> V
fn vector_zeros<V: Vector<C = Self>>(&self, len: usize) -> V
fn dense_mat_zeros<V: Vector<C = Self> + DefaultDenseMatrix>( &self, rows: usize, cols: usize, ) -> <V as DefaultDenseMatrix>::M
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.