Skip to main content

RootSolution

Struct RootSolution 

Source
pub struct RootSolution { /* private fields */ }
Expand description

The outcome of a single lane: its status, its iterate, its residual and the work it took.

The fields are private on purpose. The only way to get a number that is claimed to be a root is Self::root, which returns Option<f64> and hands back Some only for a converged lane. The raw iterate is available from Self::last_iterate, whose name is chosen so that using it as a root is a visible decision in the calling code rather than an accident.

Copy, so it can be read out of a RootBatch without cloning.

§Units

Self::root and Self::last_iterate are in the abscissa’s units; Self::residual is in the residual’s units; Self::iterations and Self::bracket_width are a dimensionless count and an abscissa-unit width respectively.

Implementations§

Source§

impl RootSolution

Source

pub fn root(&self) -> Option<f64>

The root, if this lane converged.

None for every failure status. This is the accessor to reach for; the Option is the point.

§Returns

Some(x) in the abscissa’s units when Self::status is RootStatus::Converged, otherwise None.

Source

pub fn last_iterate(&self) -> f64

The last iterate the solver held, converged or not.

A root only when Self::status is RootStatus::Converged. For RootStatus::MaxIterations this is the best estimate available and is offered for diagnosis — for deciding whether the lane was close or wildly off — not as an answer. For RootStatus::NotBracketed and RootStatus::InvalidBracket it is NaN, because there is no honest number to report and returning a bracket endpoint would be a lie.

Source

pub fn residual(&self) -> f64

The residual at Self::last_iterate, in the residual’s units.

NaN when no meaningful evaluation was reached.

Source

pub fn bracket_width(&self) -> f64

Width of the final bracket, in the abscissa’s units.

For Newton this is the width of the safeguarding bracket, not the final step. NaN when the lane never established a bracket.

Source

pub fn iterations(&self) -> u32

Iterations performed on this lane, dimensionless.

One iteration costs one residual evaluation, on top of the two bracket evaluations every lane pays up front (three for Newton, which also evaluates at its starting iterate). Useful for spotting that one lane in ten thousand which is dragging the whole batch.

Source

pub fn status(&self) -> RootStatus

How this lane ended.

Source

pub fn converged(&self) -> bool

Whether this lane produced a root.

Trait Implementations§

Source§

impl Clone for RootSolution

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for RootSolution

Source§

impl Debug for RootSolution

Source§

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

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

impl PartialEq for RootSolution

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RootSolution

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<T> Same for T

Source§

type Output = T

Should always be Self
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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.