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

DoubleFunctionSample: more call operators

This commit is contained in:
Antonin Portelli 2014-04-18 11:28:51 +01:00
parent 62d395e8e2
commit dfe6240c14
2 changed files with 38 additions and 2 deletions

View File

@ -105,12 +105,35 @@ double DoubleFunction::operator()(void) const
******************************************************************************/
DSample DoubleFunctionSample::operator()(const DMatSample &arg) const
{
DSample result(arg.size());
DSample result(size());
FOR_STAT_ARRAY(arg, s)
FOR_STAT_ARRAY((*this), s)
{
result[s] = (*this)[s](arg[s]);
}
return result;
}
DSample DoubleFunctionSample::operator()(const double *arg) const
{
DSample result(size());
FOR_STAT_ARRAY((*this), s)
{
result[s] = (*this)[s](arg);
}
return result;
}
DSample DoubleFunctionSample::operator()(const DVec &arg) const
{
return (*this)(arg.data());
}
DSample DoubleFunctionSample::operator()(const vector<double> &arg) const
{
return (*this)(arg.data());
}

View File

@ -86,8 +86,21 @@ public:
virtual ~DoubleFunctionSample(void) = default;
// function call
DSample operator()(const DMatSample &arg) const;
DSample operator()(const double *arg) const;
DSample operator()(const DVec &arg) const;
DSample operator()(const std::vector<double> &arg) const;
template <typename... Ts>
DSample operator()(const double arg0, const Ts... args) const;
};
template <typename... Ts>
DSample DoubleFunctionSample::operator()(const double arg0,
const Ts... args) const
{
const double arg[] = {arg0, args...};
return (*this)(arg);
}
END_NAMESPACE