pub struct QuadExpr { /* private fields */ }Expand description
A quadratic (or linear) expression for use as a QP objective.
Stores quadratic terms as (va, vb) → coefficient where the pair is in
canonical order: (va.model_id, va.index) ≤ (vb.model_id, vb.index).
§Q-matrix convention
When converted to CscMatrix via quad_to_csc, the “1/2 xᵀQx” convention is used:
- Diagonal
c · xi²→Q[i][i] = 2c(so1/2 · Q[i][i] · xi² = c · xi²) - Cross
c · xi · xj(i≠j) →Q[i][j] = Q[j][i] = c(symmetric fill, both sides)
Implementations§
Trait Implementations§
Source§impl Add<Expression> for QuadExpr
impl Add<Expression> for QuadExpr
Source§impl Add<QuadExpr> for Expression
impl Add<QuadExpr> for Expression
Source§impl From<Expression> for QuadExpr
impl From<Expression> for QuadExpr
Source§fn from(e: Expression) -> Self
fn from(e: Expression) -> Self
Converts to this type from the input type.
Source§impl Sub<Expression> for QuadExpr
impl Sub<Expression> for QuadExpr
Source§impl Sub<QuadExpr> for Expression
impl Sub<QuadExpr> for Expression
Auto Trait Implementations§
impl Freeze for QuadExpr
impl RefUnwindSafe for QuadExpr
impl Send for QuadExpr
impl Sync for QuadExpr
impl Unpin for QuadExpr
impl UnsafeUnpin for QuadExpr
impl UnwindSafe for QuadExpr
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
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>
Converts
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>
Converts
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