OpenTURNSPythonFunction¶
-
class
OpenTURNSPythonFunction
(n=0, p=0)¶ Override Function from Python.
Parameters: - inputDim : positive int
Dimension of the input vector
- outputDim : positive 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__ getInputDescription getInputDimension getOutputDescription getOutputDimension setInputDescription setOutputDescription -
__init__
(n=0, p=0)¶ Initialize self. See help(type(self)) for accurate signature.