#include <polynomial1d.h>
Polynomial1d is a representation of a polynomial that can calculate values at a given input
◆ Polynomial1d() [1/4]
Construct a zero polynomial
◆ Polynomial1d() [2/4]
Construct a polynomial from coefficients of the form coeffs[0] + coeffs[1]*x^(1) + ... + coeffs[n-1]*x^(n-1)
- Parameters
-
| coeffs | coefficients of the polynomial |
◆ Polynomial1d() [3/4]
| Polynomial1d |
( |
const std::initializer_list< double > & |
coeffs | ) |
|
|
explicit |
Construct a polynomial from coefficients of the form coeffs[0] + coeffs[1]*x^(1) + ... + coeffs[n-1]*x^(n-1)
- Parameters
-
| coeffs | coefficients of the polynomial |
◆ Polynomial1d() [4/4]
Construct a polynomial from a series of constraints (input/output pairs)
- Parameters
-
| constraints | A series of pairs, where each pair is of the form {input, output}, indicating the output that the created polynomial must have for a given input. |
| constraints | A series of constraints that define the polynomial. Note that all inputs must be unique, and there must be at least two constraints. |
- Exceptions
-
| std::invalid_argument | if any two inputs are equal, or if there are less then two constraints |
◆ getCoeff()
| double getCoeff |
( |
unsigned int |
order | ) |
const |
Returns the coefficient of the term of given order
- Parameters
-
| order | the order of the term |
- Returns
- the coefficient of the term
◆ getOrder()
| unsigned int getOrder |
( |
| ) |
const |
Returns the order of the Polynomial1d
- Returns
- the index of the highest order non-zero coefficient
◆ setCoeff()
| void setCoeff |
( |
unsigned int |
order, |
|
|
double |
coeff |
|
) |
| |
Sets the coefficient of the term of given order
- Parameters
-
| order | the order of the term to set the coefficient |
| coeff | the coefficient |
◆ valueAt()
| double valueAt |
( |
double |
val | ) |
const |
Calculates the value of polynomial evaluated at value val
- Parameters
-
| val | value to evaluate polynomial |
- Returns
- value of polynomial evaluated at value val
The documentation for this class was generated from the following files: