[][src]Function peroxide::numerical::utils::jacobian

pub fn jacobian<F>(x: Vec<f64>, f: F) -> Matrix where
    F: Fn(Vec<Dual>) -> Vec<Dual>, 

Jacobian Matrix

Description

: Exact jacobian matrix using Automatic Differenitation

Type

(Vector, F) -> Matrix where F: Fn(Vec) -> Vec

Examples

extern crate peroxide;
use peroxide::*;
 
let x = c!(1, 1);
let j = jacobian(x, f);
j.print();
 
//      c[0] c[1]
// r[0]    1    1
// r[1]   -1    2
 
fn f(xs: Vec<Dual>) -> Vec<Dual> {
    let x = xs[0];
    let y = xs[1];
 
    vec![
       x - y,
       x + 2.*y,
   ]
}