|
ccgsl 2.7.2
C++wrappersforGnuScientificLibrary
|
Various functions for handling polynomials, represented as sequences of coefficients \(a_0,\ldots,a_n\) for \(a_0+\cdots+a_nx^n\). More...
Namespaces | |
| namespace | complex_poly |
| Polynomial with complex coefficients. | |
Classes | |
| class | complex_workspace |
| Workspace for solving polynomials. More... | |
Functions | |
| template<typename T > | |
| double | eval (T const &c, double const x) |
| C++ version of gsl_poly_eval(). More... | |
| template<typename T > | |
| complex | complex_eval (T const &c, gsl::complex const z) |
| C++ version of gsl_poly_complex_eval(). More... | |
| template<typename T , typename U > | |
| int | eval_derivs (T const &c, double const x, U &res) |
| C++ version of gsl_poly_eval_derivs(). More... | |
| template<typename T , typename U , typename V > | |
| int | dd_init (T &dd, U const &x, V const &y) |
| C++ version of gsl_poly_dd_init(). More... | |
| template<typename DD , typename Z , typename XA , typename YA , typename DYA > | |
| int | dd_hermite_init (DD &dd, Z &z, XA const &xa, YA const &ya, DYA const &dya) |
| This function computes a divided-difference representation of the interpolating Hermite polynomial for the points (x, y) stored in the arrays xa and ya of length size. More... | |
| template<typename T , typename U > | |
| double | dd_eval (T const &dd, U const &xa, double const x) |
| C++ version of gsl_poly_dd_eval(). More... | |
| template<typename C , typename DD , typename X , typename W > | |
| int | dd_taylor (C &c, double xp, DD const &dd, X const &x, W &w) |
| C++ version of gsl_poly_dd_taylor(). More... | |
| int | solve_quadratic (double a, double b, double c, double &x0, double &x1) |
| C++ version of gsl_poly_solve_quadratic(). More... | |
| int | complex_solve_quadratic (double a, double b, double c, complex &z0, complex &z1) |
| C++ version of gsl_poly_complex_solve_quadratic(). More... | |
| int | solve_cubic (double a, double b, double c, double &x0, double &x1, double &x2) |
| C++ version of gsl_poly_solve_cubic(). More... | |
| int | complex_solve_cubic (double a, double b, double c, complex &z0, complex &z1, complex &z2) |
| C++ version of gsl_poly_complex_solve_cubic(). More... | |
| template<typename A , typename Z > | |
| int | complex_solve (A const &a, complex_workspace &w, Z &z) |
| C++ version of gsl_poly_complex_solve(). More... | |
Various functions for handling polynomials, represented as sequences of coefficients \(a_0,\ldots,a_n\) for \(a_0+\cdots+a_nx^n\).
The sequences can be stored in arrays (as GSL does) or in any container that has a size() functiion and data() function returning an array of doubles of length container.size(). In particular, there are versions of the GSL functions that contain no size paramater work with a mixture of std::array, std::vector and gsl::vector objects, which have these properties. It is only possible to mix C-style arrays with containers by using the functions that require an array size and passing the remaining arrays in as container.data().
|
inline |
C++ version of gsl_poly_complex_eval().
Works with std::array<double>, std::vector<double> and gsl::vector.
| c | Array of polynomial coefficients. |
| z | Value at which to evaluate polynomial. |
Definition at line 286 of file poly.hpp.
References gsl::complex::get().
|
inline |
C++ version of gsl_poly_complex_solve().
Here the actual sizes of a and z should be \(n\) and \(2(n-1)\) because the complex values are stored as pairs of doubles in arrays or vectors of doubles. Works with std::array<double>, std::vector<double> and gsl::vector.
| a | Array of coefficients. |
| w | Workspace (with same size \(n\) as a). |
| z | Roots ( \(n-1\), return value). |
Definition at line 581 of file poly.hpp.
References gsl::sf::mathieu::a(), gsl::poly::complex_workspace::get(), and gsl::rstat::n().
|
inline |
C++ version of gsl_poly_complex_solve_cubic().
| a | Coefficient of \(x^2\). |
| b | Coefficient of \(x\). |
| c | Constant in cubic. |
| z0 | Root (return value). |
| z1 | Root (return value). |
| z2 | Root (return value). |
Definition at line 552 of file poly.hpp.
References gsl::sf::mathieu::a(), gsl::sf::mathieu::b(), and gsl::complex::get().
|
inline |
C++ version of gsl_poly_complex_solve_quadratic().
| a | Coefficient of \(x^2\). |
| b | Coefficient of \(x\). |
| c | Constant in quadratic. |
| z0 | Root (return value). |
| z1 | Root (return value). |
Definition at line 508 of file poly.hpp.
References gsl::sf::mathieu::a(), gsl::sf::mathieu::b(), and gsl::complex::get().
|
inline |
C++ version of gsl_poly_dd_eval().
Works with std::array<double>, std::vector<double> and gsl::vector.
| dd | An array of length size representing the divided differences (input). |
| xa | An array of x values of length size representing the divided differences (input). |
| x | Value at which to evaluate polynomial. |
Definition at line 436 of file poly.hpp.
References gsl::cheb::size().
|
inline |
This function computes a divided-difference representation of the interpolating Hermite polynomial for the points (x, y) stored in the arrays xa and ya of length size.
Hermite interpolation constructs polynomials which also match first derivatives dy/dx which are provided in the array dya also of length size. The first derivatives can be incorported into the usual divided-difference algorithm by forming a new dataset \(z = \{x_0,x_0,x_1,x_1,...\}\), which is stored in the array za of length 2*size on output. On output the divided-differences of the Hermite representation are stored in the array dd, also of length 2*size. Using the notation above, \(dd[k] = [z_0,z_1,...,z_k]\). The resulting Hermite polynomial can be evaluated by calling gsl_poly_dd_eval and using za for the input argument xa.
| dd | An array of length size representing the divided differences (return value). |
| z | The first derivatives |
| xa | The x-coördinates of the interpolating Hermite polynomial |
| ya | The y-coördinates of the interpolating Hermite polynomial |
| dya | First derivatives |
Definition at line 393 of file poly.hpp.
References gsl::cheb::size().
|
inline |
C++ version of gsl_poly_dd_init().
Works with std::array<double>, std::vector<double> and gsl::vector.
| dd | An array of length size representing the divided differences (return value). |
| x | An array of x values of length size (input). |
| y | An array of y values (input). |
Definition at line 342 of file poly.hpp.
References gsl::cheb::size().
|
inline |
C++ version of gsl_poly_dd_taylor().
Works with std::array<double>, std::vector<double> and gsl::vector.
| c | Array of Taylor coefficients about xp. |
| xp | Point at which Taylor expansion is computed. |
| dd | An array of length size of c representing the divided differences. |
| x | An array of x values of length size of c. |
| w | A workspace in the form of an array of length size of c. |
Definition at line 467 of file poly.hpp.
References gsl::cheb::size().
|
inline |
C++ version of gsl_poly_eval().
Works with std::array<double>, std::vector<double> and gsl::vector.
| c | Array of polynomial coefficients. |
| x | Value at which to evaluate polynomial. |
|
inline |
C++ version of gsl_poly_eval_derivs().
Works with std::array<double>, std::vector<double> and gsl::vector.
| c | Array of polynomial coefficients. |
| x | Value at which to evaluate polynomial. |
| res | An array containing 0th, 1st, 2nd, ... derivatives of polynomial evaluated at x: res.size() is the largest value of \(k\) at which to evaluate \(k\)th derivative of polynomial. |
|
inline |
C++ version of gsl_poly_solve_cubic().
Cubic with coefficient of \(x^3=1\).
| a | Coefficient of \(x^2\). |
| b | Coefficient of \(x\). |
| c | Constant in cubic. |
| x0 | Real root (return value). |
| x1 | Real root (return value). |
| x2 | Real root (return value). |
Definition at line 538 of file poly.hpp.
References gsl::sf::mathieu::a(), and gsl::sf::mathieu::b().
|
inline |