pub struct Polynomial<'a, B, T: Value = f64>where
B: Basis<T> + PolynomialDisplay<T>,{ /* private fields */ }Expand description
Represents a polynomial function in a given basis.
Unlike crate::CurveFit, this struct is not tied to any dataset or matrix, making it a canonical function that
can be evaluated for any x-value without range restrictions.
§Type Parameters
'a: Lifetime for borrowed basis or coefficients, if used.B: The polynomial basis (e.g.,crate::basis::MonomialBasis,crate::basis::ChebyshevBasis).T: Numeric type for the coefficients, default isf64.
Implementations§
Source§impl<'a, T: Value> Polynomial<'a, MonomialBasis<T>, T>
impl<'a, T: Value> Polynomial<'a, MonomialBasis<T>, T>
Source§impl<T: Value> Polynomial<'_, FourierBasis<T>, T>
impl<T: Value> Polynomial<'_, FourierBasis<T>, T>
Sourcepub fn new(x_range: (T, T), constant: T, terms: &[(T, T)]) -> Self
pub fn new(x_range: (T, T), constant: T, terms: &[(T, T)]) -> Self
Create a new Fourier polynomial with the given constant and Fourier coefficients over the specified x-range.
§Parameters
x_range: The range of x-values over which the Fourier basis is definedconstant: The constant term of the polynomialterms: A slice of (a_n,b_n) pairs representing the sine and cosine coefficients
§Returns
A polynomial defined in the Fourier basis.
For example to create a Fourier polynomial:
f(x) = 3 + 2 sin(2πx) - 0.5 cos(2πx)use polyfit::FourierPolynomial;
let poly = FourierPolynomial::new((-1.0, 1.0), 3.0, &[(2.0, -0.5)]);Source§impl<'a, B, T: Value> Polynomial<'a, B, T>where
B: Basis<T> + PolynomialDisplay<T>,
impl<'a, B, T: Value> Polynomial<'a, B, T>where
B: Basis<T> + PolynomialDisplay<T>,
Sourcepub const unsafe fn from_raw(
basis: B,
coefficients: Cow<'a, [T]>,
degree: usize,
) -> Self
pub const unsafe fn from_raw( basis: B, coefficients: Cow<'a, [T]>, degree: usize, ) -> Self
Creates a Polynomial from a given basis, coefficients, and degree.
§Safety
This constructor is unsafe because it allows the creation of a polynomial without enforcing the usual invariants (e.g., degree must match the number of coefficients expected by the basis).
The length of coefficients must be equal to Basis::k(degree)
§Parameters
basis: The polynomial basiscoefficients: The coefficients for the polynomial, possibly borrowed or owneddegree: The degree of the polynomial
§Returns
A new Polynomial instance with the given basis and coefficients.
Sourcepub fn from_basis(
basis: B,
coefficients: impl Into<Cow<'a, [T]>>,
) -> Result<Self>
pub fn from_basis( basis: B, coefficients: impl Into<Cow<'a, [T]>>, ) -> Result<Self>
Creates a new polynomial from a basis and coefficients, inferring the degree.
§Parameters
basis: The polynomial basiscoefficients: The coefficients for the polynomial, possibly borrowed or owned
§Returns
A new Polynomial instance with the given basis and coefficients, or an error if the number of coefficients is invalid for the basis.
§Errors
Returns an error if the number of coefficients does not correspond to a valid degree for the given basis.
Sourcepub fn into_inner(self) -> (B, Cow<'a, [T]>, usize)
pub fn into_inner(self) -> (B, Cow<'a, [T]>, usize)
Decomposes the polynomial into its basis, coefficients, and degree.
Sourcepub fn into_owned(self) -> Polynomial<'static, B, T>
pub fn into_owned(self) -> Polynomial<'static, B, T>
Converts the polynomial into an owned version.
This consumes the current Polynomial and returns a new one with
'static lifetime, owning both the basis and the coefficients.
Useful when you need a fully independent polynomial that does not borrow from any external data.
Sourcepub fn coefficients(&self) -> &[T]
pub fn coefficients(&self) -> &[T]
Returns a reference to the polynomial’s coefficients.
The index of each coefficient the jth basis function.
For example in a monomial expression y(x) = 2x^2 - 3x + 1;
coefficients = [1.0, -3.0, 2.0]
Technical Details
Formally, for each coefficient j, and the jth basis function B_j(x), the relationship is:
y(x) = Σ (c_j * B_j(x))Sourcepub fn coefficients_mut(&mut self) -> &mut [T]
pub fn coefficients_mut(&mut self) -> &mut [T]
Returns a mutable reference to the polynomial’s coefficients.
The index of each coefficient the jth basis function.
For example in a monomial expression y(x) = 2x^2 - 3x + 1;
coefficients = [1.0, -3.0, 2.0]
Technical Details
Formally, for each coefficient j, and the jth basis function B_j(x), the relationship is:
y(x) = Σ (c_j * B_j(x))Sourcepub fn degree(&self) -> usize
pub fn degree(&self) -> usize
Returns the degree of the polynomial.
The number of actual components, or basis functions, in the expression of a degree is defined by the basis.
That number is called k. For most basis choices, k = degree + 1.
Sourcepub fn abs(&mut self)
pub fn abs(&mut self)
Replaces the coefficients of the polynomial in place with absolute values.
Sourcepub fn scale(&mut self, factor: T)
pub fn scale(&mut self, factor: T)
Scales all coefficients of the polynomial by a given factor in place.
Sourcepub fn y(&self, x: T) -> T
pub fn y(&self, x: T) -> T
Evaluates the polynomial at a given x-value.
Technical Details
Given Basis::k coefficients and basis functions, and for each pair of coefficients c_j and basis function B_j(x), this function returns:
y(x) = Σ (c_j * B_j(x))§Parameters
x: The point at which to evaluate the polynomial.
§Returns
The computed y-value using the polynomial basis and coefficients.
§Example
let poly = MonomialPolynomial::borrowed(&[1.0, 2.0, 3.0]); // Represents 1 + 2x + 3x^2
let y = poly.y(2.0); // evaluates 1 + 2*2 + 3*2^2 = 17.0Sourcepub fn solve(&self, x: impl IntoIterator<Item = T>) -> Vec<(T, T)>
pub fn solve(&self, x: impl IntoIterator<Item = T>) -> Vec<(T, T)>
Evaluates the polynomial at multiple x-values.
Technical Details
Given Basis::k coefficients and basis functions, and for each pair of coefficients c_j and basis function B_j(x), this function returns:
y(x) = Σ (c_j * B_j(x))§Parameters
x: An iterator of x-values at which to evaluate the polynomial.
§Returns
A Vec of (x, y) pairs corresponding to each input value.
§Example
let poly = MonomialPolynomial::borrowed(&[1.0, 2.0, 3.0]); // 1 + 2x + 3x^2
let points = poly.solve(vec![0.0, 1.0, 2.0]);
// points = [(0.0, 1.0), (1.0, 6.0), (2.0, 17.0)]Sourcepub fn solve_range(&self, range: RangeInclusive<T>, step: T) -> Vec<(T, T)>
pub fn solve_range(&self, range: RangeInclusive<T>, step: T) -> Vec<(T, T)>
Evaluates the polynomial over a range of x-values with a fixed step.
Technical Details
Given Basis::k coefficients and basis functions, and for each pair of coefficients c_j and basis function B_j(x), this function returns:
y(x) = Σ (c_j * B_j(x))§Parameters
range: The start and end of the x-values to evaluate.step: The increment between successive x-values.
§Returns
A Vec of (x, y) pairs for each sampled point.
§Example
let poly = MonomialPolynomial::borrowed(&[1.0, 2.0, 3.0]); // 1 + 2x + 3x^2
let points = poly.solve_range(0.0..=2.0, 1.0);
// points = [(0.0, 1.0), (1.0, 6.0), (2.0, 17.0)]Sourcepub fn r_squared(&self, data: &[(T, T)]) -> T
pub fn r_squared(&self, data: &[(T, T)]) -> T
Calculates the R-squared value for the model compared to provided data.
R-squared is a statistical measure of how well the polynomial explains the variance in the data. Values closer to 1 indicate a better fit.
§Parameters
data: A slice of(x, y)pairs to compare against the polynomial fit.
See statistics::r_squared for more details.
§Returns
The R-squared value as type T.
Sourcepub fn remove_leading_zeros(&mut self)
pub fn remove_leading_zeros(&mut self)
Removes leading zero coefficients from the polynomial in place.
For example, a polynomial y(x) = 0x^2 + x + 3 would become y(x) = x + 3
Sourcepub fn leading_coefficient(&self) -> T
pub fn leading_coefficient(&self) -> T
Returns the most-significant (leading) non-zero coefficient of the polynomial.
If all coefficients are zero, returns zero.
Sourcepub fn derivative(&self) -> Result<Polynomial<'static, B::B2, T>>where
B: DifferentialBasis<T>,
pub fn derivative(&self) -> Result<Polynomial<'static, B::B2, T>>where
B: DifferentialBasis<T>,
Computes the derivative of this polynomial.
§Type Parameters
B2: The basis type for the derivative (determined by the implementingDifferentialBasistrait).
§Returns
Ok(Polynomial<'static, B2, T>): The derivative polynomial.Err: If computing the derivative fails.
§Requirements
- The polynomial’s basis
Bmust implementDifferentialBasis.
§Errors
If the basis cannot compute the derivative coefficients, an error is returned.
§Example
use polyfit::function;
function!(test(x) = 20.0 + 3.0 x^1 + 2.0 x^2 + 4.0 x^3);
let deriv = test.derivative().unwrap();
println!("Derivative: {:?}", deriv.coefficients());Sourcepub fn critical_points(
&self,
x_range: RangeInclusive<T>,
) -> Result<Vec<CriticalPoint<T>>>
pub fn critical_points( &self, x_range: RangeInclusive<T>, ) -> Result<Vec<CriticalPoint<T>>>
Finds the critical points (where the derivative is zero) of a polynomial in this basis.
This corresponds to the polynomial’s local minima and maxima (The x values where curvature changes).
Technical Details
The critical points are found by solving the equation f'(x) = 0, where f'(x) is the derivative of the polynomial.
This is done with by finding the eigenvalues of the companion matrix of the derivative polynomial.
§Returns
A vector of x values where the critical points occur.
§Requirements
- The polynomial’s basis
Bmust implementDifferentialBasis.
§Errors
Returns an error if the critical points cannot be found.
§Example
let poly = MonomialPolynomial::borrowed(&[1.0, 2.0, 3.0]); // 1 + 2x + 3x^2
let critical_points = poly.critical_points(0.0..=100.0).unwrap();Sourcepub fn roots(&self) -> Result<Vec<Root<T>>>where
B: RootFindingBasis<T>,
pub fn roots(&self) -> Result<Vec<Root<T>>>where
B: RootFindingBasis<T>,
Finds the roots (zeros) of the polynomial in this basis.
This corresponds to the x values where the polynomial evaluates to zero.
A root can be either real or complex:
Root::Real(x)indicates a real root atx. This is a point where the polynomial crosses or touches the x-axis.Root::ComplexPair(z, z2)indicates a pair of complex conjugate roots. These do not correspond to x-axis crossings but are important in the polynomial’s overall behavior.Root::Complex(z)indicates a single complex root (not part of a conjugate pair). Should be rare for polynomials with real coefficients.
Technical Details
The roots are found by solving the equation f(x) = 0, where f(x) is the polynomial.
This is done in a basis-specific manner, often involving finding the eigenvalues of the companion matrix of the polynomial.
§Returns
A vector of Root<T> representing the roots of the polynomial.
§Errors
Returns an error if the roots cannot be found.
Sourcepub fn real_roots(
&self,
x_range: RangeInclusive<T>,
max_newton_iterations: Option<usize>,
) -> Result<Vec<T>>where
B: DifferentialBasis<T>,
pub fn real_roots(
&self,
x_range: RangeInclusive<T>,
max_newton_iterations: Option<usize>,
) -> Result<Vec<T>>where
B: DifferentialBasis<T>,
Uses a less precise iterative method to find only the real roots of the polynomial.
This is less precise than Self::roots and will not find complex roots, but is often faster and more stable for high-degree polynomials
and is available for all bases.
§Parameters
x_range: The range of x-values to search for real roots.max_newton_iterations: The maximum number of Newton-Raphson iterations to refine each root. This helps improve the accuracy of the found roots. If omitted, a sensible value will be calculated
§Returns
A vector of T representing the real roots of the polynomial within the specified range
§Errors
Returns an error if the derivative cannot be computed.
Sourcepub fn integral(
&self,
constant: Option<T>,
) -> Result<Polynomial<'static, B::B2, T>>where
B: IntegralBasis<T>,
pub fn integral(
&self,
constant: Option<T>,
) -> Result<Polynomial<'static, B::B2, T>>where
B: IntegralBasis<T>,
Computes the indefinite integral of this polynomial.
§Type Parameters
B2: The basis type for the integral (determined by the implementingDifferentialBasistrait).
§Parameters
constant: Constant of integration (value at x = 0).
§Requirements
- The polynomial’s basis
Bmust implementIntegralBasis.
§Returns
Ok(Polynomial<'static, B2, T>): The integral polynomial.Err: If computing the integral fails.
§Errors
If the basis cannot compute the integral coefficients, an error is returned.
§Example
use polyfit::function;
function!(test(x) = 20.0 + 3.0 x^1 + 2.0 x^2 + 4.0 x^3);
let integral = test.integral(Some(1.0)).unwrap();
println!("Integral: {:?}", integral.coefficients());Sourcepub fn area_under_curve(
&self,
x_min: T,
x_max: T,
constant: Option<T>,
) -> Result<T>where
B: IntegralBasis<T>,
pub fn area_under_curve(
&self,
x_min: T,
x_max: T,
constant: Option<T>,
) -> Result<T>where
B: IntegralBasis<T>,
Computes the definite integral (area under the curve) of the fitted polynomial
between x_min and x_max.
Technical Details
The area under the curve is computed using the definite integral of the polynomial between the specified bounds:
Area = ∫[x_min to x_max] f(x) dx = F(x_max) - F(x_min)§Parameters
x_min: Lower bound of integration.x_max: Upper bound of integration.constant: Constant of integration (value at x = 0) for the indefinite integral.
§Requirements
- The polynomial’s basis
Bmust implementIntegralBasis.
§Returns
Ok(T): The computed area under the curve betweenx_minandx_max.Err: If computing the integral fails (e.g., basis cannot compute integral coefficients).
§Errors
If the basis cannot compute the integral coefficients, an error is returned.
§Example
polyfit::function!(poly(x) = 4 x^3 + 2);
let area = poly.area_under_curve(0.0, 3.0, None).unwrap();
println!("Area under curve: {}", area);Sourcepub fn monotonicity_violations(
&self,
x_range: RangeInclusive<T>,
) -> Result<Vec<T>>where
B: DifferentialBasis<T>,
pub fn monotonicity_violations(
&self,
x_range: RangeInclusive<T>,
) -> Result<Vec<T>>where
B: DifferentialBasis<T>,
Returns the X-values where the function is not monotone (i.e., where the derivative changes sign).
§Errors
Returns an error if the derivative cannot be computed.
§Example
polyfit::function!(poly(x) = 4 x^3 + 2);
let area = poly.area_under_curve(0.0, 3.0, None).unwrap();
let violations = poly.monotonicity_violations(0.0..=3.0).unwrap();Sourcepub fn as_monomial(&self) -> Result<MonomialPolynomial<'static, T>>where
B: IntoMonomialBasis<T>,
pub fn as_monomial(&self) -> Result<MonomialPolynomial<'static, T>>where
B: IntoMonomialBasis<T>,
Converts the polynomial into a monomial polynomial.
This produces a MonomialPolynomial representation of the curve,
which uses the standard monomial basis 1, x, x^2, ….
§Returns
A monomial polynomial with owned coefficients.
§Errors
Returns an error if the current basis cannot be converted to monomial form.
This requires that the basis implements IntoMonomialBasis.
§Example
let data = &[(0.0, 1.0), (1.0, 3.0), (2.0, 7.0)];
let fit = ChebyshevFit::new(data, 2).unwrap();
let mono_poly = fit.as_polynomial().as_monomial().unwrap();
let y = mono_poly.y(1.5);Sourcepub fn project<B2: Basis<T> + PolynomialDisplay<T>>(
&self,
x_range: RangeInclusive<T>,
) -> Result<Polynomial<'static, B2, T>>
pub fn project<B2: Basis<T> + PolynomialDisplay<T>>( &self, x_range: RangeInclusive<T>, ) -> Result<Polynomial<'static, B2, T>>
Projects this polynomial onto another basis over a specified x-range.
This is useful for converting between different polynomial representations.
Technical Details
Gets 15 * k evenly spaced sample points over the specified range, where k is the number of coefficients in the current polynomial.
- 15 observations per degree of freedom -
crate::statistics::DegreeBound::Conservative
Fits a new polynomial in the target basis to these points using least-squares fitting.
§Type Parameters
B2: The target basis type to project onto.
§Parameters
x_range: The range of x-values over which to perform the projection.
§Returns
Ok(Polynomial<'static, B2, T>): The projected polynomial in the new basis.
§Errors
Returns an error if the projection fails, such as if the fitting process encounters issues.
Sourcepub fn project_orthogonal<B2>(
&self,
x_range: RangeInclusive<T>,
target_degree: usize,
) -> Result<Polynomial<'static, B2, T>>
pub fn project_orthogonal<B2>( &self, x_range: RangeInclusive<T>, target_degree: usize, ) -> Result<Polynomial<'static, B2, T>>
Projects this polynomial onto an orthogonal basis over a specified x-range.
This is a -very- stable way to convert between polynomial bases, as it uses Gaussian quadrature
You can use it to leverage the strengths of different bases, for example:
- If you have very very bad data
- Fit a fourier curve of a moderate degree
- This smooths out noise, but overexplains outliers and can ring at the edges
- Then project that onto a Chebyshev basis of degree 2(degree of fourier - 1)
- This makes sure you don’t create new information in the transfer
- It drops 2 parameters to account for noise and the fourier ringing
- The Chebyshev basis is well behaved and numerically stable
- This will far outperform a direct fit to the noisy data
§Type Parameters
B2: The target orthogonal basis type to project onto.T: The numeric type for the polynomial coefficients and evaluations.
§Parameters
x_range: The range of x-values over which to perform the projection.target_degree: The degree of the target polynomial in the new basis.
§Returns
Ok(Polynomial<'static, B2, T>): The projected polynomial in the new orthogonal basis.Err: If the projection fails, such as if the fitting process encounters issues.
§Errors
Returns an error if the projection fails, such as if the fitting process encounters issues.
Sourcepub fn is_orthogonal(&self) -> boolwhere
B: OrthogonalBasis<T>,
pub fn is_orthogonal(&self) -> boolwhere
B: OrthogonalBasis<T>,
Checks if the polynomial’s basis is orthogonal.
Can be used to determine if methods that require orthogonality can be applied. Returns true if the basis is orthogonal, false otherwise, like in the case of integrated Fourier series.
Sourcepub fn coefficient_energies(&self) -> Result<Vec<T>>where
B: OrthogonalBasis<T>,
pub fn coefficient_energies(&self) -> Result<Vec<T>>where
B: OrthogonalBasis<T>,
Computes the energy contribution of each coefficient in an orthogonal basis.
This is a measure of how much each basis function contributes to the resulting polynomial.
It can be useful for understanding the significance of each term
Technical Details
For an orthogonal basis, the energy contribution of each coefficient is calculated as:
E_j = c_j^2 * N_jwhere:
E_jis the energy contribution of the jth coefficient.c_jis the jth coefficient.N_jis the normalization factor for the jth basis function, provided by the basis.
§Returns
A vector of energy contributions for each coefficient.
§Errors
Returns an error if the basis is not orthogonal. This can be checked with Polynomial::is_orthogonal.
Can happen for integrated Fourier series
Sourcepub fn smoothness(&self) -> Result<T>where
B: OrthogonalBasis<T>,
pub fn smoothness(&self) -> Result<T>where
B: OrthogonalBasis<T>,
Computes a smoothness metric for the polynomial.
This metric quantifies how “smooth” the polynomial is, with lower values indicating smoother curves.
Technical Details
The smoothness is calculated as a weighted average of the coefficient energies, where higher-degree coefficients are penalized more heavily. The formula used is:
Smoothness = (Σ (k^2 * E_k)) / (Σ E_k)where:
kis the degree of the basis function.E_kis the energy contribution of the k-th coefficient.
§Returns
A smoothness value, where lower values indicate a smoother polynomial.
§Errors
Returns an error if the basis is not orthogonal. This can be checked with Polynomial::is_orthogonal.
Sourcepub fn spectral_energy_filter(&mut self) -> Result<()>where
B: OrthogonalBasis<T>,
pub fn spectral_energy_filter(&mut self) -> Result<()>where
B: OrthogonalBasis<T>,
Applies a spectral energy filter to the polynomial.
This uses the properties of a orthogonal basis to de-noise the polynomial by removing higher-degree terms that contribute little to the overall energy. Terms are split into “signal” and “noise” based on their energy contributions, and the polynomial is truncated to only include the signal components.
Remaining terms are smoothly attenuated to prevent ringing artifacts from a hard cutoff.
Technical Details
The energy of each coefficient is calculated using the formula:
E_j = c_j^2 * N_jwhere:
E_jis the energy contribution of the jth coefficient.c_jis the jth coefficient.N_jis the normalization factor for the jth basis function, provided by the basis.
Generalized Cross-Validation (GCV) is used to determine the optimal cutoff degree K that minimizes the prediction error using:
GCV(K) = (suffix[0] - suffix[K]) / K^2, where suffix is the suffix sum of energies.
A Lanczos Sigma filter with p=1 is applied to smoothly attenuate coefficients up to the cutoff degree, reducing Gibbs ringing artifacts.
§Notes
- This method modifies the polynomial in place.
§Errors
Returns an error if the basis is not orthogonal. This can be checked with Polynomial::is_orthogonal.
Sourcepub fn equation(&self) -> String
pub fn equation(&self) -> String
Returns a human-readable string of the polynomial equation.
The output shows the polynomial in standard mathematical notation, for example:
y = 1.0x^3 + 2.0x^2 + 3.0x + 4.0§Notes
- Requires the basis to implement
PolynomialDisplayfor formatting. - This operation is infallible and guaranteed to succeed, hence no error return.
§Example
let poly = MonomialPolynomial::borrowed(&[1.0, 2.0, 3.0]); // 1 + 2x + 3x^2
println!("{}", poly.equation());Trait Implementations§
Source§impl<B, T> AsPlottingElement<T> for Polynomial<'_, B, T>
Available on crate feature plotting only.
impl<B, T> AsPlottingElement<T> for Polynomial<'_, B, T>
plotting only.Source§fn as_plotting_element(
&self,
xs: &[T],
_: Confidence,
_: Option<Tolerance<T>>,
) -> PlottingElement<T>
fn as_plotting_element( &self, xs: &[T], _: Confidence, _: Option<Tolerance<T>>, ) -> PlottingElement<T>
Source§impl<B, T: Value> AsRef<Polynomial<'_, B, T>> for CurveFit<'_, B, T>where
B: Basis<T> + PolynomialDisplay<T>,
impl<B, T: Value> AsRef<Polynomial<'_, B, T>> for CurveFit<'_, B, T>where
B: Basis<T> + PolynomialDisplay<T>,
Source§fn as_ref(&self) -> &Polynomial<'static, B, T>
fn as_ref(&self) -> &Polynomial<'static, B, T>
Source§impl<'a, B, T: Value> AsRef<Polynomial<'a, B, T>> for Polynomial<'a, B, T>where
B: Basis<T> + PolynomialDisplay<T>,
impl<'a, B, T: Value> AsRef<Polynomial<'a, B, T>> for Polynomial<'a, B, T>where
B: Basis<T> + PolynomialDisplay<T>,
Source§fn as_ref(&self) -> &Polynomial<'a, B, T>
fn as_ref(&self) -> &Polynomial<'a, B, T>
Source§impl<'a, B, T: Clone + Value> Clone for Polynomial<'a, B, T>
impl<'a, B, T: Clone + Value> Clone for Polynomial<'a, B, T>
Source§fn clone(&self) -> Polynomial<'a, B, T>
fn clone(&self) -> Polynomial<'a, B, T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<B, T: Value> Display for Polynomial<'_, B, T>where
B: Basis<T> + PolynomialDisplay<T>,
impl<B, T: Value> Display for Polynomial<'_, B, T>where
B: Basis<T> + PolynomialDisplay<T>,
Source§impl<B: Basis<T> + PolynomialDisplay<T>, T: Value> Div<T> for Polynomial<'_, B, T>
impl<B: Basis<T> + PolynomialDisplay<T>, T: Value> Div<T> for Polynomial<'_, B, T>
Source§impl<B: Basis<T> + PolynomialDisplay<T>, T: Value> DivAssign<T> for Polynomial<'_, B, T>
impl<B: Basis<T> + PolynomialDisplay<T>, T: Value> DivAssign<T> for Polynomial<'_, B, T>
Source§fn div_assign(&mut self, rhs: T)
fn div_assign(&mut self, rhs: T)
/= operation. Read moreSource§impl<B: Basis<T> + PolynomialDisplay<T>, T: Value> Mul<T> for Polynomial<'_, B, T>
impl<B: Basis<T> + PolynomialDisplay<T>, T: Value> Mul<T> for Polynomial<'_, B, T>
Source§impl<B: Basis<T> + PolynomialDisplay<T>, T: Value> MulAssign<T> for Polynomial<'_, B, T>
impl<B: Basis<T> + PolynomialDisplay<T>, T: Value> MulAssign<T> for Polynomial<'_, B, T>
Source§fn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
*= operation. Read moreimpl<'a, B, T: Value> StructuralPartialEq for Polynomial<'a, B, T>where
B: Basis<T> + PolynomialDisplay<T>,
Auto Trait Implementations§
impl<'a, B, T> Freeze for Polynomial<'a, B, T>where
B: Freeze,
impl<'a, B, T> RefUnwindSafe for Polynomial<'a, B, T>where
B: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, B, T> Send for Polynomial<'a, B, T>
impl<'a, B, T> Sync for Polynomial<'a, B, T>
impl<'a, B, T> Unpin for Polynomial<'a, B, T>
impl<'a, B, T> UnwindSafe for Polynomial<'a, B, T>
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
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>
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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.Source§impl<E, T> WithTypeFrom<T> for Ewhere
E: AsPlottingElement<T>,
T: Value,
impl<E, T> WithTypeFrom<T> for Ewhere
E: AsPlottingElement<T>,
T: Value,
Source§fn options_with_type_from(&self) -> PlotOptions<T>
fn options_with_type_from(&self) -> PlotOptions<T>
plotting only.Source§fn plot_with_type_from<P>(
&self,
root: &<P as PlotBackend>::Root,
options: PlotOptions<T>,
) -> Result<Plot<P, T>, <P as PlotBackend>::Error>where
P: PlotBackend,
fn plot_with_type_from<P>(
&self,
root: &<P as PlotBackend>::Root,
options: PlotOptions<T>,
) -> Result<Plot<P, T>, <P as PlotBackend>::Error>where
P: PlotBackend,
plotting only.Source§fn add_to_plot_with_type_from<P>(
&self,
plot: &mut Plot<P, T>,
) -> Result<(), <P as PlotBackend>::Error>where
P: PlotBackend,
fn add_to_plot_with_type_from<P>(
&self,
plot: &mut Plot<P, T>,
) -> Result<(), <P as PlotBackend>::Error>where
P: PlotBackend,
plotting only.