#automatic-differentiation #gradient #dual #numbers

dual_num

Fully-featured Dual Number implementation with features for automatic differentiation of multivariate vectorial functions into gradients

10 releases

Uses old Rust 2015

0.2.7 Apr 3, 2019
0.2.6 Mar 1, 2019
0.2.5 Feb 4, 2019
0.2.4 Jan 28, 2019
0.1.1 Jun 5, 2017

#21 in #dual

MIT license

28KB
768 lines

dual_num Build Status

Fully-featured Dual Number implementation with features for automatic differentiation of multivariate vectorial functions into gradients.

Usage

extern crate dual_num;

use dual_num::{Dual, Float, differentiate};

fn main() {
    // find partial derivative at x=4.0
    println!("{:.5}", differentiate(4.0f64, |x| {
        x.sqrt() + Dual::from_real(1.0)
    })); // 0.25000
}
Previous Work

Dependencies

~4MB
~70K SLoC