pub struct Polynomial { /* private fields */ }
Expand description
A polynomial.
Implementations§
Source§impl Polynomial
impl Polynomial
Sourcepub fn new(coefficients: &[i64]) -> Polynomial
pub fn new(coefficients: &[i64]) -> Polynomial
The coefficients of the polynomial. The left-most coefficient corresponds with x^n. The right-most with x^0.
Sourcepub fn degree(&self) -> usize
pub fn degree(&self) -> usize
The degree of a polynomial. I.e. the highest n such that the coefficient for x^n is not zero.
Sourcepub fn find_roots(&self) -> Vec<i64>
pub fn find_roots(&self) -> Vec<i64>
Find integer values x, such that the polynomial evaluates to 0 for x. These values are sorted from smallest to largest.
Trait Implementations§
Source§impl Add<i64> for Polynomial
impl Add<i64> for Polynomial
Source§impl Add for Polynomial
impl Add for Polynomial
Source§type Output = Polynomial
type Output = Polynomial
The resulting type after applying the
+
operator.Source§impl Clone for Polynomial
impl Clone for Polynomial
Source§fn clone(&self) -> Polynomial
fn clone(&self) -> Polynomial
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 Debug for Polynomial
impl Debug for Polynomial
Source§impl Display for Polynomial
impl Display for Polynomial
Source§impl Index<usize> for Polynomial
impl Index<usize> for Polynomial
Source§impl Mul<i64> for Polynomial
impl Mul<i64> for Polynomial
Source§impl Neg for Polynomial
impl Neg for Polynomial
Source§impl PartialEq for Polynomial
impl PartialEq for Polynomial
Source§impl Sub<i64> for Polynomial
impl Sub<i64> for Polynomial
Source§impl Sub for Polynomial
impl Sub for Polynomial
Source§type Output = Polynomial
type Output = Polynomial
The resulting type after applying the
-
operator.impl Eq for Polynomial
impl StructuralPartialEq for Polynomial
Auto Trait Implementations§
impl Freeze for Polynomial
impl RefUnwindSafe for Polynomial
impl Send for Polynomial
impl Sync for Polynomial
impl Unpin for Polynomial
impl UnwindSafe for Polynomial
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more