#[non_exhaustive]pub enum PiggybackError {
PrimalDivergence {
iteration: usize,
last_norm: f64,
},
TangentDivergence {
iteration: usize,
last_norm: f64,
},
AdjointDivergence {
iteration: usize,
last_norm: f64,
},
IterationsExhaustedTangent {
iteration: usize,
z_norm: f64,
},
IterationsExhaustedAdjoint {
iteration: usize,
lam_norm: f64,
},
IterationsExhaustedForwardAdjoint {
iteration: usize,
z_norm: f64,
lam_norm: f64,
},
DimensionMismatch {
field: &'static str,
expected: usize,
actual: usize,
},
}Expand description
Reason a piggyback solve failed to converge.
Marked #[non_exhaustive] so future variants can be added without
breaking exhaustive matches. Numeric fields use f64 (cast via
Float::to_f64) for uniform diagnostic output regardless of the
solver’s F type.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
PrimalDivergence
The primal z_{k+1} = G(z_k, x) produced a non-finite norm
(relative-norm ||z_new - z||/(1 + ||z||) is NaN/Inf), or
the primal vector itself contained non-finite components in
the forward-adjoint loop. last_norm is the primal-delta
relative norm at the detecting iteration: non-finite when
detection came from the norm check (the usual case);
finite — and itself diagnostic — when detection came from
the componentwise finite check (primal vector overflowed
mid-iteration while the step-to-step delta stayed bounded).
TangentDivergence
Primal stayed finite but the tangent
ż_{k+1} = G_z · ż_k + G_x · ẋ produced non-finite values.
Catches the ratio-converging case where the primal norm
remains bounded while individual tangent components overflow.
last_norm is the primal-delta relative norm at the
detecting iteration — finite by construction here (the
tangent-only divergence path takes the norm-finite branch
before the componentwise check fires); surfacing it tells
the caller the primal iteration was bounded while the JVP
overflowed.
AdjointDivergence
Adjoint λ_{k+1} = G_z^T · λ_k + z̄ produced non-finite
values (norm or individual components). last_norm is the
adjoint-delta relative norm at the detecting iteration:
non-finite when detection came from the norm check; finite
when it came from the componentwise lambda_new check.
IterationsExhaustedTangent
piggyback_tangent_solve reached max_iter without meeting
tol. z_norm is the final iteration’s relative primal-delta
norm (||z_new - z|| / (1 + ||z||)) — a value just over tol
signals proximity to convergence; many orders over signals
stagnation. iteration equals max_iter.
IterationsExhaustedAdjoint
piggyback_adjoint_solve reached max_iter without meeting
tol. lam_norm is the final iteration’s relative adjoint-
delta norm (||λ_new - λ|| / (1 + ||λ||)).
IterationsExhaustedForwardAdjoint
piggyback_forward_adjoint_solve reached max_iter without
meeting tol on both norms simultaneously. Each field is the
final iteration’s relative norm for the corresponding stream.
DimensionMismatch
A runtime-supplied vector argument to a public *_solve fn
had an unexpected length. field names the argument (e.g.
"z_dot", "z_bar"), expected is the length the API
requires (typically num_states or x.len()), actual is
the length the caller supplied.
Note: tape-shape contract mismatches
(validate_step_tape) and step-fn argument mismatches
(piggyback_tangent_step[_with_buf]) continue to panic —
those are programmer-contract violations, not recoverable
runtime failures.
Trait Implementations§
Source§impl Clone for PiggybackError
impl Clone for PiggybackError
Source§fn clone(&self) -> PiggybackError
fn clone(&self) -> PiggybackError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PiggybackError
impl Debug for PiggybackError
Source§impl Display for PiggybackError
impl Display for PiggybackError
Source§impl Error for PiggybackError
impl Error for PiggybackError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for PiggybackError
impl RefUnwindSafe for PiggybackError
impl Send for PiggybackError
impl Sync for PiggybackError
impl Unpin for PiggybackError
impl UnsafeUnpin for PiggybackError
impl UnwindSafe for PiggybackError
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<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.