frechet 0.1.0

basic autodifferentiation
Documentation
  • Coverage
  • 8.51%
    8 out of 94 items documented1 out of 84 items with examples
  • Size
  • Source code size: 23.15 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 3.16 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • martin-fl/frechet
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • martin-fl

frechet

frechet implements the simple dual number types dual32 and dual64, thus providing basic auto-differentiation capabilities.

Example

use frechet::*;

fn p(x: dual32) -> dual32 { x.powf(2.5).atanh() + 1.0  }
fn p_derivative(x: f32) -> f32 { -2.5 * x.powf(1.5)/(x.powi(5) - 1.0) }

// using the `derivative` function
let z1 = derivative(p, 2.0);

// manually
let z2 = p(2.0.as_dual_variable()).d;

// exact derivative
let z3 = p_derivative(2.0);

assert!((z1 - z3).abs() < f32::EPSILON);
assert!((z2 - z3).abs() < f32::EPSILON);