Struct rustnomial::LinearBinomial [−][src]
Expand description
A type that stores terms of a linear binomial in a static array. Operations are much faster than on Polynomial for the same size polynomial, but terms can not be added freely.
Fields
coefficients: [N; 2]
Implementations
Return the root of LinearBinomial
.
Example
use rustnomial::{LinearBinomial, Roots, SizedPolynomial}; let binomial = LinearBinomial::new([1.0, 2.0]); assert_eq!(Roots::OneRealRoot(-2.0), binomial.root()); let zero = LinearBinomial::<i32>::zero(); assert_eq!(Roots::InfiniteRoots, zero.root()); let constant = LinearBinomial::new([0, 1]); assert_eq!(Roots::NoRoots, constant.root());
Trait Implementations
type Output = LinearBinomial<N>
type Output = LinearBinomial<N>
The resulting type after applying the +
operator.
Performs the +
operation. Read more
Performs the +=
operation. Read more
Returns the derivative of the LinearBinomial
.
Example
use rustnomial::{LinearBinomial, Derivable}; let binomial = LinearBinomial::new([3.0, 1.0]); assert_eq!(LinearBinomial::new([0., 3.0]), binomial.derivative());
type Output = LinearBinomial<N>
type Output = LinearBinomial<N>
The resulting type after applying the /
operator.
Performs the /
operation. Read more
Performs the /=
operation. Read more
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
impl<N> Integrable<N, Polynomial<N>> for LinearBinomial<N> where
N: Zero + Copy + DivAssign + Mul<Output = N> + MulAssign + AddAssign + Div<Output = N> + TryFromUsizeContinuous,
impl<N> Integrable<N, Polynomial<N>> for LinearBinomial<N> where
N: Zero + Copy + DivAssign + Mul<Output = N> + MulAssign + AddAssign + Div<Output = N> + TryFromUsizeContinuous,
Returns the integral of the LinearBinomial
.
Example
use rustnomial::{LinearBinomial, Integrable, Polynomial}; let binomial = LinearBinomial::new([2.0, 0.]); let integral = binomial.integral(); assert_eq!(&Polynomial::new(vec![1.0, 0.0, 0.0]), integral.inner());
Will panic if N
can not losslessly represent 2usize
.
type Output = LinearBinomial<N>
type Output = LinearBinomial<N>
The resulting type after applying the *
operator.
Performs the *
operation. Read more
Performs the *=
operation. Read more
impl<N> MutablePolynomial<N> for LinearBinomial<N> where
N: Zero + SubAssign + AddAssign + Copy,
impl<N> MutablePolynomial<N> for LinearBinomial<N> where
N: Zero + SubAssign + AddAssign + Copy,
Tries to add the term with given coefficient and degree
to self
, returning an error
if the particular term can not be added to self without violating constraints. Read more
Tries to subtract the term with given coefficient and degree
from self
, returning
an error if the particular term can not be subtracted from self without violating
constraints. Read more
type Output = LinearBinomial<N>
type Output = LinearBinomial<N>
The resulting type after applying the -
operator.
Performs the unary -
operation. Read more
type Output = LinearBinomial<N>
type Output = LinearBinomial<N>
The resulting type after applying the >>
operator.
Performs the >>
operation. Read more
Performs the >>=
operation. Read more
Returns the term with the given degree
of the LinearBinomial
.
Example
use rustnomial::{LinearBinomial, SizedPolynomial, Term}; let binomial = LinearBinomial::new([5, 0]); assert_eq!(Term::Term(5, 1), binomial.term_with_degree(1)); assert_eq!(Term::ZeroTerm, binomial.term_with_degree(0));
Returns the degree of the LinearBinomial
.
Example
use rustnomial::{SizedPolynomial, LinearBinomial, Degree}; let binomial = LinearBinomial::new([3.0, 2.0]); assert_eq!(Degree::Num(1), binomial.degree()); let monomial = LinearBinomial::new([0.0, 1.0]); assert_eq!(Degree::Num(0), monomial.degree()); let zero = LinearBinomial::<i32>::zero(); assert_eq!(Degree::NegInf, zero.degree());
Returns a LinearBinomial
with no terms.
Example
use rustnomial::{SizedPolynomial, LinearBinomial}; let zero = LinearBinomial::<i32>::zero(); assert!(zero.is_zero()); assert!(zero.ordered_term_iter().next().is_none());
Sets self to zero.
Example
use rustnomial::{SizedPolynomial, LinearBinomial}; let mut non_zero = LinearBinomial::new([1, 1]); assert!(!non_zero.is_zero()); non_zero.set_to_zero(); assert!(non_zero.is_zero());
Returns a Vec containing all of the terms of self
, where each item is
the coefficient and degree of each non-zero term, in order of descending degree. Read more
type Output = LinearBinomial<N>
type Output = LinearBinomial<N>
The resulting type after applying the -
operator.
Performs the -
operation. Read more
Performs the -=
operation. Read more
Auto Trait Implementations
impl<N> RefUnwindSafe for LinearBinomial<N> where
N: RefUnwindSafe,
impl<N> Send for LinearBinomial<N> where
N: Send,
impl<N> Sync for LinearBinomial<N> where
N: Sync,
impl<N> Unpin for LinearBinomial<N> where
N: Unpin,
impl<N> UnwindSafe for LinearBinomial<N> where
N: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more