Struct autodiff::forward_autodiff::F[][src]

#[repr(C)]pub struct F<D> {
    pub x: f64,
    pub dx: D,
}

A generic forward differentiation Dual number.

The derivative is generic to support higher order differentiation.

Fields

x: f64

The value of the variable

dx: D

The derivative of the variable

Implementations

impl<D> F<D>[src]

pub fn new<T: ToPrimitive>(x: T, d: D) -> F<D>[src]

Create a new dual number with value x and initial derivative d.

Panics

This constructor panics if x cannot be converted to f64.

impl<D: Zero> F<D>[src]

pub fn cst<T: ToPrimitive>(x: T) -> F<D>[src]

Create a new constant.

Use this also to convert from a variable to a constant. This constructor panics if x cannot be converted to f64.

impl<D: One> F<D>[src]

pub fn var<T: ToPrimitive>(x: T) -> F<D>[src]

Create a new variable.

Use this also to convert from a constant to a variable. This constructor panics if x cannot be converted to f64.

impl<D> F<D>[src]

pub fn value(&self) -> f64[src]

Get the value of this variable.

impl<D: Copy> F<D>[src]

pub fn deriv(&self) -> D[src]

Get the current derivative of this variable. This will be zero if this F is a constant.

impl<D> F<D> where
    Self: Float
[src]

pub fn pow(self, n: impl Into<F<D>>) -> F<D>[src]

Raise this number to the n’th power.

This is a generic version of Float::powf.

Trait Implementations

impl<D: Add<D, Output = D>> Add<F<D>> for F<D>[src]

type Output = F<D>

The resulting type after applying the + operator.

impl<D> Add<f32> for F<D>[src]

type Output = F<D>

The resulting type after applying the + operator.

impl<D> Add<f64> for F<D>[src]

type Output = F<D>

The resulting type after applying the + operator.

impl<D: AddAssign> AddAssign<F<D>> for F<D>[src]

impl<D> AddAssign<f32> for F<D>[src]

impl<D> AddAssign<f64> for F<D>[src]

impl<D: Clone> Clone for F<D>[src]

impl<D: Copy> Copy for F<D>[src]

impl<D: Debug> Debug for F<D>[src]

impl<D: Default> Default for F<D>[src]

impl<D, R> Div<F<D>> for F<D> where
    D: Copy + Div<R, Output = D> + Mul<R, Output = D> + Sub<Output = D>,
    F<D>: ReduceOrder<Reduced = R>,
    R: Copy + Mul<Output = R>, 
[src]

type Output = F<D>

The resulting type after applying the / operator.

impl<D> Div<f32> for F<D> where
    D: Div<f64, Output = D> + Mul<f64, Output = D> + Sub<Output = D>, 
[src]

type Output = F<D>

The resulting type after applying the / operator.

impl<D: Div<f64, Output = D>> Div<f64> for F<D>[src]

type Output = F<D>

The resulting type after applying the / operator.

impl<D, R> DivAssign<F<D>> for F<D> where
    D: Mul<R, Output = D> + DivAssign<R> + SubAssign,
    F<D>: ReduceOrder<Reduced = R>,
    R: Copy + Mul<Output = R> + Div<R, Output = R>, 
[src]

impl<D: DivAssign<f64>> DivAssign<f32> for F<D>[src]

impl<D: DivAssign<f64>> DivAssign<f64> for F<D>[src]

impl<D, R> Float for F<D> where
    D: Debug + Float + Zero + Neg<Output = D> + Mul<R, Output = D> + Mul<f64, Output = D> + Add<Output = D> + Div<f64, Output = D> + Div<R, Output = D> + Sub<Output = D> + Copy + PartialOrd,
    F<D>: ReduceOrder<Reduced = R>,
    R: Float + Mul<f64, Output = R>, 
[src]

impl<D: Zero> FloatConst for F<D>[src]

impl<D: Zero> From<f32> for F<D>[src]

fn from(x: f32) -> F<D>[src]

Construct a constant from an f32.

impl<D: Zero> From<f64> for F<D>[src]

fn from(x: f64) -> F<D>[src]

Construct a constant from an f64.

impl<D: Zero> FromPrimitive for F<D>[src]

impl<D> Into<f32> for F<D>[src]

fn into(self) -> f32[src]

