pub struct StabilizationLedger {
pub kind: StabilizationKind,
pub delta: f64,
pub matrix_form: RidgeMatrixForm,
pub chosen_by: StabilizationRule,
pub inertia_before: Option<Inertia>,
pub inertia_after: Option<Inertia>,
}Expand description
Canonical record of a single stabilization δ applied at a single site.
Construct via the helper constructors (solver_damping,
numerical_perturbation, explicit_prior) so the included_in_*
invariants are guaranteed to match kind. Direct field construction is
public for serialization round-trips only.
Fields§
§kind: StabilizationKind§delta: f64§matrix_form: RidgeMatrixForm§chosen_by: StabilizationRule§inertia_before: Option<Inertia>§inertia_after: Option<Inertia>Implementations§
Source§impl StabilizationLedger
impl StabilizationLedger
Sourcepub const fn solver_damping(delta: f64, chosen_by: StabilizationRule) -> Self
pub const fn solver_damping(delta: f64, chosen_by: StabilizationRule) -> Self
LM/TR damping. δ is invisible to the objective, gradient, and any saved artifact. Asserting this invariant at every read site is the whole reason the ledger exists.
Sourcepub const fn numerical_perturbation(
delta: f64,
chosen_by: StabilizationRule,
backward_error_bound: Option<f64>,
) -> Self
pub const fn numerical_perturbation( delta: f64, chosen_by: StabilizationRule, backward_error_bound: Option<f64>, ) -> Self
Solver-only perturbation that leaves the objective unchanged. The caller may attach a backward-error bound when one is available (e.g. from iterative refinement / Wilkinson-style analysis).
Sourcepub const fn explicit_prior(delta: f64, matrix_form: RidgeMatrixForm) -> Self
pub const fn explicit_prior(delta: f64, matrix_form: RidgeMatrixForm) -> Self
Model-level explicit prior. δ enters every accounting pass: the quadratic penalty, the Laplace Hessian, the penalty log-determinant, and serialization.
Sourcepub const fn from_passport(passport: RidgePassport) -> Self
pub const fn from_passport(passport: RidgePassport) -> Self
Bridge from the existing RidgePassport so PIRLS-side code (which
already passes a RidgePassport through every call) can hand a
ledger to anything that wants the new uniform view.
RidgePolicy is homogeneous-by-construction: every constructor sets
the three inclusion flags identically. A passport whose policy
excludes every accounting term is morally a numerical perturbation
(the ridge is there to make the solve work but the objective ignores
it); a passport whose policy includes every accounting term is an
explicit prior. Heterogeneous flag combinations cannot be produced
by the public RidgePolicy API and have no inhabitants downstream.
Sourcepub const fn quadratic_delta(&self) -> f64
pub const fn quadratic_delta(&self) -> f64
δ value to fold into the quadratic penalty term, or 0.0 if this
ledger entry is not part of the model. Derived from kind: only
StabilizationKind::ExplicitPrior contributes.
Sourcepub const fn laplace_hessian_delta(&self) -> f64
pub const fn laplace_hessian_delta(&self) -> f64
δ value to add to the Laplace Hessian, or 0.0 if not included.
Derived from kind: only StabilizationKind::ExplicitPrior
contributes.
Sourcepub const fn penalty_logdet_delta(&self) -> f64
pub const fn penalty_logdet_delta(&self) -> f64
δ value to add inside log|S + δ I|, or 0.0 if not included.
Derived from kind: only StabilizationKind::ExplicitPrior
contributes.
Trait Implementations§
Source§impl Clone for StabilizationLedger
impl Clone for StabilizationLedger
Source§fn clone(&self) -> StabilizationLedger
fn clone(&self) -> StabilizationLedger
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for StabilizationLedger
Source§impl Debug for StabilizationLedger
impl Debug for StabilizationLedger
Source§impl<'de> Deserialize<'de> for StabilizationLedger
impl<'de> Deserialize<'de> for StabilizationLedger
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for StabilizationLedger
impl PartialEq for StabilizationLedger
Source§fn eq(&self, other: &StabilizationLedger) -> bool
fn eq(&self, other: &StabilizationLedger) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for StabilizationLedger
impl Serialize for StabilizationLedger
impl StructuralPartialEq for StabilizationLedger
Auto Trait Implementations§
impl Freeze for StabilizationLedger
impl RefUnwindSafe for StabilizationLedger
impl Send for StabilizationLedger
impl Sync for StabilizationLedger
impl Unpin for StabilizationLedger
impl UnsafeUnpin for StabilizationLedger
impl UnwindSafe for StabilizationLedger
Blanket Implementations§
impl<T> Boilerplate for T
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
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.