OpenTURNSPythonFunction

class OpenTURNSPythonFunction(n=0, p=0)

Override Function from Python.

Parameters
inputDimpositive int

Dimension of the input vector

outputDimpositive int

Dimension of the output vector

Notes

You have to overload the function:

_exec(X): single evaluation, X is a sequence of float, returns a sequence of float

You can also optionally override these functions:

_exec_sample(X): multiple evaluations, X is a 2-d sequence of float, returns a 2-d sequence of float

_gradient(X): gradient, X is a sequence of float, returns a 2-d sequence of float

_hessian(X): hessian, X is a sequence of float, returns a 3-d sequence of float

Examples

>>> import openturns as ot
>>> class FUNC(OpenTURNSPythonFunction):
...     def __init__(self):
...         super(FUNC, self).__init__(2, 1)
...         self.setInputDescription(['R', 'S'])
...         self.setOutputDescription(['T'])
...     def _exec(self, X):
...         Y = [X[0] + X[1]]
...         return Y
>>> F = FUNC()

Create the associated Function:

>>> myFunc = Function(F)

Methods

__call__(self, X)

Call self as a function.

getInputDescription(self)

Input description accessor.

getInputDimension(self)

Input dimension accessor.

getOutputDescription(self)

Output description accessor.

getOutputDimension(self)

Output dimension accessor.

setInputDescription(self, descIn)

Input description accessor.

setOutputDescription(self, descOut)

Output description accessor.

__init__(self, n=0, p=0)

Initialize self. See help(type(self)) for accurate signature.

getInputDescription(self)

Input description accessor.

getInputDimension(self)

Input dimension accessor.

getOutputDescription(self)

Output description accessor.

getOutputDimension(self)

Output dimension accessor.

setInputDescription(self, descIn)

Input description accessor.

setOutputDescription(self, descOut)

Output description accessor.