DGtal  1.5.beta
DGtal::MPolynomialEvaluatorImpl< n, TRing, TOwner, TAlloc, TX >::EvalFun< XX, Fun > Class Template Reference

Public Member Functions

 EvalFun (const MPolynomialEvaluatorImpl< n, Ring, Owner, Alloc, X > &owner, const Fun &evalfun)
 
XX operator() (const MPolynomial< n, Ring, Alloc > &p) const
 

Private Attributes

const MPolynomialEvaluatorImpl< n, Ring, Owner, Alloc, X > & myOwner
 
const Fun & myEvalFun
 

Detailed Description

template<int n, typename TRing, typename TOwner, typename TAlloc, typename TX>
template<typename XX, typename Fun>
class DGtal::MPolynomialEvaluatorImpl< n, TRing, TOwner, TAlloc, TX >::EvalFun< XX, Fun >

Evaluates a polynomial of type MPolynomial<n, TRing> in myEvalPoint; the coefficients of the first indeterminate are evaluated using the given functor of type Fun.

Definition at line 232 of file MPolynomial.h.

Constructor & Destructor Documentation

◆ EvalFun()

template<int n, typename TRing , typename TOwner , typename TAlloc , typename TX >
template<typename XX , typename Fun >
DGtal::MPolynomialEvaluatorImpl< n, TRing, TOwner, TAlloc, TX >::EvalFun< XX, Fun >::EvalFun ( const MPolynomialEvaluatorImpl< n, Ring, Owner, Alloc, X > &  owner,
const Fun &  evalfun 
)
inline

Definition at line 239 of file MPolynomial.h.

241  : myOwner(owner), myEvalFun(evalfun)
242  {}
const MPolynomialEvaluatorImpl< n, Ring, Owner, Alloc, X > & myOwner
Definition: MPolynomial.h:234

Member Function Documentation

◆ operator()()

template<int n, typename TRing , typename TOwner , typename TAlloc , typename TX >
template<typename XX , typename Fun >
XX DGtal::MPolynomialEvaluatorImpl< n, TRing, TOwner, TAlloc, TX >::EvalFun< XX, Fun >::operator() ( const MPolynomial< n, Ring, Alloc > &  p) const
inline

Evaluate: the first indeterminate is replaced by myEvalPoint, and the coefficients of the first indeterminate (which are polynomials of type poly<n-1, T>) are evaluated using myEvalFun.

Definition at line 250 of file MPolynomial.h.

251  {
252  XX res = (XX) 0;
253  X xx = (X) 1;
254  for ( int i = 0; i < (int) p.myValue.size(); ++i )
255  {
256  res += myEvalFun(p.myValue[i]) * (XX) xx;
257  xx = xx * myOwner.myEvalPoint;
258  }
259  return res;
260  }

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

Field Documentation

◆ myEvalFun

template<int n, typename TRing , typename TOwner , typename TAlloc , typename TX >
template<typename XX , typename Fun >
const Fun& DGtal::MPolynomialEvaluatorImpl< n, TRing, TOwner, TAlloc, TX >::EvalFun< XX, Fun >::myEvalFun
private

◆ myOwner

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

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