OEFunc1

Attention

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.

../../_images/OEFunc1.png
The following methods are publicly inherited from OEFunc0:
The OEFunc1 class defines the following additional public methods:
The following classes derive from this class:

operator()

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.