Expr

Enum Expr 

Source
pub enum Expr {
    Quad(QuadExpr),
    Linear(LinExpr),
    QTerm(f64, Var, Var),
    Term(f64, Var),
    Constant(f64),
}
Expand description

An algbraic expression of variables.

Variants§

§

Quad(QuadExpr)

A quadratic expression

§

Linear(LinExpr)

A linear expression

§

QTerm(f64, Var, Var)

A single quadratic term

§

Term(f64, Var)

A single linear term

§

Constant(f64)

A constant term

Implementations§

Source§

impl Expr

Source

pub fn is_linear(&self) -> bool

Returns false if quadratic terms are present.

Source

pub fn into_quadexpr(self) -> QuadExpr

Transform into a QuadExpr, possibly with no quadratic terms)

Source

pub fn into_linexpr(self) -> Result<LinExpr>

Transform into a LinExpr, possible with no linear terms (just a constant)

§Errors

Returns an Error::AlgebraicError if Expr is not linear.

Trait Implementations§

Source§

impl Add<Expr> for LinExpr

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Expr) -> Expr

Performs the + operation. Read more
Source§

impl Add<Expr> for QuadExpr

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Expr) -> Expr

Performs the + operation. Read more
Source§

impl Add<Expr> for Var

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Expr) -> Expr

Performs the + operation. Read more
Source§

impl Add<Expr> for f32

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Expr) -> Expr

Performs the + operation. Read more
Source§

impl Add<Expr> for f64

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Expr) -> Expr

Performs the + operation. Read more
Source§

impl Add<Expr> for i16

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Expr) -> Expr

Performs the + operation. Read more
Source§

impl Add<Expr> for i32

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Expr) -> Expr

Performs the + operation. Read more
Source§

impl Add<Expr> for i64

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Expr) -> Expr

Performs the + operation. Read more
Source§

impl Add<Expr> for i8

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Expr) -> Expr

Performs the + operation. Read more
Source§

impl Add<Expr> for isize

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Expr) -> Expr

Performs the + operation. Read more
Source§

impl Add<Expr> for u16

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Expr) -> Expr

Performs the + operation. Read more
Source§

impl Add<Expr> for u32

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Expr) -> Expr

Performs the + operation. Read more
Source§

impl Add<Expr> for u64

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Expr) -> Expr

Performs the + operation. Read more
Source§

impl Add<Expr> for u8

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Expr) -> Expr

Performs the + operation. Read more
Source§

impl Add<Expr> for usize

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Expr) -> Expr

Performs the + operation. Read more
Source§

impl Add<LinExpr> for Expr

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: LinExpr) -> Expr

Performs the + operation. Read more
Source§

impl Add<QuadExpr> for Expr

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: QuadExpr) -> Expr

Performs the + operation. Read more
Source§

impl Add<Var> for Expr

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Var) -> Expr

Performs the + operation. Read more
Source§

impl Add<f32> for Expr

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: f32) -> Expr

Performs the + operation. Read more
Source§

impl Add<f64> for Expr

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: f64) -> Expr

Performs the + operation. Read more
Source§

impl Add<i16> for Expr

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: i16) -> Expr

Performs the + operation. Read more
Source§

impl Add<i32> for Expr

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: i32) -> Expr

Performs the + operation. Read more
Source§

impl Add<i64> for Expr

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: i64) -> Expr

Performs the + operation. Read more
Source§

impl Add<i8> for Expr

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: i8) -> Expr

Performs the + operation. Read more
Source§

impl Add<isize> for Expr

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: isize) -> Expr

Performs the + operation. Read more
Source§

impl Add<u16> for Expr

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: u16) -> Expr

Performs the + operation. Read more
Source§

impl Add<u32> for Expr

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: u32) -> Expr

Performs the + operation. Read more
Source§

impl Add<u64> for Expr

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: u64) -> Expr

Performs the + operation. Read more
Source§

impl Add<u8> for Expr

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: u8) -> Expr

Performs the + operation. Read more
Source§

impl Add<usize> for Expr

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: usize) -> Expr

Performs the + operation. Read more
Source§

impl Add for Expr

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self

Performs the + operation. Read more
Source§

impl AttachModel for Expr

Source§

fn attach<'a>(&'a self, model: &'a Model) -> Attached<'a, Self>
where Self: Sized,

Attach a model reference to this object for formatting with Debug
Source§

impl Clone for Expr

Source§

fn clone(&self) -> Expr

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Expr

Source§

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

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

