#include <vnl_real_polynomial.h>
vnl_real_polynomial represents a univariate polynomial with real coefficients, stored as a vector of doubles. This allows evaluation of the polynomial
at given values of
, or of its derivative
.
Roots may be extracted using the roots() method.
Definition at line 34 of file vnl_real_polynomial.h.
Public Member Functions | |
| vnl_real_polynomial (vnl_vector< double > const &a) | |
| Initialize polynomial. | |
| vnl_real_polynomial (double const *a, unsigned len) | |
| Initialize polynomial from C vector. | |
| vnl_real_polynomial (double a) | |
| Initialize polynomial from double. | |
| vnl_real_polynomial (int d) | |
| Initialize polynomial of a given degree. | |
| bool | operator== (vnl_real_polynomial const &p) const |
| comparison operator. | |
| double | evaluate (double x) const |
| Evaluate polynomial at value x. | |
| double | evaluate_integral (double x) const |
| Evaluate integral at x (assuming constant of integration is zero). | |
| double | evaluate_integral (double x1, double x2) const |
| Evaluate integral between x1 and x2. | |
| double | devaluate (double x) const |
| Evaluate derivative at value x. | |
| vcl_complex< double > | evaluate (vcl_complex< double > const &x) const |
| Evaluate polynomial at complex value x. | |
| vcl_complex< double > | devaluate (vcl_complex< double > const &x) const |
| Evaluate derivative at complex value x. | |
| vnl_real_polynomial | derivative () const |
| Return derivative of this polynomial. | |
| vnl_real_polynomial | primitive () const |
| Return primitive function (inverse derivative) of this polynomial. | |
| int | degree () const |
| Return the degree (highest power of x) of the polynomial. | |
| double & | operator[] (int i) |
| Access to the polynomial coefficients. | |
| double | operator[] (int i) const |
| Access to the polynomial coefficients. | |
| const vnl_vector< double > & | coefficients () const |
| Return the vector of coefficients. | |
| vnl_vector< double > & | coefficients () |
| Return the vector of coefficients. | |
| void | set_coefficients (vnl_vector< double > const &coeffs) |
| void | print (vcl_ostream &os) const |
| Print this polynomial to stream. | |
Protected Attributes | |
| vnl_vector< double > | coeffs_ |
| The coefficients of the polynomial. | |
Related Functions | |
| (Note that these are not member functions.) | |
| vnl_real_polynomial | operator+ (const vnl_real_polynomial &f1, const vnl_real_polynomial &f2) |
| Returns polynomial which is sum of two polynomials f1(x)+f2(x). | |
| vnl_real_polynomial | operator- (const vnl_real_polynomial &f1, const vnl_real_polynomial &f2) |
| Returns polynomial which is different of two polynomials f1(x)-f2(x). | |
| double | vnl_rms_difference (const vnl_real_polynomial &f1, const vnl_real_polynomial &f2, double x1, double x2) |
| Returns RMS difference between f1 and f2 over range [x1,x2]. | |
| vnl_real_polynomial::vnl_real_polynomial | ( | vnl_vector< double > const & | a | ) | [inline] |
| vnl_real_polynomial::vnl_real_polynomial | ( | double const * | a, | |
| unsigned | len | |||
| ) | [inline] |
Initialize polynomial from C vector.
The parameter len is the number of coefficients, one greater than the degree.
Definition at line 46 of file vnl_real_polynomial.h.
| vnl_real_polynomial::vnl_real_polynomial | ( | double | a | ) | [inline] |
Initialize polynomial from double.
Useful when adding or multiplying a polynomial and a number.
Definition at line 52 of file vnl_real_polynomial.h.
| vnl_real_polynomial::vnl_real_polynomial | ( | int | d | ) | [inline] |
| bool vnl_real_polynomial::operator== | ( | vnl_real_polynomial const & | p | ) | const [inline] |
| double vnl_real_polynomial::evaluate | ( | double | x | ) | const |
Evaluate polynomial at value x.
| double vnl_real_polynomial::evaluate_integral | ( | double | x | ) | const |
Evaluate integral at x (assuming constant of integration is zero).
Definition at line 77 of file vnl_real_polynomial.cxx.
| double vnl_real_polynomial::evaluate_integral | ( | double | x1, | |
| double | x2 | |||
| ) | const |
| double vnl_real_polynomial::devaluate | ( | double | x | ) | const |
| vcl_complex<double> vnl_real_polynomial::evaluate | ( | vcl_complex< double > const & | x | ) | const |
Evaluate polynomial at complex value x.
| vcl_complex< double > vnl_real_polynomial::devaluate | ( | vcl_complex< double > const & | x | ) | const |
| vnl_real_polynomial vnl_real_polynomial::derivative | ( | ) | const |
| vnl_real_polynomial vnl_real_polynomial::primitive | ( | ) | const |
Return primitive function (inverse derivative) of this polynomial.
Since a primitive function is not unique, the one with constant = 0 is returned
Definition at line 188 of file vnl_real_polynomial.cxx.
| int vnl_real_polynomial::degree | ( | ) | const [inline] |
Return the degree (highest power of x) of the polynomial.
Definition at line 89 of file vnl_real_polynomial.h.
| double& vnl_real_polynomial::operator[] | ( | int | i | ) | [inline] |
| double vnl_real_polynomial::operator[] | ( | int | i | ) | const [inline] |
| const vnl_vector<double>& vnl_real_polynomial::coefficients | ( | ) | const [inline] |
| vnl_vector<double>& vnl_real_polynomial::coefficients | ( | ) | [inline] |
| void vnl_real_polynomial::set_coefficients | ( | vnl_vector< double > const & | coeffs | ) | [inline] |
Definition at line 101 of file vnl_real_polynomial.h.
| void vnl_real_polynomial::print | ( | vcl_ostream & | os | ) | const |
| vnl_real_polynomial operator+ | ( | const vnl_real_polynomial & | f1, | |
| const vnl_real_polynomial & | f2 | |||
| ) | [related] |
Returns polynomial which is sum of two polynomials f1(x)+f2(x).
Definition at line 101 of file vnl_real_polynomial.cxx.
| vnl_real_polynomial operator- | ( | const vnl_real_polynomial & | f1, | |
| const vnl_real_polynomial & | f2 | |||
| ) | [related] |
Returns polynomial which is different of two polynomials f1(x)-f2(x).
Definition at line 123 of file vnl_real_polynomial.cxx.
| double vnl_rms_difference | ( | const vnl_real_polynomial & | f1, | |
| const vnl_real_polynomial & | f2, | |||
| double | x1, | |||
| double | x2 | |||
| ) | [related] |
Returns RMS difference between f1 and f2 over range [x1,x2].
Definition at line 163 of file vnl_real_polynomial.cxx.
vnl_vector<double> vnl_real_polynomial::coeffs_ [protected] |
The coefficients of the polynomial.
coeffs_.back() is the const term. coeffs_[n] is the coefficient of the x^(d-n) term, where d=coeffs_.size()-1
Definition at line 112 of file vnl_real_polynomial.h.
1.5.1