| 1 | /* poly/gsl_poly.h |
| 2 | * |
| 3 | * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004, 2007 Brian Gough |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 3 of the License, or (at |
| 8 | * your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, but |
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 18 | */ |
| 19 | |
| 20 | #ifndef __GSL_POLY_H__ |
| 21 | #define __GSL_POLY_H__cxx . . $ `external/gsl/gsl_poly.h:21:9`! |
| 22 | |
| 23 | #include <stdlib.h> |
| 24 | #include "gsl_complex.h"cxx . . $ `<file>/external/gsl/gsl_complex.h`/ |
| 25 | |
| 26 | #undef __BEGIN_DECLScxx . . $ `external/gsl/gsl_blas.h:38:10`! |
| 27 | #undef __END_DECLScxx . . $ `external/gsl/gsl_complex.h:30:10`! |
| 28 | #ifdef __cpluspluscxx . . $ `<built-in>:470:9`! |
| 29 | # define __BEGIN_DECLScxx . . $ `external/gsl/gsl_poly.h:29:10`! extern "C" { |
| 30 | # define __END_DECLScxx . . $ `external/gsl/gsl_poly.h:30:10`! } |
| 31 | #else |
| 32 | # define __BEGIN_DECLScxx . . $ `external/gsl/gsl_poly.h:32:10`! /* empty */ |
| 33 | # define __END_DECLScxx . . $ `external/gsl/gsl_poly.h:33:10`! /* empty */ |
| 34 | #endif |
| 35 | |
| 36 | __BEGIN_DECLScxx . . $ `external/gsl/gsl_poly.h:32:10`! |
| 37 | |
| 38 | |
| 39 | /* Evaluate polynomial |
| 40 | * |
| 41 | * c[0] + c[1] x + c[2] x^2 + ... + c[len-1] x^(len-1) |
| 42 | * |
| 43 | * exceptions: none |
| 44 | */ |
| 45 | double gsl_poly_evalcxx . . $ gsl_poly_eval(6ed32fe3a3878f6b).(const double c[], const int len, const double x); |
| 46 | |
| 47 | |
| 48 | #ifdef HAVE_INLINE |
| 49 | extern inline |
| 50 | double |
| 51 | gsl_poly_eval(const double c[], const int len, const double x) |
| 52 | { |
| 53 | int i; |
| 54 | double ans = c[len-1]; |
| 55 | for(i=len-1; i>0; i--) ans = c[i-1] + x * ans; |
| 56 | return ans; |
| 57 | } |
| 58 | #endif /* HAVE_INLINE */ |
| 59 | |
| 60 | /* Work with divided-difference polynomials, Abramowitz & Stegun 25.2.26 */ |
| 61 | |
| 62 | int |
| 63 | gsl_poly_dd_initcxx . . $ gsl_poly_dd_init(d8b78af2bc50e346). (double dd[], const double x[], const double y[], |
| 64 | size_tcxx . . $ size_t# size); |
| 65 | |
| 66 | double |
| 67 | gsl_poly_dd_evalcxx . . $ gsl_poly_dd_eval(36e97d7b069e8e2b). (const double dd[], const double xa[], const size_tcxx . . $ size_t# size, const double x); |
| 68 | |
| 69 | #ifdef HAVE_INLINE |
| 70 | extern inline |
| 71 | double |
| 72 | gsl_poly_dd_eval(const double dd[], const double xa[], const size_t size, const double x) |
| 73 | { |
| 74 | size_t i; |
| 75 | double y = dd[size - 1]; |
| 76 | for (i = size - 1; i--;) y = dd[i] + (x - xa[i]) * y; |
| 77 | return y; |
| 78 | } |
| 79 | #endif /* HAVE_INLINE */ |
| 80 | |
| 81 | |
| 82 | int |
| 83 | gsl_poly_dd_taylorcxx . . $ gsl_poly_dd_taylor(70e9d65e3e9966ff). (double c[], double xp, |
| 84 | const double dd[], const double x[], size_tcxx . . $ size_t# size, |
| 85 | double w[]); |
| 86 | |
| 87 | /* Solve for real or complex roots of the standard quadratic equation, |
| 88 | * returning the number of real roots. |
| 89 | * |
| 90 | * Roots are returned ordered. |
| 91 | */ |
| 92 | int gsl_poly_solve_quadraticcxx . . $ gsl_poly_solve_quadratic(1ba59c935786ff8f). (double a, double b, double c, |
| 93 | double * x0, double * x1); |
| 94 | |
| 95 | int |
| 96 | gsl_poly_complex_solve_quadraticcxx . . $ gsl_poly_complex_solve_quadratic(8bfd8638668fce51). (double a, double b, double c, |
| 97 | gsl_complexcxx . . $ gsl_complex# * z0, gsl_complexcxx . . $ gsl_complex# * z1); |
| 98 | |
| 99 | |
| 100 | /* Solve for real roots of the cubic equation |
| 101 | * x^3 + a x^2 + b x + c = 0, returning the |
| 102 | * number of real roots. |
| 103 | * |
| 104 | * Roots are returned ordered. |
| 105 | */ |
| 106 | int gsl_poly_solve_cubiccxx . . $ gsl_poly_solve_cubic(d928b0b37d49360b). (double a, double b, double c, |
| 107 | double * x0, double * x1, double * x2); |
| 108 | |
| 109 | int |
| 110 | gsl_poly_complex_solve_cubiccxx . . $ gsl_poly_complex_solve_cubic(e9567d07e4857143). (double a, double b, double c, |
| 111 | gsl_complexcxx . . $ gsl_complex# * z0, gsl_complexcxx . . $ gsl_complex# * z1, |
| 112 | gsl_complexcxx . . $ gsl_complex# * z2); |
| 113 | |
| 114 | |
| 115 | /* Solve for the complex roots of a general real polynomial */ |
| 116 | |
| 117 | typedef structcxx . . $ $anonymous_type_a68e025527e5319d_0# |
| 118 | { |
| 119 | size_tcxx . . $ size_t# nccxx . . $ $anonymous_type_a68e025527e5319d_0#nc. ; |
| 120 | double * matrixcxx . . $ $anonymous_type_a68e025527e5319d_0#matrix. ; |
| 121 | } |
| 122 | gsl_poly_complex_workspacecxx . . $ gsl_poly_complex_workspace# ; |
| 123 | |
| 124 | gsl_poly_complex_workspacecxx . . $ gsl_poly_complex_workspace# * gsl_poly_complex_workspace_alloccxx . . $ gsl_poly_complex_workspace_alloc(5d1c6074a757cc7a). (size_tcxx . . $ size_t# n); |
| 125 | void gsl_poly_complex_workspace_freecxx . . $ gsl_poly_complex_workspace_free(856fbceaed224b67). (gsl_poly_complex_workspacecxx . . $ gsl_poly_complex_workspace# * w); |
| 126 | |
| 127 | int |
| 128 | gsl_poly_complex_solvecxx . . $ gsl_poly_complex_solve(2d3e07883725725c). (const double * a, size_tcxx . . $ size_t# n, |
| 129 | gsl_poly_complex_workspacecxx . . $ gsl_poly_complex_workspace# * w, |
| 130 | gsl_complex_packed_ptrcxx . . $ gsl_complex_packed_ptr# z); |
| 131 | |
| 132 | __END_DECLScxx . . $ `external/gsl/gsl_poly.h:30:10`! |
| 133 | |
| 134 | #endif /* __GSL_POLY_H__ */ |