Convert the value into an f32 type.

impl<D> Into<f64> for F<D>[src]

fn into(self) -> f64[src]

Convert the value into an f64 type.

impl<D, R> Mul<F<D>> for F<D> where
    D: Copy + Mul<R, Output = D> + Add<Output = D>,
    F<D>: ReduceOrder<Reduced = R>, 
[src]

type Output = F<D>

The resulting type after applying the * operator.

impl<D: Mul<f64, Output = D>> Mul<f32> for F<D>[src]

type Output = F<D>

The resulting type after applying the * operator.

impl<D: Mul<f64, Output = D>> Mul<f64> for F<D>[src]

type Output = F<D>

The resulting type after applying the * operator.

impl<D, R> MulAssign<F<D>> for F<D> where
    D: MulAssign<R> + Mul<R, Output = D> + AddAssign,
    F<D>: ReduceOrder<Reduced = R>, 
[src]

impl<D: MulAssign<f64>> MulAssign<f32> for F<D>[src]

impl<D: MulAssign<f64>> MulAssign<f64> for F<D>[src]

impl<D: Neg<Output = D>> Neg for F<D>[src]

type Output = F<D>

The resulting type after applying the - operator.

impl<D, R> Num for F<D> where
    D: Copy + Debug + Zero + PartialEq + Sub<Output = D> + Mul<f64, Output = D> + Mul<R, Output = D> + Div<f64, Output = D> + Div<R, Output = D>,
    F<D>: ReduceOrder<Reduced = R>,
    R: Float
[src]

type FromStrRadixErr = ParseFloatError

impl<D: Zero> NumCast for F<D>[src]

impl<D: Copy + Debug + Zero + Mul<<F<D> as ReduceOrder>::Reduced, Output = D>> One for F<D> where
    F<D>: ReduceOrder
[src]

impl<D, U> PartialEq<F<U>> for F<D>[src]

impl<D, U> PartialOrd<F<U>> for F<D>[src]

impl<D: ReduceOrder> ReduceOrder for F<D>[src]

type Reduced = F<D::Reduced>

impl<D, R> Rem<F<D>> for F<D> where
    D: Copy + Mul<R, Output = D> + Sub<Output = D>,
    F<D>: ReduceOrder<Reduced = R>,
    R: Float
[src]

type Output = F<D>

The resulting type after applying the % operator.

impl<D: Rem<f64, Output = D>> Rem<f64> for F<D>[src]

type Output = F<D>

The resulting type after applying the % operator.

impl<D, R> RemAssign<F<D>> for F<D> where
    D: Copy + Mul<R, Output = D> + SubAssign,
    F<D>: ReduceOrder<Reduced = R>,
    R: Float
[src]

impl<D: RemAssign<f64>> RemAssign<f32> for F<D>[src]

impl<D: RemAssign<f64>> RemAssign<f64> for F<D>[src]

impl<D: Sub<D, Output = D>> Sub<F<D>> for F<D>[src]

type Output = F<D>

The resulting type after applying the - operator.

impl<D> Sub<f64> for F<D>[src]

type Output = F<D>

The resulting type after applying the - operator.

impl<D: SubAssign> SubAssign<F<D>> for F<D>[src]

impl<D> SubAssign<f32> for F<D>[src]

impl<D> SubAssign<f64> for F<D>[src]

impl<D: AddAssign + Zero> Sum<F<D>> for F<D>[src]

impl<D: AddAssign + Zero> Sum<f64> for F<D>[src]

impl<D> ToPrimitive for F<D>[src]

impl<D: Zero> Zero for F<D>[src]

Auto Trait Implementations

impl<D> RefUnwindSafe for F<D> where
    D: RefUnwindSafe

impl<D> Send for F<D> where
    D: Send

impl<D> Sync for F<D> where
    D: Sync

impl<D> Unpin for F<D> where
    D: Unpin

impl<D> UnwindSafe for F<D> where
    D: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> NumAssign for T where
    T: Num + NumAssignOps<T>, 
[src]

impl<T, Rhs> NumAssignOps<Rhs> for T where
    T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>, 
[src]

impl<T, Rhs, Output> NumOps<Rhs, Output> for T where
    T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>, 
[src]

impl<T> Real for T where
    T: Float
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.