Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

vnl_real_npolynomial Class Reference

#include <vnl_real_npolynomial.h>

List of all members.


Detailed Description

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 $A X^3 + B XY + C Y^2 + D XY^2$ 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 54 of file 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 poylnomial with coefficients vector c and with exponents matrix p.
double eval (const vnl_vector< double > &x)
 Evaluate the polynomial at x.
double deval (const vnl_vector< double > &x, unsigned int i)
 Evaluate the derivative of the polynomial at x with respect to the ith variable.
vnl_vector< double > deval (const vnl_vector< double > &x)
 Evaluate the gradient of the polynomial at x.
vnl_real_npolynomial deriv (unsigned int i)
 Differentiate the polynomial with respect to the ith variable.
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+ (double) const
vnl_real_npolynomial operator- (double P) const
vnl_real_npolynomial operator * (double) const
vnl_real_npolynomialoperator *= (double P)
vnl_real_npolynomial operator/ (double P) const
vnl_real_npolynomialoperator/= (double P)
unsigned int degree () const
 Return the degree (highest total power of all terms) of the polynomial.
unsigned int maxdegree () const
 Return the highest degree of the polynomial in an individual variable.
vcl_vector< unsigned int > degrees () const
 Return the degrees (highest power of all terms) in each of the variables.
double & operator[] (unsigned int i)
 Access to the polynomial coefficients.
double operator[] (unsigned 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 (const vnl_vector< double > &c, const vnl_matrix< unsigned int > &p)
 Set vector of coefficients of each product.
const vnl_matrix< unsigned
int > & 
polyn () const
 Return the polynomial matrix.
vnl_matrix< unsigned int > & polyn ()
 Return the vector of coefficients.
vcl_string asString () const
 Return the textual representation of this polynomial.

Private Member Functions

void simplify ()
 Combine terms with identical exponents (i.e.
double eval (const vnl_matrix< double > &xn)

Private Attributes

vnl_vector< double > coeffs_
 coefficients.
vnl_matrix< unsigned int > polyn_
 degrees of every term for every variable.
unsigned int nvar_
 number of variables = # columns of polyn_.
unsigned int nterms_
 number of terms of polynomial.
unsigned int ideg_
 max. degree of polynomial.

Friends

class vnl_rnpoly_solve
vcl_ostream & operator<< (vcl_ostream &, vnl_real_npolynomial const &)


Constructor & Destructor Documentation

vnl_real_npolynomial::vnl_real_npolynomial  )  [inline]
 

Definition at line 72 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 poylnomial with coefficients vector c and with exponents matrix p.

 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 31 of file vnl_real_npolynomial.cxx.


Member Function Documentation

vcl_string vnl_real_npolynomial::asString  )  const
 

Return the textual representation of this polynomial.

Definition at line 258 of file vnl_real_npolynomial.cxx.

vnl_vector<double>& vnl_real_npolynomial::coefficients  )  [inline]
 

Return the vector of coefficients.

Definition at line 121 of file vnl_real_npolynomial.h.

const vnl_vector<double>& vnl_real_npolynomial::coefficients  )  const [inline]
 

Return the vector of coefficients.

Definition at line 119 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 132 of file vnl_real_npolynomial.cxx.

vcl_vector< unsigned int > vnl_real_npolynomial::degrees  )  const
 

Return the degrees (highest power of all terms) in each of the variables.

Definition at line 145 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 105 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 95 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 90 of file vnl_real_npolynomial.cxx.

double vnl_real_npolynomial::eval const vnl_matrix< double > &  xn  )  [private]
 

Definition at line 66 of file vnl_real_npolynomial.cxx.

double vnl_real_npolynomial::eval const vnl_vector< double > &  x  ) 
 

Evaluate the polynomial at x.

Definition at line 78 of file vnl_real_npolynomial.cxx.

unsigned int vnl_real_npolynomial::maxdegree  )  const [inline]
 

Return the highest degree of the polynomial in an individual variable.

