![]() |
Reference documentation for deal.II version 8.4.2
|
#include <deal.II/base/polynomial.h>
Public Member Functions | |
| Polynomial (const std::vector< number > &coefficients) | |
| Polynomial (const unsigned int n) | |
| Polynomial (const std::vector< Point< 1 > > &lagrange_support_points, const unsigned int evaluation_point) | |
| Polynomial () | |
| number | value (const number x) const |
| void | value (const number x, std::vector< number > &values) const |
| unsigned int | degree () const |
| void | scale (const number factor) |
| template<typename number2 > | |
| void | shift (const number2 offset) |
| Polynomial< number > | derivative () const |
| Polynomial< number > | primitive () const |
| Polynomial< number > & | operator*= (const double s) |
| Polynomial< number > & | operator*= (const Polynomial< number > &p) |
| Polynomial< number > & | operator+= (const Polynomial< number > &p) |
| Polynomial< number > & | operator-= (const Polynomial< number > &p) |
| bool | operator== (const Polynomial< number > &p) const |
| void | print (std::ostream &out) const |
| template<class Archive > | |
| void | serialize (Archive &ar, const unsigned int version) |
Public Member Functions inherited from Subscriptor | |
| Subscriptor () | |
| Subscriptor (const Subscriptor &) | |
| virtual | ~Subscriptor () |
| Subscriptor & | operator= (const Subscriptor &) |
| void | subscribe (const char *identifier=0) const |
| void | unsubscribe (const char *identifier=0) const |
| unsigned int | n_subscriptions () const |
| void | list_subscribers () const |
| DeclException3 (ExcInUse, int, char *, std::string &,<< "Object of class "<< arg2<< " is still used by "<< arg1<< " other objects."<< "\"<< "(Additional information: "<< arg3<< ")\"<< "See the entry in the Frequently Asked Questions of "<< "deal.II (linked to from http://www.dealii.org/) for "<< "a lot more information on what this error means and "<< "how to fix programs in which it happens.") | |
| DeclException2 (ExcNoSubscriber, char *, char *,<< "No subscriber with identifier <"<< arg2<< "> subscribes to this object of class "<< arg1<< ". Consequently, it cannot be unsubscribed.") | |
| template<class Archive > | |
| void | serialize (Archive &ar, const unsigned int version) |
Protected Member Functions | |
| void | transform_into_standard_form () |
Static Protected Member Functions | |
| static void | scale (std::vector< number > &coefficients, const number factor) |
| template<typename number2 > | |
| static void | shift (std::vector< number > &coefficients, const number2 shift) |
| static void | multiply (std::vector< number > &coefficients, const number factor) |
Protected Attributes | |
| std::vector< number > | coefficients |
| bool | in_lagrange_product_form |
| std::vector< number > | lagrange_support_points |
| number | lagrange_weight |
Base class for all 1D polynomials. A polynomial is represented in this class by its coefficients, which are set through the constructor or by derived classes. Evaluation of a polynomial happens through the Horner scheme which provides both numerical stability and a minimal number of numerical operations.
Definition at line 53 of file polynomial.h.
| Polynomials::Polynomial< number >::Polynomial | ( | const std::vector< number > & | coefficients | ) |
Constructor. The coefficients of the polynomial are passed as arguments, and denote the polynomial
, i.e. the first element of the array denotes the constant term, the second the linear one, and so on. The degree of the polynomial represented by this object is thus the number of elements in the coefficient array minus one.
Definition at line 51 of file polynomial.cc.
| Polynomials::Polynomial< number >::Polynomial | ( | const unsigned int | n | ) |
Constructor creating a zero polynomial of degree n.
Definition at line 61 of file polynomial.cc.
| Polynomials::Polynomial< number >::Polynomial | ( | const std::vector< Point< 1 > > & | lagrange_support_points, |
| const unsigned int | evaluation_point | ||
| ) |
Constructor for Lagrange polynomial and its point of evaluation. The idea is to construct
, where j is the evaluation point specified as argument and the support points contain all points (including x_j, which will internally not be stored).
Definition at line 71 of file polynomial.cc.
|
inline |
Default constructor creating an illegal object.
Definition at line 604 of file polynomial.h.
|
inline |
Return the value of this polynomial at the given point.
This function uses the Horner scheme for numerical stability of the evaluation.
Definition at line 633 of file polynomial.h.
| void Polynomials::Polynomial< number >::value | ( | const number | x, |
| std::vector< number > & | values | ||
| ) | const |
Return the values and the derivatives of the Polynomial at point x. values[i], i=0,...,values.size()-1 includes the ith derivative. The number of derivatives to be computed is thus determined by the size of the array passed.
This function uses the Horner scheme for numerical stability of the evaluation.
Definition at line 101 of file polynomial.cc.
|
inline |
Degree of the polynomial. This is the degree reflected by the number of coefficients provided by the constructor. Leading non-zero coefficients are not treated separately.
Definition at line 615 of file polynomial.h.
| void Polynomials::Polynomial< number >::scale | ( | const number | factor | ) |
Scale the abscissa of the polynomial. Given the polynomial p(t) and the scaling t = ax, then the result of this operation is the polynomial q, such that q(x) = p(t).
The operation is performed in place.
Definition at line 289 of file polynomial.cc.
| void Polynomials::Polynomial< number >::shift | ( | const number2 | offset | ) |
Shift the abscissa oft the polynomial. Given the polynomial p(t) and the shift t = x + a, then the result of this operation is the polynomial q, such that q(x) = p(t).
The template parameter allows to compute the new coefficients with higher accuracy, since all computations are performed with type number2. This may be necessary, since this operation involves a big number of additions. On a Sun Sparc Ultra with Solaris 2.8, the difference between double and long double was not significant, though.
The operation is performed in place, i.e. the coefficients of the present object are changed.
Definition at line 563 of file polynomial.cc.
| Polynomial< number > Polynomials::Polynomial< number >::derivative | ( | ) | const |
Compute the derivative of a polynomial.
Definition at line 582 of file polynomial.cc.
| Polynomial< number > Polynomials::Polynomial< number >::primitive | ( | ) | const |
Compute the primitive of a polynomial. the coefficient of the zero order term of the polynomial is zero.
Definition at line 611 of file polynomial.cc.
| Polynomial< number > & Polynomials::Polynomial< number >::operator*= | ( | const double | s | ) |
Multiply with a scalar.
Definition at line 326 of file polynomial.cc.
| Polynomial< number > & Polynomials::Polynomial< number >::operator*= | ( | const Polynomial< number > & | p | ) |
Multiply with another polynomial.
Definition at line 343 of file polynomial.cc.
| Polynomial< number > & Polynomials::Polynomial< number >::operator+= | ( | const Polynomial< number > & | p | ) |
Add a second polynomial.
Definition at line 390 of file polynomial.cc.
| Polynomial< number > & Polynomials::Polynomial< number >::operator-= | ( | const Polynomial< number > & | p | ) |
Subtract a second polynomial.
Definition at line 432 of file polynomial.cc.
| bool Polynomials::Polynomial< number >::operator== | ( | const Polynomial< number > & | p | ) | const |
Test for equality of two polynomials.
Definition at line 468 of file polynomial.cc.
| void Polynomials::Polynomial< number >::print | ( | std::ostream & | out | ) | const |
Print coefficients.
Definition at line 638 of file polynomial.cc.
|
inline |
Write or read the data of this object to or from a stream for the purpose of serialization.
Definition at line 664 of file polynomial.h.
|
staticprotected |
This function performs the actual scaling.
Definition at line 273 of file polynomial.cc.
|
staticprotected |
This function performs the actual shift
Definition at line 500 of file polynomial.cc.
|
staticprotected |
Multiply polynomial by a factor.
Definition at line 314 of file polynomial.cc.
|
protected |
Transforms polynomial form of product of linear factors into standard form,
. Deletes all data structures related to the product form.
Definition at line 236 of file polynomial.cc.
|
protected |
Coefficients of the polynomial
. This vector is filled by the constructor of this class and may be passed down by derived classes.
This vector cannot be constant since we want to allow copying of polynomials.
Definition at line 224 of file polynomial.h.
|
protected |
Stores whether the polynomial is in Lagrange product form, i.e., constructed as a product
, or not.
Definition at line 230 of file polynomial.h.
|
protected |
If the polynomial is in Lagrange product form, i.e., constructed as a product
, store the shifts
.
Definition at line 236 of file polynomial.h.
|
protected |
If the polynomial is in Lagrange product form, i.e., constructed as a product
, store the weight c.
Definition at line 242 of file polynomial.h.
1.8.12