2 #ifndef vnl_real_polynomial_h_ 3 #define vnl_real_polynomial_h_ 23 # include <vcl_msvc_warnings.h> 26 #include "vnl/vnl_export.h" 46 if (a.
empty()) { coeffs_.set_size(1); coeffs_(0)=0.0; }
53 if (len==0) { coeffs_.set_size(1); coeffs_(0)=0.0; }
68 double evaluate(
double x)
const;
71 double evaluate_integral(
double x)
const;
74 double evaluate_integral(
double x1,
double x2)
const;
77 double devaluate(
double x)
const;
80 std::complex<double> evaluate(std::complex<double>
const& x)
const;
84 std::complex<double> devaluate(std::complex<double>
const& x)
const;
105 int degree()
const {
return int(coeffs_.size()) - 1; }
108 double& operator [] (
int i) {
return coeffs_[i]; }
110 double operator [] (
int i)
const {
return coeffs_[i]; }
120 void print(std::ostream& os)
const;
146 double x1,
double x2);
148 #endif // vnl_real_polynomial_h_ vnl_bignum operator+(vnl_bignum const &r1, long r2)
Returns the sum of two bignum numbers.
vnl_vector< double > & coefficients()
Return the vector of coefficients.
vnl_real_polynomial(vnl_vector< double > const &a)
Initialize polynomial.
bool operator==(vnl_real_polynomial const &p) const
comparison operator.
const vnl_vector< double > & coefficients() const
Return the vector of coefficients.
Evaluation of real polynomials at real and complex points.
vnl_real_polynomial(double a)
Initialize polynomial from double.
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].
vnl_real_polynomial(double const *a, unsigned len)
Initialize polynomial from C vector.
void set_coefficients(vnl_vector< double > const &coeffs)
vnl_real_polynomial(int d)
Initialize polynomial of a given degree.
vnl_bignum operator-(vnl_bignum const &r1, vnl_bignum const &r2)
Returns the difference of two bignum numbers.
vnl_vector< double > coeffs_
The coefficients of the polynomial.
vnl_bignum operator *(vnl_bignum const &r1, vnl_bignum const &r2)
Returns the product of two bignum numbers.
bool empty() const
Return true iff the size is zero.
int degree() const
Return the degree (highest power of x) of the polynomial.
vnl_real_polynomial(unsigned int d)