DGtal  1.5.beta
DGtal::MPolynomialEvaluator< 1, TRing, TAlloc, TX > Class Template Reference

#include <DGtal/math/MPolynomial.h>

Public Types

typedef TRing Ring
 
typedef TAlloc Alloc
 
typedef TX X
 
typedef MPolynomial< 1, Ring, AllocMPoly1
 

Public Member Functions

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

Private Member Functions

 MPolynomialEvaluator (const MPoly1 &poly, const X &evalpoint)
 

Private Attributes

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

Friends

class MPolynomial< 1, TRing, TAlloc >
 

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 355 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 360 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 362 of file MPolynomial.h.

◆ Ring

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

Definition at line 359 of file MPolynomial.h.

◆ X

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

Definition at line 361 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 369 of file MPolynomial.h.

370  : myPoly( poly ), myEvalPoint( evalpoint )
371  {}
const X & myEvalPoint
The evaluation point.
Definition: MPolynomial.h:366
const MPoly1 & myPoly
The polynomial in question.
Definition: MPolynomial.h:365

Member Function Documentation

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

379  {
380  X res = (X) 0;
381  X xx = (X) 1;
382  for ( int i = 0; i < (int) myPoly.myValue.size(); ++i )
383  {
384  res += ( (X) (Ring) myPoly.myValue[i] ) * xx;
385  xx = xx * myEvalPoint;
386  }
387  return res;
388  }
Size size() const
Definition: MPolynomial.h:752

References DGtal::MPolynomialEvaluator< n, TRing, TAlloc, TX >::myEvalPoint, DGtal::MPolynomialEvaluator< n, TRing, TAlloc, TX >::myPoly, DGtal::MPolynomial< n, TRing, TAlloc >::myValue, and DGtal::IVector< T, TAlloc, usePointers >::size().

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

395  {
396  return (X) (*this);
397  }

Friends And Related Function Documentation

◆ MPolynomial< 1, TRing, TAlloc >

template<typename TRing , typename TAlloc , typename TX >
friend class MPolynomial< 1, TRing, TAlloc >
friend

Definition at line 301 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 366 of file MPolynomial.h.

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


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