3#ifndef DUNE_FUNCTIONS_ANALYTICFUNCTIONS_POLYNOMIAL_HH
4#define DUNE_FUNCTIONS_ANALYTICFUNCTIONS_POLYNOMIAL_HH
7#include <initializer_list>
80 for (
size_t i=0; i<coefficients_.size(); ++i)
81 y += coefficients_[i] * std::pow(x, i);
96 std::vector<K> dpCoefficients(p.
coefficients().size()-1);
97 for (
size_t i=1; i<p.coefficients_.size(); ++i)
105 return coefficients_;
109 std::vector<K> coefficients_;
friend Polynomial derivative(const Polynomial &p)
Obtain derivative of Polynomial function.
Definition: polynomial.hh:94
Definition: polynomial.hh:10
A scalar polynomial implementation.
Definition: polynomial.hh:26
Polynomial()=default
Default constructor.
const std::vector< K > & coefficients() const
Obtain reference to coefficient vector.
Definition: polynomial.hh:103
Polynomial & operator=(const Polynomial &other)=default
Copy-assignment operator.
Polynomial & operator=(Polynomial &&other)=default
Move-assignment operator.
Polynomial(std::initializer_list< K > coefficients)
Create from list of coefficients.
Definition: polynomial.hh:50
K operator()(const K &x) const
Evaluate polynomial.
Definition: polynomial.hh:77
Polynomial(const Polynomial &other)=default
Copy constructor.
Polynomial(Polynomial &&other)=default
Move constructor.
Polynomial(const std::vector< K > &coefficients)
Create from list of coefficients.
Definition: polynomial.hh:72
Polynomial(std::vector< K > &&coefficients)
Create from list of coefficients.
Definition: polynomial.hh:61