|
Alexandria
2.27.0
SDC-CH common library for the Euclid project
|
Adapt a std::function<double(double)> to the Function Interface. More...
#include <FunctionAdapter.h>


Public Member Functions | |
| FunctionAdapter (std::function< double(double)> function) | |
| Constructor. More... | |
| virtual | ~FunctionAdapter ()=default |
| Default destructor. More... | |
| double | operator() (const double x) const override |
| void | operator() (const std::vector< double > &xs, std::vector< double > &out) const override |
| std::unique_ptr< Function > | clone () const override |
Private Attributes | |
| std::function< double(double)> | m_function |
Adapt a std::function<double(double)> to the Function Interface.
In some case one need to wrap a std::function into the Function Interface. This class provide this functionality. In particular it allows to build a Function out of a Lamda expression.
Definition at line 44 of file FunctionAdapter.h.
|
explicit |
Constructor.
| function | A std::function<double(double)> to be adapted as a Function. |
Definition at line 32 of file FunctionAdapter.cpp.
Referenced by clone().
|
virtualdefault |
Default destructor.
|
overridevirtual |
Creates a clone of the function adapter object.
Implements Euclid::MathUtils::NAryFunction< N >.
Definition at line 43 of file FunctionAdapter.cpp.
References FunctionAdapter(), and m_function.

|
override |
Converts the value x from the input domain to the output domain by calling the internal std::function<double(double)>.
| x | The value to convert |
Definition at line 34 of file FunctionAdapter.cpp.
References m_function.
|
override |
Converts the vector of x values from the input domain to the output domain by calling the internal std::function<double(double)> repeatedly.
| xs | The values to convert |
| out | Output vector |
Definition at line 38 of file FunctionAdapter.cpp.
References std::vector< T >::begin(), std::vector< T >::end(), m_function, std::vector< T >::resize(), std::vector< T >::size(), and std::transform().

|
private |
Definition at line 79 of file FunctionAdapter.h.
Referenced by clone(), and operator()().
1.8.5