ReFRACtor
FullPhysics::Poly1d Class Reference

A one-dimensional polynomial class. More...

#include <polynomial_eval.h>

+ Inheritance diagram for FullPhysics::Poly1d:
+ Collaboration diagram for FullPhysics::Poly1d:

Public Member Functions

 Poly1d (const ArrayAd< double, 1 > &Coefficients, const bool Decreasing_order=true)
 The polynomial's coefficients, in decreasing powers. More...
 
double operator() (double Value) const
 Evaluate polynomial for a value. More...
 
AutoDerivative< double > operator() (const AutoDerivative< double > &Value) const
 
blitz::Array< double, 1 > operator() (const blitz::Array< double, 1 > &Arr) const
 Evaluate polynomial for an array. More...
 
ArrayAd< double, 1 > operator() (const ArrayAd< double, 1 > &Arr) const
 
virtual void print (std::ostream &Os) const
 
std::string print_to_string () const
 Print to string. More...
 

Detailed Description

A one-dimensional polynomial class.

A convenience class, used to encapsulate "natural" operations on polynomials so that said operations may take on their customary form in code.

Evaluation is done Horner's Scheme to reduce problems due to round off error and overflows.

Inspired by numpy.poly1d

Additionally handles ArrayAd data correctly.

Definition at line 21 of file polynomial_eval.h.

Constructor & Destructor Documentation

◆ Poly1d()

FullPhysics::Poly1d::Poly1d ( const ArrayAd< double, 1 > &  Coefficients,
const bool  Decreasing_order = true 
)
inline

The polynomial's coefficients, in decreasing powers.

Definition at line 27 of file polynomial_eval.h.

Member Function Documentation

◆ operator()() [1/4]

double Poly1d::operator() ( double  Value) const

Evaluate polynomial for a value.

Definition at line 6 of file polynomial_eval.cc.

◆ operator()() [2/4]

AutoDerivative< double > Poly1d::operator() ( const AutoDerivative< double > &  Value) const

Definition at line 17 of file polynomial_eval.cc.

◆ operator()() [3/4]

Array< double, 1 > Poly1d::operator() ( const blitz::Array< double, 1 > &  Arr) const

Evaluate polynomial for an array.

Definition at line 37 of file polynomial_eval.cc.

◆ operator()() [4/4]

ArrayAd< double, 1 > Poly1d::operator() ( const ArrayAd< double, 1 > &  Arr) const

Definition at line 29 of file polynomial_eval.cc.

◆ print()

void Poly1d::print ( std::ostream &  Os) const
virtual

Definition at line 57 of file polynomial_eval.cc.

◆ print_to_string()

std::string FullPhysics::Printable< Poly1d >::print_to_string ( ) const
inlineinherited

Print to string.

This is primarily useful for SWIG wrappers to this class, e.g. a to_s method in ruby.

Definition at line 31 of file printable.h.


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

Copyright © 2017, California Institute of Technology.
ALL RIGHTS RESERVED.
U.S. Government Sponsorship acknowledged.
Generated Fri Aug 24 2018 15:44:13