Trait DualNum

Source
pub trait DualNum<F>:
    NumOps
    + for<'r> NumOps<&'r Self>
    + Signed
    + NumOps<F>
    + NumAssignOps
    + NumAssignOps<F>
    + Clone
    + Inv<Output = Self>
    + Sum
    + Product
    + FromPrimitive
    + From<F>
    + DualStruct<Self, F, Real = F>
    + Display
    + PartialEq
    + Debug
    + 'static {
    type Inner;

    const NDERIV: usize;
Show 34 methods // Required methods fn from_inner(inner: Self::Inner) -> Self; fn re(&self) -> F; fn recip(&self) -> Self; fn powi(&self, n: i32) -> Self; fn powf(&self, n: F) -> Self; fn sqrt(&self) -> Self; fn cbrt(&self) -> Self; fn exp(&self) -> Self; fn exp2(&self) -> Self; fn exp_m1(&self) -> Self; fn ln(&self) -> Self; fn log(&self, base: F) -> Self; fn log2(&self) -> Self; fn log10(&self) -> Self; fn ln_1p(&self) -> Self; fn sin(&self) -> Self; fn cos(&self) -> Self; fn tan(&self) -> Self; fn sin_cos(&self) -> (Self, Self); fn asin(&self) -> Self; fn acos(&self) -> Self; fn atan(&self) -> Self; fn atan2(&self, other: Self) -> Self; fn sinh(&self) -> Self; fn cosh(&self) -> Self; fn tanh(&self) -> Self; fn asinh(&self) -> Self; fn acosh(&self) -> Self; fn atanh(&self) -> Self; fn sph_j0(&self) -> Self; fn sph_j1(&self) -> Self; fn sph_j2(&self) -> Self; // Provided methods fn mul_add(&self, a: Self, b: Self) -> Self { ... } fn powd(&self, exp: Self) -> Self { ... }
}
Expand description

A generalized (hyper) dual number.

Required Associated Constants§

Source

const NDERIV: usize

Highest derivative that can be calculated with this struct

Required Associated Types§

Source

type Inner

Type of the elements of this generalized (hyper) dual number

Required Methods§

Source

fn from_inner(inner: Self::Inner) -> Self

Construct a new generalized (hyper) dual number from its real part

Source

fn re(&self) -> F

Real part (0th derivative) of the number

Source

fn recip(&self) -> Self

Reciprocal (inverse) of a number 1/x

Source

fn powi(&self, n: i32) -> Self

Power with integer exponent x^n

Source

fn powf(&self, n: F) -> Self

Power with real exponent x^n

Source

fn sqrt(&self) -> Self

Square root

Source

fn cbrt(&self) -> Self

Cubic root

Source

fn exp(&self) -> Self

Exponential e^x

Source

fn exp2(&self) -> Self

Exponential with base 2 2^x

Source

fn exp_m1(&self) -> Self

Exponential minus 1 e^x-1

Source

fn ln(&self) -> Self

Natural logarithm

Source

fn log(&self, base: F) -> Self

Logarithm with arbitrary base

Source

fn log2(&self) -> Self

Logarithm with base 2

Source

fn log10(&self) -> Self

Logarithm with base 10

Source

fn ln_1p(&self) -> Self

Logarithm on x plus one ln(1+x)

Source

fn sin(&self) -> Self

Sine

Source

fn cos(&self) -> Self

Cosine

Source

fn tan(&self) -> Self

Tangent

Source

fn sin_cos(&self) -> (Self, Self)

Calculate sine and cosine simultaneously

Source

fn asin(&self) -> Self

Arcsine

Source

fn acos(&self) -> Self

Arccosine

Source

fn atan(&self) -> Self

Arctangent

Source

fn atan2(&self, other: Self) -> Self

Arctangent

Source

fn sinh(&self) -> Self

Hyperbolic sine

Source

fn cosh(&self) -> Self

Hyperbolic cosine

Source

fn tanh(&self) -> Self

Hyperbolic tangent

Source

fn asinh(&self) -> Self

Area hyperbolic sine

Source

fn acosh(&self) -> Self

Area hyperbolic cosine

Source

fn atanh(&self) -> Self

Area hyperbolic tangent

Source

fn sph_j0(&self) -> Self

0th order spherical Bessel function of the first kind

Source

fn sph_j1(&self) -> Self

1st order spherical Bessel function of the first kind

Source

fn sph_j2(&self) -> Self

2nd order spherical Bessel function of the first kind

Provided Methods§

Source

fn mul_add(&self, a: Self, b: Self) -> Self

Fused multiply-add

Source

fn powd(&self, exp: Self) -> Self

Power with dual exponent x^n

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl DualNum<f32> for f32

Source§