impl Default for Expr

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T: Copy + Into<Expr>> From<&T> for Expr

Source§

fn from(val: &T) -> Expr

Converts to this type from the input type.
Source§

impl From<LinExpr> for Expr

Source§

fn from(val: LinExpr) -> Expr

Converts to this type from the input type.
Source§

impl From<QuadExpr> for Expr

Source§

fn from(val: QuadExpr) -> Expr

Converts to this type from the input type.
Source§

impl From<Var> for Expr

Source§

fn from(var: Var) -> Expr

Converts to this type from the input type.
Source§

impl From<f32> for Expr

Source§

fn from(val: f32) -> Expr

Converts to this type from the input type.
Source§

impl From<f64> for Expr

Source§

fn from(val: f64) -> Expr

Converts to this type from the input type.
Source§

impl From<i16> for Expr

Source§

fn from(val: i16) -> Expr

Converts to this type from the input type.
Source§

impl From<i32> for Expr

Source§

fn from(val: i32) -> Expr

Converts to this type from the input type.
Source§

impl From<i64> for Expr

Source§

fn from(val: i64) -> Expr

Converts to this type from the input type.
Source§

impl From<i8> for Expr

Source§

fn from(val: i8) -> Expr

Converts to this type from the input type.
Source§

impl From<isize> for Expr

Source§

fn from(val: isize) -> Expr

Converts to this type from the input type.
Source§

impl From<u16> for Expr

Source§

fn from(val: u16) -> Expr

Converts to this type from the input type.
Source§

impl From<u32> for Expr

Source§

fn from(val: u32) -> Expr

Converts to this type from the input type.
Source§

impl From<u64> for Expr

Source§

fn from(val: u64) -> Expr

Converts to this type from the input type.
Source§

impl From<u8> for Expr

Source§

fn from(val: u8) -> Expr

Converts to this type from the input type.
Source§

impl From<usize> for Expr

Source§

fn from(val: usize) -> Expr

Converts to this type from the input type.
Source§

impl Mul<Expr> for f32

Source§

type Output = Expr

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Expr) -> Expr

Performs the * operation. Read more
Source§

impl Mul<Expr> for f64

Source§

type Output = Expr

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Expr) -> Expr

Performs the * operation. Read more
Source§

impl Mul<Expr> for i16

Source§

type Output = Expr

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Expr) -> Expr

Performs the * operation. Read more
Source§

impl Mul<Expr> for i32

Source§

type Output = Expr

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Expr) -> Expr

Performs the * operation. Read more
Source§

impl Mul<Expr> for i64

Source§

type Output = Expr

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Expr) -> Expr

Performs the * operation. Read more
Source§

impl Mul<Expr> for i8

Source§

type Output = Expr

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Expr) -> Expr

Performs the * operation. Read more
Source§

impl Mul<Expr> for isize

Source§

type Output = Expr

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Expr) -> Expr

Performs the * operation. Read more
Source§

impl Mul<Expr> for u16

Source§

type Output = Expr

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Expr) -> Expr

Performs the * operation. Read more
Source§

impl Mul<Expr> for u32

Source§

type Output = Expr

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Expr) -> Expr

Performs the * operation. Read more
Source§

impl Mul<Expr> for u64

Source§

type Output = Expr

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Expr) -> Expr

Performs the * operation. Read more
Source§

impl Mul<Expr> for u8

Source§

type Output = Expr

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Expr) -> Expr

Performs the * operation. Read more
Source§

impl Mul<Expr> for usize

Source§

type Output = Expr

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Expr) -> Expr

Performs the * operation. Read more
Source§

impl Mul<f32> for Expr

Source§

type Output = Expr

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: f32) -> Expr

Performs the * operation. Read more
Source§

impl Mul<f64> for Expr

Source§

type Output = Expr

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: f64) -> Expr

Performs the * operation. Read more
Source§

impl Mul<i16> for Expr

Source§

type Output = Expr

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: i16) -> Expr

Performs the * operation. Read more
Source§

impl Mul<i32> for Expr

Source§

type Output = Expr

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: i32) -> Expr

Performs the * operation. Read more
Source§

impl Mul<i64> for Expr

Source§

type Output = Expr

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: i64) -> Expr

Performs the * operation. Read more
Source§

impl Mul<i8> for Expr

Source§

type Output = Expr

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: i8) -> Expr

Performs the * operation. Read more
Source§

impl Mul<isize> for Expr

Source§

type Output = Expr

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: isize) -> Expr

