This API is currently available in C++ and Python.
class OEFunc2 : public OEFunc1
The OEFunc2 is an abstract base class. This class defines the interface for functions which take a set of variables and compute a function value, gradients and second derivatives.
bool operator()(const double *x, double *h, double *g)
This method defines the interface for function evaluation along with gradients and second derivatives. The corresponding second derivatives for the given set of variable is returned in the second argument, and the gradients are returned in the third argument.
There should be a one to one correspondence between the elements of the variable and that second derivatives and gradients arrays. Methods that override this operator method must not initialize the second derivatives and the gradient arrays, but rather assume that the arrays has already been initialized.