const NDERIV: usize = 0usize

Source§

type Inner = f32

Source§

fn from_inner(inner: Self::Inner) -> Self

Source§

fn re(&self) -> f32

Source§

fn mul_add(&self, a: Self, b: Self) -> Self

Source§

fn recip(&self) -> Self

Source§

fn powi(&self, n: i32) -> Self

Source§

fn powf(&self, n: Self) -> Self

Source§

fn powd(&self, n: Self) -> Self

Source§

fn sqrt(&self) -> Self

Source§

fn exp(&self) -> Self

Source§

fn exp2(&self) -> Self

Source§

fn ln(&self) -> Self

Source§

fn log(&self, base: Self) -> Self

Source§

fn log2(&self) -> Self

Source§

fn log10(&self) -> Self

Source§

fn cbrt(&self) -> Self

Source§

fn sin(&self) -> Self

Source§

fn cos(&self) -> Self

Source§

fn tan(&self) -> Self

Source§

fn asin(&self) -> Self

Source§

fn acos(&self) -> Self

Source§

fn atan(&self) -> Self

Source§

fn atan2(&self, other: f32) -> Self

Source§

fn sin_cos(&self) -> (Self, Self)

Source§

fn exp_m1(&self) -> Self

Source§

fn ln_1p(&self) -> Self

Source§

fn sinh(&self) -> Self

Source§

fn cosh(&self) -> Self

Source§

fn tanh(&self) -> Self

Source§

fn asinh(&self) -> Self

Source§

fn acosh(&self) -> Self

Source§

fn atanh(&self) -> Self

Source§

fn sph_j0(&self) -> Self

Source§

fn sph_j1(&self) -> Self

Source§

fn sph_j2(&self) -> Self

Source§

impl DualNum<f64> for f64

Source§

const NDERIV: usize = 0usize

Source§

type Inner = f64

Source§

fn from_inner(inner: Self::Inner) -> Self

Source§

fn re(&self) -> f64

Source§

fn mul_add(&self, a: Self, b: Self) -> Self

Source§

fn recip(&self) -> Self

Source§

fn powi(&self, n: i32) -> Self

Source§

fn powf(&self, n: Self) -> Self

Source§

fn powd(&self, n: Self) -> Self

Source§

fn sqrt(&self) -> Self

Source§

fn exp(&self) -> Self

Source§

fn exp2(&self) -> Self

Source§

fn ln(&self) -> Self

Source§

fn log(&self, base: Self) -> Self

Source§

fn log2(&self) -> Self

Source§

fn log10(&self) -> Self

Source§

fn cbrt(&self) -> Self

Source§

fn sin(&self) -> Self

Source§

fn cos(&self) -> Self

Source§

fn tan(&self) -> Self

Source§

fn asin(&self) -> Self

Source§

fn acos(&self) -> Self

Source§

fn atan(&self) -> Self

Source§

fn atan2(&self, other: f64) -> Self

Source§

fn sin_cos(&self) -> (Self, Self)

Source§

fn exp_m1(&self) -> Self

Source§

fn ln_1p(&self) -> Self

Source§

fn sinh(&self) -> Self

Source§

fn cosh(&self) -> Self

Source§

fn tanh(&self) -> Self

Source§

fn asinh(&self) -> Self

Source§

fn acosh(&self) -> Self

Source§

fn atanh(&self) -> Self

Source§

fn sph_j0(&self) -> Self

Source§

fn sph_j1(&self) -> Self

Source§

fn sph_j2(&self) -> Self

Implementors§

Source§

impl<T: DualNum<F>, F: DualNumFloat> DualNum<F> for Dual2<T, F>

Source§

impl<T: DualNum<F>, F: DualNumFloat> DualNum<F> for Dual3<T, F>

Source§

impl<T: DualNum<F>, F: DualNumFloat> DualNum<F> for Dual<T, F>

Source§

impl<T: DualNum<F>, F: DualNumFloat> DualNum<F> for HyperDual<T, F>

Source§

impl<T: DualNum<F>, F: DualNumFloat> DualNum<F> for HyperHyperDual<T, F>

Source§

impl<T: DualNum<F>, F: DualNumFloat, D: Dim> DualNum<F> for Dual2Vec<T, F, D>

Source§

impl<T: DualNum<F>, F: DualNumFloat, D: Dim> DualNum<F> for DualVec<T, F, D>

Source§

impl<T: DualNum<F>, F: DualNumFloat, M: Dim, N: Dim> DualNum<F> for HyperDualVec<T, F, M, N>
where DefaultAllocator: Allocator<M> + Allocator<U1, M> + Allocator<M, M> + Allocator<N> + Allocator<U1, N> + Allocator<N, N> + Allocator<M, N>,