[][src]Struct rdcl_aoc_helpers::math::polynomial::Polynomial

pub struct Polynomial { /* fields omitted */ }

A polynomial.

Implementations

impl Polynomial[src]

pub fn new(coefficients: &[i64]) -> Polynomial[src]

The coefficients of the polynomial. The left-most coefficient corresponds with x^n. The right-most with x^0.

pub fn degree(&self) -> usize[src]

The degree of a polynomial. I.e. the highest n such that the coefficient for x^n is not zero.

pub fn find_roots(&self) -> Vec<i64>[src]

Find integer values x, such that the polynomial evaluates to 0 for x. These values are sorted from smallest to largest.

pub fn at(&self, x: i64) -> i64[src]

Evaluate the polynomial for x.

Trait Implementations

impl Add<Polynomial> for Polynomial[src]

type Output = Polynomial

The resulting type after applying the + operator.

impl Clone for Polynomial[src]

impl Debug for Polynomial[src]

impl Display for Polynomial[src]

impl Eq for Polynomial[src]

impl Neg for Polynomial[src]

type Output = Polynomial

The resulting type after applying the - operator.

impl PartialEq<Polynomial> for Polynomial[src]

impl StructuralEq for Polynomial[src]

impl StructuralPartialEq for Polynomial[src]

impl Sub<Polynomial> for Polynomial[src]

type Output = Polynomial

The resulting type after applying the - operator.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.