Representation of a polynomial including differentiation, integration and root finding. More...
#include <polynomial.hpp>
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... | |
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 \).
CoeffT | numerical precision of polynomial coefficients (e.g. double ) |
Definition at line 28 of file polynomial.hpp.
pfasst::quadrature::Polynomial< CoeffT >::Polynomial | ( | size_t | n | ) |
n
is zero. Definition at line 18 of file polynomial_impl.hpp.
Polynomial< CoeffT > pfasst::quadrature::Polynomial< CoeffT >::differentiate | ( | ) | const |
Differentiate this polynomial.
Computes standard differential of this polynomial.
Definition at line 35 of file polynomial_impl.hpp.
|
inline |
Evaluate polynomial for given value.
xtype | numerical type of the value |
[in] | x | value to evaluate 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().
Polynomial< CoeffT > pfasst::quadrature::Polynomial< CoeffT >::integrate | ( | ) | const |
Integrates this polynomial.
Computes integral of this polynomial.
Definition at line 45 of file polynomial_impl.hpp.
Referenced by pfasst::quadrature::compute_q_matrix(), and pfasst::quadrature::compute_q_vec().
|
static |
Computes the Legendre polynomial of given order.
[in] | order | desired order of the Legendre polynomial |
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().
Polynomial< CoeffT > pfasst::quadrature::Polynomial< CoeffT >::normalize | ( | ) | const |
Normalizes this polynomial with respect to \( c_0 \).
Definition at line 55 of file polynomial_impl.hpp.
CoeffT & pfasst::quadrature::Polynomial< CoeffT >::operator[] | ( | const size_t | i | ) |
Access coefficient i
.
[in] | i | coefficient index (zero-based) |
std::out_of_range | if index is out of bounds, i.e. i >= Polynomial::order() |
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.
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.
Definition at line 23 of file polynomial_impl.hpp.
vector< CoeffT > pfasst::quadrature::Polynomial< CoeffT >::roots | ( | size_t | num_iterations = 100 , |
CoeffT | ztol = 1.0e-20 |
||
) | const |
Computes the roots of this polynomial.
Definition at line 70 of file polynomial_impl.hpp.
References pfasst::quadrature::Polynomial< CoeffT >::evaluate().
|
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.