DUNE PDELab (git)

Dune::Functions::Polynomial< K, C > Class Template Reference

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...
 
operator() (const K &x) const
 Evaluate polynomial.
 
bool operator== (const Polynomial &other) const
 Comparison of coefficients.
 
const Coefficientscoefficients () const
 Obtain reference to coefficient vector.
 

Friends

auto derivative (const Polynomial &p)
 Obtain derivative of Polynomial function. More...
 

Detailed Description

template<class K, class C = std::vector<K>>
class Dune::Functions::Polynomial< K, C >

A univariate polynomial implementation.

Template Parameters
KScalar type. The polynomial will map K to K
CCoefficient 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()

template<class K , class C = std::vector<K>>
Dune::Functions::Polynomial< K, C >::Polynomial ( Coefficients  coefficients)
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:
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 23, 23:29, 2024)