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__(X)

Call self as a function.

getInputDescription()

Input description accessor.

getInputDimension()

Input dimension accessor.

getOutputDescription()

Output description accessor.

getOutputDimension()

Output dimension accessor.

setInputDescription(descIn)

Input description accessor.

setOutputDescription(descOut)

Output description accessor.

__init__(n=0, p=0)

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

getInputDescription()

Input description accessor.

getInputDimension()

Input dimension accessor.

getOutputDescription()

Output description accessor.

getOutputDimension()

Output dimension accessor.

setInputDescription(descIn)

Input description accessor.

setOutputDescription(descOut)

Output description accessor.