This API is currently available in C++ and Python.class OEFunc1 : public OEFunc0
The OEFunc1 is an abstract base class. This class defines the interface for functions which take a set of variables and compute a function value and gradients. Classes derived from OEFunc1 are intended for use with optimizers which require gradients.
double operator()(const double *x, double *g)
This method defines the interface for function evaluation along with the gradients. An array of variables is passed as an argument, and a function value is returned. The corresponding gradients for the given set of variable is returned in the second argument. All classes derived from OEFunc1 implements this method.
There should be a one to one correspondence between the elements of the variable and gradient arrays. Methods that override this operator method must not initialize the gradient array, but rather assume the array has already been initialized.