Struct rdcl_aoc_helpers::math::polynomial::Polynomial
source · pub struct Polynomial { /* private fields */ }
Expand description
A polynomial.
Implementations
sourceimpl 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
sourceimpl Add<Polynomial> for Polynomial
impl Add<Polynomial> for Polynomial
type Output = Polynomial
type Output = Polynomial
The resulting type after applying the
+
operator.sourcefn add(self, rhs: Polynomial) -> Self::Output
fn add(self, rhs: Polynomial) -> Self::Output
Performs the
+
operation. Read moresourceimpl Add<i64> for Polynomial
impl Add<i64> for Polynomial
sourceimpl Clone for Polynomial
impl Clone for Polynomial
sourcefn clone(&self) -> Polynomial
fn clone(&self) -> Polynomial
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 moresourceimpl Debug for Polynomial
impl Debug for Polynomial
sourceimpl Display for Polynomial
impl Display for Polynomial
sourceimpl Index<usize> for Polynomial
impl Index<usize> for Polynomial
sourceimpl Mul<i64> for Polynomial
impl Mul<i64> for Polynomial
sourceimpl Neg for Polynomial
impl Neg for Polynomial
sourceimpl PartialEq<Polynomial> for Polynomial
impl PartialEq<Polynomial> for Polynomial
sourcefn eq(&self, other: &Polynomial) -> bool
fn eq(&self, other: &Polynomial) -> bool
sourceimpl Sub<Polynomial> for Polynomial
impl Sub<Polynomial> for Polynomial
type Output = Polynomial
type Output = Polynomial
The resulting type after applying the
-
operator.sourcefn sub(self, rhs: Polynomial) -> Self::Output
fn sub(self, rhs: Polynomial) -> Self::Output
Performs the
-
operation. Read moresourceimpl Sub<i64> for Polynomial
impl Sub<i64> for Polynomial
impl Eq for Polynomial
impl StructuralEq for Polynomial
impl StructuralPartialEq for Polynomial
Auto Trait Implementations
impl RefUnwindSafe for Polynomial
impl Send for Polynomial
impl Sync for Polynomial
impl Unpin for Polynomial
impl UnwindSafe for Polynomial
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more