![]() |
Quartic roots
Utilities for C++ programming
|
Classes | |
| class | CubicT |
| class | QuadraticT |
| class | QuarticT |
| class | real_complex |
| Lightweight complex number type used by the standard-precision solvers. More... | |
Typedefs | |
| using | real_type = double |
| Scalar type used by the standard-precision API. | |
| using | integer = int |
| Integer type used for degrees, counts and indices. | |
| using | ostream_type = std::basic_ostream<char> |
| Output stream type used by diagnostic methods. | |
| using | istream_type = std::basic_istream<char> |
| Input stream type reserved for formatted input helpers. | |
| using | Quadratic = QuadraticT<real_type, real_complex> |
| using | Cubic = CubicT<real_type, real_complex> |
| using | Quartic = QuarticT<real_type, real_complex> |
Functions | |
| template<typename T_real> | |
| T_real | thirdT () |
| template<typename T_real> | |
| T_real | one27thT () |
| template<typename T_real> | |
| T_real | two27thT () |
| real_complex | operator+ (real_complex const &a, real_complex const &b) |
| Return the sum of two standard-precision complex values. | |
| real_complex | operator+ (real_complex const &a, real_type b) |
| Return the sum of a standard-precision complex value and a real scalar. | |
| real_complex | operator+ (real_type a, real_complex const &b) |
| Return the sum of a real scalar and a standard-precision complex value. | |
| real_complex | operator- (real_complex const &a, real_complex const &b) |
| Return the difference of two standard-precision complex values. | |
| real_complex | operator- (real_complex const &a, real_type b) |
| Return the difference between a standard-precision complex value and a real scalar. | |
| real_complex | operator- (real_type a, real_complex const &b) |
| Return the difference between a real scalar and a standard-precision complex value. | |
| real_complex | operator- (real_complex const &a) |
| Return the additive inverse of a standard-precision complex value. | |
| real_complex | operator* (real_complex const &a, real_complex const &b) |
| Return the product of two standard-precision complex values. | |
| real_complex | operator* (real_complex const &a, real_type b) |
| Return the product of a standard-precision complex value and a real scalar. | |
| real_complex | operator* (real_type a, real_complex const &b) |
| Return the product of a real scalar and a standard-precision complex value. | |
| real_complex | operator/ (real_complex const &a, real_complex const &b) |
| Return the quotient of two standard-precision complex values. | |
| real_complex | operator/ (real_complex const &a, real_type b) |
| Return the quotient of a standard-precision complex value and a real scalar. | |
| real_complex | operator/ (real_type a, real_complex const &b) |
| Return the quotient of a real scalar and a standard-precision complex value. | |
| real_type | abs (real_complex const &value) |
| real_type | abs2 (real_complex const &value) |
| int | roots (real_type const *op, integer const Degree, real_type *zeror, real_type *zeroi) |
| template<> | |
| real_type | machepsiT () |
| template<> | |
| real_type | toleranceT () |
| template<typename T_real> | |
| T_real | eval_poly (T_real const op[], integer const Degree, T_real const &x) |
| template double | eval_poly (double const op[], integer const Degree, double const &x) |
| template<typename T_real> | |
| bool | Newton_step (T_real const op[], integer const Degree, T_real &x) |
| template bool | Newton_step (double const op[], integer const Degree, double &x) |
| template<typename T_real> | |
| void | eval_poly_Dpoly (T_real const op[], integer const Degree, T_real const &x, T_real &p, T_real &dp) |
| template void | eval_poly_Dpoly (double const op[], integer const Degree, double const &x, double &p, double &dp) |
| template<typename T_real, typename T_complex> | |
| T_complex | eval_poly_complex (T_real const op[], integer const Degree, T_complex const &x) |
| template real_complex | eval_poly_complex (real_type const op[], integer const Degree, real_complex const &x) |
| template<typename... Args> | |
| void | root_assert (bool cond, std::format_string< Args... > fmt, Args &&... args) |
| template<typename T_real> | |
| T_real | machepsiT () |
| Return the machine epsilon associated with the scalar type. | |
| template<typename T_real> | |
| T_real | toleranceT () |
| Return the default residual tolerance associated with the scalar type. | |
| template<typename T_real> | |
| T_real | evalMonicCubic (T_real const &x, T_real const &a, T_real const &b, T_real const &c) |
| template<typename T_real> | |
| void | evalMonicCubic (T_real const &x, T_real const &a, T_real const &b, T_real const &c, T_real &p, T_real &dp) |
| Evaluate a monic cubic polynomial and its first derivative. | |
| template<typename T_real> | |
| void | evalMonicCubic (T_real const &x, T_real const &a, T_real const &b, T_real const &c, T_real &p, T_real &dp, T_real &ddp) |
| Evaluate a monic cubic polynomial and its first two derivatives. | |
| template<typename T_real> | |
| T_real | evalMonicQuartic (T_real const &x, T_real const &a, T_real const &b, T_real const &c, T_real const &d) |
| Evaluate a monic quartic polynomial. | |
| template<typename T_real> | |
| void | evalMonicQuartic (T_real const &x, T_real const &a, T_real const &b, T_real const &c, T_real const &d, T_real &p, T_real &dp) |
| Evaluate a monic quartic polynomial and its first derivative. | |
| template<typename T_real> | |
| void | evalMonicQuartic (T_real const &x, T_real const &a, T_real const &b, T_real const &c, T_real const &d, T_real &p, T_real &dp, T_real &ddp) |
| Evaluate a monic quartic polynomial and its first two derivatives. | |
Variables | |
| constexpr integer | MAXDEGREE = 100 |
| Maximum degree accepted by the Jenkins-Traub entry point. | |
Implementation of Flocke algorithm for roots of 3rd and 4th degree polynomials.
There are 3 classed for 2nd, 3rd and 4th degree polynomial. An experimental translation to C++ of a C implementation of Jenkins–Traub algorithm is available.
References
| using PolynomialRoots::Cubic = CubicT<real_type, real_complex> |
| using PolynomialRoots::integer = int |
Integer type used for degrees, counts and indices.
| using PolynomialRoots::istream_type = std::basic_istream<char> |
Input stream type reserved for formatted input helpers.
| using PolynomialRoots::ostream_type = std::basic_ostream<char> |
Output stream type used by diagnostic methods.
| using PolynomialRoots::real_type = double |
Scalar type used by the standard-precision API.
|
inline |
|
inline |
| template double PolynomialRoots::eval_poly | ( | double const | op[], |
| integer const | Degree, | ||
| double const & | x ) |
| T_real PolynomialRoots::eval_poly | ( | T_real const | op[], |
| integer | Degree, | ||
| T_real const & | x ) |
Evaluate a real polynomial at a real point with a numerically stable scheme.
| [in] | op | polynomial coefficients in descending powers |
| [in] | Degree | polynomial degree |
| [in] | x | evaluation point |
x | template real_complex PolynomialRoots::eval_poly_complex | ( | real_type const | op[], |
| integer const | Degree, | ||
| real_complex const & | x ) |
| T_complex PolynomialRoots::eval_poly_complex | ( | T_real const | op[], |
| integer | Degree, | ||
| T_complex const & | x ) |
Evaluate a real polynomial at a complex point.
| [in] | op | polynomial coefficients in descending powers |
| [in] | Degree | polynomial degree |
| [in] | x | complex evaluation point |
x | template void PolynomialRoots::eval_poly_Dpoly | ( | double const | op[], |
| integer const | Degree, | ||
| double const & | x, | ||
| double & | p, | ||
| double & | dp ) |
| void PolynomialRoots::eval_poly_Dpoly | ( | T_real const | op[], |
| integer | Degree, | ||
| T_real const & | x, | ||
| T_real & | p, | ||
| T_real & | dp ) |
Evaluate a real polynomial and its first derivative at a real point.
| [in] | op | polynomial coefficients in descending powers |
| [in] | Degree | polynomial degree |
| [in] | x | evaluation point |
| [out] | p | polynomial value at x |
| [out] | dp | derivative value at x |
|
inline |
Evaluate a monic cubic polynomial.
| [in] | x | evaluation point |
| [in] | a | coefficient of \( x^2 \) |
| [in] | b | coefficient of \( x \) |
| [in] | c | constant coefficient |
|
inline |
Evaluate a monic cubic polynomial and its first derivative.
|
inline |
Evaluate a monic cubic polynomial and its first two derivatives.
|
inline |
Evaluate a monic quartic polynomial.
|
inline |
Evaluate a monic quartic polynomial and its first derivative.
|
inline |
Evaluate a monic quartic polynomial and its first two derivatives.
| real_type PolynomialRoots::machepsiT | ( | ) |
| T_real PolynomialRoots::machepsiT | ( | ) |
Return the machine epsilon associated with the scalar type.
| template bool PolynomialRoots::Newton_step | ( | double const | op[], |
| integer const | Degree, | ||
| double & | x ) |
| bool PolynomialRoots::Newton_step | ( | T_real const | op[], |
| integer | Degree, | ||
| T_real & | x ) |
Apply one Newton update to a real polynomial root estimate.
| [in] | op | polynomial coefficients in descending powers |
| [in] | Degree | polynomial degree |
| [in,out] | x | current estimate, overwritten with the updated value |
|
inline |
|
inline |
Return the product of two standard-precision complex values.
|
inline |
Return the product of a standard-precision complex value and a real scalar.
|
inline |
Return the product of a real scalar and a standard-precision complex value.
|
inline |
Return the sum of two standard-precision complex values.
|
inline |
Return the sum of a standard-precision complex value and a real scalar.
|
inline |
Return the sum of a real scalar and a standard-precision complex value.
|
inline |
Return the additive inverse of a standard-precision complex value.
|
inline |
Return the difference of two standard-precision complex values.
|
inline |
Return the difference between a standard-precision complex value and a real scalar.
|
inline |
Return the difference between a real scalar and a standard-precision complex value.
|
inline |
Return the quotient of two standard-precision complex values.
|
inline |
Return the quotient of a standard-precision complex value and a real scalar.
|
inline |
Return the quotient of a real scalar and a standard-precision complex value.
|
inline |
Lightweight assertion helper used by the solvers to validate inputs.
| [in] | cond | condition that must hold |
| [in] | fmt | format string used to build the diagnostic message |
| [in] | args | arguments interpolated in fmt |
|
nodiscard |
Find roots of a generic polynomial using Jenkins-Traub method
| [in] | op | the coefficients of the polynomial |
| [in] | Degree | degree of the polynomial |
| [out] | zeror | real part of the roots |
| [out] | zeroi | imaginary part of the roots |
|
inline |
| real_type PolynomialRoots::toleranceT | ( | ) |
| T_real PolynomialRoots::toleranceT | ( | ) |
Return the default residual tolerance associated with the scalar type.
|
inline |
|
inlineconstexpr |
Maximum degree accepted by the Jenkins-Traub entry point.