reverse
Reverse mode automatic differentiation in Rust.
To use this in your crate, add the following to Cargo.toml
:
= "0.1"
reverse
Examples
use *;
Differentiable Functions
There is an optional diff
feature that activates a macro to transform functions to the right type so that they are differentiable. That is, functions that act on f64
s can be used on differentiable variables without change, and without needing to specify the (not simple) correct type.
To use this, add the following to Cargo.toml
:
reverse =
Functions must have the type Fn(&[f64], &[&[f64]]) -> f64
, where the first argument contains the differentiable parameters and the second argument contains arbitrary arrays of data.
Example
Here is an example of what the feature allows you to do:
use *;
// function must have these argument types but can be arbitrarily complex