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
impl RootSolution
Sourcepub fn root(&self) -> Option<f64>
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.
Sourcepub fn last_iterate(&self) -> f64
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.
Sourcepub fn residual(&self) -> f64
pub fn residual(&self) -> f64
The residual at Self::last_iterate, in the residual’s units.
NaN when no meaningful evaluation was reached.
Sourcepub fn bracket_width(&self) -> f64
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.
Sourcepub fn iterations(&self) -> u32
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.
Sourcepub fn status(&self) -> RootStatus
pub fn status(&self) -> RootStatus
How this lane ended.