pub struct FactoredQuadratic {
pub squares: Vec<SquaredAffine>,
pub linear: Vec<(usize, f64)>,
pub constant: f64,
}Expand description
A degree-2 form kept as Σ wₖ(bₖᵀx + dₖ)² + aᵀx + c — the shape the
.nl writer wrote, rather than its expansion about the origin.
This is the representation gh #673 asks for and
is_expanded_quadratic exists to refuse the alternative to. Reading
(x − 500000)² back as x² − 10⁶x + 2.5·10¹¹ cancels five digits;
reading it back as one squared residual repeats exactly the
multiplication the tape performs, so admitting it costs no accuracy at
all.
The degree-≤1 leftovers (linear, constant) are the monomials the
writer folded into the same tree — the + 3y of (x − 1)² + 3y. They
are summed as coefficients rather than kept term by term, which is the
same reassociation the expanded path already makes and is gated the
same way (see Quad2::lost_terms).
Fields§
§squares: Vec<SquaredAffine>The squared affine terms, in the order the spine walk met them.
linear: Vec<(usize, f64)>a, ascending by variable index.
constant: f64c.
Trait Implementations§
Source§impl Clone for FactoredQuadratic
impl Clone for FactoredQuadratic
Source§fn clone(&self) -> FactoredQuadratic
fn clone(&self) -> FactoredQuadratic
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FactoredQuadratic
impl Debug for FactoredQuadratic
Source§impl PartialEq for FactoredQuadratic
impl PartialEq for FactoredQuadratic
impl StructuralPartialEq for FactoredQuadratic
Auto Trait Implementations§
impl Freeze for FactoredQuadratic
impl RefUnwindSafe for FactoredQuadratic
impl Send for FactoredQuadratic
impl Sync for FactoredQuadratic
impl Unpin for FactoredQuadratic
impl UnsafeUnpin for FactoredQuadratic
impl UnwindSafe for FactoredQuadratic
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T, U> Imply<T> for U
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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