Skip to content
Snippets Groups Projects
Commit 26e7d3bc authored by Carsten Gräser's avatar Carsten Gräser
Browse files

Add operator() to PythonFunction

For simplicity we make PythonFunction callable.
In the long run, we can/should implement this
independently of the VirtualFunction interface.
parent 42da082a
No related branches found
No related tags found
No related merge requests found
...@@ -101,6 +101,14 @@ class PythonFunction : ...@@ -101,6 +101,14 @@ class PythonFunction :
callable_(x).toC(y); callable_(x).toC(y);
} }
/**
* \brief Evaluate function
*/
RT operator()(const DT& x) const
{
return callable_(x).template toC<RT>();
}
protected: protected:
Python::Callable callable_; Python::Callable callable_;
...@@ -172,6 +180,14 @@ class DifferentiablePythonFunction : ...@@ -172,6 +180,14 @@ class DifferentiablePythonFunction :
derivative_(x).toC(y); derivative_(x).toC(y);
} }
/**
* \brief Evaluate function
*/
RT operator()(const DT& x) const
{
return callable_(x).template toC<RT>();
}
protected: protected:
Python::Callable value_; Python::Callable value_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment