Rosetta
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
[legend]

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

◆ Polynomial_1d() [1/2]

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 
)

ctor

References check_invariants().

◆ Polynomial_1d() [2/2]

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

References check_invariants().

◆ ~Polynomial_1d()

numeric::Polynomial_1d::~Polynomial_1d ( )
overridedefault

Member Function Documentation

◆ check_invariants()

void numeric::Polynomial_1d::check_invariants ( ) const

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

Referenced by Polynomial_1d().

◆ coefficients()

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

References coefficients_.

◆ degree()

Size numeric::Polynomial_1d::degree ( ) const

References degree_.

◆ eval()

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

just evaluate the polynomial, w/o derivatives

References coefficients_, degree_, create_a3b_hbs::i, max_val_, min_val_, value, xmax_, and xmin_.

◆ max_val()

Real numeric::Polynomial_1d::max_val ( ) const

References max_val_.

◆ min_val()

Real numeric::Polynomial_1d::min_val ( ) const

References min_val_.

◆ name()

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

◆ operator()()

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.

Parameters
variable- [in] - evaluate polynomial(value)
value- [out] - returned output
deriv- [out] - returned output
Global Read:
Global Write:
Remarks
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

References:
Author
Jack Snoeyink
Matthew O'Meara

References coefficients_, degree_, create_a3b_hbs::i, max_val_, min_val_, value, xmax_, and xmin_.

◆ root1()

Real numeric::Polynomial_1d::root1 ( ) const

References root1_.

◆ root2()

Real numeric::Polynomial_1d::root2 ( ) const

References root2_.

◆ show()

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

◆ xmax()

Real numeric::Polynomial_1d::xmax ( ) const

References xmax_.

◆ xmin()

Real numeric::Polynomial_1d::xmin ( ) const

References xmin_.

Member Data Documentation

◆ coefficients_

utility::vector1< Real > numeric::Polynomial_1d::coefficients_
private

◆ degree_

Size numeric::Polynomial_1d::degree_
private

◆ max_val_

Real numeric::Polynomial_1d::max_val_
private

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

◆ min_val_

Real numeric::Polynomial_1d::min_val_
private

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

◆ polynomial_name_

std::string numeric::Polynomial_1d::polynomial_name_
private

Referenced by name(), and show().

◆ root1_

Real numeric::Polynomial_1d::root1_
private

Referenced by root1(), and show().

◆ root2_

Real numeric::Polynomial_1d::root2_
private

Referenced by root2(), and show().

◆ xmax_

Real numeric::Polynomial_1d::xmax_
private

◆ xmin_

Real numeric::Polynomial_1d::xmin_
private

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