Class cubic_real_coeff_gsl2 (o2scl)

O2scl : Class List

template<class fp_t = double, class cx_t = std::complex<fp_t>>
class cubic_real_coeff_gsl2 : public o2scl::cubic_real_coeff<double, std::complex<double>>

Solve a cubic with real coefficients and complex roots (C++ rewrite of GSL algorithm)

This class is designed to be identical to the GSL code in gsl_poly_complex_solve_cubic(), but generalized to generic floating point types.

Public Functions

inline virtual ~cubic_real_coeff_gsl2()
inline virtual int solve_rc(const fp_t a3, const fp_t b3, const fp_t c3, const fp_t d3, fp_t &x1, cx_t &x2, cx_t &x3)

Solves the polynomial \( a_3 x^3 + b_3 x^2 + c_3 x + d_3= 0 \) giving the real solution \( x=x_1 \) and two complex solutions \( x=x_2 \) and \( x=x_3 \) .

inline const char *type()

Return a string denoting the type (“cubic_real_coeff_gsl2”)

Protected Functions

inline void swap(double &a, double &b)