Struct 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§

Source§

impl<T: Sized> Polynomial<T>

Source

pub fn deg(&self) -> Option<usize>

The degree of the polynomial. This is the highest power, or None for the zero 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);
Source

pub fn lc(&self) -> Option<&T>

The leading coefficent. This is the coeffient of the highest power, or None for the zero polynomial.

use polynomial_ring::Polynomial;
let p = Polynomial::new(vec![3, 2, 1]); // 3+2x+x^2
assert_eq!(p.lc(), Some(&1));
let q = Polynomial::new(vec![0]); // 0
assert_eq!(q.lc(), None);
Source

pub fn coeffs(&self) -> &[T]

Get the coefficents.

use polynomial_ring::Polynomial;
let p = Polynomial::new(vec![3, 2, 1]); // 3+2x+x^2
assert_eq!(p.coeffs(), &[3, 2, 1]);
let q = Polynomial::new(vec![0]); // 0
assert_eq!(q.coeffs(), &[]);
Source§

impl<M: Sized + Zero> Polynomial<M>

Source

pub fn new(coeff: Vec<M>) -> Self

Construct a polynomial from a Vec of coefficients.

use polynomial_ring::Polynomial;
let p = Polynomial::new(vec![3, 2, 1]);
assert_eq!(p.to_string(), "x^2+2*x+3");
Source

pub fn from_monomial(coefficent: M, degree: usize) -> Self

Construct a monomial $cx^d$ from a coefficient and a degree ($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);
Source§

impl<R: Sized> Polynomial<R>

Source

pub fn eval<'a>(&self, x: &'a R) -> R
where R: Sized + Zero + for<'x> AddAssign<&'x R> + MulAssign<&'a R>,

Evaluate a polynomial at some point, using 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);
Source

pub fn derivative(&self) -> Self
where R: Sized + Zero + One + for<'x> AddAssign<&'x R> + for<'x> From<<&'x R as Mul>::Output>, for<'x> &'x R: Mul,

Calculate the derivative.

use polynomial_ring::{Polynomial, polynomial};
let p = polynomial![1i32, 2, 3, 2, 1]; // 1+2x+3x^2+2x^3+x^4
assert_eq!(p.derivative(), polynomial![2, 6, 6, 4]); // 2+6x+6x^2+4x^3
Source

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> From<<&'x R as Sub>::Output> + for<'x> From<<&'x R as Mul>::Output>, for<'x> &'x R: Sub + Mul,

Pseudo division.

Let $R$ be an integral domain. Let $f, g \in R[x]$, where $g \neq 0$. This function calculates $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![1i32, 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);
Source

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> From<<&'x R as Sub>::Output> + for<'x> From<<&'x R as Mul>::Output> + for<'x> From<<&'x R as Div>::Output>, for<'x> &'x R: Sub + Mul + Div,

Calculate the resultant

use polynomial_ring::{polynomial, Polynomial};

let f = polynomial![0i32, 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);
Source

pub fn primitive_part_mut(&mut self)
where R: Sized + Clone + Zero + for<'x> DivAssign<&'x R> + RingNormalize + for<'x> From<<&'x R as Rem>::Output>, for<'x> &'x R: Rem,

Calculate the primitive part of the input polynomial, that is divide the polynomial by the GCD of its coefficents.

use polynomial_ring::{polynomial, Polynomial};
use num_traits::{One, Zero};
let mut f = polynomial![2i32, 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![1i32, 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]
Source§

impl<K: Sized> Polynomial<K>

Source

pub fn monic(&mut self)
where K: Clone + for<'x> DivAssign<&'x K>,

Make the polynomial monic, that is divide it by its leading coefficient.

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);
Source

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> MulAssign<&'x K> + for<'x> DivAssign<&'x 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);
Source

pub fn square_free(&self) -> Self
where K: Sized + Clone + Zero + One + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K> + for<'x> MulAssign<&'x K> + for<'x> DivAssign<&'x K> + for<'x> From<<&'x K as Mul>::Output> + for<'x> From<<&'x K as Div>::Output>, for<'x> &'x K: Mul + Div,

Calculate the square-free decomposition.

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§

Source§

impl<M> Add<&Polynomial<M>> for &Polynomial<M>
where M: Sized + Zero + for<'x> AddAssign<&'x M>, Polynomial<M>: Clone,

Source§

type Output = Polynomial<M>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Polynomial<M>) -> Self::Output

Performs the + operation. Read more
Source§

impl<M> Add<&Polynomial<M>> for Polynomial<M>
where M: Sized + Zero + for<'x> AddAssign<&'x M>,

Source§

type Output = Polynomial<M>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Polynomial<M>) -> Self::Output

