df

  1. auto df(Vector!(M, T) delegate(in Vector!(N, T)) f, in Vector!(N, T) p, E step = E.epsilon * 10)
    df
    (
    size_t N
    size_t M
    T
    E = T
    )
    (
    Vector!(M, T) delegate(
    in Vector!(N, T)
    )
    f
    ,
    in Vector!(N, T) p
    ,
    E step = E.epsilon * 10
    )
    if (
    isFloatingPoint!T &&
    isFloatingPoint!E
    )
    in { assert (f !is null); }
  2. auto df(T delegate(T) f, K p, E step = E.epsilon * 2)

Examples

1 import std.math : sqrt;
2 auto func( in dvec2 p ) { return dvec3( p.x^^2, sqrt(p.y) * p.x, 3 ); }
3 
4 auto res = df( &func, dvec2(18,9), 1e-5 );
5 auto must = Matrix!(3,2,double)( 36, 0, 3, 3, 0, 0 );
6 
7 assertEqApprox( res.asArray, must.asArray, 1e-5 );

Meta