dxpr
Differentiable expression templates in compile-time, dependency-free, no_std Rust.
Examples
Basics:
use *;
let x = 4; // Any type works; no special wrappers
let expr = -var; // Unevaluated expression
assert_eq!; // Evaluated (expr moved)
let dvdx = .grad; // Automatic differentiation!
// ...into another differentiable expression!
assert_eq!; // dvdx NOT moved yet: reusable
assert_eq!;
Want to implement differentiable expressions for your own types and functions?
use ;
; // Unevaluated Teleport operation
const // Not yet!
implement_eval!; // Function definition
let _ = tp; // Unevaluated expression
assert_eq!; // Done!
At compile time:
use ;
const X: i32 = 4;
const A: = var;
const EXPRESSION: = ---A;
const VALUE: i32 = EXPRESSION.eval;
assert_eq!;
// Rust currently can't compare pointers to constants at compile time, so no compile-time autodiff at the moment
// Plans in the works to fix this with the ability to manually specify a "variable ID."
// Either way, your `build.rs` could easily evaluate an arbitrary expression and write it, unevaluated, to a file.
To do:
- Figure out why Rust doesn't like
+in macro:patharguments - Interoperability with builtin constants
IndexandRangeBoundoperators (i.e.a[b]anda..b)