Struct au::rational_function::Rf [−][src]
Rational function
Implementations
impl<T> Rf<T>
[src]
Implementation of rational function methods
impl<T> Rf<T>
[src]
#[must_use]pub fn new(num: Poly<T>, den: Poly<T>) -> Self
[src]
Create a new rational function given its numerator and denominator
Arguments
num
- Rational function numeratorden
- Rational function denominator
Example
use au::{poly, Rf}; let rf = Rf::new(poly!(1., 2.), poly!(-4., 6., -2.));
#[must_use]pub fn num(&self) -> &Poly<T>
[src]
Extract rational function numerator
Example
use au::{poly, Rf}; let num = poly!(1., 2.); let rf = Rf::new(num.clone(), poly!(-4., 6., -2.)); assert_eq!(&num, rf.num());
#[must_use]pub fn den(&self) -> &Poly<T>
[src]
Extract rational function denominator
Example
use au::{poly, Rf}; let den = poly!(-4., 6., -2.); let rf = Rf::new(poly!(1., 2.), den.clone()); assert_eq!(&den, rf.den());
impl<T: Clone + PartialEq + Zero> Rf<T>
[src]
#[must_use]pub fn relative_degree(&self) -> i32
[src]
Calculate the relative degree between denominator and numerator.
Example
use au::{num_traits::Inv, poly, Rf}; let rf = Rf::new(poly!(1., 2.), poly!(-4., 6., -2.)); let expected = rf.relative_degree(); assert_eq!(expected, 1); assert_eq!(rf.inv().relative_degree(), -1);
impl<T: Float + RealField> Rf<T>
[src]
#[must_use]pub fn real_poles(&self) -> Option<Vec<T>>
[src]
Calculate the poles of the rational function
#[must_use]pub fn complex_poles(&self) -> Vec<Complex<T>>
[src]
Calculate the poles of the rational function
#[must_use]pub fn real_zeros(&self) -> Option<Vec<T>>
[src]
Calculate the zeros of the rational function
#[must_use]pub fn complex_zeros(&self) -> Vec<Complex<T>>
[src]
Calculate the zeros of the rational function
impl<T: Clone + Div<Output = T> + One + PartialEq + Zero> Rf<T>
[src]
#[must_use]pub fn normalize(&self) -> Self
[src]
Normalization of rational function. If the denominator is zero the same rational function is returned.
from:
b_n*z^n + b_(n-1)*z^(n-1) + ... + b_1*z + b_0
G(z) = ---------------------------------------------
a_n*z^n + a_(n-1)*z^(n-1) + ... + a_1*z + a_0
to:
b'_n*z^n + b'_(n-1)*z^(n-1) + ... + b'_1*z + b'_0
G(z) = -------------------------------------------------
z^n + a'_(n-1)*z^(n-1) + ... + a'_1*z + a'_0
Example
use au::{poly, Rf}; let rf = Rf::new(poly!(1., 2.), poly!(-4., 6., -2.)); let expected = Rf::new(poly!(-0.5, -1.), poly!(2., -3., 1.)); assert_eq!(expected, rf.normalize());
pub fn normalize_mut(&mut self)
[src]
In place normalization of rational function. If the denominator is zero no operation is done.
from:
b_n*z^n + b_(n-1)*z^(n-1) + ... + b_1*z + b_0
G(z) = ---------------------------------------------
a_n*z^n + a_(n-1)*z^(n-1) + ... + a_1*z + a_0
to:
b'_n*z^n + b'_(n-1)*z^(n-1) + ... + b'_1*z + b'_0
G(z) = -------------------------------------------------
z^n + a'_(n-1)*z^(n-1) + ... + a'_1*z + a'_0
Example
use au::{poly, Rf}; let mut rf = Rf::new(poly!(1., 2.), poly!(-4., 6., -2.)); rf.normalize_mut(); let expected = Rf::new(poly!(-0.5, -1.), poly!(2., -3., 1.)); assert_eq!(expected, rf);
impl<T: Clone> Rf<T>
[src]
pub fn eval_by_val<N>(&self, s: N) -> N where
N: Add<T, Output = N> + Clone + Div<Output = N> + Mul<Output = N> + Zero,
[src]
N: Add<T, Output = N> + Clone + Div<Output = N> + Mul<Output = N> + Zero,
Evaluate the rational function.
Arguments
s
- Value at which the rational function is evaluated.
Example
use au::{poly, Rf}; use au::num_complex::Complex as C; let rf = Rf::new(poly!(1., 2., 3.), poly!(-4., -3., 1.)); assert_eq!(-8.5, rf.eval_by_val(3.)); assert_eq!(C::new(0.64, -0.98), rf.eval_by_val(C::new(0., 2.0_f32)));
impl<T> Rf<T>
[src]
pub fn eval<'a, N>(&'a self, s: &'a N) -> N where
T: 'a,
N: 'a + Add<&'a T, Output = N> + Div<Output = N> + Mul<&'a N, Output = N> + Zero,
[src]
T: 'a,
N: 'a + Add<&'a T, Output = N> + Div<Output = N> + Mul<&'a N, Output = N> + Zero,
Evaluate the rational function.
Arguments
s
- Value at which the rational function is evaluated.
Example
use au::{poly, Rf}; use au::num_complex::Complex as C; let rf = Rf::new(poly!(1., 2., 3.), poly!(-4., -3., 1.)); assert_eq!(-8.5, rf.eval(&3.)); assert_eq!(C::new(0.64, -0.98), rf.eval(&C::new(0., 2.0_f32)));
Trait Implementations
impl<T: Clone + Mul<Output = T> + One + PartialEq + Zero> Add<&'_ Rf<T>> for &Rf<T>
[src]
Implementation of rational function addition
type Output = Rf<T>
The resulting type after applying the +
operator.
fn add(self, rhs: Self) -> Self::Output
[src]
impl<T: Clone + Mul<Output = T> + PartialEq + Zero> Add<&'_ T> for Rf<T>
[src]
Implementation of rational function addition
type Output = Self
The resulting type after applying the +
operator.
fn add(self, rhs: &T) -> Self
[src]
impl<T: Clone + One + PartialEq + Zero> Add<Rf<T>> for Rf<T>
[src]
Implementation of rational function addition
type Output = Self
The resulting type after applying the +
operator.
fn add(self, rhs: Self) -> Self
[src]
impl<T: Clone + Mul<Output = T> + PartialEq + Zero> Add<T> for Rf<T>
[src]
Implementation of rational function addition
type Output = Self
The resulting type after applying the +
operator.
fn add(self, rhs: T) -> Self
[src]
impl<T: Clone> Clone for Rf<T>
[src]
impl<T: Debug> Debug for Rf<T>
[src]
impl<T> Display for Rf<T> where
T: Display + One + PartialEq + PartialOrd + Zero,
[src]
T: Display + One + PartialEq + PartialOrd + Zero,
Implementation of rational function printing
impl<T: Clone + One + PartialEq + Zero> Div<&'_ Rf<T>> for &Rf<T>
[src]
Implementation of rational function division
type Output = Rf<T>
The resulting type after applying the /
operator.
fn div(self, rhs: Self) -> Self::Output
[src]
impl<T: Clone + One + PartialEq + Zero> Div<Rf<T>> for Rf<T>
[src]
Implementation of rational function division
type Output = Self
The resulting type after applying the /
operator.
fn div(self, rhs: Self) -> Self
[src]
impl<T: Clone> Inv for &Rf<T>
[src]
type Output = Rf<T>
The result after applying the operator.
fn inv(self) -> Self::Output
[src]
Compute the reciprocal of a rational function.
impl<T: Clone> Inv for Rf<T>
[src]
type Output = Self
The result after applying the operator.
fn inv(self) -> Self::Output
[src]
Compute the reciprocal of a rational function.
impl<T: Clone + One + PartialEq + Zero> Mul<&'_ Rf<T>> for &Rf<T>
[src]
Implementation of rational function multiplication
type Output = Rf<T>
The resulting type after applying the *
operator.
fn mul(self, rhs: Self) -> Self::Output
[src]
impl<T: Clone + One + PartialEq + Zero> Mul<&'_ Rf<T>> for Rf<T>
[src]
Implementation of rational function multiplication
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, rhs: &Rf<T>) -> Self
[src]
impl<T: Clone + One + PartialEq + Zero> Mul<Rf<T>> for Rf<T>
[src]
Implementation of rational function multiplication
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, rhs: Self) -> Self
[src]
impl<T: Clone + Neg<Output = T>> Neg for &Rf<T>
[src]
Implementation of rational function negation. Negative sign is transferred to the numerator.
type Output = Rf<T>
The resulting type after applying the -
operator.
fn neg(self) -> Self::Output
[src]
impl<T: Clone + Neg<Output = T>> Neg for Rf<T>
[src]
Implementation of rational function negation. Negative sign is transferred to the numerator.
type Output = Self
The resulting type after applying the -
operator.
fn neg(self) -> Self::Output
[src]
impl<T: PartialEq> PartialEq<Rf<T>> for Rf<T>
[src]
impl<T> StructuralPartialEq for Rf<T>
[src]
impl<T: Clone + Neg<Output = T> + PartialEq + Sub<Output = T> + Zero + One> Sub<&'_ Rf<T>> for &Rf<T>
[src]
Implementation of rational function subtraction
type Output = Rf<T>
The resulting type after applying the -
operator.
fn sub(self, rhs: Self) -> Self::Output
[src]
impl<T: Clone + Neg<Output = T> + One + PartialEq + Sub<Output = T> + Zero> Sub<Rf<T>> for Rf<T>
[src]
Implementation of rational function subtraction
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, rhs: Self) -> Self
[src]
impl<T: Clone + One + PartialEq + Zero> Zero for Rf<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Rf<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Rf<T> where
T: Send,
T: Send,
impl<T> Sync for Rf<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Rf<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Rf<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> ClosedNeg for T where
T: Neg<Output = T>,
T: Neg<Output = T>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
pub fn is_in_subset(&self) -> bool
pub fn to_subset_unchecked(&self) -> SS
pub fn from_subset(element: &SS) -> SP
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,