DGtal  0.9.4beta
Public Member Functions | Private Attributes
DGtal::MPolynomialEvaluatorImpl< 1, TRing, TOwner, TAlloc, TX >::EvalFun Class Reference
Collaboration diagram for DGtal::MPolynomialEvaluatorImpl< 1, TRing, TOwner, TAlloc, TX >::EvalFun:
[legend]

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 115 of file MPolynomial.h.

Constructor & Destructor Documentation

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 121 of file MPolynomial.h.

123  : myOwner(owner)
124  {}
const MPolynomialEvaluatorImpl< 1, Ring, Owner, Alloc, X > & myOwner
Definition: MPolynomial.h:117

Member Function Documentation

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 132 of file MPolynomial.h.

References DGtal::MPolynomialEvaluatorImpl< n, TRing, TOwner, TAlloc, TX >::myEvalPoint, and DGtal::MPolynomial< n, TRing, TAlloc >::myValue.

133  {
134  X res = (X) 0;
135  X xx = (X) 1;
136  for ( int i = 0; i < (int) p.myValue.size(); ++i )
137  {
138  res += (X)(Ring) p.myValue[i] * xx;
139  xx = xx * myOwner.myEvalPoint;
140  }
141  return res;
142  }
const MPolynomialEvaluatorImpl< 1, Ring, Owner, Alloc, X > & myOwner
Definition: MPolynomial.h:117

Field Documentation

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 117 of file MPolynomial.h.


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