DGtal  1.4.beta
DGtal::MPolynomialEvaluatorImpl< 1, TRing, TOwner, TAlloc, TX >::EvalFun Class Reference

Public Member Functions

 EvalFun (const MPolynomialEvaluatorImpl< 1, Ring, Owner, Alloc, X > &owner)
 
X operator() (const MPolynomial< 1, Ring, Alloc > &p) const
 

Private Attributes

const MPolynomialEvaluatorImpl< 1, Ring, Owner, Alloc, X > & myOwner
 

Detailed Description

template<typename TRing, typename TOwner, typename TAlloc, typename TX>
class DGtal::MPolynomialEvaluatorImpl< 1, TRing, TOwner, TAlloc, TX >::EvalFun

Evaluates a polynomial of type MPolynomial<1, T> in myEvalPoint.

Definition at line 125 of file MPolynomial.h.

Constructor & Destructor Documentation

◆ EvalFun()

template<typename TRing , typename TOwner , typename TAlloc , typename TX >
DGtal::MPolynomialEvaluatorImpl< 1, TRing, TOwner, TAlloc, TX >::EvalFun::EvalFun ( const MPolynomialEvaluatorImpl< 1, Ring, Owner, Alloc, X > &  owner)
inline

Definition at line 131 of file MPolynomial.h.

133  : myOwner(owner)
134  {}
const MPolynomialEvaluatorImpl< 1, Ring, Owner, Alloc, X > & myOwner
Definition: MPolynomial.h:127

Member Function Documentation

◆ operator()()

template<typename TRing , typename TOwner , typename TAlloc , typename TX >
X DGtal::MPolynomialEvaluatorImpl< 1, TRing, TOwner, TAlloc, TX >::EvalFun::operator() ( const MPolynomial< 1, Ring, Alloc > &  p) const
inline

Evalutate polynomial p at the point stored in myOwner.

Parameters
pa monovariate polynomial.
Returns
the value of p at the point.

Definition at line 142 of file MPolynomial.h.

143  {
144  X res = (X) 0;
145  X xx = (X) 1;
146  for ( int i = 0; i < (int) p.myValue.size(); ++i )
147  {
148  res += (X)(Ring) p.myValue[i] * xx;
149  xx = xx * myOwner.myEvalPoint;
150  }
151  return res;
152  }

References DGtal::MPolynomialEvaluatorImpl< n, TRing, TOwner, TAlloc, TX >::myEvalPoint, and DGtal::MPolynomialEvaluatorImpl< n, TRing, TOwner, TAlloc, TX >::EvalFun< XX, Fun >::myOwner.

Field Documentation

◆ myOwner

template<typename TRing , typename TOwner , typename TAlloc , typename TX >
const MPolynomialEvaluatorImpl<1, Ring, Owner, Alloc, X>& DGtal::MPolynomialEvaluatorImpl< 1, TRing, TOwner, TAlloc, TX >::EvalFun::myOwner
private

Definition at line 127 of file MPolynomial.h.


The documentation for this class was generated from the following file: