KrisLibrary
1.0.0
|
A function from R to R. More...
#include <function.h>
A function from R to R.
Subclasses of RealFunction must overload Eval(), and optionally overload Deriv() and Deriv2() (first and second derivatives).
NOTE: PreEval(x) MUST be called before evaluating the function value or derivatives using Eval(x), Deriv(x), or Deriv2(x).
PreEval() allows reducing the number of computations when Eval() and Deriv() share some intermediate lengthy computation `Z'. `Z' can be computed and cached from PreEval(), and then reused when Eval() or Deriv.
y=f(x) can be used as a shorthand for f.PreEval(x); y=f.Eval(x).