pub struct Poly<T: Scalar>(_);Implementations§
source§impl<T: Scalar> Poly<T>
impl<T: Scalar> Poly<T>
pub fn new(coeffs: &[Complex<T>]) -> Self
pub fn from_roots(roots: DVector<Complex<T>>) -> Self
pub fn line(offset: Complex<T>, scale: Complex<T>) -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn pow(&self, pow: u32) -> Self
pub fn pow_usize(&self, pow: usize) -> Self
sourcepub fn roots(&self) -> Option<DVector<Complex<T>>>
pub fn roots(&self) -> Option<DVector<Complex<T>>>
use rust_poly::Poly;
use rust_poly::num_complex::Complex;
let p = Poly::new(&[Complex::new(1.0, 0.0), Complex::new(2.0, 0.0), Complex::new(3.0, 0.0), Complex::new(4.0, 0.0)]);
dbg!(p.roots());
assert!(false);sourcepub fn compose(&self, x: Self) -> Self
pub fn compose(&self, x: Self) -> Self
Compose two polynomials, returning a new polynomial.
Substitute the given polynomial x into self and expand the
result into a new polynomial.
Examples
use rust_poly::Poly;
use num_complex::Complex;
use num_traits::identities::One;
let f = Poly::new(&[Complex::new(1.0, 0.0), Complex::new(2.0, 0.0)]);
let g = Poly::one();
assert_eq!(f.compose(g), f);Trait Implementations§
source§impl<T: PartialEq + Scalar> PartialEq<Poly<T>> for Poly<T>
impl<T: PartialEq + Scalar> PartialEq<Poly<T>> for Poly<T>
impl<T: Eq + Scalar> Eq for Poly<T>
impl<T: Scalar> StructuralEq for Poly<T>
impl<T: Scalar> StructuralPartialEq for Poly<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for Poly<T>where T: RefUnwindSafe,
impl<T> Send for Poly<T>
impl<T> Sync for Poly<T>
impl<T> Unpin for Poly<T>where T: Unpin,
impl<T> UnwindSafe for Poly<T>where T: UnwindSafe,
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
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.