Evaluation of real polynomials at real and complex points. More...
#include <vnl_real_polynomial.h>
Public Member Functions | |
| vnl_real_polynomial (vnl_vector< double > const &a) | |
| Initialize polynomial. More... | |
| vnl_real_polynomial (double const *a, unsigned len) | |
| Initialize polynomial from C vector. More... | |
| vnl_real_polynomial (double a) | |
| Initialize polynomial from double. More... | |
| vnl_real_polynomial (int d) | |
| Initialize polynomial of a given degree. More... | |
| vnl_real_polynomial (unsigned int d) | |
| bool | operator== (vnl_real_polynomial const &p) const |
| comparison operator. More... | |
| double | evaluate (double x) const |
| Evaluate polynomial at value x. More... | |
| double | evaluate_integral (double x) const |
| Evaluate integral at x (assuming constant of integration is zero). More... | |
| double | evaluate_integral (double x1, double x2) const |
| Evaluate integral between x1 and x2. More... | |
| double | devaluate (double x) const |
| Evaluate derivative at value x. More... | |
| std::complex< double > | evaluate (std::complex< double > const &x) const |
| Evaluate polynomial at complex value x. More... | |
| std::complex< double > | devaluate (std::complex< double > const &x) const |
| Evaluate derivative at complex value x. More... | |
| vnl_real_polynomial | derivative () const |
| Return derivative of this polynomial. More... | |
| vnl_real_polynomial | primitive () const |
| Return primitive function (inverse derivative) of this polynomial. More... | |
| vnl_real_polynomial & | operator+= (vnl_real_polynomial const &rhs) |
| Add rhs to this and return *this. More... | |
| vnl_real_polynomial & | operator-= (vnl_real_polynomial const &rhs) |
| Subtract rhs from this and return *this. More... | |
| vnl_real_polynomial & | operator *= (vnl_real_polynomial const &rhs) |
| Multiply rhs with this and return *this. More... | |
| int | degree () const |
| Return the degree (highest power of x) of the polynomial. More... | |
| double & | operator [] (int i) |
| Access to the polynomial coefficients. More... | |
| double | operator [] (int i) const |
| Access to the polynomial coefficients. More... | |
| const vnl_vector< double > & | coefficients () const |
| Return the vector of coefficients. More... | |
| vnl_vector< double > & | coefficients () |
| Return the vector of coefficients. More... | |
| void | set_coefficients (vnl_vector< double > const &coeffs) |
| void | print (std::ostream &os) const |
| Print this polynomial to stream. More... | |
Protected Attributes | |
| vnl_vector< double > | coeffs_ |
| The coefficients of the polynomial. More... | |
Related Functions | |
(Note that these are not member functions.) | |
| void | vsl_b_write (vsl_b_ostream &os, const vnl_real_polynomial &v) |
| Binary save vnl_real_polynomial to stream. More... | |
| void | vsl_b_read (vsl_b_istream &is, vnl_real_polynomial &v) |
| Binary load vnl_real_polynomial from stream. More... | |
| void | vsl_print_summary (std::ostream &os, const vnl_real_polynomial &b) |
| Print human readable summary of object to a stream. More... | |
| VNL_EXPORT 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). More... | |
| VNL_EXPORT 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). More... | |
| VNL_EXPORT 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]. More... | |
Evaluation of real polynomials at real and complex points.
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
.
The coefficients (coeffs_) are stored as a vnl_vector, where coeffs_[n] is the coefficient of the x^(d-n) term, where d is the degree of the polynomial. Otherwise said, the coefficients are stored starting with the highest degree term.
Roots may be extracted using the roots() method.
Definition at line 40 of file vnl_real_polynomial.h.
|
inline |
|
inline |
Initialize polynomial from C vector.
The parameter len is the number of coefficients, one greater than the degree.
Definition at line 52 of file vnl_real_polynomial.h.
|
inline |
Initialize polynomial from double.
Useful when adding or multiplying a polynomial and a number.
Definition at line 58 of file vnl_real_polynomial.h.
|
inline |
Initialize polynomial of a given degree.
Definition at line 61 of file vnl_real_polynomial.h.
|
inline |
Definition at line 62 of file vnl_real_polynomial.h.
|
inline |
Return the vector of coefficients.
Definition at line 113 of file vnl_real_polynomial.h.
|
inline |
Return the vector of coefficients.
Definition at line 115 of file vnl_real_polynomial.h.
|
inline |
Return the degree (highest power of x) of the polynomial.
Definition at line 105 of file vnl_real_polynomial.h.
| vnl_real_polynomial vnl_real_polynomial::derivative | ( | ) | const |
Return derivative of this polynomial.
Definition at line 189 of file vnl_real_polynomial.cxx.
| double vnl_real_polynomial::devaluate | ( | double | x | ) | const |
Evaluate derivative at value x.
Definition at line 60 of file vnl_real_polynomial.cxx.
| std::complex< double > vnl_real_polynomial::devaluate | ( | std::complex< double > const & | x | ) | const |
Evaluate derivative at complex value x.
Evaluate derivative at complex value x. Not implemented.
Definition at line 67 of file vnl_real_polynomial.cxx.
| double vnl_real_polynomial::evaluate | ( | double | x | ) | const |
Evaluate polynomial at value x.
| std::complex<double> vnl_real_polynomial::evaluate | ( | std::complex< double > const & | x | ) | const |
Evaluate polynomial at complex value x.
| double vnl_real_polynomial::evaluate_integral | ( | double | x | ) | const |
Evaluate integral at x (assuming constant of integration is zero).
Definition at line 73 of file vnl_real_polynomial.cxx.
| double vnl_real_polynomial::evaluate_integral | ( | double | x1, |
| double | x2 | ||
| ) | const |
Evaluate integral between x1 and x2.
Definition at line 91 of file vnl_real_polynomial.cxx.
| vnl_real_polynomial & vnl_real_polynomial::operator *= | ( | vnl_real_polynomial const & | rhs | ) |
Multiply rhs with this and return *this.
multiply rhs with this and return *this.
Definition at line 169 of file vnl_real_polynomial.cxx.
|
inline |
Access to the polynomial coefficients.
Definition at line 108 of file vnl_real_polynomial.h.
|
inline |
Access to the polynomial coefficients.
Definition at line 110 of file vnl_real_polynomial.h.
| vnl_real_polynomial & vnl_real_polynomial::operator+= | ( | vnl_real_polynomial const & | rhs | ) |
Add rhs to this and return *this.
Definition at line 157 of file vnl_real_polynomial.cxx.
| vnl_real_polynomial & vnl_real_polynomial::operator-= | ( | vnl_real_polynomial const & | rhs | ) |
Subtract rhs from this and return *this.
Definition at line 163 of file vnl_real_polynomial.cxx.
|
inline |
comparison operator.
Definition at line 65 of file vnl_real_polynomial.h.
| 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 200 of file vnl_real_polynomial.cxx.
| void vnl_real_polynomial::print | ( | std::ostream & | os | ) | const |
Print this polynomial to stream.
Definition at line 210 of file vnl_real_polynomial.cxx.
|
inline |
Definition at line 117 of file vnl_real_polynomial.h.
|
related |
Returns polynomial which is sum of two polynomials f1(x)+f2(x).
Definition at line 97 of file vnl_real_polynomial.cxx.
|
related |
Returns polynomial which is different of two polynomials f1(x)-f2(x).
Definition at line 119 of file vnl_real_polynomial.cxx.
|
related |
Returns RMS difference between f1 and f2 over range [x1,x2].
Definition at line 176 of file vnl_real_polynomial.cxx.
|
related |
Binary load vnl_real_polynomial from stream.
Definition at line 23 of file vnl_io_real_polynomial.cxx.
|
related |
Binary save vnl_real_polynomial to stream.
Definition at line 13 of file vnl_io_real_polynomial.cxx.
|
related |
Print human readable summary of object to a stream.
Definition at line 47 of file vnl_io_real_polynomial.cxx.
|
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 128 of file vnl_real_polynomial.h.
1.8.15