pub struct Expression<T> {
pub terms: Vec<Term<T>>,
pub constant: OrderedFloat<f64>,
}Expand description
An expression that can be the left hand or right hand side of a constraint equation. It is a linear combination of variables, i.e. a sum of variables weighted by coefficients, plus an optional constant.
Fields§
§terms: Vec<Term<T>>§constant: OrderedFloat<f64>Implementations§
Source§impl<T: Clone> Expression<T>
impl<T: Clone> Expression<T>
Sourcepub fn from_constant(v: f64) -> Expression<T>
pub fn from_constant(v: f64) -> Expression<T>
Constructs an expression of the form n, where n is a constant real number, not a variable.
Sourcepub fn from_term(term: Term<T>) -> Expression<T>
pub fn from_term(term: Term<T>) -> Expression<T>
Constructs an expression from a single term. Forms an expression of the form n x where n is the coefficient, and x is the variable.
Trait Implementations§
Source§impl<T> Add<Expression<T>> for Term<T>
impl<T> Add<Expression<T>> for Term<T>
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
+ operator.Source§fn add(self, e: Expression<T>) -> Expression<T>
fn add(self, e: Expression<T>) -> Expression<T>
Performs the
+ operation. Read moreSource§impl<T> Add<Expression<T>> for f32
impl<T> Add<Expression<T>> for f32
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
+ operator.Source§fn add(self, e: Expression<T>) -> Expression<T>
fn add(self, e: Expression<T>) -> Expression<T>
Performs the
+ operation. Read moreSource§impl<T> Add<Expression<T>> for f64
impl<T> Add<Expression<T>> for f64
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
+ operator.Source§fn add(self, e: Expression<T>) -> Expression<T>
fn add(self, e: Expression<T>) -> Expression<T>
Performs the
+ operation. Read moreSource§impl<T> Add<Expression<T>> for i32
impl<T> Add<Expression<T>> for i32
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
+ operator.Source§fn add(self, e: Expression<T>) -> Expression<T>
fn add(self, e: Expression<T>) -> Expression<T>
Performs the
+ operation. Read moreSource§impl<T> Add<Expression<T>> for u32
impl<T> Add<Expression<T>> for u32
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
+ operator.Source§fn add(self, e: Expression<T>) -> Expression<T>
fn add(self, e: Expression<T>) -> Expression<T>
Performs the
+ operation. Read moreSource§impl Add<Expression<Variable>> for Variable
impl Add<Expression<Variable>> for Variable
Source§type Output = Expression<Variable>
type Output = Expression<Variable>
The resulting type after applying the
+ operator.Source§fn add(self, e: Expression<Variable>) -> Expression<Variable>
fn add(self, e: Expression<Variable>) -> Expression<Variable>
Performs the
+ operation. Read moreSource§impl<T> Add<Term<T>> for Expression<T>
impl<T> Add<Term<T>> for Expression<T>
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
+ operator.Source§impl<T> Add<f32> for Expression<T>
impl<T> Add<f32> for Expression<T>
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
+ operator.Source§impl<T> Add<f64> for Expression<T>
impl<T> Add<f64> for Expression<T>
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
+ operator.Source§impl<T> Add<i32> for Expression<T>
impl<T> Add<i32> for Expression<T>
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
+ operator.Source§impl<T> Add<u32> for Expression<T>
impl<T> Add<u32> for Expression<T>
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
+ operator.Source§impl<T> Add for Expression<T>
impl<T> Add for Expression<T>
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
+ operator.Source§fn add(self, e: Expression<T>) -> Expression<T>
fn add(self, e: Expression<T>) -> Expression<T>
Performs the
+ operation. Read moreSource§impl<T> AddAssign<Term<T>> for Expression<T>
impl<T> AddAssign<Term<T>> for Expression<T>
Source§fn add_assign(&mut self, t: Term<T>)
fn add_assign(&mut self, t: Term<T>)
Performs the
+= operation. Read moreSource§impl AddAssign<Variable> for Expression<Variable>
impl AddAssign<Variable> for Expression<Variable>
Source§fn add_assign(&mut self, v: Variable)
fn add_assign(&mut self, v: Variable)
Performs the
+= operation. Read moreSource§impl<T> AddAssign<f32> for Expression<T>
impl<T> AddAssign<f32> for Expression<T>
Source§fn add_assign(&mut self, v: f32)
fn add_assign(&mut self, v: f32)
Performs the
+= operation. Read moreSource§impl<T> AddAssign<f64> for Expression<T>
impl<T> AddAssign<f64> for Expression<T>
Source§fn add_assign(&mut self, v: f64)
fn add_assign(&mut self, v: f64)
Performs the
+= operation. Read moreSource§impl<T> AddAssign<i32> for Expression<T>
impl<T> AddAssign<i32> for Expression<T>
Source§fn add_assign(&mut self, v: i32)
fn add_assign(&mut self, v: i32)
Performs the
+= operation. Read moreSource§impl<T> AddAssign<u32> for Expression<T>
impl<T> AddAssign<u32> for Expression<T>
Source§fn add_assign(&mut self, v: u32)
fn add_assign(&mut self, v: u32)
Performs the
+= operation. Read moreSource§impl<T> AddAssign for Expression<T>
impl<T> AddAssign for Expression<T>
Source§fn add_assign(&mut self, e: Expression<T>)
fn add_assign(&mut self, e: Expression<T>)
Performs the
+= operation. Read moreSource§impl<T: Clone> Clone for Expression<T>
impl<T: Clone> Clone for Expression<T>
Source§fn clone(&self) -> Expression<T>
fn clone(&self) -> Expression<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<Var: Clone> Constrainable<Var> for Expression<Var>
impl<Var: Clone> Constrainable<Var> for Expression<Var>
fn equal_to<X>(self, x: X) -> Constraint<Var>
fn greater_than_or_equal_to<X>(self, x: X) -> Constraint<Var>
fn less_than_or_equal_to<X>(self, x: X) -> Constraint<Var>
fn is<X>(self, x: X) -> Constraint<Var>
fn is_ge<X>(self, x: X) -> Constraint<Var>
fn is_le<X>(self, x: X) -> Constraint<Var>
Source§impl<T: Debug> Debug for Expression<T>
impl<T: Debug> Debug for Expression<T>
Source§impl<T: Clone> Div<f32> for Expression<T>
impl<T: Clone> Div<f32> for Expression<T>
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
/ operator.Source§impl<T: Clone> Div<f64> for Expression<T>
impl<T: Clone> Div<f64> for Expression<T>
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
/ operator.Source§impl<T: Clone> Div<i32> for Expression<T>
impl<T: Clone> Div<i32> for Expression<T>
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
/ operator.Source§impl<T: Clone> Div<u32> for Expression<T>
impl<T: Clone> Div<u32> for Expression<T>
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
/ operator.Source§impl<T: Clone> DivAssign<f32> for Expression<T>
impl<T: Clone> DivAssign<f32> for Expression<T>
Source§fn div_assign(&mut self, v: f32)
fn div_assign(&mut self, v: f32)
Performs the
/= operation. Read moreSource§impl<T: Clone> DivAssign<f64> for Expression<T>
impl<T: Clone> DivAssign<f64> for Expression<T>
Source§fn div_assign(&mut self, v: f64)
fn div_assign(&mut self, v: f64)
Performs the
/= operation. Read moreSource§impl<T: Clone> DivAssign<i32> for Expression<T>
impl<T: Clone> DivAssign<i32> for Expression<T>
Source§fn div_assign(&mut self, v: i32)
fn div_assign(&mut self, v: i32)
Performs the
/= operation. Read moreSource§impl<T: Clone> DivAssign<u32> for Expression<T>
impl<T: Clone> DivAssign<u32> for Expression<T>
Source§fn div_assign(&mut self, v: u32)
fn div_assign(&mut self, v: u32)
Performs the
/= operation. Read moreSource§impl<T: Clone> From<Term<T>> for Expression<T>
impl<T: Clone> From<Term<T>> for Expression<T>
Source§fn from(t: Term<T>) -> Expression<T>
fn from(t: Term<T>) -> Expression<T>
Converts to this type from the input type.
Source§impl<T: Clone> From<f64> for Expression<T>
impl<T: Clone> From<f64> for Expression<T>
Source§fn from(v: f64) -> Expression<T>
fn from(v: f64) -> Expression<T>
Converts to this type from the input type.
Source§impl<T: Clone> From<i32> for Expression<T>
impl<T: Clone> From<i32> for Expression<T>
Source§fn from(v: i32) -> Expression<T>
fn from(v: i32) -> Expression<T>
Converts to this type from the input type.
Source§impl<T: Clone> From<u32> for Expression<T>
impl<T: Clone> From<u32> for Expression<T>
Source§fn from(v: u32) -> Expression<T>
fn from(v: u32) -> Expression<T>
Converts to this type from the input type.
Source§impl<T: Hash> Hash for Expression<T>
impl<T: Hash> Hash for Expression<T>
Source§impl<T: Clone> Mul<Expression<T>> for f32
impl<T: Clone> Mul<Expression<T>> for f32
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
* operator.Source§fn mul(self, e: Expression<T>) -> Expression<T>
fn mul(self, e: Expression<T>) -> Expression<T>
Performs the
* operation. Read moreSource§impl<T: Clone> Mul<Expression<T>> for f64
impl<T: Clone> Mul<Expression<T>> for f64
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
* operator.Source§fn mul(self, e: Expression<T>) -> Expression<T>
fn mul(self, e: Expression<T>) -> Expression<T>
Performs the
* operation. Read moreSource§impl<T: Clone> Mul<Expression<T>> for i32
impl<T: Clone> Mul<Expression<T>> for i32
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
* operator.Source§fn mul(self, e: Expression<T>) -> Expression<T>
fn mul(self, e: Expression<T>) -> Expression<T>
Performs the
* operation. Read moreSource§impl<T: Clone> Mul<Expression<T>> for u32
impl<T: Clone> Mul<Expression<T>> for u32
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
* operator.Source§fn mul(self, e: Expression<T>) -> Expression<T>
fn mul(self, e: Expression<T>) -> Expression<T>
Performs the
* operation. Read moreSource§impl<T: Clone> Mul<f32> for Expression<T>
impl<T: Clone> Mul<f32> for Expression<T>
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
* operator.Source§impl<T: Clone> Mul<f64> for Expression<T>
impl<T: Clone> Mul<f64> for Expression<T>
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
* operator.Source§impl<T: Clone> Mul<i32> for Expression<T>
impl<T: Clone> Mul<i32> for Expression<T>
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
* operator.Source§impl<T: Clone> Mul<u32> for Expression<T>
impl<T: Clone> Mul<u32> for Expression<T>
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
* operator.Source§impl<T: Clone> MulAssign<f32> for Expression<T>
impl<T: Clone> MulAssign<f32> for Expression<T>
Source§fn mul_assign(&mut self, v: f32)
fn mul_assign(&mut self, v: f32)
Performs the
*= operation. Read moreSource§impl<T: Clone> MulAssign<f64> for Expression<T>
impl<T: Clone> MulAssign<f64> for Expression<T>
Source§fn mul_assign(&mut self, v: f64)
fn mul_assign(&mut self, v: f64)
Performs the
*= operation. Read moreSource§impl<T: Clone> MulAssign<i32> for Expression<T>
impl<T: Clone> MulAssign<i32> for Expression<T>
Source§fn mul_assign(&mut self, v: i32)
fn mul_assign(&mut self, v: i32)
Performs the
*= operation. Read moreSource§impl<T: Clone> MulAssign<u32> for Expression<T>
impl<T: Clone> MulAssign<u32> for Expression<T>
Source§fn mul_assign(&mut self, v: u32)
fn mul_assign(&mut self, v: u32)
Performs the
*= operation. Read moreSource§impl<T: Clone> Neg for Expression<T>
impl<T: Clone> Neg for Expression<T>
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
- operator.Source§fn neg(self) -> Expression<T>
fn neg(self) -> Expression<T>
Performs the unary
- operation. Read moreSource§impl<T: PartialEq> PartialEq for Expression<T>
impl<T: PartialEq> PartialEq for Expression<T>
Source§impl<T: Clone> Sub<Expression<T>> for Term<T>
impl<T: Clone> Sub<Expression<T>> for Term<T>
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
- operator.Source§fn sub(self, e: Expression<T>) -> Expression<T>
fn sub(self, e: Expression<T>) -> Expression<T>
Performs the
- operation. Read moreSource§impl<T: Clone> Sub<Expression<T>> for f32
impl<T: Clone> Sub<Expression<T>> for f32
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
- operator.Source§fn sub(self, e: Expression<T>) -> Expression<T>
fn sub(self, e: Expression<T>) -> Expression<T>
Performs the
- operation. Read moreSource§impl<T: Clone> Sub<Expression<T>> for f64
impl<T: Clone> Sub<Expression<T>> for f64
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
- operator.Source§fn sub(self, e: Expression<T>) -> Expression<T>
fn sub(self, e: Expression<T>) -> Expression<T>
Performs the
- operation. Read moreSource§impl<T: Clone> Sub<Expression<T>> for i32
impl<T: Clone> Sub<Expression<T>> for i32
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
- operator.Source§fn sub(self, e: Expression<T>) -> Expression<T>
fn sub(self, e: Expression<T>) -> Expression<T>
Performs the
- operation. Read moreSource§impl<T: Clone> Sub<Expression<T>> for u32
impl<T: Clone> Sub<Expression<T>> for u32
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
- operator.Source§fn sub(self, e: Expression<T>) -> Expression<T>
fn sub(self, e: Expression<T>) -> Expression<T>
Performs the
- operation. Read moreSource§impl Sub<Expression<Variable>> for Variable
impl Sub<Expression<Variable>> for Variable
Source§type Output = Expression<Variable>
type Output = Expression<Variable>
The resulting type after applying the
- operator.Source§fn sub(self, e: Expression<Variable>) -> Expression<Variable>
fn sub(self, e: Expression<Variable>) -> Expression<Variable>
Performs the
- operation. Read moreSource§impl<T> Sub<Term<T>> for Expression<T>
impl<T> Sub<Term<T>> for Expression<T>
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
- operator.Source§impl<T> Sub<f32> for Expression<T>
impl<T> Sub<f32> for Expression<T>
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
- operator.Source§impl<T> Sub<f64> for Expression<T>
impl<T> Sub<f64> for Expression<T>
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
- operator.Source§impl<T> Sub<i32> for Expression<T>
impl<T> Sub<i32> for Expression<T>
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
- operator.Source§impl<T> Sub<u32> for Expression<T>
impl<T> Sub<u32> for Expression<T>
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
- operator.Source§impl<T: Clone> Sub for Expression<T>
impl<T: Clone> Sub for Expression<T>
Source§type Output = Expression<T>
type Output = Expression<T>
The resulting type after applying the
- operator.Source§fn sub(self, e: Expression<T>) -> Expression<T>
fn sub(self, e: Expression<T>) -> Expression<T>
Performs the
- operation. Read moreSource§impl<T> SubAssign<Term<T>> for Expression<T>
impl<T> SubAssign<Term<T>> for Expression<T>
Source§fn sub_assign(&mut self, t: Term<T>)
fn sub_assign(&mut self, t: Term<T>)
Performs the
-= operation. Read moreSource§impl SubAssign<Variable> for Expression<Variable>
impl SubAssign<Variable> for Expression<Variable>
Source§fn sub_assign(&mut self, v: Variable)
fn sub_assign(&mut self, v: Variable)
Performs the
-= operation. Read moreSource§impl<T> SubAssign<f32> for Expression<T>
impl<T> SubAssign<f32> for Expression<T>
Source§fn sub_assign(&mut self, v: f32)
fn sub_assign(&mut self, v: f32)
Performs the
-= operation. Read moreSource§impl<T> SubAssign<f64> for Expression<T>
impl<T> SubAssign<f64> for Expression<T>
Source§fn sub_assign(&mut self, v: f64)
fn sub_assign(&mut self, v: f64)
Performs the
-= operation. Read moreSource§impl<T> SubAssign<i32> for Expression<T>
impl<T> SubAssign<i32> for Expression<T>
Source§fn sub_assign(&mut self, v: i32)
fn sub_assign(&mut self, v: i32)
Performs the
-= operation. Read moreSource§impl<T> SubAssign<u32> for Expression<T>
impl<T> SubAssign<u32> for Expression<T>
Source§fn sub_assign(&mut self, v: u32)
fn sub_assign(&mut self, v: u32)
Performs the
-= operation. Read moreSource§impl<T: Clone> SubAssign for Expression<T>
impl<T: Clone> SubAssign for Expression<T>
Source§fn sub_assign(&mut self, e: Expression<T>)
fn sub_assign(&mut self, e: Expression<T>)
Performs the
-= operation. Read moreimpl<T: Eq> Eq for Expression<T>
impl<T> StructuralPartialEq for Expression<T>
Auto Trait Implementations§
impl<T> Freeze for Expression<T>
impl<T> RefUnwindSafe for Expression<T>where
T: RefUnwindSafe,
impl<T> Send for Expression<T>where
T: Send,
impl<T> Sync for Expression<T>where
T: Sync,
impl<T> Unpin for Expression<T>where
T: Unpin,
impl<T> UnwindSafe for Expression<T>where
T: UnwindSafe,
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