Macro rust_ad::forward [−][src]
forward!() { /* proc-macro */ }Expand description
Calls forward auto-differentiation function corresponding to a given function.
E.g.
#[rust_ad::forward_autodiff]
fn function_name(x: f32, y: f32) -> f32 {
let a = 7f32 * x;
let b = 3f32 * y;
return b;
}
fn main() {
println!("{:?}",rust_ad::forward!(function_name,2.,4.,1.,5.))
}This is just a procedural functional macro replacement for the declarative macro:
#[macro_export]
macro_rules! forward {
($f:ident,$($x:expr),*) => {{
FORWARD_MODE_PREFIX$ident($($x,)*);
}}
}Since you can’t export declarative macros from a procedural macro crate.
