pub struct Polynomial { /* private fields */ }Implementations§
Source§impl Polynomial
impl Polynomial
pub fn var(vindex: usize) -> Polynomial
Sourcepub fn sign(&self) -> Option<bool>
pub fn sign(&self) -> Option<bool>
Determine the sign of this polynomial (if known). Here,
positive sign indicates the polynomial can never evaluate to
a negative number. In constrast, a negative sign indicates
it cannot evalute to a (strictly) positive number. For
example, 1+2x has positive sign, whilst -2x has negative
sign.
Sourcepub fn constant(&self) -> isize
pub fn constant(&self) -> isize
Determine the constant coefficient of this polynomial. For
example, 1 is the constant component of 2x+1.
Sourcepub fn is_zero(&self) -> Option<bool>
pub fn is_zero(&self) -> Option<bool>
Determine whether or not this polynomial could be zero (or
not). For example, 2x+1 cannot be zero (i.e. given that x
cannot be negative). However, x - y can be zero (e.g. when
x=y). Note: just because this polynomial could evaluate to
zero, it does not mean that it will.
Sourcepub fn above_zero(&self) -> Option<bool>
pub fn above_zero(&self) -> Option<bool>
Determine whether or not this polynomial always evaluates to something above zero (or not).
Sourcepub fn below_zero(&self) -> Option<bool>
pub fn below_zero(&self) -> Option<bool>
Determine whether or not this polynomial always evaluates to something below zero (or not).
Sourcepub fn negate(self) -> Self
pub fn negate(self) -> Self
Negate this polynomial. This is achieved by negating each term within the polynomial.
Sourcepub fn add(self, rhs: &Polynomial) -> Self
pub fn add(self, rhs: &Polynomial) -> Self
Add a given Polynomial onto this polynomial. For example,
adding x+2 to 2x+1 gives 3x+3.
Sourcepub fn sub(self, rhs: &Polynomial) -> Self
pub fn sub(self, rhs: &Polynomial) -> Self
Subtract a given Polynomial from this polynomial.
pub fn mul(self, rhs: &Polynomial) -> Self
Sourcepub fn equals(self, rhs: Polynomial) -> Constraint
pub fn equals(self, rhs: Polynomial) -> Constraint
Construct a constraint enforcing the equality of two polynomials.
Sourcepub fn not_equals(self, rhs: Polynomial) -> Constraint
pub fn not_equals(self, rhs: Polynomial) -> Constraint
Construct a constraint enforcing the non-equality of two polynomials.
Sourcepub fn less_than(self, rhs: Polynomial) -> Constraint
pub fn less_than(self, rhs: Polynomial) -> Constraint
Construct a constraint enforcing that one polynomial is less than another.
Sourcepub fn less_than_or_equals(self, rhs: Polynomial) -> Constraint
pub fn less_than_or_equals(self, rhs: Polynomial) -> Constraint
Construct a constraint enforcing that one polynomial is less than or equal to another.
Sourcepub fn substitute(&self, var: usize, val: &Polynomial) -> Polynomial
pub fn substitute(&self, var: usize, val: &Polynomial) -> Polynomial
Substitute all occurrenes of a given variable in self with a
given Polynomial. For example, substituting x:=x+1 into
2x + xy gives 2+2x+xy+y.
Trait Implementations§
Source§impl Add for Polynomial
impl Add for Polynomial
Source§impl Add<usize> for Polynomial
impl Add<usize> for Polynomial
Source§impl Clone for Polynomial
impl Clone for Polynomial
Source§fn clone(&self) -> Polynomial
fn clone(&self) -> Polynomial
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 Polynomial
impl Debug for Polynomial
Source§impl Display for Polynomial
impl Display for Polynomial
Source§impl From<i32> for Polynomial
impl From<i32> for Polynomial
Source§impl From<usize> for Polynomial
impl From<usize> for Polynomial
Source§impl Mul for Polynomial
impl Mul for Polynomial
Source§type Output = Polynomial
type Output = Polynomial
* operator.Source§fn mul(self, rhs: Polynomial) -> Self
fn mul(self, rhs: Polynomial) -> Self
* operation. Read more