pub struct OdeWrapper(/* private fields */);Implementations§
Source§impl OdeWrapper
impl OdeWrapper
Sourcepub fn get_matrix_type(&self) -> Result<MatrixType, DiffsolRtError>
pub fn get_matrix_type(&self) -> Result<MatrixType, DiffsolRtError>
Matrix type used in the ODE solver. This is fixed after construction.
pub fn get_nstates(&self) -> Result<usize, DiffsolRtError>
pub fn get_nparams(&self) -> Result<usize, DiffsolRtError>
pub fn get_nout(&self) -> Result<usize, DiffsolRtError>
pub fn has_stop(&self) -> Result<bool, DiffsolRtError>
Sourcepub fn get_ode_solver(&self) -> Result<OdeSolverType, DiffsolRtError>
pub fn get_ode_solver(&self) -> Result<OdeSolverType, DiffsolRtError>
Ode solver method, default Bdf (backward differentiation formula).
pub fn set_ode_solver(&self, value: OdeSolverType) -> Result<(), DiffsolRtError>
Sourcepub fn get_linear_solver(&self) -> Result<LinearSolverType, DiffsolRtError>
pub fn get_linear_solver(&self) -> Result<LinearSolverType, DiffsolRtError>
Linear solver type used in the ODE solver. Set to default to use the solver’s default choice, which is typically an LU solver.
pub fn set_linear_solver( &self, value: LinearSolverType, ) -> Result<(), DiffsolRtError>
Sourcepub fn get_rtol(&self) -> Result<f64, DiffsolRtError>
pub fn get_rtol(&self) -> Result<f64, DiffsolRtError>
Relative tolerance for the solver, default 1e-6. Governs the error relative to the solution size.
pub fn set_rtol(&self, value: f64) -> Result<(), DiffsolRtError>
Sourcepub fn get_atol(&self) -> Result<f64, DiffsolRtError>
pub fn get_atol(&self) -> Result<f64, DiffsolRtError>
Absolute tolerance for the solver, default 1e-6. Governs the error as the solution goes to zero.
pub fn set_atol(&self, value: f64) -> Result<(), DiffsolRtError>
pub fn get_code(&self) -> Result<String, DiffsolRtError>
pub fn get_scalar_type(&self) -> Result<ScalarType, DiffsolRtError>
pub fn get_jit_backend(&self) -> Result<Option<JitBackendType>, DiffsolRtError>
pub fn get_ic_options(&self) -> InitialConditionSolverOptions
pub fn get_options(&self) -> OdeSolverOptions
Sourcepub fn y0(&self, params: HostArray) -> Result<HostArray, DiffsolRtError>
pub fn y0(&self, params: HostArray) -> Result<HostArray, DiffsolRtError>
Get the initial condition vector y0 as a 1D numpy array.
Sourcepub fn rhs(
&self,
params: HostArray,
t: f64,
y: HostArray,
) -> Result<HostArray, DiffsolRtError>
pub fn rhs( &self, params: HostArray, t: f64, y: HostArray, ) -> Result<HostArray, DiffsolRtError>
evaluate the right-hand side function at time t and state y.
Sourcepub fn rhs_jac_mul(
&self,
params: HostArray,
t: f64,
y: HostArray,
v: HostArray,
) -> Result<HostArray, DiffsolRtError>
pub fn rhs_jac_mul( &self, params: HostArray, t: f64, y: HostArray, v: HostArray, ) -> Result<HostArray, DiffsolRtError>
evaluate the right-hand side Jacobian-vector product Jv`` at time tand statey`.
Sourcepub fn solve(
&self,
params: HostArray,
final_time: f64,
) -> Result<SolutionWrapper, DiffsolRtError>
pub fn solve( &self, params: HostArray, final_time: f64, ) -> Result<SolutionWrapper, DiffsolRtError>
Using the provided state, solve the problem up to time final_time.
The number of params must match the expected params in the diffsl code.
If specified, the config can be used to override the solver method
(Bdf by default) and SolverType (Lu by default) along with other solver
params like rtol.
:param params: 1D array of solver parameters
:type params: numpy.ndarray
:param final_time: end time of solver
:type final_time: float
:return: (ys, ts) tuple where ys is a 2D array of values at times
ts chosen by the solver
:rtype: Tuple[numpy.ndarray, numpy.ndarray]
Example: >>> print(ode.solve(np.array([]), 0.5))
Sourcepub fn solve_hybrid(
&self,
params: HostArray,
final_time: f64,
) -> Result<SolutionWrapper, DiffsolRtError>
pub fn solve_hybrid( &self, params: HostArray, final_time: f64, ) -> Result<SolutionWrapper, DiffsolRtError>
Solve a hybrid ODE up to final_time, automatically applying reset
functions and continuing after root events until the solution completes.
Sourcepub fn solve_dense(
&self,
params: HostArray,
t_eval: HostArray,
) -> Result<SolutionWrapper, DiffsolRtError>
pub fn solve_dense( &self, params: HostArray, t_eval: HostArray, ) -> Result<SolutionWrapper, DiffsolRtError>
Using the provided state, solve the problem up to time
t_eval[t_eval.len()-1]. Returns 2D array of solution values at
timepoints given by t_eval.
The number of params must match the expected params in the diffsl code. The config may be optionally specified to override solver settings.
:param params: 1D array of solver parameters
:type params: numpy.ndarray
:param t_eval: 1D array of solver times
:type params: numpy.ndarray
:return: 2D array of values at times t_eval
:rtype: numpy.ndarray
Sourcepub fn solve_hybrid_dense(
&self,
params: HostArray,
t_eval: HostArray,
) -> Result<SolutionWrapper, DiffsolRtError>
pub fn solve_hybrid_dense( &self, params: HostArray, t_eval: HostArray, ) -> Result<SolutionWrapper, DiffsolRtError>
Solve a hybrid ODE at dense evaluation times, automatically applying reset functions and continuing after root events until all requested output points are filled.
Sourcepub fn solve_fwd_sens(
&self,
params: HostArray,
t_eval: HostArray,
) -> Result<SolutionWrapper, DiffsolRtError>
pub fn solve_fwd_sens( &self, params: HostArray, t_eval: HostArray, ) -> Result<SolutionWrapper, DiffsolRtError>
Using the provided state, solve the problem up to time t_eval[t_eval.len()-1].
Returns 2D array of solution values at timepoints given by t_eval.
Also returns a list of 2D arrays of sensitivities at the same timepoints
as the solution.
The number of params must match the expected params in the diffsl code.
The config may be optionally specified to override solver settings.
:param params: 1D array of solver parameters
:type params: numpy.ndarray
:param t_eval: 1D array of solver times
:type params: numpy.ndarray
:return: 2D array of values at times t_eval and a list of 2D arrays of sensitivities at the same timepoints
:rtype: (numpy.ndarray, List[numpy.ndarray])
Sourcepub fn solve_hybrid_fwd_sens(
&self,
params: HostArray,
t_eval: HostArray,
) -> Result<SolutionWrapper, DiffsolRtError>
pub fn solve_hybrid_fwd_sens( &self, params: HostArray, t_eval: HostArray, ) -> Result<SolutionWrapper, DiffsolRtError>
Solve a hybrid ODE with forward sensitivities at dense evaluation times, automatically applying sensitivity-aware reset functions and continuing after root events until all requested output points are filled.
Sourcepub fn solve_sum_squares_adj(
&self,
params: HostArray,
data: HostArray,
t_eval: HostArray,
) -> Result<(f64, HostArray), DiffsolRtError>
pub fn solve_sum_squares_adj( &self, params: HostArray, data: HostArray, t_eval: HostArray, ) -> Result<(f64, HostArray), DiffsolRtError>
Using the provided state, solve the adjoint problem for the sum of squares
objective given data at timepoints t_eval.
Returns the objective value and a list of 1D arrays of adjoint sensitivities
for each parameter.
Trait Implementations§
Source§impl Clone for OdeWrapper
impl Clone for OdeWrapper
Source§fn clone(&self) -> OdeWrapper
fn clone(&self) -> OdeWrapper
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for OdeWrapper
impl RefUnwindSafe for OdeWrapper
impl Send for OdeWrapper
impl Sync for OdeWrapper
impl Unpin for OdeWrapper
impl UnsafeUnpin for OdeWrapper
impl UnwindSafe for OdeWrapper
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> 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.