Struct polynomial_ring::Polynomial
source · [−]pub struct Polynomial<T> { /* private fields */ }
Expand description
Polynomial ring $R[x]
$
use num::Rational64;
use polynomial_ring::Polynomial;
let f = Polynomial::new(vec![3, 1, 4, 1, 5].into_iter().map(|x| Rational64::from_integer(x)).collect());
let g = Polynomial::new(vec![2, 7, 1].into_iter().map(|x| Rational64::from_integer(x)).collect());
let mut r = f.clone();
let q = r.division(&g);
assert_eq!(f, q * g + r);
Implementations
sourceimpl<T: Sized> Polynomial<T>
impl<T: Sized> Polynomial<T>
sourcepub fn deg(&self) -> Option<usize>
pub fn deg(&self) -> Option<usize>
degree of polynomial
use polynomial_ring::Polynomial;
let p = Polynomial::new(vec![3, 2, 1]); // 3+2x+x^2
assert_eq!(p.deg(), Some(2));
let q = Polynomial::new(vec![0]); // 0
assert_eq!(q.deg(), None);
sourceimpl<M: Sized + Zero> Polynomial<M>
impl<M: Sized + Zero> Polynomial<M>
sourcepub fn new(coef: Vec<M>) -> Self
pub fn new(coef: Vec<M>) -> Self
construct polynomial
use polynomial_ring::Polynomial;
let p = Polynomial::new(vec![3, 2, 1]);
assert_eq!(p.to_string(), "x^2+2*x+3");
sourcepub fn from_monomial(coefficent: M, degree: usize) -> Self
pub fn from_monomial(coefficent: M, degree: usize) -> Self
construct polynomial from monomial $cx^d
$ ($c
$=coefficent, $d
$=degree)
use polynomial_ring::Polynomial;
let p = Polynomial::from_monomial(3, 2);
let q = Polynomial::new(vec![0, 0, 3]);
assert_eq!(p, q);
sourceimpl<R: Sized> Polynomial<R>
impl<R: Sized> Polynomial<R>
sourcepub fn eval<'a>(&self, x: &'a R) -> R where
R: Sized + Clone + Zero + for<'x> AddAssign<&'x R> + MulAssign<&'a R>,
pub fn eval<'a>(&self, x: &'a R) -> R where
R: Sized + Clone + Zero + for<'x> AddAssign<&'x R> + MulAssign<&'a R>,
evaluate polynomial by Horner’s method
use polynomial_ring::Polynomial;
let p = Polynomial::new(vec![3, 2, 1]); // 3+2x+x^2
assert_eq!(p.eval(&1), 6);
assert_eq!(p.eval(&2), 11);
sourcepub fn derivative(self) -> Self where
R: Sized + Clone + Zero + One + for<'x> AddAssign<&'x R> + Mul<Output = R>,
for<'x> &'x R: Mul<Output = R>,
pub fn derivative(self) -> Self where
R: Sized + Clone + Zero + One + for<'x> AddAssign<&'x R> + Mul<Output = R>,
for<'x> &'x R: Mul<Output = R>,
derivative
use polynomial_ring::{Polynomial, polynomial};
let p = polynomial![1, 2, 3, 2, 1]; // 1+2x+3x^2+2x^3+x^4
assert_eq!(p.derivative(), polynomial![2, 6, 6, 4]);
sourcepub fn pseudo_division(&mut self, other: &Self) -> (R, Self) where
R: Sized + Clone + Zero + One + for<'x> AddAssign<&'x R> + for<'x> MulAssign<&'x R>,
for<'x> &'x R: Sub<Output = R> + Mul<Output = R>,
pub fn pseudo_division(&mut self, other: &Self) -> (R, Self) where
R: Sized + Clone + Zero + One + for<'x> AddAssign<&'x R> + for<'x> MulAssign<&'x R>,
for<'x> &'x R: Sub<Output = R> + Mul<Output = R>,
pseudo division
Let $R
$ be an integral domain.
Let $f, g \in R[x]
$, where $g \neq 0
$.
This function calculate $s \in R
$, $q, r \in R[x]
$ s.t. $sf=qg+r
$,
where $r=0
$ or $\deg(r)<\deg(g)
$.
use polynomial_ring::{polynomial, Polynomial};
let f = polynomial![1, 3, 1]; // 1+3x+x^2 ∈ Z[x]
let g = polynomial![5, 2]; // 5+2x ∈ Z[x]
let mut r = f.clone();
let (s, q) = r.pseudo_division(&g);
assert_eq!(f * s, q * g + r);
let f = polynomial![1, -1, -1, 1]; // 1-x-x^2+x^3 ∈ Z[x]
let g = polynomial![1, 2]; // 1+2x ∈ Z[x]
let mut r = f.clone();
let (s, q) = r.pseudo_division(&g);
assert_eq!(polynomial![s] * f, q * g + r);
// 1-yx-x^2+yx^3 ∈ Z[y][x]
let f = polynomial![polynomial![1], polynomial![0, -1], polynomial![-1], polynomial![0, 1]];
// -1+y^2x ∈ Z[y][x]
let g = polynomial![polynomial![-1], polynomial![0, 0, 1]];
let mut r = f.clone();
let (s, q) = r.pseudo_division(&g);
assert_eq!(f * s, q * g + r);
// x^3 ∈ Z[y][x]
let f = polynomial![polynomial![], polynomial![], polynomial![], polynomial![1]];
// yx ∈ Z[y][x]
let g = polynomial![polynomial![], polynomial![0, 1]];
let mut r = f.clone();
let (s, q) = r.pseudo_division(&g);
assert_eq!(f * s, q * g + r);
sourcepub fn resultant(self, other: Self) -> R where
R: Sized + Clone + Zero + One + for<'x> AddAssign<&'x R> + for<'x> MulAssign<&'x R> + Neg<Output = R>,
for<'x> &'x R: Sub<Output = R> + Mul<Output = R> + Div<Output = R>,
pub fn resultant(self, other: Self) -> R where
R: Sized + Clone + Zero + One + for<'x> AddAssign<&'x R> + for<'x> MulAssign<&'x R> + Neg<Output = R>,
for<'x> &'x R: Sub<Output = R> + Mul<Output = R> + Div<Output = R>,
calculate resultant
use polynomial_ring::{polynomial, Polynomial};
use num_traits::{One, Zero};
let f = polynomial![0, 2, 0, 1]; // 2x+x^3 ∈ Z[x]
let g = polynomial![2, 3, 5]; // 2+3x+5x^2 ∈ Z[x]
let r = f.resultant(g);
assert_eq!(r, 164);
let f = polynomial![-4, 0, 0, 0, 1]; // -4+x^4 ∈ Z[x]
let g = polynomial![0, 2, 0, 1]; // 2x+x^3 ∈ Z[x]
let r = f.resultant(g); // deg(gcd(f, g)) = deg(x^2-2) = 2 ≠ 0
assert_eq!(r, 0);
let f = polynomial![polynomial![1], polynomial![0], polynomial![1]]; // 1+x^2 ∈ Z[y][x]
let g = polynomial![polynomial![1], polynomial![1, 2]]; // 1+(1+2y)x ∈ Z[y][x]
let r = f.resultant(g);
assert_eq!(r, polynomial![2, 4, 4]); // 2+4y+4y^2
let y3 = Polynomial::from_monomial(polynomial![-1], 3); // -y^3 ∈ Z[x][y]
let y2xy = Polynomial::from_monomial(polynomial![0, -1], 2) + &y3; // -xy^2-y^3 ∈ Z[x][y]
let x = polynomial![polynomial![0, 1]]; // x ∈ Z[x][y]
let f = polynomial![y3, polynomial![], x.clone()]; // -y^3+xz^2 ∈ Z[x][y][z]
let g = polynomial![y2xy, polynomial![], x]; // -xy^2-y^3+xz^2 ∈ Z[x][y][z]
let r = f.resultant(g);
assert_eq!(r, Polynomial::from_monomial(Polynomial::from_monomial(1, 4), 4)); // x^4y^4
sourcepub fn primitive_part_mut(&mut self) where
R: Sized + Clone + Zero + for<'x> DivAssign<&'x R> + RingNormalize,
for<'x> &'x R: Rem<Output = R>,
pub fn primitive_part_mut(&mut self) where
R: Sized + Clone + Zero + for<'x> DivAssign<&'x R> + RingNormalize,
for<'x> &'x R: Rem<Output = R>,
calculate primitive part of input polynomial
divide polynomial by GCD of coefficents.
use polynomial_ring::{polynomial, Polynomial};
use num_traits::{One, Zero};
let mut f = polynomial![2, 4, -2, 6]; // 2+4x+2x^2+6x^3 ∈ Z[x]
f.primitive_part_mut();
assert_eq!(f, polynomial![1, 2, -1, 3]);// 1+2x+x^2+3x^3 ∈ Z[x]
let mut g = polynomial![polynomial![1, 1], polynomial![1, 2, 1], polynomial![3, 4, 1], polynomial![-1, -1]]; // (1+x)+(1+2x+x^2)y+(3+4x+x^2)y^2+(-1-x)y^3 ∈ Z[x][y]
g.primitive_part_mut();
assert_eq!(g, polynomial![polynomial![1], polynomial![1, 1], polynomial![3, 1], polynomial![-1]]); // 1+(1+x)y+(3+x)y^2-y^3 ∈ Z[x][y]
sourceimpl<K: Sized> Polynomial<K>
impl<K: Sized> Polynomial<K>
sourcepub fn monic(&mut self) where
K: Clone + for<'x> DivAssign<&'x K>,
pub fn monic(&mut self) where
K: Clone + for<'x> DivAssign<&'x K>,
make polynomial monic
use num::Rational64;
use polynomial_ring::Polynomial;
let mut p = Polynomial::new(vec![1, 2, 3].into_iter().map(|x| Rational64::from_integer(x)).collect());
p.monic();
let q = Polynomial::new(vec![(1, 3), (2, 3), (1, 1)].into_iter().map(|(n, d)| Rational64::new(n, d)).collect());
assert_eq!(p, q);
sourcepub fn division(&mut self, other: &Self) -> Self where
K: Sized + Clone + Zero + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K>,
for<'x> &'x K: Mul<Output = K> + Div<Output = K>,
pub fn division(&mut self, other: &Self) -> Self where
K: Sized + Clone + Zero + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K>,
for<'x> &'x K: Mul<Output = K> + Div<Output = K>,
polynomial division
use num::Rational64;
use polynomial_ring::Polynomial;
let f = Polynomial::new(vec![3, 1, 4, 1, 5].into_iter().map(|x| Rational64::from_integer(x)).collect());
let g = Polynomial::new(vec![2, 7, 1].into_iter().map(|x| Rational64::from_integer(x)).collect());
let mut r = f.clone();
let q = r.division(&g);
assert_eq!(f, q * g + r);
sourcepub fn square_free(&self) -> Self where
K: Sized + Clone + Zero + One + Mul<Output = K> + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K> + for<'x> DivAssign<&'x K>,
for<'x> &'x K: Mul<Output = K> + Div<Output = K>,
pub fn square_free(&self) -> Self where
K: Sized + Clone + Zero + One + Mul<Output = K> + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K> + for<'x> DivAssign<&'x K>,
for<'x> &'x K: Mul<Output = K> + Div<Output = K>,
calculate square-free polynomial
use polynomial_ring::{Polynomial, polynomial};
use num::Rational64;
let f = polynomial![Rational64::from(1), Rational64::from(1)];
let g = polynomial![Rational64::from(1), Rational64::from(1), Rational64::from(1)];
let p = &f * &f * &f * &g * &g; // (x+1)^3(x^2+x+1)^2
assert_eq!(p.square_free(), &f * &g); // (x+1)(x^2+x+1)
Trait Implementations
sourceimpl<'a, M> Add<&'a Polynomial<M>> for &'a Polynomial<M> where
M: Sized + Clone + Zero + for<'x> AddAssign<&'x M>,
impl<'a, M> Add<&'a Polynomial<M>> for &'a Polynomial<M> where
M: Sized + Clone + Zero + for<'x> AddAssign<&'x M>,
sourceimpl<'a, M> Add<&'a Polynomial<M>> for Polynomial<M> where
M: Sized + Clone + Zero + for<'x> AddAssign<&'x M>,
impl<'a, M> Add<&'a Polynomial<M>> for Polynomial<M> where
M: Sized + Clone + Zero + for<'x> AddAssign<&'x M>,
sourceimpl<'a, M> Add<Polynomial<M>> for &'a Polynomial<M> where
M: Sized + Clone + Zero + for<'x> AddAssign<&'x M>,
impl<'a, M> Add<Polynomial<M>> for &'a Polynomial<M> where
M: Sized + Clone + Zero + for<'x> AddAssign<&'x M>,
type Output = Polynomial<M>
type Output = Polynomial<M>
The resulting type after applying the +
operator.
sourcefn add(self, other: Polynomial<M>) -> Self::Output
fn add(self, other: Polynomial<M>) -> Self::Output
Performs the +
operation. Read more
sourceimpl<M> Add<Polynomial<M>> for Polynomial<M> where
M: Sized + Clone + Zero + for<'x> AddAssign<&'x M>,
impl<M> Add<Polynomial<M>> for Polynomial<M> where
M: Sized + Clone + Zero + for<'x> AddAssign<&'x M>,
sourceimpl<'a, M> AddAssign<&'a Polynomial<M>> for Polynomial<M> where
M: Sized + Clone + Zero + for<'x> AddAssign<&'x M>,
impl<'a, M> AddAssign<&'a Polynomial<M>> for Polynomial<M> where
M: Sized + Clone + Zero + for<'x> AddAssign<&'x M>,
sourcefn add_assign(&mut self, other: &Self)
fn add_assign(&mut self, other: &Self)
Performs the +=
operation. Read more
sourceimpl<M> AddAssign<Polynomial<M>> for Polynomial<M> where
M: Sized + Clone + Zero + for<'x> AddAssign<&'x M>,
impl<M> AddAssign<Polynomial<M>> for Polynomial<M> where
M: Sized + Clone + Zero + for<'x> AddAssign<&'x M>,
sourcefn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
Performs the +=
operation. Read more
sourceimpl<T: Clone> Clone for Polynomial<T>
impl<T: Clone> Clone for Polynomial<T>
sourcefn clone(&self) -> Polynomial<T>
fn clone(&self) -> Polynomial<T>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<T: Debug> Debug for Polynomial<T>
impl<T: Debug> Debug for Polynomial<T>
sourceimpl<T: Default> Default for Polynomial<T>
impl<T: Default> Default for Polynomial<T>
sourcefn default() -> Polynomial<T>
fn default() -> Polynomial<T>
Returns the “default value” for a type. Read more
sourceimpl<'a, K> Div<&'a Polynomial<K>> for &'a Polynomial<K> where
K: Sized + Clone + Zero + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K>,
for<'x> &'x K: Mul<Output = K> + Div<Output = K>,
impl<'a, K> Div<&'a Polynomial<K>> for &'a Polynomial<K> where
K: Sized + Clone + Zero + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K>,
for<'x> &'x K: Mul<Output = K> + Div<Output = K>,
sourceimpl<'a, K> Div<&'a Polynomial<K>> for Polynomial<K> where
K: Sized + Clone + Zero + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K>,
for<'x> &'x K: Mul<Output = K> + Div<Output = K>,
impl<'a, K> Div<&'a Polynomial<K>> for Polynomial<K> where
K: Sized + Clone + Zero + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K>,
for<'x> &'x K: Mul<Output = K> + Div<Output = K>,
sourceimpl<'a, R> Div<&'a R> for &'a Polynomial<R> where
R: Sized + Clone + Zero + for<'x> DivAssign<&'x R>,
impl<'a, R> Div<&'a R> for &'a Polynomial<R> where
R: Sized + Clone + Zero + for<'x> DivAssign<&'x R>,
sourceimpl<'a, R> Div<&'a R> for Polynomial<R> where
R: Sized + Clone + Zero + for<'x> DivAssign<&'x R>,
impl<'a, R> Div<&'a R> for Polynomial<R> where
R: Sized + Clone + Zero + for<'x> DivAssign<&'x R>,
sourceimpl<'a, K> Div<Polynomial<K>> for &'a Polynomial<K> where
K: Sized + Clone + Zero + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K>,
for<'x> &'x K: Mul<Output = K> + Div<Output = K>,
impl<'a, K> Div<Polynomial<K>> for &'a Polynomial<K> where
K: Sized + Clone + Zero + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K>,
for<'x> &'x K: Mul<Output = K> + Div<Output = K>,
type Output = Polynomial<K>
type Output = Polynomial<K>
The resulting type after applying the /
operator.
sourcefn div(self, other: Polynomial<K>) -> Self::Output
fn div(self, other: Polynomial<K>) -> Self::Output
Performs the /
operation. Read more
sourceimpl<K> Div<Polynomial<K>> for Polynomial<K> where
K: Sized + Clone + Zero + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K>,
for<'x> &'x K: Mul<Output = K> + Div<Output = K>,
impl<K> Div<Polynomial<K>> for Polynomial<K> where
K: Sized + Clone + Zero + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K>,
for<'x> &'x K: Mul<Output = K> + Div<Output = K>,
sourceimpl<'a, R> Div<R> for &'a Polynomial<R> where
R: Sized + Clone + Zero + for<'x> DivAssign<&'x R>,
impl<'a, R> Div<R> for &'a Polynomial<R> where
R: Sized + Clone + Zero + for<'x> DivAssign<&'x R>,
sourceimpl<'a, K> DivAssign<&'a Polynomial<K>> for Polynomial<K> where
K: Sized + Clone + Zero + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K>,
for<'x> &'x K: Mul<Output = K> + Div<Output = K>,
impl<'a, K> DivAssign<&'a Polynomial<K>> for Polynomial<K> where
K: Sized + Clone + Zero + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K>,
for<'x> &'x K: Mul<Output = K> + Div<Output = K>,
sourcefn div_assign(&mut self, other: &Self)
fn div_assign(&mut self, other: &Self)
Performs the /=
operation. Read more
sourceimpl<'a, R> DivAssign<&'a R> for Polynomial<R> where
R: Sized + Zero + for<'x> DivAssign<&'x R>,
impl<'a, R> DivAssign<&'a R> for Polynomial<R> where
R: Sized + Zero + for<'x> DivAssign<&'x R>,
sourcefn div_assign(&mut self, other: &R)
fn div_assign(&mut self, other: &R)
Performs the /=
operation. Read more
sourceimpl<K> DivAssign<Polynomial<K>> for Polynomial<K> where
K: Sized + Clone + Zero + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K>,
for<'x> &'x K: Mul<Output = K> + Div<Output = K>,
impl<K> DivAssign<Polynomial<K>> for Polynomial<K> where
K: Sized + Clone + Zero + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K>,
for<'x> &'x K: Mul<Output = K> + Div<Output = K>,
sourcefn div_assign(&mut self, other: Self)
fn div_assign(&mut self, other: Self)
Performs the /=
operation. Read more
sourceimpl<'a, R> DivAssign<R> for Polynomial<R> where
R: Sized + Zero + for<'x> DivAssign<&'x R>,
impl<'a, R> DivAssign<R> for Polynomial<R> where
R: Sized + Zero + for<'x> DivAssign<&'x R>,
sourcefn div_assign(&mut self, other: R)
fn div_assign(&mut self, other: R)
Performs the /=
operation. Read more
sourceimpl<'a, R> Mul<&'a Polynomial<R>> for &'a Polynomial<R> where
R: Sized + Clone + Zero + for<'x> AddAssign<&'x R>,
for<'x> &'x R: Mul<Output = R>,
impl<'a, R> Mul<&'a Polynomial<R>> for &'a Polynomial<R> where
R: Sized + Clone + Zero + for<'x> AddAssign<&'x R>,
for<'x> &'x R: Mul<Output = R>,
sourceimpl<'a, R> Mul<&'a Polynomial<R>> for Polynomial<R> where
R: Sized + Clone + Zero + for<'x> AddAssign<&'x R>,
for<'x> &'x R: Mul<Output = R>,
impl<'a, R> Mul<&'a Polynomial<R>> for Polynomial<R> where
R: Sized + Clone + Zero + for<'x> AddAssign<&'x R>,
for<'x> &'x R: Mul<Output = R>,
sourceimpl<'a, R> Mul<&'a R> for &'a Polynomial<R> where
R: Sized + Clone + Zero + for<'x> MulAssign<&'x R>,
impl<'a, R> Mul<&'a R> for &'a Polynomial<R> where
R: Sized + Clone + Zero + for<'x> MulAssign<&'x R>,
sourceimpl<'a, R> Mul<&'a R> for Polynomial<R> where
R: Sized + Clone + Zero + for<'x> MulAssign<&'x R>,
impl<'a, R> Mul<&'a R> for Polynomial<R> where
R: Sized + Clone + Zero + for<'x> MulAssign<&'x R>,
sourceimpl<'a, R> Mul<Polynomial<R>> for &'a Polynomial<R> where
R: Sized + Clone + Zero + for<'x> AddAssign<&'x R>,
for<'x> &'x R: Mul<Output = R>,
impl<'a, R> Mul<Polynomial<R>> for &'a Polynomial<R> where
R: Sized + Clone + Zero + for<'x> AddAssign<&'x R>,
for<'x> &'x R: Mul<Output = R>,
type Output = Polynomial<R>
type Output = Polynomial<R>
The resulting type after applying the *
operator.
sourcefn mul(self, other: Polynomial<R>) -> Self::Output
fn mul(self, other: Polynomial<R>) -> Self::Output
Performs the *
operation. Read more
sourceimpl<R> Mul<Polynomial<R>> for Polynomial<R> where
R: Sized + Clone + Zero + for<'x> AddAssign<&'x R>,
for<'x> &'x R: Mul<Output = R>,
impl<R> Mul<Polynomial<R>> for Polynomial<R> where
R: Sized + Clone + Zero + for<'x> AddAssign<&'x R>,
for<'x> &'x R: Mul<Output = R>,
sourceimpl<'a, R> Mul<R> for &'a Polynomial<R> where
R: Sized + Clone + Zero + for<'x> MulAssign<&'x R>,
impl<'a, R> Mul<R> for &'a Polynomial<R> where
R: Sized + Clone + Zero + for<'x> MulAssign<&'x R>,
sourceimpl<'a, R> MulAssign<&'a Polynomial<R>> for Polynomial<R> where
R: Sized + Clone + Zero + for<'x> AddAssign<&'x R>,
for<'x> &'x R: Mul<Output = R>,
impl<'a, R> MulAssign<&'a Polynomial<R>> for Polynomial<R> where
R: Sized + Clone + Zero + for<'x> AddAssign<&'x R>,
for<'x> &'x R: Mul<Output = R>,
sourcefn mul_assign(&mut self, other: &Self)
fn mul_assign(&mut self, other: &Self)
Performs the *=
operation. Read more
sourceimpl<'a, R> MulAssign<&'a R> for Polynomial<R> where
R: Sized + Zero + for<'x> MulAssign<&'x R>,
impl<'a, R> MulAssign<&'a R> for Polynomial<R> where
R: Sized + Zero + for<'x> MulAssign<&'x R>,
sourcefn mul_assign(&mut self, other: &R)
fn mul_assign(&mut self, other: &R)
Performs the *=
operation. Read more
sourceimpl<R> MulAssign<Polynomial<R>> for Polynomial<R> where
R: Sized + Clone + Zero + for<'x> AddAssign<&'x R>,
for<'x> &'x R: Mul<Output = R>,
impl<R> MulAssign<Polynomial<R>> for Polynomial<R> where
R: Sized + Clone + Zero + for<'x> AddAssign<&'x R>,
for<'x> &'x R: Mul<Output = R>,
sourcefn mul_assign(&mut self, other: Self)
fn mul_assign(&mut self, other: Self)
Performs the *=
operation. Read more
sourceimpl<'a, R> MulAssign<R> for Polynomial<R> where
R: Sized + Zero + for<'x> MulAssign<&'x R>,
impl<'a, R> MulAssign<R> for Polynomial<R> where
R: Sized + Zero + for<'x> MulAssign<&'x R>,
sourcefn mul_assign(&mut self, other: R)
fn mul_assign(&mut self, other: R)
Performs the *=
operation. Read more
sourceimpl<G> Neg for Polynomial<G> where
G: Sized + Neg<Output = G>,
impl<G> Neg for Polynomial<G> where
G: Sized + Neg<Output = G>,
sourceimpl<R> One for Polynomial<R> where
R: Sized + Clone + Zero + for<'x> AddAssign<&'x R> + One,
for<'x> &'x R: Mul<Output = R>,
impl<R> One for Polynomial<R> where
R: Sized + Clone + Zero + for<'x> AddAssign<&'x R> + One,
for<'x> &'x R: Mul<Output = R>,
sourceimpl<T: PartialEq> PartialEq<Polynomial<T>> for Polynomial<T>
impl<T: PartialEq> PartialEq<Polynomial<T>> for Polynomial<T>
sourcefn eq(&self, other: &Polynomial<T>) -> bool
fn eq(&self, other: &Polynomial<T>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &Polynomial<T>) -> bool
fn ne(&self, other: &Polynomial<T>) -> bool
This method tests for !=
.
sourceimpl<R> Product<Polynomial<R>> for Polynomial<R> where
R: Sized + Clone + Zero + for<'x> AddAssign<&'x R> + One,
for<'x> &'x R: Mul<Output = R>,
impl<R> Product<Polynomial<R>> for Polynomial<R> where
R: Sized + Clone + Zero + for<'x> AddAssign<&'x R> + One,
for<'x> &'x R: Mul<Output = R>,
sourceimpl<'a, K> Rem<&'a Polynomial<K>> for &'a Polynomial<K> where
K: Sized + Clone + Zero + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K>,
for<'x> &'x K: Mul<Output = K> + Div<Output = K>,
impl<'a, K> Rem<&'a Polynomial<K>> for &'a Polynomial<K> where
K: Sized + Clone + Zero + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K>,
for<'x> &'x K: Mul<Output = K> + Div<Output = K>,
sourceimpl<'a, K> Rem<&'a Polynomial<K>> for Polynomial<K> where
K: Sized + Clone + Zero + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K>,
for<'x> &'x K: Mul<Output = K> + Div<Output = K>,
impl<'a, K> Rem<&'a Polynomial<K>> for Polynomial<K> where
K: Sized + Clone + Zero + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K>,
for<'x> &'x K: Mul<Output = K> + Div<Output = K>,
sourceimpl<'a, K> Rem<Polynomial<K>> for &'a Polynomial<K> where
K: Sized + Clone + Zero + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K>,
for<'x> &'x K: Mul<Output = K> + Div<Output = K>,
impl<'a, K> Rem<Polynomial<K>> for &'a Polynomial<K> where
K: Sized + Clone + Zero + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K>,
for<'x> &'x K: Mul<Output = K> + Div<Output = K>,
type Output = Polynomial<K>
type Output = Polynomial<K>
The resulting type after applying the %
operator.
sourcefn rem(self, other: Polynomial<K>) -> Self::Output
fn rem(self, other: Polynomial<K>) -> Self::Output
Performs the %
operation. Read more
sourceimpl<K> Rem<Polynomial<K>> for Polynomial<K> where
K: Sized + Clone + Zero + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K>,
for<'x> &'x K: Mul<Output = K> + Div<Output = K>,
impl<K> Rem<Polynomial<K>> for Polynomial<K> where
K: Sized + Clone + Zero + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K>,
for<'x> &'x K: Mul<Output = K> + Div<Output = K>,
sourceimpl<'a, K> RemAssign<&'a Polynomial<K>> for Polynomial<K> where
K: Sized + Clone + Zero + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K>,
for<'x> &'x K: Mul<Output = K> + Div<Output = K>,
impl<'a, K> RemAssign<&'a Polynomial<K>> for Polynomial<K> where
K: Sized + Clone + Zero + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K>,
for<'x> &'x K: Mul<Output = K> + Div<Output = K>,
sourcefn rem_assign(&mut self, other: &Self)
fn rem_assign(&mut self, other: &Self)
Performs the %=
operation. Read more
sourceimpl<'a, K> RemAssign<Polynomial<K>> for Polynomial<K> where
K: Sized + Clone + Zero + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K>,
for<'x> &'x K: Mul<Output = K> + Div<Output = K>,
impl<'a, K> RemAssign<Polynomial<K>> for Polynomial<K> where
K: Sized + Clone + Zero + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K>,
for<'x> &'x K: Mul<Output = K> + Div<Output = K>,
sourcefn rem_assign(&mut self, other: Self)
fn rem_assign(&mut self, other: Self)
Performs the %=
operation. Read more
sourceimpl<K> RingNormalize for Polynomial<K> where
K: Sized + Clone + Zero + One + for<'x> AddAssign<&'x K> + for<'x> DivAssign<&'x K>,
for<'x> &'x K: Mul<Output = K>,
impl<K> RingNormalize for Polynomial<K> where
K: Sized + Clone + Zero + One + for<'x> AddAssign<&'x K> + for<'x> DivAssign<&'x K>,
for<'x> &'x K: Mul<Output = K>,
fn leading_unit(&self) -> Self
fn normalize_mut(&mut self)
fn into_normalize(self) -> Self
fn normalize(&self) -> Self where
Self: Clone,
fn is_similar(&self, other: &Self) -> bool where
Self: Clone + Eq,
sourceimpl<'a, G> Sub<&'a Polynomial<G>> for &'a Polynomial<G> where
G: Sized + Clone + Zero + for<'x> SubAssign<&'x G>,
impl<'a, G> Sub<&'a Polynomial<G>> for &'a Polynomial<G> where
G: Sized + Clone + Zero + for<'x> SubAssign<&'x G>,
sourceimpl<'a, G> Sub<&'a Polynomial<G>> for Polynomial<G> where
G: Sized + Clone + Zero + for<'x> SubAssign<&'x G>,
impl<'a, G> Sub<&'a Polynomial<G>> for Polynomial<G> where
G: Sized + Clone + Zero + for<'x> SubAssign<&'x G>,
sourceimpl<'a, G> Sub<Polynomial<G>> for &'a Polynomial<G> where
G: Sized + Clone + Zero + for<'x> SubAssign<&'x G>,
impl<'a, G> Sub<Polynomial<G>> for &'a Polynomial<G> where
G: Sized + Clone + Zero + for<'x> SubAssign<&'x G>,
type Output = Polynomial<G>
type Output = Polynomial<G>
The resulting type after applying the -
operator.
sourcefn sub(self, other: Polynomial<G>) -> Self::Output
fn sub(self, other: Polynomial<G>) -> Self::Output
Performs the -
operation. Read more
sourceimpl<G> Sub<Polynomial<G>> for Polynomial<G> where
G: Sized + Clone + Zero + for<'x> SubAssign<&'x G>,
impl<G> Sub<Polynomial<G>> for Polynomial<G> where
G: Sized + Clone + Zero + for<'x> SubAssign<&'x G>,
sourceimpl<'a, G> SubAssign<&'a Polynomial<G>> for Polynomial<G> where
G: Sized + Clone + Zero + for<'x> SubAssign<&'x G>,
impl<'a, G> SubAssign<&'a Polynomial<G>> for Polynomial<G> where
G: Sized + Clone + Zero + for<'x> SubAssign<&'x G>,
sourcefn sub_assign(&mut self, other: &Self)
fn sub_assign(&mut self, other: &Self)
Performs the -=
operation. Read more
sourceimpl<G> SubAssign<Polynomial<G>> for Polynomial<G> where
G: Sized + Clone + Zero + for<'x> SubAssign<&'x G>,
impl<G> SubAssign<Polynomial<G>> for Polynomial<G> where
G: Sized + Clone + Zero + for<'x> SubAssign<&'x G>,
sourcefn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
Performs the -=
operation. Read more
sourceimpl<M> Sum<Polynomial<M>> for Polynomial<M> where
M: Sized + Clone + Zero + for<'x> AddAssign<&'x M>,
impl<M> Sum<Polynomial<M>> for Polynomial<M> where
M: Sized + Clone + Zero + for<'x> AddAssign<&'x M>,
impl<T: Eq> Eq for Polynomial<T>
impl<T> StructuralEq for Polynomial<T>
impl<T> StructuralPartialEq for Polynomial<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for Polynomial<T> where
T: RefUnwindSafe,
impl<T> Send for Polynomial<T> where
T: Send,
impl<T> Sync for Polynomial<T> where
T: Sync,
impl<T> Unpin for Polynomial<T> where
T: Unpin,
impl<T> UnwindSafe for Polynomial<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> CheckedAs for T
impl<T> CheckedAs for T
sourcepub fn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
pub fn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> CheckedCastFrom<Src> for Dst where
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dst where
Src: CheckedCast<Dst>,
sourcepub fn checked_cast_from(src: Src) -> Option<Dst>
pub fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
sourceimpl<T> OverflowingAs for T
impl<T> OverflowingAs for T
sourcepub fn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
pub fn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> OverflowingCastFrom<Src> for Dst where
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dst where
Src: OverflowingCast<Dst>,
sourcepub fn overflowing_cast_from(src: Src) -> (Dst, bool)
pub fn overflowing_cast_from(src: Src) -> (Dst, bool)
OverflowingCasts the value.
sourceimpl<T> SaturatingAs for T
impl<T> SaturatingAs for T
sourcepub fn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
pub fn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> SaturatingCastFrom<Src> for Dst where
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dst where
Src: SaturatingCast<Dst>,
sourcepub fn saturating_cast_from(src: Src) -> Dst
pub fn saturating_cast_from(src: Src) -> Dst
Casts the value.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
sourcepub fn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
pub fn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> UnwrappedCastFrom<Src> for Dst where
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dst where
Src: UnwrappedCast<Dst>,
sourcepub fn unwrapped_cast_from(src: Src) -> Dst
pub fn unwrapped_cast_from(src: Src) -> Dst
UnwrappedCasts the value.
sourceimpl<T> WrappingAs for T
impl<T> WrappingAs for T
sourcepub fn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
pub fn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> WrappingCastFrom<Src> for Dst where
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dst where
Src: WrappingCast<Dst>,
sourcepub fn wrapping_cast_from(src: Src) -> Dst
pub fn wrapping_cast_from(src: Src) -> Dst
WrappingCasts the value.