Skip to main content

PiggybackError

Enum PiggybackError 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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).

Fields

§iteration: usize
§last_norm: f64
§

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.

Fields

§iteration: usize
§last_norm: f64
§

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.

Fields

§iteration: usize
§last_norm: f64
§

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.

Fields

§iteration: usize
§z_norm: f64
§

IterationsExhaustedAdjoint

piggyback_adjoint_solve reached max_iter without meeting tol. lam_norm is the final iteration’s relative adjoint- delta norm (||λ_new - λ|| / (1 + ||λ||)).

Fields

§iteration: usize
§lam_norm: f64
§

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.

Fields

§iteration: usize
§z_norm: f64
§lam_norm: f64
§

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.

Fields

§field: &'static str
§expected: usize
§actual: usize

Trait Implementations§

Source§

impl Clone for PiggybackError

Source§

fn clone(&self) -> PiggybackError

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PiggybackError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for PiggybackError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for PiggybackError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.