mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2024-11-10 00:45:36 +00:00
function sampling method
This commit is contained in:
parent
61c18b7f2d
commit
3918d3a9b8
@ -179,6 +179,26 @@ DoubleFunction DoubleFunction::bind(const Index argIndex,
|
|||||||
return bindFunc;
|
return bindFunc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sample //////////////////////////////////////////////////////////////////////
|
||||||
|
DVec DoubleFunction::sample(const DMat &x)
|
||||||
|
{
|
||||||
|
if (x.cols() != getNArg())
|
||||||
|
{
|
||||||
|
LATAN_ERROR(Size, "sampling point matrix and number of arguments "
|
||||||
|
"mismatch (matrix has " + strFrom(x.cols())
|
||||||
|
+ ", number of arguments is " + strFrom(getNArg()) + ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
DVec res(x.rows());
|
||||||
|
|
||||||
|
for (Index i = 0; i < res.size(); ++i)
|
||||||
|
{
|
||||||
|
res(i) = (*this)(x.row(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
// arithmetic operators ////////////////////////////////////////////////////////
|
// arithmetic operators ////////////////////////////////////////////////////////
|
||||||
DoubleFunction DoubleFunction::operator-(void) const
|
DoubleFunction DoubleFunction::operator-(void) const
|
||||||
{
|
{
|
||||||
|
@ -56,6 +56,8 @@ public:
|
|||||||
// bind
|
// bind
|
||||||
DoubleFunction bind(const Index argIndex, const double val) const;
|
DoubleFunction bind(const Index argIndex, const double val) const;
|
||||||
DoubleFunction bind(const Index argIndex, const DVec &x) const;
|
DoubleFunction bind(const Index argIndex, const DVec &x) const;
|
||||||
|
// sample
|
||||||
|
DVec sample(const DMat &x);
|
||||||
// arithmetic operators
|
// arithmetic operators
|
||||||
DoubleFunction operator-(void) const;
|
DoubleFunction operator-(void) const;
|
||||||
DoubleFunction & operator+=(const DoubleFunction &f);
|
DoubleFunction & operator+=(const DoubleFunction &f);
|
||||||
|
Loading…
Reference in New Issue
Block a user