Definition at line 108 of file vnl_real_npolynomial.h.

vnl_real_npolynomial vnl_real_npolynomial::operator * double   )  const
 

Definition at line 242 of file vnl_real_npolynomial.cxx.

vnl_real_npolynomial vnl_real_npolynomial::operator * vnl_real_npolynomial const &   )  const
 

Definition at line 222 of file vnl_real_npolynomial.cxx.

vnl_real_npolynomial& vnl_real_npolynomial::operator *= double  P  )  [inline]
 

Definition at line 95 of file vnl_real_npolynomial.h.

vnl_real_npolynomial vnl_real_npolynomial::operator+ double   )  const
 

Definition at line 186 of file vnl_real_npolynomial.cxx.

vnl_real_npolynomial vnl_real_npolynomial::operator+ vnl_real_npolynomial const &   )  const
 

Definition at line 167 of file vnl_real_npolynomial.cxx.

vnl_real_npolynomial vnl_real_npolynomial::operator- double  P  )  const [inline]
 

Definition at line 93 of file vnl_real_npolynomial.h.

vnl_real_npolynomial vnl_real_npolynomial::operator- vnl_real_npolynomial const &   )  const
 

Definition at line 203 of file vnl_real_npolynomial.cxx.

vnl_real_npolynomial vnl_real_npolynomial::operator-  )  const
 

Definition at line 157 of file vnl_real_npolynomial.cxx.

vnl_real_npolynomial vnl_real_npolynomial::operator/ double  P  )  const [inline]
 

Definition at line 96 of file vnl_real_npolynomial.h.

vnl_real_npolynomial& vnl_real_npolynomial::operator/= double  P  )  [inline]
 

Definition at line 97 of file vnl_real_npolynomial.h.

double vnl_real_npolynomial::operator[] unsigned int  i  )  const [inline]
 

Access to the polynomial coefficients.

Definition at line 116 of file vnl_real_npolynomial.h.

double& vnl_real_npolynomial::operator[] unsigned int  i  )  [inline]
 

Access to the polynomial coefficients.

Definition at line 114 of file vnl_real_npolynomial.h.

vnl_matrix<unsigned int>& vnl_real_npolynomial::polyn  )  [inline]
 

Return the vector of coefficients.

Definition at line 131 of file vnl_real_npolynomial.h.

const vnl_matrix<unsigned int>& vnl_real_npolynomial::polyn  )  const [inline]
 

Return the polynomial matrix.

(ie specifying the variables in each product)

Definition at line 128 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 123 of file vnl_real_npolynomial.cxx.

void vnl_real_npolynomial::simplify  )  [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 44 of file vnl_real_npolynomial.cxx.


Friends And Related Function Documentation

vcl_ostream& operator<< vcl_ostream &  os,
vnl_real_npolynomial const &  P
[friend]
 

Definition at line 253 of file vnl_real_npolynomial.cxx.

friend class vnl_rnpoly_solve [friend]
 

Definition at line 67 of file vnl_real_npolynomial.h.


Member Data Documentation

vnl_vector<double> vnl_real_npolynomial::coeffs_ [private]
 

coefficients.

Definition at line 57 of file vnl_real_npolynomial.h.

unsigned int vnl_real_npolynomial::ideg_ [private]
 

max. degree of polynomial.

Definition at line 65 of file vnl_real_npolynomial.h.

unsigned int vnl_real_npolynomial::nterms_ [private]
 

number of terms of polynomial.

Definition at line 63 of file vnl_real_npolynomial.h.

unsigned int vnl_real_npolynomial::nvar_ [private]
 

number of variables = # columns of polyn_.

Definition at line 61 of file vnl_real_npolynomial.h.

vnl_matrix<unsigned int> vnl_real_npolynomial::polyn_ [private]
 

degrees of every term for every variable.

Definition at line 59 of file vnl_real_npolynomial.h.


The documentation for this class was generated from the following files:
Generated on Thu Jan 10 14:37:40 2008 for core/vnl by  doxygen 1.4.4