pub struct SensitivityResult<S: Scalar> {
pub t: Vec<S>,
pub y: Vec<S>,
pub sensitivity: Vec<S>,
pub n_states: usize,
pub n_params: usize,
pub stats: SolverStats,
pub success: bool,
pub message: String,
}Expand description
Result of an ODE forward-sensitivity solve.
Layout matches the conventions in the module-level docs:
the state y is row-major over time; the sensitivity is row-major over
time, column-major within each per-time block.
Fields§
§t: Vec<S>Output time points (length n_times).
y: Vec<S>State trajectory: y[i*N + j] = y_j(t_i), length n_times * N.
sensitivity: Vec<S>Sensitivities: per-time block of length N · N_s, column-major
within the block, so
sensitivity[i * (N*N_s) + k*N + j] = ∂y_j(t_i)/∂p_k.
n_states: usizeNumber of state variables N.
n_params: usizeNumber of parameters N_s.
stats: SolverStatsSolver statistics from the underlying integration.
success: boolWas the integration successful?
message: StringError description if the integration failed.
Implementations§
Source§impl<S: Scalar> SensitivityResult<S>
impl<S: Scalar> SensitivityResult<S>
Sourcepub fn sensitivity_at(&self, i: usize) -> &[S]
pub fn sensitivity_at(&self, i: usize) -> &[S]
Full sensitivity block at output index i, column-major
(length N · N_s). sensitivity_at(i)[k*N + j] = ∂y_j(t_i)/∂p_k.
Sourcepub fn sensitivity_for_param(&self, i: usize, k: usize) -> &[S]
pub fn sensitivity_for_param(&self, i: usize, k: usize) -> &[S]
Contiguous slice S_{:,k}(t_i) = ∂y/∂p_k at output index i,
length N. Free slice thanks to the column-major flattening.
Sourcepub fn dyi_dpj(&self, i: usize, state: usize, param: usize) -> S
pub fn dyi_dpj(&self, i: usize, state: usize, param: usize) -> S
Single component ∂y_state(t_i)/∂p_param.
Sourcepub fn final_state(&self) -> &[S]
pub fn final_state(&self) -> &[S]
State at the final output time. Returns an empty slice if the result has no time points.
Sourcepub fn final_sensitivity(&self) -> &[S]
pub fn final_sensitivity(&self) -> &[S]
Sensitivity block at the final output time, column-major (length
N · N_s). Empty slice when the result has no time points.
Sourcepub fn normalized_sensitivity_at(&self, i: usize, p_nominal: &[S]) -> Vec<S>
pub fn normalized_sensitivity_at(&self, i: usize, p_nominal: &[S]) -> Vec<S>
Normalised (logarithmic) sensitivity at output index i:
(p_k / y_j) · ∂y_j/∂p_k, column-major in the same shape as
Self::sensitivity_at. Components where |y_j| falls below
1e-15 · max(1, |y|_∞) are reported as zero to avoid blow-up.
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for SensitivityResult<S>
impl<S> RefUnwindSafe for SensitivityResult<S>where
S: RefUnwindSafe,
impl<S> Send for SensitivityResult<S>
impl<S> Sync for SensitivityResult<S>
impl<S> Unpin for SensitivityResult<S>where
S: Unpin,
impl<S> UnsafeUnpin for SensitivityResult<S>
impl<S> UnwindSafe for SensitivityResult<S>where
S: UnwindSafe,
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> 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 more