Performs the * operation. Read more
Source§

impl Mul<u16> for Expr

Source§

type Output = Expr

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: u16) -> Expr

Performs the * operation. Read more
Source§

impl Mul<u32> for Expr

Source§

type Output = Expr

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: u32) -> Expr

Performs the * operation. Read more
Source§

impl Mul<u64> for Expr

Source§

type Output = Expr

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: u64) -> Expr

Performs the * operation. Read more
Source§

impl Mul<u8> for Expr

Source§

type Output = Expr

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: u8) -> Expr

Performs the * operation. Read more
Source§

impl Mul<usize> for Expr

Source§

type Output = Expr

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: usize) -> Expr

Performs the * operation. Read more
Source§

impl Neg for Expr

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn neg(self) -> Expr

Performs the unary - operation. Read more
Source§

impl Sub<Expr> for LinExpr

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Expr) -> Expr

Performs the - operation. Read more
Source§

impl Sub<Expr> for QuadExpr

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Expr) -> Expr

Performs the - operation. Read more
Source§

impl Sub<Expr> for Var

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Expr) -> Expr

Performs the - operation. Read more
Source§

impl Sub<Expr> for f32

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Expr) -> Expr

Performs the - operation. Read more
Source§

impl Sub<Expr> for f64

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Expr) -> Expr

Performs the - operation. Read more
Source§

impl Sub<Expr> for i16

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Expr) -> Expr

Performs the - operation. Read more
Source§

impl Sub<Expr> for i32

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Expr) -> Expr

Performs the - operation. Read more
Source§

impl Sub<Expr> for i64

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Expr) -> Expr

Performs the - operation. Read more
Source§

impl Sub<Expr> for i8

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Expr) -> Expr

Performs the - operation. Read more
Source§

impl Sub<Expr> for isize

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Expr) -> Expr

Performs the - operation. Read more
Source§

impl Sub<Expr> for u16

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Expr) -> Expr

Performs the - operation. Read more
Source§

impl Sub<Expr> for u32

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Expr) -> Expr

Performs the - operation. Read more
Source§

impl Sub<Expr> for u64

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Expr) -> Expr

Performs the - operation. Read more
Source§

impl Sub<Expr> for u8

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Expr) -> Expr

Performs the - operation. Read more
Source§

impl Sub<Expr> for usize

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Expr) -> Expr

Performs the - operation. Read more
Source§

impl Sub<LinExpr> for Expr

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: LinExpr) -> Expr

Performs the - operation. Read more
Source§

impl Sub<QuadExpr> for Expr

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: QuadExpr) -> Expr

Performs the - operation. Read more
Source§

impl Sub<Var> for Expr

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Var) -> Expr

Performs the - operation. Read more
Source§

impl Sub<f32> for Expr

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: f32) -> Expr

Performs the - operation. Read more
Source§

impl Sub<f64> for Expr

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: f64) -> Expr

Performs the - operation. Read more
Source§

impl Sub<i16> for Expr

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: i16) -> Expr

Performs the - operation. Read more
Source§

impl Sub<i32> for Expr

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: i32) -> Expr

Performs the - operation. Read more
Source§

impl Sub<i64> for Expr

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: i64) -> Expr

Performs the - operation. Read more
Source§

impl Sub<i8> for Expr

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: i8) -> Expr

Performs the - operation. Read more
Source§

impl Sub<isize> for Expr

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: isize) -> Expr

Performs the - operation. Read more
Source§

impl Sub<u16> for Expr

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: u16) -> Expr

Performs the - operation. Read more
Source§

impl Sub<u32> for Expr

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: u32) -> Expr

Performs the - operation. Read more
Source§

impl Sub<u64> for Expr

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: u64) -> Expr

Performs the - operation. Read more
Source§

impl Sub<u8> for Expr

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: u8) -> Expr

Performs the - operation. Read more
Source§

impl Sub<usize> for Expr

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: usize) -> Expr

Performs the - operation. Read more
Source§

impl Sub for Expr

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self

Performs the - operation. Read more
Source§

impl<A: Into<Expr>> Sum<A> for Expr

Source§

fn sum<I>(iter: I) -> Expr
where I: Iterator<Item = A>,

Takes an iterator and generates Self from the elements by “summing up” the items.

Auto Trait Implementations§

§

impl Freeze for Expr

§

impl RefUnwindSafe for Expr

§

impl Send for Expr

§

impl Sync for Expr

§

impl Unpin for Expr

§

impl UnwindSafe for Expr

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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.