Skip to main content

DualNum

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<F, Real = F>
    + Mappable<Self>
    + Display
    + PartialOrd
    + PartialOrd<F>
    + Debug
    + 'static {
    type InnerDual: DualNum<F>;

    const NDERIV: usize;
Show 33 methods // Required methods fn from_re(re: Self::InnerDual) -> Self; 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 InnerDual: DualNum<F>

The type of the individual elements of this dual number

Required Methods§

Source

fn from_re(re: Self::InnerDual) -> Self

Build a dual number from its real part, setting all other values to 0

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".

Implementations on Foreign Types§

Source§

impl DualNum<f32> for f32

Source§

const NDERIV: usize = 0

Source§

type InnerDual = f32

Source§

fn from_re(re: f32) -> Self

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 = 0

Source§

type InnerDual = f64

Source§

fn from_re(re: f64) -> Self

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§