Alexandria
2.14.1
Please provide a description of the project.
|
Represents a polynomial function. More...
#include <Polynomial.h>
Public Member Functions | |
Polynomial (std::vector< double > coefficients) | |
virtual | ~Polynomial ()=default |
Default destructor. More... | |
const std::vector< double > & | getCoefficients () const |
Returns the coefficients of the polynomial. More... | |
double | operator() (const double) const override |
Calculates the value of the polynomial for the given value. More... | |
std::unique_ptr< Function > | clone () const override |
Creates a new polynomial with the same coefficients. More... | |
std::shared_ptr< Function > | derivative () const override |
Returns the derivative of the polynomial. More... | |
std::shared_ptr< Function > | indefiniteIntegral () const override |
Returns the indefinite integral of the polynomial. More... | |
![]() | |
virtual | ~Differentiable () |
Default destructor. More... | |
double | integrate (const double x1, const double x2) const override final |
![]() | |
virtual | ~Integrable ()=default |
Default destructor. More... | |
![]() | |
virtual | ~Function ()=default |
Default destructor. More... | |
Private Attributes | |
std::vector< double > | m_coef |
The vector where the polynomial coefficients are stored. More... | |
std::shared_ptr< Function > | m_derivative {} |
The function representing the derivative (uses lazy initialization) More... | |
std::shared_ptr< Function > | m_indefIntegral {} |
The function representing the indefinite integral (uses lazy initialization) More... | |
Represents a polynomial function.
Definition at line 43 of file Polynomial.h.
Euclid::MathUtils::Polynomial::Polynomial | ( | std::vector< double > | coefficients | ) |
Constructs a new Polynomial function with the given coefficients. The index of the coefficients in the given vector corresponds to the degree of the coefficient.
coefficients | the polynomial coefficients |
Definition at line 33 of file Polynomial.cpp.
References std::move().
Referenced by clone().
|
virtualdefault |
Default destructor.
|
overridevirtual |
Creates a new polynomial with the same coefficients.
Implements Euclid::MathUtils::Function.
Definition at line 50 of file Polynomial.cpp.
References m_coef, and Polynomial().
|
overridevirtual |
Returns the derivative of the polynomial.
Implements Euclid::MathUtils::Differentiable.
Definition at line 54 of file Polynomial.cpp.
References m_coef, m_derivative, std::move(), std::vector< T >::push_back(), and std::vector< T >::size().
const std::vector< double > & Euclid::MathUtils::Polynomial::getCoefficients | ( | ) | const |
Returns the coefficients of the polynomial.
Definition at line 36 of file Polynomial.cpp.
References m_coef.
Referenced by Euclid::MathUtils::multiplyPolynomials().
|
overridevirtual |
Returns the indefinite integral of the polynomial.
Implements Euclid::MathUtils::Differentiable.
Definition at line 65 of file Polynomial.cpp.
References m_coef, m_indefIntegral, std::move(), std::vector< T >::push_back(), and std::vector< T >::size().
|
overridevirtual |
Calculates the value of the polynomial for the given value.
Implements Euclid::MathUtils::Function.
Definition at line 40 of file Polynomial.cpp.
References m_coef.
|
private |
The vector where the polynomial coefficients are stored.
Definition at line 77 of file Polynomial.h.
Referenced by clone(), derivative(), getCoefficients(), indefiniteIntegral(), and operator()().
|
mutableprivate |
The function representing the derivative (uses lazy initialization)
Definition at line 79 of file Polynomial.h.
Referenced by derivative().
|
mutableprivate |
The function representing the indefinite integral (uses lazy initialization)
Definition at line 81 of file Polynomial.h.
Referenced by indefiniteIntegral().