PFASST++
pfasst::quadrature::Polynomial< CoeffT > Class Template Reference

Representation of a polynomial including differentiation, integration and root finding. More...

#include <polynomial.hpp>

+ Collaboration diagram for pfasst::quadrature::Polynomial< CoeffT >:

Public Member Functions

 Polynomial (size_t n)
 
size_t order () const
 Order of this polynomial. More...
 
CoeffT & operator[] (const size_t i)
 Access coefficient i. More...
 
Polynomial< CoeffT > differentiate () const
 Differentiate this polynomial. More...
 
Polynomial< CoeffT > integrate () const
 Integrates this polynomial. More...
 
template<typename xtype >
xtype evaluate (const xtype x) const
 Evaluate polynomial for given value. More...
 
Polynomial< CoeffT > normalize () const
 Normalizes this polynomial with respect to \( c_0 \). More...
 
vector< CoeffT > roots (size_t num_iterations=100, CoeffT ztol=1.0e-20) const
 Computes the roots of this polynomial. More...
 

Static Public Member Functions

static Polynomial< CoeffT > legendre (const size_t order)
 Computes the Legendre polynomial of given order. More...
 

Protected Attributes

vector< CoeffT > c
 Coefficients of the polynomial. More...
 

Detailed Description

template<typename CoeffT>
class pfasst::quadrature::Polynomial< CoeffT >

Representation of a polynomial including differentiation, integration and root finding.

Nothing more than a \( n \)-th order polynomial of the form \( P_n(x) = \sum_{i=0}^{n} c_i x^i \) with coefficients \( c_i \), \( i=0, \dots, n \).

Template Parameters
CoeffTnumerical precision of polynomial coefficients (e.g. double)
Since
v0.3.0

Definition at line 28 of file polynomial.hpp.

Constructor & Destructor Documentation

template<typename CoeffT >
pfasst::quadrature::Polynomial< CoeffT >::Polynomial ( size_t  n)
Todo:
Consider issuing a warning/assertion when n is zero.

Definition at line 18 of file polynomial_impl.hpp.

Member Function Documentation

template<typename CoeffT >
Polynomial< CoeffT > pfasst::quadrature::Polynomial< CoeffT >::differentiate ( ) const

Differentiate this polynomial.

Computes standard differential of this polynomial.

Returns
differentiated polynomial

Definition at line 35 of file polynomial_impl.hpp.

template<typename CoeffT>
template<typename xtype >
xtype pfasst::quadrature::Polynomial< CoeffT >::evaluate ( const xtype  x) const
inline

Evaluate polynomial for given value.

Template Parameters
xtypenumerical type of the value
Parameters
[in]xvalue to evaluate polynomial at
Returns
value of polynomial at x

Definition at line 95 of file polynomial.hpp.

Referenced by pfasst::quadrature::compute_q_matrix(), pfasst::quadrature::compute_q_vec(), and pfasst::quadrature::Polynomial< CoeffT >::roots().

+ Here is the caller graph for this function:

template<typename CoeffT >
Polynomial< CoeffT > pfasst::quadrature::Polynomial< CoeffT >::integrate ( ) const

Integrates this polynomial.

Computes integral of this polynomial.

Returns
integrated polynomial

Definition at line 45 of file polynomial_impl.hpp.

Referenced by pfasst::quadrature::compute_q_matrix(), and pfasst::quadrature::compute_q_vec().

+ Here is the caller graph for this function:

template<typename CoeffT >
Polynomial< CoeffT > pfasst::quadrature::Polynomial< CoeffT >::legendre ( const size_t  order)
static

Computes the Legendre polynomial of given order.

Parameters
[in]orderdesired order of the Legendre polynomial
Returns
Legendre polynomial of order order

Definition at line 106 of file polynomial_impl.hpp.

Referenced by pfasst::quadrature::GaussLegendre< precision >::compute_nodes(), pfasst::quadrature::GaussRadau< precision >::compute_nodes(), pfasst::quadrature::GaussLobatto< precision >::compute_nodes(), pfasst::quadrature::ClenshawCurtis< precision >::compute_nodes(), and TEST().

+ Here is the caller graph for this function:

template<typename CoeffT >
Polynomial< CoeffT > pfasst::quadrature::Polynomial< CoeffT >::normalize ( ) const

Normalizes this polynomial with respect to \( c_0 \).

Returns
normalized polynomial

Definition at line 55 of file polynomial_impl.hpp.

template<typename CoeffT >
CoeffT & pfasst::quadrature::Polynomial< CoeffT >::operator[] ( const size_t  i)

Access coefficient i.

Parameters
[in]icoefficient index (zero-based)
Returns
\( i+1 \)-th coefficient
Exceptions
std::out_of_rangeif index is out of bounds, i.e. i >= Polynomial::order()
Note
The coefficients are stored in reversed order to the degree of the indeterminate, i.e. i=0 corresponds to \( c_n \) while i=n corresponds to \( c_0 \). See also Polynomial::c.

Definition at line 29 of file polynomial_impl.hpp.

template<typename CoeffT >
size_t pfasst::quadrature::Polynomial< CoeffT >::order ( ) const

Order of this polynomial.

The order of this polynomial is one less the number of coefficients defined.

Returns
order of the polynomial

Definition at line 23 of file polynomial_impl.hpp.

template<typename CoeffT >
vector< CoeffT > pfasst::quadrature::Polynomial< CoeffT >::roots ( size_t  num_iterations = 100,
CoeffT  ztol = 1.0e-20 
) const

Computes the roots of this polynomial.

Returns
roots sorted with respect to their value

Definition at line 70 of file polynomial_impl.hpp.

References pfasst::quadrature::Polynomial< CoeffT >::evaluate().

+ Here is the call graph for this function:

Member Data Documentation

template<typename CoeffT>
vector<CoeffT> pfasst::quadrature::Polynomial< CoeffT >::c
protected

Coefficients of the polynomial.

The coefficient for the highest degree of \( x \) has index 0. The last coefficient is for \( x^0 \).

Definition at line 37 of file polynomial.hpp.


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