ContRap-Libraries
Public Member Functions | Protected Attributes

crp::RealPolynomial Class Reference

Class RealPolynomial represents a polynomial function over the reals. More...

#include <functions.h>

Inheritance diagram for crp::RealPolynomial:
crp::RealFunction crp::Function< double >

Public Member Functions

 RealPolynomial (const std::vector< double > &coefficients=std::vector< double >())
 Creates a polynomial from coefficients.
virtual ~RealPolynomial ()
 Virtual destructor.
virtual double operator() (double x)
 Evaluates the function at a given point.
std::vector< double > & get_coefficients ()
 Returns the coefficients vector.
void set_coefficients (std::vector< double > &coefficients)
 Sets the coefficients vector by making a copy.
int get_max_degree ()
 Returns the maximal degree of the polynomial.

Protected Attributes

std::vector< double > coefficients
 Coefficients in ascending order.

Detailed Description

Class RealPolynomial represents a polynomial function over the reals.


Constructor & Destructor Documentation

crp::RealPolynomial::RealPolynomial ( const std::vector< double > &  coefficients = std::vector< double >())

Creates a polynomial from coefficients.

Parameters:
coefficientsArray of coefficients in ascending order
virtual crp::RealPolynomial::~RealPolynomial ( ) [inline, virtual]

Virtual destructor.


Member Function Documentation

std::vector<double>& crp::RealPolynomial::get_coefficients ( )

Returns the coefficients vector.

Returns:
List of coefficients in ascending order
int crp::RealPolynomial::get_max_degree ( ) [inline]

Returns the maximal degree of the polynomial.

Returns:
Maximal degree of the polynomial
virtual double crp::RealPolynomial::operator() ( double  x) [virtual]

Evaluates the function at a given point.

Parameters:
xEvaluation point

Implements crp::RealFunction.

void crp::RealPolynomial::set_coefficients ( std::vector< double > &  coefficients)

Sets the coefficients vector by making a copy.

Parameters:
coefficientsVector of coefficients

Field Documentation

std::vector<double> crp::RealPolynomial::coefficients [protected]

Coefficients in ascending order.


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