diff --git a/latan/Function.cpp b/latan/Function.cpp index 51ba1c3..1e2ba0a 100644 --- a/latan/Function.cpp +++ b/latan/Function.cpp @@ -96,3 +96,18 @@ double DoubleFunction::operator()(void) const return (*this)(nullptr); } + +/****************************************************************************** + * DoubleFunctionSample implementation * + ******************************************************************************/ +DSample DoubleFunctionSample::operator()(const DMatSample &arg) const +{ + DSample result(arg.size()); + + FOR_STAT_ARRAY(arg, s) + { + result[s] = (*this)[s](arg[s]); + } + + return result; +} diff --git a/latan/Function.hpp b/latan/Function.hpp index 610626a..7bbc51e 100644 --- a/latan/Function.hpp +++ b/latan/Function.hpp @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -74,6 +75,21 @@ double DoubleFunction::operator()(const double arg0, const Ts... args) const return (*this)(arg); } +/****************************************************************************** + * DoubleFunctionSample class * + ******************************************************************************/ +class DoubleFunctionSample: public Sample +{ +public: + // constructors + using Sample::Sample; + // destructor + virtual ~DoubleFunctionSample(void) = default; + // function call + DSample operator()(const DMatSample &arg) const; +}; + + END_NAMESPACE #endif // Latan_Function_hpp_