Expand description
Jacobian Matrix
Description
: Exact jacobian matrix using Automatic Differenitation
Type
(Vector, F) -> Matrix where F: Fn(&Vec
Examples
#[macro_use]
extern crate peroxide;
use peroxide::fuga::*;
fn main() {
let x = c!(1, 1);
let j = jacobian(f, &x);
j.print();
// c[0] c[1]
// r[0] 1 -1
// r[1] 1 2
}
fn f(xs: &Vec<AD>) -> Vec<AD> {
let x = xs[0];
let y = xs[1];
vec![
x - y,
x + 2.*y,
]
}