pub struct QuadraticTerms {
pub hessian: Vec<(VarId, VarId, f64)>,
pub linear: Vec<(VarId, f64)>,
pub constant: f64,
}Expand description
Quadratic decomposition of an expression: its Hessian, gradient-linear part, and constant.
For a degree-<= 2 polynomial f(x), this holds the exact Taylor data
f(x) = constant + sum_i linear_i * x_i + 0.5 * x' Q xwhere Q is the (constant) Hessian. Returned by
extract_quadratic.
Fields§
§hessian: Vec<(VarId, VarId, f64)>Lower-triangle Hessian entries (row, col, h) with row >= col, where
h = partial^2 f / partial x_row partial x_col. Diagonal entries are the full second
derivative, so a * x^2 yields (x, x, 2a). This matches the
0.5 * x' Q x convention used by QP solvers.
linear: Vec<(VarId, f64)>Linear coefficients (var, coeff), the gradient of f at the origin.
constant: f64The constant term f(0).
Trait Implementations§
Source§impl Clone for QuadraticTerms
impl Clone for QuadraticTerms
Source§fn clone(&self) -> QuadraticTerms
fn clone(&self) -> QuadraticTerms
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for QuadraticTerms
impl Debug for QuadraticTerms
Source§impl Default for QuadraticTerms
impl Default for QuadraticTerms
Source§fn default() -> QuadraticTerms
fn default() -> QuadraticTerms
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for QuadraticTerms
impl RefUnwindSafe for QuadraticTerms
impl Send for QuadraticTerms
impl Sync for QuadraticTerms
impl Unpin for QuadraticTerms
impl UnsafeUnpin for QuadraticTerms
impl UnwindSafe for QuadraticTerms
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
Mutably borrows from an owned value. Read more