df

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

Examples

auto pow2( double x ){ return x^^2; }
assertEqApprox( df( &pow2,  1 ), 2.0, 2e-6 );
assertEqApprox( df( &pow2,  3 ), 6.0, 2e-6 );
assertEqApprox( df( &pow2, -2 ), -4.0, 2e-6 );

Meta