Representation of a polynomial function of n-th degree. More...
#include <polynomial.hpp>
Public Types | |
typedef Array< double, N+1 > | Coefficients |
The coefficient container storage type. More... | |
Public Member Functions | |
Coefficients & | coefficients () |
Handle to the coefficient array, use to initialise the polynomial. More... | |
const Coefficients & | coefficients () const |
Non-modifiable handle to the coefficient array. More... | |
double | dderivative (const double &x) const |
Access the second derivative directly. More... | |
Polynomial< N-1 > | derivative () const |
Generates the derivative polynomial. More... | |
double | derivative (const double &x) const |
Access the derivative directly. More... | |
double | operator() (const double &x) const |
Access the value of the polynomial at a certain point. More... | |
Polynomial () | |
Default constructor. More... | |
template<typename Derived > | |
Polynomial (const BluePrint< Derived > &blueprint) | |
Blueprint constructor. More... | |
void | shift_horizontal (const double &shift) |
Horizontal shift transform. More... | |
virtual | ~Polynomial () |
Private Attributes | |
Coefficients | coeff |
Friends | |
template<typename OutputStream , unsigned int Degree> | |
OutputStream & | operator<< (OutputStream &ostream, const Polynomial< Degree > &polynomial) |
Streaming output insertion operator for polynomials. More... | |
Representation of a polynomial function of n-th degree.
Representation of a polynomial function of n-th order. Use the template parameter to specify the degree of the polynomial. The representation is defined by an array of coefficients which are given in the form a_0 -> a_n where p(x) = a_0 + a_1 x + ....
Comma Initialisation:
The polynomial uses a an ecl array (ecl_containers) for storage, so comma initialisation is possible.
Blueprint Initialisation:
Lightweight blueprints can also be used to initialise/assign the polynomial:
Utility Functions:
N | : the degree of the polynomial (i.e. a_0 + ... + a_i x^i + ... + a_N x^N) |
Definition at line 50 of file polynomial.hpp.
typedef Array<double,N+1> ecl::Polynomial< N >::Coefficients |
The coefficient container storage type.
Definition at line 123 of file polynomial.hpp.
|
inline |
Default constructor.
This does not initialise the polynomial, use with the coefficients() accessor with comma initialisation operator to conveniently set the coefficients.
Definition at line 135 of file polynomial.hpp.
|
inline |
Blueprint constructor.
Constructor that allows automatic generation from an existing blueprint. This can be used simply in the following manner for any static element belonging to the BluePrintFactory.
Since this is not explicit, it will also allow assignment.
This will emit a compile time failure if the template argument does not conform to the blueprints concept (refer to ecl_concepts' documentation).
blueprint | : the blue print to use to generate this instance. |
Definition at line 162 of file polynomial.hpp.
|
inlinevirtual |
Definition at line 165 of file polynomial.hpp.
|
inline |
Handle to the coefficient array, use to initialise the polynomial.
This returns a handle to the coefficient array. Use this with the comma initialiser to conveniently set the polynomial.
Definition at line 241 of file polynomial.hpp.
|
inline |
Non-modifiable handle to the coefficient array.
Definition at line 247 of file polynomial.hpp.
double ecl::Polynomial< N >::dderivative | ( | const double & | x | ) | const |
Access the second derivative directly.
Access the values of the second derivative directly.
x | : the point at which you wish to calculate the value for. |
Definition at line 443 of file polynomial.hpp.
|
inline |
Generates the derivative polynomial.
Calculates and returns a copy of the derivative polynomial.
Definition at line 197 of file polynomial.hpp.
double ecl::Polynomial< N >::derivative | ( | const double & | x | ) | const |
Access the derivative directly.
Access the values of the derivative directly.
x | : the point at which you wish to calculate the value for. |
Definition at line 433 of file polynomial.hpp.
double ecl::Polynomial< N >::operator() | ( | const double & | x | ) | const |
Access the value of the polynomial at a certain point.
Access the value of the polynomial at a certain point.
x | : the point at which you wish to calculate the value for. |
Definition at line 422 of file polynomial.hpp.
void ecl::Polynomial< N >::shift_horizontal | ( | const double & | shift | ) |
Horizontal shift transform.
Shifts the polynomial along the x axis by the specified offset. A negative offset will shift the polynomial to the left, while a positive offset will shit the polynomial to the right.
shift | : the amount of x-shift (-ve -> left, +ve -> right). |
Definition at line 402 of file polynomial.hpp.
|
friend |
Streaming output insertion operator for polynomials.
Streaming output insertion operator for polynomials.
OutputStream | : the type of stream being used. |
Degree | : the order of the polynomial being inserted. |
ostream | : the output stream being used. |
polynomial | : the polynomial |
Definition at line 457 of file polynomial.hpp.
|
private |
Definition at line 275 of file polynomial.hpp.