real polynomial in N variables. More...
#include <vnl_real_npolynomial.h>
Public Member Functions | |
| vnl_real_npolynomial () | |
| vnl_real_npolynomial (const vnl_vector< double > &c, const vnl_matrix< unsigned int > &p) | |
| Construct the polynomial with coefficients vector c and with exponents matrix p. More... | |
| double | eval (const vnl_vector< double > &x) |
| Evaluate the polynomial at x. More... | |
| double | deval (const vnl_vector< double > &x, unsigned int i) |
| Evaluate the derivative of the polynomial at x with respect to the ith variable. More... | |
| vnl_vector< double > | deval (const vnl_vector< double > &x) |
| Evaluate the gradient of the polynomial at x. More... | |
| vnl_real_npolynomial | deriv (unsigned int i) |
| Differentiate the polynomial with respect to the ith variable. More... | |
| vnl_real_npolynomial | operator- () const |
| vnl_real_npolynomial | operator+ (vnl_real_npolynomial const &) const |
| vnl_real_npolynomial | operator- (vnl_real_npolynomial const &) const |
| vnl_real_npolynomial | operator * (vnl_real_npolynomial const &) const |
| vnl_real_npolynomial & | operator+= (vnl_real_npolynomial const &rhs) |
| vnl_real_npolynomial & | operator-= (vnl_real_npolynomial const &rhs) |
| vnl_real_npolynomial & | operator *= (vnl_real_npolynomial const &rhs) |
| vnl_real_npolynomial | operator+ (double) const |
| vnl_real_npolynomial | operator- (double P) const |
| vnl_real_npolynomial | operator * (double) const |
| vnl_real_npolynomial & | operator *= (double P) |
| vnl_real_npolynomial | operator/ (double P) const |
| vnl_real_npolynomial & | operator/= (double P) |
| unsigned int | degree () const |
| Return the degree (highest total power of all terms) of the polynomial. More... | |
| unsigned int | maxdegree () const |
| Return the highest degree of the polynomial in an individual variable. More... | |
| std::vector< unsigned int > | degrees () const |
| Return the degrees (highest power of all terms) in each of the variables. More... | |
| double & | operator [] (unsigned int i) |
| Access to the polynomial coefficients. More... | |
| double | operator [] (unsigned 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 (const vnl_vector< double > &c, const vnl_matrix< unsigned int > &p) |
| Set vector of coefficients of each product. More... | |
| const vnl_matrix< unsigned int > & | polyn () const |
| Return the polynomial matrix. More... | |
| vnl_matrix< unsigned int > & | polyn () |
| Return the vector of coefficients. More... | |
| std::string | asString () const |
| Return the textual representation of this polynomial. More... | |
Private Member Functions | |
| void | simplify () |
| Combine terms with identical exponents (i.e., identical rows in polyn_). More... | |
| double | eval (const vnl_matrix< double > &xn) |
Private Attributes | |
| vnl_vector< double > | coeffs_ |
| coefficients. More... | |
| vnl_matrix< unsigned int > | polyn_ |
| degrees of every term for every variable. More... | |
| unsigned int | nvar_ |
| number of variables = # columns of polyn_. More... | |
| unsigned int | nterms_ |
| number of terms of polynomial. More... | |
| unsigned int | ideg_ |
| max. degree of polynomial. More... | |
Friends | |
| class | vnl_rnpoly_solve |
| VNL_EXPORT std::ostream & | operator<< (std::ostream &, vnl_real_npolynomial const &) |
Related Functions | |
(Note that these are not member functions.) | |
| void | vsl_b_write (vsl_b_ostream &os, const vnl_real_npolynomial &v) |
| Binary save vnl_real_npolynomial to stream. More... | |
| void | vsl_b_read (vsl_b_istream &is, vnl_real_npolynomial &v) |
| Binary load vnl_real_polynomial from stream. More... | |
| void | vsl_print_summary (std::ostream &os, const vnl_real_npolynomial &b) |
| Print human readable summary of object to a stream. More... | |
real polynomial in N variables.
vnl_real_npolynomial represents a polynomial in multiple variables. Used by vnl_rnpoly_solve which solves systems of polynomial equations. Representation: an N-omial (N terms) is represented by (1) a vector with the N coefficients (vnl_vector<double>), and (2) a matrix with N rows, the i-th row representing the exponents of term i, as follows: (vnl_matrix<int>) column k contains the (integer) exponent of variable k. Example: the polynomial
is represented by the coefficients vector [A B C D] and the exponents matrix
[3 0] [1 1] [0 2] [1 2].
Definition at line 55 of file vnl_real_npolynomial.h.
|
inline |
Definition at line 74 of file vnl_real_npolynomial.h.
| vnl_real_npolynomial::vnl_real_npolynomial | ( | const vnl_vector< double > & | c, |
| const vnl_matrix< unsigned int > & | p | ||
| ) |
Construct the polynomial with coefficients vector c and with exponents matrix p.
Constructor.
coeffs = vnl_vector<double>(nterms)
polyn = vnl_matrix<int>(nterms,nvar)
Example: A*x^3 + B*x*y + C*y^2 + D*x*y^2
nvar = 2;
nterms = 4;
coeffs = [A B C D]';
polyn = [3 0]
[1 1]
[0 2]
[1 2];
Definition at line 28 of file vnl_real_npolynomial.cxx.
| std::string vnl_real_npolynomial::asString | ( | ) | const |
Return the textual representation of this polynomial.
Definition at line 266 of file vnl_real_npolynomial.cxx.
|
inline |
Return the vector of coefficients.
Definition at line 124 of file vnl_real_npolynomial.h.
|
inline |
Return the vector of coefficients.
Definition at line 126 of file vnl_real_npolynomial.h.
| unsigned int vnl_real_npolynomial::degree | ( | ) | const |
Return the degree (highest total power of all terms) of the polynomial.
Definition at line 129 of file vnl_real_npolynomial.cxx.
| std::vector< unsigned int > vnl_real_npolynomial::degrees | ( | ) | const |
Return the degrees (highest power of all terms) in each of the variables.
Definition at line 142 of file vnl_real_npolynomial.cxx.
| vnl_real_npolynomial vnl_real_npolynomial::deriv | ( | unsigned int | i | ) |
Differentiate the polynomial with respect to the ith variable.
Definition at line 102 of file vnl_real_npolynomial.cxx.
| double vnl_real_npolynomial::deval | ( | const vnl_vector< double > & | x, |
| unsigned int | i | ||
| ) |
Evaluate the derivative of the polynomial at x with respect to the ith variable.
Definition at line 87 of file vnl_real_npolynomial.cxx.
| vnl_vector< double > vnl_real_npolynomial::deval | ( | const vnl_vector< double > & | x | ) |
Evaluate the gradient of the polynomial at x.
Definition at line 92 of file vnl_real_npolynomial.cxx.
| double vnl_real_npolynomial::eval | ( | const vnl_vector< double > & | x | ) |
Evaluate the polynomial at x.
Definition at line 75 of file vnl_real_npolynomial.cxx.
|
private |
Definition at line 63 of file vnl_real_npolynomial.cxx.
|
inline |
Return the highest degree of the polynomial in an individual variable.
Definition at line 113 of file vnl_real_npolynomial.h.
| vnl_real_npolynomial vnl_real_npolynomial::operator * | ( | vnl_real_npolynomial const & | P | ) | const |
Definition at line 219 of file vnl_real_npolynomial.cxx.
| vnl_real_npolynomial vnl_real_npolynomial::operator * | ( | double | P | ) | const |
Definition at line 239 of file vnl_real_npolynomial.cxx.
| vnl_real_npolynomial & vnl_real_npolynomial::operator *= | ( | vnl_real_npolynomial const & | rhs | ) |
Definition at line 262 of file vnl_real_npolynomial.cxx.
|
inline |
Definition at line 100 of file vnl_real_npolynomial.h.
|
inline |
Access to the polynomial coefficients.
Definition at line 119 of file vnl_real_npolynomial.h.
|
inline |
Access to the polynomial coefficients.
Definition at line 121 of file vnl_real_npolynomial.h.
| vnl_real_npolynomial vnl_real_npolynomial::operator+ | ( | vnl_real_npolynomial const & | P | ) | const |
Definition at line 164 of file vnl_real_npolynomial.cxx.
| vnl_real_npolynomial vnl_real_npolynomial::operator+ | ( | double | P | ) | const |
Definition at line 183 of file vnl_real_npolynomial.cxx.
| vnl_real_npolynomial & vnl_real_npolynomial::operator+= | ( | vnl_real_npolynomial const & | rhs | ) |
Definition at line 254 of file vnl_real_npolynomial.cxx.
| vnl_real_npolynomial vnl_real_npolynomial::operator- | ( | ) | const |
Definition at line 154 of file vnl_real_npolynomial.cxx.
| vnl_real_npolynomial vnl_real_npolynomial::operator- | ( | vnl_real_npolynomial const & | P | ) | const |
Definition at line 200 of file vnl_real_npolynomial.cxx.
|
inline |
Definition at line 98 of file vnl_real_npolynomial.h.
| vnl_real_npolynomial & vnl_real_npolynomial::operator-= | ( | vnl_real_npolynomial const & | rhs | ) |
Definition at line 258 of file vnl_real_npolynomial.cxx.
|
inline |
Definition at line 101 of file vnl_real_npolynomial.h.
|
inline |
Definition at line 102 of file vnl_real_npolynomial.h.
|
inline |
Return the polynomial matrix.
(ie specifying the variables in each product)
Definition at line 133 of file vnl_real_npolynomial.h.
|
inline |
Return the vector of coefficients.
Definition at line 136 of file vnl_real_npolynomial.h.
| void vnl_real_npolynomial::set | ( | const vnl_vector< double > & | c, |
| const vnl_matrix< unsigned int > & | p | ||
| ) |
Set vector of coefficients of each product.
Definition at line 120 of file vnl_real_npolynomial.cxx.
|
private |
Combine terms with identical exponents (i.e., identical rows in polyn_).
Remove terms with zero coefficient, also at the end of the vector.
Definition at line 41 of file vnl_real_npolynomial.cxx.
|
friend |
Definition at line 250 of file vnl_real_npolynomial.cxx.
|
friend |
Definition at line 69 of file vnl_real_npolynomial.h.
|
related |
Binary load vnl_real_polynomial from stream.
Definition at line 23 of file vnl_io_real_npolynomial.cxx.
|
related |
Binary save vnl_real_npolynomial to stream.
Definition at line 12 of file vnl_io_real_npolynomial.cxx.
|
related |
Print human readable summary of object to a stream.
Definition at line 49 of file vnl_io_real_npolynomial.cxx.
|
private |
coefficients.
Definition at line 59 of file vnl_real_npolynomial.h.
|
private |
max. degree of polynomial.
Definition at line 67 of file vnl_real_npolynomial.h.
|
private |
number of terms of polynomial.
Definition at line 65 of file vnl_real_npolynomial.h.
|
private |
number of variables = # columns of polyn_.
Definition at line 63 of file vnl_real_npolynomial.h.
|
private |
degrees of every term for every variable.
Definition at line 61 of file vnl_real_npolynomial.h.
1.8.15