pub struct JacobianPattern { /* private fields */ }Expand description
Structural sparsity of a Jacobian: for each row, the columns that may be nonzero.
Supplying the pattern lets CsrMatrix::jacobian_colored differentiate
several structurally independent columns with a single RHS call, so the cost
of a Jacobian drops from n evaluations to the number of colors.
Implementations§
Source§impl JacobianPattern
impl JacobianPattern
Sourcepub fn new(rows: Vec<Vec<usize>>) -> Result<Self, OdeError>
pub fn new(rows: Vec<Vec<usize>>) -> Result<Self, OdeError>
Build a pattern from per-row column lists. Each list is sorted and deduplicated.
§Errors
Returns OdeError::Invalid if any column index is out of range for
rows.len() states.
Sourcepub fn dense(n: usize) -> Self
pub fn dense(n: usize) -> Self
The fully dense pattern (every entry may be nonzero) for n states.
Sourcepub fn detect<F>(f: F, t: f64, y: &[f64]) -> Result<Self, OdeError>
pub fn detect<F>(f: F, t: f64, y: &[f64]) -> Result<Self, OdeError>
Detect the pattern by probing f: column j is perturbed and every row
whose value changes gets an entry. Costs n + 1 RHS evaluations.
Detection is exact for entries whose dependence is visible at y. An
entry that is zero at this particular point (for example the product
x·y when x = 0) is missed, so probe at a generic state when in doubt.
§Errors
Propagates any error returned by the RHS f.
Sourcepub fn column_coloring(&self) -> (Vec<usize>, usize)
pub fn column_coloring(&self) -> (Vec<usize>, usize)
Greedy column coloring: two columns get different colors whenever they share a row, so each color class can be perturbed together without the contributions colliding in any row.
Returns (colors, n_colors), where colors[j] is column j’s color.
Trait Implementations§
Source§impl Clone for JacobianPattern
impl Clone for JacobianPattern
Source§impl Debug for JacobianPattern
impl Debug for JacobianPattern
impl Eq for JacobianPattern
Source§impl PartialEq for JacobianPattern
impl PartialEq for JacobianPattern
impl StructuralPartialEq for JacobianPattern
Auto Trait Implementations§
impl Freeze for JacobianPattern
impl RefUnwindSafe for JacobianPattern
impl Send for JacobianPattern
impl Sync for JacobianPattern
impl Unpin for JacobianPattern
impl UnsafeUnpin for JacobianPattern
impl UnwindSafe for JacobianPattern
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<T, U> Imply<T> for U
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
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar 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.