Dune Core Modules (2.10.0)
A univariate polynomial implementation. More...
#include <dune/functions/analyticfunctions/polynomial.hh>
Public Types | |
using | Coefficients = C |
The type of the stored coefficient container. | |
Public Member Functions | |
Polynomial ()=default | |
Default constructor. | |
Polynomial (Coefficients coefficients) | |
Create from container of coefficients. More... | |
K | operator() (const K &x) const |
Evaluate polynomial. | |
bool | operator== (const Polynomial &other) const |
Comparison of coefficients. | |
const Coefficients & | coefficients () const |
Obtain reference to coefficient vector. | |
Friends | |
auto | derivative (const Polynomial &p) |
Obtain derivative of Polynomial function. More... | |
Detailed Description
class Dune::Functions::Polynomial< K, C >
A univariate polynomial implementation.
- Template Parameters
-
K Scalar type. The polynomial will map K to K C Coefficient container type (default std::vector<K>)
This class will store a coefficient container of type C. Supported containers are std::vector, std::array, std::integer_sequence, std::tuple. When passing std::tuple, coefficients of type std::integral_constant are promoted as std::integral_constant when computing derivatives.
Class template argument deduction is supported for passing std::array, std::vector, std::integer_sequence, std::initializer_list. When passing such containers without specifying the template parameters, then the scalar type is deduced to be the coefficient type. Notice that the deduced coefficient container type when passing std::initializer_list is std::vector.
If you want to use different types for scalar and coefficients, you can use the makePolynomial() function to explicitly specify the scalar type while the coefficient type is deduced.
This class exists mainly to demonstrate how to implement the Concept::DifferentiableFunction<Range(Domain), DerivativeTraits> concept.
Constructor & Destructor Documentation
◆ Polynomial()
|
inline |
Create from container of coefficients.
Coefficients are ordered in accordance with the corresponding monomial order. The constructed Polynomial object will store a copy of the passed coefficient container.
The documentation for this class was generated from the following file:
- dune/functions/analyticfunctions/polynomial.hh