File failed to load: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/config/TeX-MML-AM_CHTML/MathJax.js
DGtal 2.0.0
DGtal::MPolynomialEvaluator< 1, TRing, TAlloc, TX > Class Template Reference

#include <DGtal/math/MPolynomial.h>

Inheritance diagram for DGtal::MPolynomialEvaluator< 1, TRing, TAlloc, TX >:
[legend]

Public Types

typedef TRing Ring
typedef TAlloc Alloc
typedef TX X
typedef MPolynomial< 1, Ring, AllocMPoly1
typedef MPolynomial< n, Ring, AllocMPolyN
typedef MPolynomial< n - 1, X, typename std::allocator_traits< Alloc >::template rebind_alloc< X > > MPolyNM1

Public Member Functions

 operator X () const
X operator() () const
 operator MPolyNM1 () const

Private Member Functions

 MPolynomialEvaluator (const MPoly1 &poly, const X &evalpoint)
void evaluate (XX &res, const Fun &evalfun) const

Private Attributes

const MPoly1myPoly
 The polynomial in question.
const XmyEvalPoint
 The evaluation point.

Friends

class MPolynomial< 1, TRing, TAlloc >
class MPolynomial< n, TRing, TAlloc >
class MPolynomialEvaluatorImpl

Detailed Description

template<typename TRing, typename TAlloc, typename TX>
class DGtal::MPolynomialEvaluator< 1, TRing, TAlloc, TX >

The top level polynomial evaluation class, in case n = 1, i.e. does direct evaluation.

This class is a backport from Spielwiese.

Definition at line 357 of file MPolynomial.h.

Member Typedef Documentation

◆ Alloc

template<typename TRing, typename TAlloc, typename TX>
typedef TAlloc DGtal::MPolynomialEvaluator< 1, TRing, TAlloc, TX >::Alloc

Definition at line 362 of file MPolynomial.h.

◆ MPoly1

template<typename TRing, typename TAlloc, typename TX>
typedef MPolynomial< 1, Ring, Alloc > DGtal::MPolynomialEvaluator< 1, TRing, TAlloc, TX >::MPoly1

Definition at line 364 of file MPolynomial.h.

◆ MPolyN

typedef MPolynomial< n, Ring, Alloc > DGtal::MPolynomialEvaluator< n, TRing, TAlloc, TX >::MPolyN

Definition at line 423 of file MPolynomial.h.

◆ MPolyNM1

typedef MPolynomial< n - 1, X, typename std::allocator_traits<Alloc>::template rebind_alloc<X> > DGtal::MPolynomialEvaluator< n, TRing, TAlloc, TX >::MPolyNM1

Definition at line 425 of file MPolynomial.h.

◆ Ring

template<typename TRing, typename TAlloc, typename TX>
typedef TRing DGtal::MPolynomialEvaluator< 1, TRing, TAlloc, TX >::Ring

Definition at line 361 of file MPolynomial.h.

◆ X

template<typename TRing, typename TAlloc, typename TX>
typedef TX DGtal::MPolynomialEvaluator< 1, TRing, TAlloc, TX >::X

Definition at line 363 of file MPolynomial.h.

Constructor & Destructor Documentation

◆ MPolynomialEvaluator()

template<typename TRing, typename TAlloc, typename TX>
DGtal::MPolynomialEvaluator< 1, TRing, TAlloc, TX >::MPolynomialEvaluator ( const MPoly1 & poly,
const X & evalpoint )
inlineprivate

Definition at line 371 of file MPolynomial.h.

References myEvalPoint, and myPoly.

Member Function Documentation

◆ evaluate()

void DGtal::MPolynomialEvaluator< n, TRing, TAlloc, TX >::evaluate ( XX & res,
const Fun & evalfun ) const
inlineprivate

Will be called by "child". Evaluates the polynomial into an element of XX (which must not necessarily be X, it can also be MPolynomial<k, X> for some k < n - 1) using the given functor to evaluate the coefficients, which are of type MPolynomial<n-1, Ring>.

Definition at line 443 of file MPolynomial.h.

444 {
445 X xx = (X) 1;
446 for ( int i = 0; i < (int) myPoly.myValue.size(); ++i )
447 {
448 res += evalfun( myPoly.myValue[i] ) * xx;
449 xx = xx * myEvalPoint;
450 }
451 }

◆ operator MPolyNM1()

DGtal::MPolynomialEvaluator< n, TRing, TAlloc, TX >::operator MPolyNM1 ( ) const
inline

Evaluate to polynomial of type MPolynomial< n-1, X>.

Definition at line 458 of file MPolynomial.h.

459 {
460 MPolyNM1 res( myPoly.getAllocator() );
461 X xx = (X) 1;
462 for ( int i = 0; i < (int) myPoly.myValue.size(); ++i )
463 {
464 res += MPolyNM1( myPoly.myValue[i] ) * xx;
465 xx = xx * myEvalPoint;
466 }
467 return res;
468 }
MPolynomial< n - 1, X, typename std::allocator_traits< Alloc >::template rebind_alloc< X > > MPolyNM1

◆ operator X()

template<typename TRing, typename TAlloc, typename TX>
DGtal::MPolynomialEvaluator< 1, TRing, TAlloc, TX >::operator X ( ) const
inline

Casting to X is done by evaluation in myEvalPoint.

Definition at line 380 of file MPolynomial.h.

381 {
382 X res = (X) 0;
383 X xx = (X) 1;
384 for ( int i = 0; i < (int) myPoly.myValue.size(); ++i )
385 {
386 res += ( (X) (Ring) myPoly.myValue[i] ) * xx;
387 xx = xx * myEvalPoint;
388 }
389 return res;
390 }

References myEvalPoint, and myPoly.

◆ operator()()

template<typename TRing, typename TAlloc, typename TX>
X DGtal::MPolynomialEvaluator< 1, TRing, TAlloc, TX >::operator() ( ) const
inline

Evaluates and returns value in X.

Definition at line 396 of file MPolynomial.h.

397 {
398 return (X) (*this);
399 }

◆ MPolynomial< 1, TRing, TAlloc >

◆ MPolynomial< n, TRing, TAlloc >

friend class MPolynomial< n, TRing, TAlloc >
friend

Definition at line 396 of file MPolynomial.h.

◆ MPolynomialEvaluatorImpl

friend class MPolynomialEvaluatorImpl
friend

Definition at line 417 of file MPolynomial.h.

Field Documentation

◆ myEvalPoint

template<typename TRing, typename TAlloc, typename TX>
const X& DGtal::MPolynomialEvaluator< 1, TRing, TAlloc, TX >::myEvalPoint
private

The evaluation point.

Definition at line 368 of file MPolynomial.h.

Referenced by MPolynomialEvaluator(), and operator X().

◆ myPoly

template<typename TRing, typename TAlloc, typename TX>
const MPoly1& DGtal::MPolynomialEvaluator< 1, TRing, TAlloc, TX >::myPoly
private

The polynomial in question.

Definition at line 367 of file MPolynomial.h.

Referenced by MPolynomialEvaluator(), and operator X().


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