|
| | QuadraticT ()=default |
| | Build an empty quadratic solver instance.
|
| | QuadraticT (T_real const &a, T_real const &b, T_real const &c) |
| void | setup (T_real const &a, T_real const &b, T_real const &c) |
| integer | num_roots () const |
| integer | numRoots () const |
| | Alias of num_roots().
|
| bool | complex_root () const |
| bool | complexRoot () const |
| | Alias of complex_root().
|
| bool | double_root () const |
| bool | doubleRoot () const |
| | Alias of double_root().
|
| integer | get_real_roots (T_real r[]) const |
| integer | getRealRoots (T_real r[]) const |
| | Alias of get_real_roots().
|
| integer | get_positive_roots (T_real r[]) const |
| integer | getPositiveRoots (T_real r[]) const |
| | Alias of get_positive_roots().
|
| integer | get_negative_roots (T_real r[]) const |
| integer | getNegativeRoots (T_real r[]) const |
| | Alias of get_negative_roots().
|
| integer | get_roots_in_range (T_real const &a, T_real const &b, T_real r[]) const |
| integer | getRootsInRange (T_real const &a, T_real const &b, T_real r[]) const |
| | Alias of get_roots_in_range().
|
| integer | get_roots_in_open_range (T_real const &a, T_real const &b, T_real r[]) const |
| integer | getRootsInOpenRange (T_real const &a, T_real const &b, T_real r[]) const |
| | Alias of get_roots_in_open_range().
|
| T_real | real_root0 () const |
| T_real | real_root1 () const |
| T_complex | root0 () const |
| | Return the first root as a complex value.
|
| T_complex | root1 () const |
| | Return the second root as a complex value.
|
| void | get_root0 (T_real &re, T_real &im) const |
| void | getRoot0 (T_real &re, T_real &im) const |
| | Alias of get_root0().
|
| void | get_root0 (T_complex &r) const |
| void | getRoot0 (T_complex &r) const |
| | Alias of get_root0().
|
| void | get_root1 (T_real &re, T_real &im) const |
| void | getRoot1 (T_real &re, T_real &im) const |
| | Alias of get_root1().
|
| void | get_root1 (T_complex &r) const |
| void | getRoot1 (T_complex &r) const |
| | Alias of get_root1().
|
| T_complex | root (integer const i) const |
| void | get_root (integer const i, T_real &re, T_real &im) const |
| T_real | eval (T_real const &x) const |
| T_complex | eval (T_complex const &x) const |
| void | eval (T_real const &x, T_real &p, T_real &dp) const |
| void | info (ostream_type &s) const |
| bool | check (ostream_type &s) const |
template<typename T_real, typename T_complex>
class PolynomialRoots::QuadraticT< T_real, T_complex >
Quadratic polynomial class
Constructor
double a = 1;
double b = 2;
double c = 3;
void setup(T_real const &a, T_real const &b, T_real const &c)
Definition PolynomialRoots.hh:303
QuadraticT< real_type, real_complex > Quadratic
Definition PolynomialRoots.hh:552
Get kind of solution
bool complex_root() const
Definition PolynomialRoots.hh:329
integer num_roots() const
Definition PolynomialRoots.hh:321
bool double_root() const
Definition PolynomialRoots.hh:337
Get real roots
double r_min = 0;
double r_max = 2;
double r[2];
int nroots;
nroots = p.getRealRoots( r );
nroots = p.getPositiveRoots( r );
nroots = p.getNegativeRoots( r );
nroots = p.getRootsInRange( r_min, r_max, r );
nroots = p.getRootsInOpenRange( r_min, r_max, r );
Get roots
double re, im;
p.getRoot0( re, im );
p.getRoot0( r );
p.getRoot1( re, im );
p.getRoot1( r );
Lightweight complex number type used by the standard-precision solvers.
Definition PolynomialRoots-complex.hxx:30
double real_type
Scalar type used by the standard-precision API.
Definition PolynomialRoots.hh:66
Evaluate polynomial
{double or complex} v, x;
v = p.eval( x );
p.eval( x, p, dp );
Information
p.info( cout );
bool ok = p.check( cout );
template<typename T_real, typename T_complex>
Return the number of computed roots of
\[ q(x) = a x^2 + b x + c \]
Normally return 2 but if e.g. \( a = 0 \) return 1 or less depending on the values of \( a, b, c \)
- Returns
- number of computed roots