pub struct UnivariatePolynomial {
pub degree: Option<u32>,
/* private fields */
}Expand description
Represents a polynomial, which is a sum of monomials.
Fields§
§degree: Option<u32>The degree of the polynomial, if known.
Implementations§
Source§impl UnivariatePolynomial
impl UnivariatePolynomial
Sourcepub fn new(monomials: Vec<Monomial>) -> UnivariatePolynomial
pub fn new(monomials: Vec<Monomial>) -> UnivariatePolynomial
Adds a monomial to the polynomial. If a monomial with the same exponent already exists, their coefficients are combined.
§Arguments
exponent- The exponent of the monomial to add.coefficients- The coefficient of the monomial to add.
Sourcepub fn default() -> UnivariatePolynomial
pub fn default() -> UnivariatePolynomial
Creates a default Polynomial with no monomials and no degree.
§Returns
A default Polynomial instance.
Sourcepub fn interpolate(x: Vec<f32>, y: Vec<f32>) -> UnivariatePolynomial
pub fn interpolate(x: Vec<f32>, y: Vec<f32>) -> UnivariatePolynomial
Trait Implementations§
Source§impl Add for UnivariatePolynomial
impl Add for UnivariatePolynomial
Source§fn add(self, p2: UnivariatePolynomial) -> Self
fn add(self, p2: UnivariatePolynomial) -> Self
Source§type Output = UnivariatePolynomial
type Output = UnivariatePolynomial
The resulting type after applying the
+ operator.Source§impl Clone for UnivariatePolynomial
impl Clone for UnivariatePolynomial
Source§fn clone(&self) -> UnivariatePolynomial
fn clone(&self) -> UnivariatePolynomial
Returns a copy 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 UnivariatePolynomial
impl Debug for UnivariatePolynomial
Source§impl Mul for UnivariatePolynomial
impl Mul for UnivariatePolynomial
Source§fn mul(self, p2: UnivariatePolynomial) -> Self
fn mul(self, p2: UnivariatePolynomial) -> Self
Source§type Output = UnivariatePolynomial
type Output = UnivariatePolynomial
The resulting type after applying the
* operator.Auto Trait Implementations§
impl Freeze for UnivariatePolynomial
impl RefUnwindSafe for UnivariatePolynomial
impl Send for UnivariatePolynomial
impl Sync for UnivariatePolynomial
impl Unpin for UnivariatePolynomial
impl UnwindSafe for UnivariatePolynomial
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