Enum rust_ad_core::derivatives::forward::Arg[][src]

pub enum Arg {
    Variable(String),
    Literal(String),
}
Expand description

Gets cumulative derivative for given expression for a given input variable (only supports literals and paths).

This is difficult to explain here.

In practical application we unwrap all statements such that let e=2.*b+d; becomes 2 statements let _e=2.*b; and let e=_e+d;, when we do this can optimize this function, instead of needing to do d/db(2.*b+d) and d/dd(2.*b+d) we can simply know in an addition if the component is a variable the deriative is 1. since d/d_e(_e+d) and d/d_d(_e+d) are both 1, thus we know the result for an input x would be 1.*_e_x + 1.*d_x simply _e_x + d_x.

In this optimization we apply this function t0o each component (e.g. _e, d etc.) seperately with 4 possible results for each:

  1. Where the component is a literal (not a variable) it is simply 0.,
  2. Where the component is not a function input, we get the cumulative deriative for this variable with respect to our function input (e.g. _e_x).
  3. Where the component is an input and we looking at the cumulative derivative for this input it is our seed input cumulative derivative e.g. _x since 1. * _x.
  4. Where the component is an input, but we are not looking at the cumulative derivative for this input, it is 0. since we don’t have cumulative deriatives for inputs with respect to each other with 1. * x_wrt_y, x_wrt_y doens’t exist and we presume inputs independant.

Variants

Variable(String)

Tuple Fields

0: String

e.g. a

Literal(String)

Tuple Fields

0: String

e.g. 7.3f32

Trait Implementations

Formats the value using the given formatter. Read more

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.