Struct symbolic_polynomials::Polynomial
[−]
[src]
pub struct Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power, { pub monomials: Vec<Monomial<I, C, P>>, }
A symbolic polynomial represented as m_1 + m_2 + ... + m_n.
Fields
monomials: Vec<Monomial<I, C, P>>
A vector of the monomials m_i, where m_i is a Monomial.
Methods
impl<I, C, P> Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
fn is_constant(&self) -> bool
True
only if the polynomial is constant and does not depend on any symbolic variables.
fn eval(&self, values: &HashMap<I, C>) -> Result<C, (I, String)>
Evaluates the Polynomial
given the provided mapping of identifier to value assignment.
fn to_code<F>(&self, format: &F) -> String where
F: Fn(I) -> String,
F: Fn(I) -> String,
Returns a code equivalent string representation of the Polynomial
.
The format
specifies a function how to render the identifiers;
fn div_rem(
&self,
rhs: &Polynomial<I, C, P>
) -> (Polynomial<I, C, P>, Polynomial<I, C, P>)
&self,
rhs: &Polynomial<I, C, P>
) -> (Polynomial<I, C, P>, Polynomial<I, C, P>)
Returns the result of the polynomial division with rhs
as well as the reminder.
Note that this division depends on the ordering of the variable variables type I
as explained in Wikipedia.
fn checked_div(&self, rhs: &Polynomial<I, C, P>) -> Option<Polynomial<I, C, P>>
If the the polynomial is divisible by rhs
than returns the result
of that division, otherwise None.
Trait Implementations
impl<I: Clone, C: Clone, P: Clone> Clone for Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
fn clone(&self) -> Polynomial<I, C, P>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<I: Debug, C: Debug, P: Debug> Debug for Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
impl<I: Eq, C: Eq, P: Eq> Eq for Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
impl<I, C, P> Display for Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl<I, C, P> From<C> for Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
fn from(other: C) -> Self
Performs the conversion.
impl<'a, I, C, P> From<&'a Monomial<I, C, P>> for Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
impl<I, C, P> From<Monomial<I, C, P>> for Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
impl<I, C, P> PartialEq<C> for Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
fn eq(&self, other: &C) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl<I, C, P> PartialEq<Monomial<I, C, P>> for Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
fn eq(&self, other: &Monomial<I, C, P>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl<I, C, P> PartialEq for Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
fn eq(&self, other: &Polynomial<I, C, P>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl<I, C, P> PartialOrd<C> for Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
fn partial_cmp(&self, other: &C) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<I, C, P> PartialOrd<Monomial<I, C, P>> for Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
fn partial_cmp(&self, other: &Monomial<I, C, P>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<I, C, P> PartialOrd for Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
fn partial_cmp(&self, other: &Polynomial<I, C, P>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<I, C, P> Ord for Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
fn cmp(&self, other: &Polynomial<I, C, P>) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl<I, C, P> MulAssign<C> for Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
fn mul_assign(&mut self, rhs: C)
The method for the *=
operator
impl<'a, I, C, P> Mul<C> for &'a Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
type Output = Polynomial<I, C, P>
The resulting type after applying the *
operator
fn mul(self, rhs: C) -> Self::Output
The method for the *
operator
impl<'a, I, C, P> MulAssign<&'a Monomial<I, C, P>> for Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
fn mul_assign(&mut self, rhs: &'a Monomial<I, C, P>)
The method for the *=
operator
impl<'a, 'b, I, C, P> Mul<&'a Monomial<I, C, P>> for &'b Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
type Output = Polynomial<I, C, P>
The resulting type after applying the *
operator
fn mul(self, rhs: &'a Monomial<I, C, P>) -> Self::Output
The method for the *
operator
impl<'a, I, C, P> MulAssign<&'a Polynomial<I, C, P>> for Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
fn mul_assign(&mut self, rhs: &'a Polynomial<I, C, P>)
The method for the *=
operator
impl<'a, 'b, I, C, P> Mul<&'a Polynomial<I, C, P>> for &'b Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
type Output = Polynomial<I, C, P>
The resulting type after applying the *
operator
fn mul(self, rhs: &'a Polynomial<I, C, P>) -> Self::Output
The method for the *
operator
impl<'a, I, C, P> Div<C> for &'a Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
type Output = Polynomial<I, C, P>
The resulting type after applying the /
operator
fn div(self, rhs: C) -> Self::Output
The method for the /
operator
impl<I, C, P> DivAssign<C> for Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
fn div_assign(&mut self, rhs: C)
The method for the /=
operator
impl<'a, 'b, I, C, P> Div<&'a Monomial<I, C, P>> for &'b Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
type Output = Polynomial<I, C, P>
The resulting type after applying the /
operator
fn div(self, rhs: &'a Monomial<I, C, P>) -> Self::Output
The method for the /
operator
impl<'a, I, C, P> DivAssign<&'a Monomial<I, C, P>> for Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
fn div_assign(&mut self, rhs: &'a Monomial<I, C, P>)
The method for the /=
operator
impl<'a, 'b, I, C, P> Div<&'a Polynomial<I, C, P>> for &'b Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
type Output = Polynomial<I, C, P>
The resulting type after applying the /
operator
fn div(self, rhs: &'a Polynomial<I, C, P>) -> Self::Output
The method for the /
operator
impl<'a, I, C, P> DivAssign<&'a Polynomial<I, C, P>> for Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
fn div_assign(&mut self, rhs: &'a Polynomial<I, C, P>)
The method for the /=
operator
impl<'a, I, C, P> Neg for &'a Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
type Output = Polynomial<I, C, P>
The resulting type after applying the -
operator
fn neg(self) -> Self::Output
The method for the unary -
operator
impl<I, C, P> AddAssign<C> for Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
fn add_assign(&mut self, rhs: C)
The method for the +=
operator
impl<'a, I, C, P> Add<C> for &'a Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
type Output = Polynomial<I, C, P>
The resulting type after applying the +
operator
fn add(self, rhs: C) -> Self::Output
The method for the +
operator
impl<'a, I, C, P> AddAssign<&'a Monomial<I, C, P>> for Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
fn add_assign(&mut self, rhs: &'a Monomial<I, C, P>)
The method for the +=
operator
impl<'a, 'b, I, C, P> Add<&'a Monomial<I, C, P>> for &'b Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
type Output = Polynomial<I, C, P>
The resulting type after applying the +
operator
fn add(self, rhs: &'a Monomial<I, C, P>) -> Self::Output
The method for the +
operator
impl<'a, I, C, P> AddAssign<&'a Polynomial<I, C, P>> for Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
fn add_assign(&mut self, rhs: &'a Polynomial<I, C, P>)
The method for the +=
operator
impl<'a, 'b, I, C, P> Add<&'a Polynomial<I, C, P>> for &'b Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
type Output = Polynomial<I, C, P>
The resulting type after applying the +
operator
fn add(self, rhs: &'a Polynomial<I, C, P>) -> Self::Output
The method for the +
operator
impl<I, C, P> SubAssign<C> for Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
fn sub_assign(&mut self, rhs: C)
The method for the -=
operator
impl<'a, I, C, P> Sub<C> for &'a Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
type Output = Polynomial<I, C, P>
The resulting type after applying the -
operator
fn sub(self, rhs: C) -> Self::Output
The method for the -
operator
impl<'a, I, C, P> SubAssign<&'a Monomial<I, C, P>> for Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
fn sub_assign(&mut self, rhs: &'a Monomial<I, C, P>)
The method for the -=
operator
impl<'a, 'b, I, C, P> Sub<&'a Monomial<I, C, P>> for &'b Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
type Output = Polynomial<I, C, P>
The resulting type after applying the -
operator
fn sub(self, rhs: &'a Monomial<I, C, P>) -> Self::Output
The method for the -
operator
impl<'a, I, C, P> SubAssign<&'a Polynomial<I, C, P>> for Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
fn sub_assign(&mut self, rhs: &'a Polynomial<I, C, P>)
The method for the -=
operator
impl<'a, 'b, I, C, P> Sub<&'a Polynomial<I, C, P>> for &'b Polynomial<I, C, P> where
I: Id,
C: Coefficient,
P: Power,
[src]
I: Id,
C: Coefficient,
P: Power,
type Output = Polynomial<I, C, P>
The resulting type after applying the -
operator
fn sub(self, rhs: &'a Polynomial<I, C, P>) -> Self::Output
The method for the -
operator