DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Private Attributes
DGtal::MPolynomialEvaluatorImpl< n, TRing, TOwner, TAlloc, TX >::EvalFun< XX, Fun > Class Template Reference
Collaboration diagram for DGtal::MPolynomialEvaluatorImpl< n, TRing, TOwner, TAlloc, TX >::EvalFun< XX, Fun >:
Collaboration graph
[legend]

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


Constructor & Destructor Documentation

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

: myOwner(owner), myEvalFun(evalfun)
{}

Member Function Documentation

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

References DGtal::MPolynomialEvaluatorImpl< n, TRing, TOwner, TAlloc, TX >::EvalFun< XX, Fun >::myEvalFun, DGtal::MPolynomialEvaluatorImpl< n, TRing, TOwner, TAlloc, TX >::myEvalPoint, DGtal::MPolynomialEvaluatorImpl< n, TRing, TOwner, TAlloc, TX >::EvalFun< XX, Fun >::myOwner, DGtal::MPolynomial< n, TRing, TAlloc >::myValue, and DGtal::IVector< T, TAlloc, usePointers >::size().

{
XX res = (XX) 0;
X xx = (X) 1;
for ( int i = 0; i < (int) p.myValue.size(); ++i )
{
res += myEvalFun(p.myValue[i]) * (XX) xx;
xx = xx * myOwner.myEvalPoint;
}
return res;
}

Field Documentation

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
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: