1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2024-11-10 08:55:37 +00:00

DoubleFunction sample

This commit is contained in:
Antonin Portelli 2014-03-12 19:23:49 +00:00
parent 789ea6abe9
commit 37ecd0f0d8
2 changed files with 31 additions and 0 deletions

View File

@ -96,3 +96,18 @@ double DoubleFunction::operator()(void) const
return (*this)(nullptr); 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;
}

View File

@ -22,6 +22,7 @@
#include <latan/Global.hpp> #include <latan/Global.hpp>
#include <latan/Mat.hpp> #include <latan/Mat.hpp>
#include <latan/MatSample.hpp>
#include <functional> #include <functional>
#include <stack> #include <stack>
#include <vector> #include <vector>
@ -74,6 +75,21 @@ double DoubleFunction::operator()(const double arg0, const Ts... args) const
return (*this)(arg); return (*this)(arg);
} }
/******************************************************************************
* DoubleFunctionSample class *
******************************************************************************/
class DoubleFunctionSample: public Sample<DoubleFunction>
{
public:
// constructors
using Sample<DoubleFunction>::Sample;
// destructor
virtual ~DoubleFunctionSample(void) = default;
// function call
DSample operator()(const DMatSample &arg) const;
};
END_NAMESPACE END_NAMESPACE
#endif // Latan_Function_hpp_ #endif // Latan_Function_hpp_