pub enum StepFactor {
Ne {
h: Mat<f64>,
},
Svd {
u: Mat<f64>,
s: Vec<f64>,
v: Mat<f64>,
},
}Expand description
A once-per-outer-iteration factorization of the (column-scaled) Jacobian,
reused across every λ trial and by geodesic acceleration. This is the key
to keeping the inner λ search cheap: the O(m·p²) work (forming JᵀJ, or
the thin SVD of J) happens once; each λ trial is then only O(p³)
(Cholesky) or O(p²) (closed form).
Both J and the column scaling D = diag(diag) are fixed across the inner
loop (only λ changes), so this is sound.
Variants§
Ne
Normal equations: stores H = JᵀJ (p×p).
Svd
Thin SVD of the column-scaled J̃ = J·diag(1/D): U, s, V.
Implementations§
Source§impl StepFactor
impl StepFactor
Sourcepub fn solve(
&self,
g: MatRef<'_, f64>,
r: MatRef<'_, f64>,
diag: &[f64],
lambda: f64,
) -> Result<StepOutput, StepError>
pub fn solve( &self, g: MatRef<'_, f64>, r: MatRef<'_, f64>, diag: &[f64], lambda: f64, ) -> Result<StepOutput, StepError>
Solve (JᵀJ + λD²) δ = −g for the trial step δ and its predicted
reduction −gᵀδ − ½‖Jδ‖². r is the residual (used by the SVD path).
§Errors
Returns StepError::NotPositiveDefinite on the StepKind::NormalEqLlt
path when H + λD² fails its Cholesky factorization (not positive
definite for the current damping λ). The StepKind::SvdSecular path
cannot fail here — its factorization risk was already taken in
factorize.
Sourcepub fn solve_rhs(
&self,
diag: &[f64],
lambda: f64,
rhs: MatRef<'_, f64>,
) -> Result<Mat<f64>, StepError>
pub fn solve_rhs( &self, diag: &[f64], lambda: f64, rhs: MatRef<'_, f64>, ) -> Result<Mat<f64>, StepError>
Solve (JᵀJ + λD²) x = rhs for an arbitrary right-hand side (geodesic
acceleration: rhs = −Jᵀr_vv). Reuses this factorization — no re-forming.
§Errors
Returns StepError::NotPositiveDefinite on the StepKind::NormalEqLlt
path when H + λD² fails its Cholesky factorization, exactly as in
StepFactor::solve. The StepKind::SvdSecular path cannot fail here.
Auto Trait Implementations§
impl Freeze for StepFactor
impl RefUnwindSafe for StepFactor
impl Send for StepFactor
impl Sync for StepFactor
impl Unpin for StepFactor
impl UnsafeUnpin for StepFactor
impl UnwindSafe for StepFactor
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
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
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 more