Rosetta  2020.37
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Attributes | List of all members
numeric::Polynomial_1d Class Reference

#include <polynomial.hh>

Inheritance diagram for numeric::Polynomial_1d:
Inheritance graph

Public Member Functions

 Polynomial_1d (std::string const &polynomial_name, Real const xmin, Real const xmax, Real const min_val, Real const max_val, Real const root1, Real const root2, Size degree, utility::vector1< Real > const &coefficients)
 ctor More...
 Polynomial_1d (Polynomial_1d const &src)
 ~Polynomial_1d () override
void check_invariants () const
std::string const & name () const
Real xmin () const
Real xmax () const
Real min_val () const
Real max_val () const
Real root1 () const
Real root2 () const
Size degree () const
utility::vector1< Real > const & coefficients () const
void operator() (double const variable, double &value, double &deriv) const
 Evaluate the polynomial and its derivative. More...
double eval (double const variable)
 just evaluate the polynomial, w/o derivatives More...
void show (std::ostream &out) const
- Public Member Functions inherited from utility::VirtualBase
 VirtualBase ()=default
 Default constructor. More...
virtual ~VirtualBase ()=default
 The virtual destructor is one of the main reasons for the VirtualBase class. More...
 VirtualBase (VirtualBase const &)=default
 VirtualBase (VirtualBase &&)=default
VirtualBaseoperator= (VirtualBase const &)=default
VirtualBaseoperator= (VirtualBase &&)=default

Private Attributes

std::string polynomial_name_
Real xmin_
Real xmax_
Real min_val_
Real max_val_
Real root1_
Real root2_
Size degree_
utility::vector1< Realcoefficients_

Constructor & Destructor Documentation

numeric::Polynomial_1d::Polynomial_1d ( std::string const &  polynomial_name,
Real const  xmin,
Real const  xmax,
Real const  min_val,
Real const  max_val,
Real const  root1,
Real const  root2,
Size  degree,
utility::vector1< Real > const &  coefficients 


References check_invariants().

numeric::Polynomial_1d::Polynomial_1d ( Polynomial_1d const &  src)

References check_invariants().

numeric::Polynomial_1d::~Polynomial_1d ( )

Member Function Documentation

void numeric::Polynomial_1d::check_invariants ( ) const

References coefficients_, CREATE_EXCEPTION, degree_, xmax_, and xmin_.

Referenced by Polynomial_1d().

vector1< Real > const & numeric::Polynomial_1d::coefficients ( ) const

References coefficients_.

Size numeric::Polynomial_1d::degree ( ) const

References degree_.

double numeric::Polynomial_1d::eval ( double const  variable)

just evaluate the polynomial, w/o derivatives

References coefficients_, degree_, max_val_, min_val_, value, xmax_, and xmin_.

Real numeric::Polynomial_1d::max_val ( ) const

References max_val_.

Real numeric::Polynomial_1d::min_val ( ) const

References min_val_.

string const & numeric::Polynomial_1d::name ( ) const

References polynomial_name_.

void numeric::Polynomial_1d::operator() ( double const  variable,
double value,
double deriv 
) const

Evaluate the polynomial and its derivative.

evaluate the polynomial and its derivative.

variable- [in] - evaluate polynomial(value)
value- [out] - returned output
deriv- [out] - returned output
Global Read:
Global Write:
Note the coefficients must be in reverse order: low to high

Polynomial value and derivative using Horner's rule value = Sum_(i = 1,...,N) [ coeff_i * variable^(i-1) ] deriv = Sum_(i = 2,...,N) [ ( i - 1 ) * coeff_i * variable^(i-2) ] JSS: Horner's rule for evaluating polynomials is based on rewriting the polynomial as: JSS: p(x) = a0 + x*(a1 + x*(a2 + x*(... x*(aN)...))) JSS: or value_k = a_k + x*value_k+1 for k = N-1 to 0 JSS: and the derivative is JSS: deriv_k = value_k+1 + deriv_k+1 for k = N-1 to 1

Jack Snoeyink
Matthew O'Meara

References coefficients_, degree_, max_val_, min_val_, xmax_, and xmin_.

Real numeric::Polynomial_1d::root1 ( ) const

References root1_.

Real numeric::Polynomial_1d::root2 ( ) const

References root2_.

void numeric::Polynomial_1d::show ( std::ostream &  out) const
Real numeric::Polynomial_1d::xmax ( ) const

References xmax_.

Real numeric::Polynomial_1d::xmin ( ) const

References xmin_.

Member Data Documentation

utility::vector1< Real > numeric::Polynomial_1d::coefficients_
Size numeric::Polynomial_1d::degree_
Real numeric::Polynomial_1d::max_val_

Referenced by eval(), max_val(), operator()(), and show().

Real numeric::Polynomial_1d::min_val_

Referenced by eval(), min_val(), operator()(), and show().

std::string numeric::Polynomial_1d::polynomial_name_

Referenced by name(), and show().

Real numeric::Polynomial_1d::root1_

Referenced by root1(), and show().

Real numeric::Polynomial_1d::root2_

Referenced by root2(), and show().

Real numeric::Polynomial_1d::xmax_
Real numeric::Polynomial_1d::xmin_

The documentation for this class was generated from the following files: