![]() |
Sturm
0.0.0
Computing Sturm sequences in C++
|
Polynomial class. More...
#include <Poly.hh>
Inherits Eigen::Vector< Real, Eigen::Dynamic >.
Public Types | |
| using | Vector |
Public Member Functions | |
| Poly () | |
| Class constructor from a vector. | |
| Poly (Integer order) | |
| Class constructor from a vector. | |
| Poly (const Poly &c) | |
| Class constructor from a vector. | |
| Poly (const Vector &c) | |
| Class constructor from a vector. | |
| const Vector & | to_eigen () const |
| Access to the Eigen const class. | |
| void | set_order (Integer order) |
| Set the order of the polynomial. | |
| void | set_degree (Integer degree) |
| Set the degree of the polynomial. | |
| Poly & | set_scalar (Real s) |
| Set the polynomial to a scalar value. | |
| Poly & | set_monomial (Real a) |
| Set the polynomial to a monomial with a given coefficient. | |
| Vector | coeffs () const |
| Get the coefficients of the polynomial. | |
| Integer | degree () const |
| Get the degree of the polynomial. | |
| Integer | order () const |
| Get the order of the polynomial. | |
| std::string | to_string () const |
| Convert the polynomial to a string representation. | |
| Real | evaluate (Real x) const |
| Evaluate the polynomial at a given point. | |
| Real | evaluate_derivative (Real x) const |
| Evaluate the derivative of the polynomial at a given point. | |
| void | evaluate (Real x, Real &p, Real &Dp) const |
| Evaluate the polynomial and its derivative at a given point. | |
| Real | leading_coeff () const |
| Get the leading coefficient of the polynomial. | |
| void | derivative (Poly &res) const |
| Compute the derivative of the polynomial. | |
| void | integral (Poly &res) const |
| Compute the integral of the polynomial. | |
| void | integral (Poly &res, Real c) const |
| Compute the integral of the polynomial with a given constant. | |
| Real | normalize () |
| Normalize the polynomial. | |
| void | purge (const Real eps) |
| Purge small coefficients. | |
| void | adjust_degree () |
| Adjust the degree of the polynomial and remove leading zeros. | |
| Integer | sign_variations () const |
| Count the number of sign variations. | |
| void | make_monic () |
| Normalize the polynomial to monic form. | |
| Poly & | operator= (const Poly &p) |
| Define the assignment with another polynomial. | |
| Poly | operator- () |
| Define the negation of the polynomial. | |
| Poly & | operator+= (const Poly &p) |
| Define the addition with another polynomial. | |
| Poly & | operator-= (const Poly &p) |
| Define the subtraction with another polynomial. | |
| Poly & | operator*= (const Poly &p) |
| Define the multiplication with another polynomial. | |
| Poly & | operator+= (Real s) |
| Define the addition with a scalar. | |
| Poly & | operator-= (Real s) |
| Define the subtraction with a scalar. | |
| Poly & | operator*= (Real s) |
| Define the multiplication with a scalar. | |
Static Public Attributes | |
| static constexpr const Real | EPSILON |
Private Member Functions | |
| Vector & | to_eigen () |
| Access to the Eigen class. | |
Private Attributes | |
| Integer | m_order |
This class implements a polynomial of the form \( p(x) = \sum_{i=0}^n a_i x^i \).
| Real | Scalar number type. |
| using Sturm::Poly< Real >::Vector |
Vector of real numbers.
|
inline |
|
inlineexplicit |
| [in] | order | Order of the polynomial. |
|
inline |
| [in] | c | Vector of coefficients. |
|
inlineexplicit |
| [in] | c | Vector of coefficients. |
|
inline |
Adjust the degree of the polynomial to ensure the leading coefficient is non-zero.
|
inline |
|
inline |
|
inline |
| [out] | res | Polynomial representing the derivative. |
|
inline |
| [in] | x | Point at which to evaluate the polynomial. |
|
inline |
| [in] | x | Point at which to evaluate. |
| [out] | p | Value of the polynomial at the given point. |
| [out] | Dp | Value of the derivative at the given point. |
|
inline |
| [in] | x | Point at which to evaluate the derivative. |
|
inline |
| [out] | res | Polynomial representing the integral. |
|
inline |
| [out] | res | Polynomial representing the integral. |
| [in] | c | Constant value for the integral. |
|
inline |
|
inline |
Scales all coefficients such that the leading coefficient becomes 1. After this operation, the polynomial satisfies \( p(x) = x^n + \sum_{i=0}^{n-1} a_i x^i \), where \( n \) is the polynomial degree.
|
inline |
Normalize the polynomial such that the maximum absolute coefficient is 1.
|
inline |
| [in] | p | Polynomial to multiply. |
|
inline |
| [in] | s | Scalar to multiply. |
|
inline |
| [in] | p | Polynomial to add. |
|
inline |
| [in] | s | Scalar to add. |
|
inline |
|
inline |
| [in] | p | Polynomial to subtract. |
|
inline |
| [in] | s | Scalar to subtract. |
|
inline |
| [in] | p | Polynomial to assign from. |
|
inline |
|
inline |
Purge (set to 0) coefficients that are smaller than or equal to a given epsilon.
| [in] | eps | Epsilon value for purging coefficients. |
|
inline |
| [in] | degree | Degree of the polynomial. |
|
inline |
| [in] | a | Coefficient of the monomial. |
|
inline |
| [in] | order | Order of the polynomial. |
|
inline |
| [in] | s | Scalar value. |
|
inline |
Count the number of sign variations in the polynomial coefficients.
|
inlineprivate |
|
inline |
|
inline |
|
staticconstexpr |
Machine epsilon.
|
private |
Polynomial order.