Performs the + operation. Read more
Source§

impl<M> Add<Polynomial<M>> for &Polynomial<M>
where M: Sized + Zero + for<'x> AddAssign<&'x M>, Polynomial<M>: Clone,

Source§

type Output = Polynomial<M>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Polynomial<M>) -> Self::Output

Performs the + operation. Read more
Source§

impl<M> Add for Polynomial<M>
where M: Sized + Zero + for<'x> AddAssign<&'x M>,

Source§

type Output = Polynomial<M>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Polynomial<M>) -> Self::Output

Performs the + operation. Read more
Source§

impl<M> AddAssign<&Polynomial<M>> for Polynomial<M>
where M: Sized + Zero + for<'x> AddAssign<&'x M>,

Source§

fn add_assign(&mut self, other: &Self)

Performs the += operation. Read more
Source§

impl<M> AddAssign for Polynomial<M>
where M: Sized + Zero + for<'x> AddAssign<&'x M>,

Source§

fn add_assign(&mut self, rhs: Polynomial<M>)

Performs the += operation. Read more
Source§

impl<T: Clone> Clone for Polynomial<T>

Source§

fn clone(&self) -> Polynomial<T>

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<T: Debug> Debug for Polynomial<T>

Source§

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

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

impl<T: Default> Default for Polynomial<T>

Source§

fn default() -> Polynomial<T>

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

impl<R> Display for Polynomial<R>
where R: PartialEq + Display + Zero + One,

Source§

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

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

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> MulAssign<&'x K> + for<'x> DivAssign<&'x K>,

Source§

type Output = Polynomial<K>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &Polynomial<K>) -> Self::Output

Performs the / operation. Read more
Source§

impl<R> Div<&R> for &Polynomial<R>
where R: Sized + for<'x> DivAssign<&'x R>, Polynomial<R>: Clone,

Source§

type Output = Polynomial<R>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &R) -> Self::Output

Performs the / operation. Read more
Source§

impl<R> Div<&R> for Polynomial<R>
where R: Sized + for<'x> DivAssign<&'x R>,

Source§

type Output = Polynomial<R>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &R) -> Self::Output

Performs the / operation. Read more
Source§

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> MulAssign<&'x K> + for<'x> DivAssign<&'x K>,

Source§

type Output = Polynomial<K>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Polynomial<K>) -> Self::Output

Performs the / operation. Read more
Source§

impl<R> Div<R> for &Polynomial<R>
where R: Sized + for<'x> DivAssign<&'x R>, Polynomial<R>: Clone,

Source§

type Output = Polynomial<R>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: R) -> Self::Output

Performs the / operation. Read more
Source§

impl<R> Div<R> for Polynomial<R>
where R: Sized + for<'x> DivAssign<&'x R>,

Source§

type Output = Polynomial<R>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: R) -> Self::Output

Performs the / operation. Read more
Source§

impl<K> Div for &Polynomial<K>
where K: Sized + Clone + Zero + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K> + for<'x> MulAssign<&'x K> + for<'x> DivAssign<&'x K>,

Source§

type Output = Polynomial<K>

The resulting type after applying the / operator.
Source§

fn div(self, other: Self) -> Self::Output

Performs the / operation. Read more
Source§

impl<K> Div for Polynomial<K>
where K: Sized + Clone + Zero + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K> + for<'x> MulAssign<&'x K> + for<'x> DivAssign<&'x K>,

Source§

type Output = Polynomial<K>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Polynomial<K>) -> Self::Output

Performs the / operation. Read more
Source§

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> MulAssign<&'x K> + for<'x> DivAssign<&'x K>,

Source§

fn div_assign(&mut self, rhs: &Polynomial<K>)

Performs the /= operation. Read more
Source§

impl<R> DivAssign<&R> for Polynomial<R>
where R: Sized + for<'x> DivAssign<&'x R>,

Source§

fn div_assign(&mut self, alpha: &R)

Performs the /= operation. Read more
Source§

impl<R> DivAssign<R> for Polynomial<R>
where R: Sized + for<'x> DivAssign<&'x R>,

Source§

fn div_assign(&mut self, rhs: R)

Performs the /= operation. Read more
Source§

impl<K> DivAssign for Polynomial<K>
where K: Sized + Clone + Zero + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K> + for<'x> MulAssign<&'x K> + for<'x> DivAssign<&'x K>,

Source§

fn div_assign(&mut self, rhs: Polynomial<K>)

Performs the /= operation. Read more
Source§

impl<R> Mul<&Polynomial<R>> for Polynomial<R>
where R: Sized + Clone + Zero + for<'x> AddAssign<&'x R> + for<'x> MulAssign<&'x R>,

Source§

type Output = Polynomial<R>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Polynomial<R>) -> Self::Output

Performs the * operation. Read more
Source§

impl<R> Mul<&R> for &Polynomial<R>
where R: Sized + Zero + for<'x> MulAssign<&'x R>, Polynomial<R>: Clone,

Source§

type Output = Polynomial<R>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &R) -> Self::Output

Performs the * operation. Read more
Source§

impl<R> Mul<&R> for Polynomial<R>
where R: Sized + Zero + for<'x> MulAssign<&'x R>,

Source§

type Output = Polynomial<R>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &R) -> Self::Output

Performs the * operation. Read more
Source§

impl<R> Mul<Polynomial<R>> for &Polynomial<R>
where R: Sized + Clone + Zero + for<'x> AddAssign<&'x R> + for<'x> MulAssign<&'x R>,

Source§

type Output = Polynomial<R>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Polynomial<R>) -> Self::Output

Performs the * operation. Read more
Source§

impl<R> Mul<R> for &Polynomial<R>
where R: Sized + Zero + for<'x> MulAssign<&'x R>, Polynomial<R>: Clone,

Source§

type Output = Polynomial<R>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: R) -> Self::Output

Performs the * operation. Read more
Source§

impl<R> Mul<R> for Polynomial<R>
where R: Sized + Zero + for<'x> MulAssign<&'x R>,

Source§

type Output = Polynomial<R>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: R) -> Self::Output

Performs the * operation. Read more
Source§

impl<R> Mul for &Polynomial<R>
where R: Sized + Clone + Zero + for<'x> AddAssign<&'x R> + for<'x> MulAssign<&'x R>,

Source§

type Output = Polynomial<R>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Self) -> Self::Output

Performs the * operation. Read more
Source§

impl<R> Mul for Polynomial<R>
where R: Sized + Clone + Zero + for<'x> AddAssign<&'x R> + for<'x> MulAssign<&'x R>,

Source§

type Output = Polynomial<R>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Polynomial<R>) -> Self::Output

Performs the * operation. Read more
Source§

impl<R> MulAssign<&Polynomial<R>> for Polynomial<R>
where R: Sized + Clone + Zero + for<'x> AddAssign<&'x R> + for<'x> MulAssign<&'x R>,

Source§

fn mul_assign(&mut self, rhs: &Polynomial<R>)

Performs the *= operation. Read more
Source§

impl<R> MulAssign<&R> for Polynomial<R>
where R: Sized + Zero + for<'x> MulAssign<&'x R>,

Source§

fn mul_assign(&mut self, alpha: &R)

Performs the *= operation. Read more
Source§

impl<R> MulAssign<R> for Polynomial<R>
where R: Sized + Zero + for<'x> MulAssign<&'x R>,

Source§

fn mul_assign(&mut self, rhs: R)

Performs the *= operation. Read more
Source§

impl<R> MulAssign for Polynomial<R>
where R: Sized + Clone + Zero + for<'x> AddAssign<&'x R> + for<'x> MulAssign<&'x R>,

Source§

fn mul_assign(&mut self, rhs: Polynomial<R>)

Performs the *= operation. Read more
Source§

impl<G> Neg for &Polynomial<G>
where G: Sized + for<'x> From<<&'x G as Neg>::Output>, for<'x> &'x G: Neg,

Source§

type Output = Polynomial<G>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<G> Neg for Polynomial<G>
where G: Sized + Neg<Output = G>,

Source§

type Output = Polynomial<G>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<R> One for Polynomial<R>
where R: Sized + Clone + Zero + for<'x> AddAssign<&'x R> + One + for<'x> MulAssign<&'x R>,

Source§

fn one() -> Self

Returns the multiplicative identity element of Self, 1. Read more
Source§

fn set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.
Source§

fn is_one(&self) -> bool
where Self: PartialEq,

Returns true if self is equal to the multiplicative identity. Read more
Source§

impl<T: PartialEq> PartialEq for Polynomial<T>

Source§

fn eq(&self, other: &Polynomial<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<R> Product for Polynomial<R>
where R: Sized + Clone + Zero + for<'x> AddAssign<&'x R> + One + for<'x> MulAssign<&'x R>,

Source§

fn product<I: Iterator<Item = Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by multiplying the items.
Source§

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> MulAssign<&'x K> + for<'x> DivAssign<&'x K>, Polynomial<K>: Clone,

Source§

type Output = Polynomial<K>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: &Polynomial<K>) -> Self::Output

Performs the % operation. Read more
Source§

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> MulAssign<&'x K> + for<'x> DivAssign<&'x K>,

Source§

type Output = Polynomial<K>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: &Polynomial<K>) -> Self::Output

Performs the % operation. Read more
Source§

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> MulAssign<&'x K> + for<'x> DivAssign<&'x K>, Polynomial<K>: Clone,

Source§

type Output = Polynomial<K>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Polynomial<K>) -> Self::Output

Performs the % operation. Read more
Source§

impl<K> Rem for Polynomial<K>
where K: Sized + Clone + Zero + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K> + for<'x> MulAssign<&'x K> + for<'x> DivAssign<&'x K>,

Source§

type Output = Polynomial<K>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Polynomial<K>) -> Self::Output

Performs the % operation. Read more
Source§

impl<K> RemAssign<&Polynomial<K>> for Polynomial<K>
where K: Sized + Clone + Zero + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K> + for<'x> MulAssign<&'x K> + for<'x> DivAssign<&'x K>,

Source§

fn rem_assign(&mut self, other: &Self)

Performs the %= operation. Read more
Source§

impl<K> RemAssign for Polynomial<K>
where K: Sized + Clone + Zero + for<'x> AddAssign<&'x K> + for<'x> SubAssign<&'x K> + for<'x> MulAssign<&'x K> + for<'x> DivAssign<&'x K>,

Source§

fn rem_assign(&mut self, rhs: Polynomial<K>)

Performs the %= operation. Read more
Source§

impl<K> RingNormalize for Polynomial<K>
where K: Sized + Clone + Zero + One + for<'x> AddAssign<&'x K> + for<'x> MulAssign<&'x K> + for<'x> DivAssign<&'x K>,

Source§

fn leading_unit(&self) -> Self

Source§

fn normalize_mut(&mut self)

Source§

fn into_normalize(self) -> Self
where Self: Sized,

Source§

fn normalize(&self) -> Self
where Self: Clone,

Source§

fn is_similar(&self, other: &Self) -> bool
where Self: Clone + Eq,

Source§

impl<G> Sub<&Polynomial<G>> for &Polynomial<G>
where G: Sized + Zero + for<'x> SubAssign<&'x G>, Polynomial<G>: Clone,

Source§

type Output = Polynomial<G>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Polynomial<G>) -> Self::Output

Performs the - operation. Read more
Source§

impl<G> Sub<&Polynomial<G>> for Polynomial<G>
where G: Sized + Zero + for<'x> SubAssign<&'x G>,

Source§

type Output = Polynomial<G>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Polynomial<G>) -> Self::Output

Performs the - operation. Read more
Source§

impl<G> Sub<Polynomial<G>> for &Polynomial<G>
where G: Sized + Zero + for<'x> SubAssign<&'x G>, Polynomial<G>: Clone,

Source§

type Output = Polynomial<G>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Polynomial<G>) -> Self::Output

Performs the - operation. Read more
Source§

impl<G> Sub for Polynomial<G>
where G: Sized + Zero + for<'x> SubAssign<&'x G>,

Source§

type Output = Polynomial<G>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Polynomial<G>) -> Self::Output

Performs the - operation. Read more
Source§

impl<G> SubAssign<&Polynomial<G>> for Polynomial<G>
where G: Sized + Zero + for<'x> SubAssign<&'x G>,

Source§

fn sub_assign(&mut self, other: &Self)

Performs the -= operation. Read more
Source§

impl<G> SubAssign for Polynomial<G>
where G: Sized + Zero + for<'x> SubAssign<&'x G>,

Source§

fn sub_assign(&mut self, rhs: Polynomial<G>)

Performs the -= operation. Read more
Source§

impl<M> Sum for Polynomial<M>
where M: Sized + Zero + for<'x> AddAssign<&'x M>,

Source§

fn sum<I: Iterator<Item = Self>>(iter: I) -> Self

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

impl<M> Zero for Polynomial<M>
where M: Sized + Zero + for<'x> AddAssign<&'x M>,

Source§

fn zero() -> Self

Returns the additive identity element of Self, 0. Read more
Source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
Source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
Source§

impl<T: Eq> Eq for Polynomial<T>

Source§

impl<T> StructuralPartialEq for Polynomial<T>

Auto Trait Implementations§

§

impl<T> Freeze for Polynomial<T>

§

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§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.
Source§

impl<T> EuclideanRingOperation for T
where T: RingOperation + Div + Rem,

Source§

impl<T, Rhs> NumAssignOps<Rhs> for T
where T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,

Source§

impl<T, Rhs, Output> NumOps<Rhs, Output> for T
where T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,

Source§

impl<T, Base> RefNum<Base> for T
where T: NumOps<Base, Base> + for<'r> NumOps<&'r Base, Base>,

Source§

impl<T> RingOperation for T
where T: Add + Sub + Mul,