gsl 1.15.3 → 1.16.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (446) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.travis.yml +24 -0
  4. data/AUTHORS +10 -2
  5. data/COPYING +341 -339
  6. data/ChangeLog +612 -554
  7. data/Gemfile +4 -0
  8. data/README.md +77 -0
  9. data/Rakefile +14 -93
  10. data/THANKS +1 -1
  11. data/examples/blas/blas.rb +1 -1
  12. data/examples/bspline.rb +3 -3
  13. data/examples/complex/functions.rb +4 -4
  14. data/examples/complex/mul.rb +1 -1
  15. data/examples/const/physconst.rb +4 -4
  16. data/examples/const/travel.rb +4 -4
  17. data/examples/eigen/nonsymmv.rb +1 -1
  18. data/examples/eigen/qhoscillator.rb +3 -3
  19. data/examples/fft/radix2.rb +1 -1
  20. data/examples/fft/real-halfcomplex.rb +3 -3
  21. data/examples/fft/real-halfcomplex2.rb +3 -3
  22. data/examples/fit/expfit.rb +1 -1
  23. data/examples/fit/multifit.rb +1 -1
  24. data/examples/fit/ndlinear.rb +44 -44
  25. data/examples/fit/nonlinearfit.rb +1 -1
  26. data/examples/fit/wlinear.rb +3 -3
  27. data/examples/function/function.rb +1 -1
  28. data/examples/function/min.rb +1 -1
  29. data/examples/function/synchrotron.rb +2 -2
  30. data/examples/gallery/koch.rb +1 -1
  31. data/examples/histogram/cauchy.rb +2 -2
  32. data/examples/histogram/exponential.rb +1 -1
  33. data/examples/histogram/histo3d.rb +1 -1
  34. data/examples/histogram/histogram-pdf.rb +2 -2
  35. data/examples/histogram/xexp.rb +1 -1
  36. data/examples/integration/ahmed.rb +2 -2
  37. data/examples/integration/cosmology.rb +7 -7
  38. data/examples/integration/friedmann.rb +4 -4
  39. data/examples/integration/qng.rb +1 -1
  40. data/examples/interp/demo.rb +2 -2
  41. data/examples/linalg/LQ_solve.rb +1 -1
  42. data/examples/linalg/LU.rb +1 -1
  43. data/examples/linalg/LU2.rb +1 -1
  44. data/examples/linalg/LU_narray.rb +1 -1
  45. data/examples/linalg/PTLQ.rb +1 -1
  46. data/examples/linalg/QRPT.rb +1 -1
  47. data/examples/linalg/chol.rb +1 -1
  48. data/examples/linalg/chol_narray.rb +1 -1
  49. data/examples/linalg/complex.rb +1 -1
  50. data/examples/math/elementary.rb +1 -1
  51. data/examples/math/functions.rb +1 -1
  52. data/examples/math/inf_nan.rb +1 -1
  53. data/examples/math/minmax.rb +1 -1
  54. data/examples/math/power.rb +1 -1
  55. data/examples/math/test.rb +1 -1
  56. data/examples/min.rb +1 -1
  57. data/examples/multimin/bundle.rb +1 -1
  58. data/examples/multimin/cqp.rb +17 -17
  59. data/examples/multiroot/fsolver3.rb +1 -1
  60. data/examples/odeiv/binarysystem.rb +12 -12
  61. data/examples/odeiv/demo.rb +3 -3
  62. data/examples/odeiv/frei1.rb +7 -7
  63. data/examples/odeiv/frei2.rb +4 -4
  64. data/examples/odeiv/oscillator.rb +1 -1
  65. data/examples/odeiv/sedov.rb +3 -3
  66. data/examples/odeiv/whitedwarf.rb +11 -11
  67. data/examples/permutation/ex1.rb +2 -2
  68. data/examples/permutation/permutation.rb +1 -1
  69. data/examples/poly/demo.rb +1 -1
  70. data/examples/random/diffusion.rb +1 -1
  71. data/examples/random/generator.rb +2 -2
  72. data/examples/random/randomwalk.rb +3 -3
  73. data/examples/random/rng.rb +1 -1
  74. data/examples/roots/bisection.rb +1 -1
  75. data/examples/roots/brent.rb +1 -1
  76. data/examples/roots/demo.rb +1 -1
  77. data/examples/roots/newton.rb +2 -2
  78. data/examples/roots/recombination.gp +0 -1
  79. data/examples/sf/hyperg.rb +1 -1
  80. data/examples/sf/sphbessel.rb +1 -1
  81. data/examples/sort/sort.rb +1 -1
  82. data/examples/tamu_anova.rb +4 -4
  83. data/examples/vector/add.rb +1 -1
  84. data/examples/vector/decimate.rb +1 -1
  85. data/examples/vector/gnuplot.rb +8 -8
  86. data/examples/vector/vector.rb +2 -2
  87. data/examples/wavelet/wavelet1.rb +1 -1
  88. data/ext/{alf.c → gsl_native/alf.c} +10 -10
  89. data/ext/{array.c → gsl_native/array.c} +70 -159
  90. data/ext/{array_complex.c → gsl_native/array_complex.c} +63 -66
  91. data/ext/{blas.c → gsl_native/blas.c} +2 -3
  92. data/ext/{blas1.c → gsl_native/blas1.c} +35 -36
  93. data/ext/{blas2.c → gsl_native/blas2.c} +57 -62
  94. data/ext/{blas3.c → gsl_native/blas3.c} +57 -58
  95. data/ext/{block.c → gsl_native/block.c} +14 -18
  96. data/ext/{block_source.c → gsl_native/block_source.h} +110 -112
  97. data/ext/gsl_native/bspline.c +122 -0
  98. data/ext/{bundle.c → gsl_native/bundle.c} +0 -0
  99. data/ext/{cdf.c → gsl_native/cdf.c} +79 -93
  100. data/ext/{cheb.c → gsl_native/cheb.c} +78 -89
  101. data/ext/{combination.c → gsl_native/combination.c} +11 -19
  102. data/ext/{common.c → gsl_native/common.c} +9 -41
  103. data/ext/{complex.c → gsl_native/complex.c} +116 -118
  104. data/ext/gsl_native/const.c +331 -0
  105. data/ext/{const_additional.c → gsl_native/const_additional.c} +13 -34
  106. data/ext/gsl_native/cqp.c +283 -0
  107. data/ext/{deriv.c → gsl_native/deriv.c} +25 -33
  108. data/ext/{dht.c → gsl_native/dht.c} +23 -31
  109. data/ext/{diff.c → gsl_native/diff.c} +26 -28
  110. data/ext/{dirac.c → gsl_native/dirac.c} +45 -46
  111. data/ext/{eigen.c → gsl_native/eigen.c} +1044 -1095
  112. data/ext/{error.c → gsl_native/error.c} +18 -18
  113. data/ext/gsl_native/extconf.rb +118 -0
  114. data/ext/{fft.c → gsl_native/fft.c} +197 -204
  115. data/ext/{fit.c → gsl_native/fit.c} +17 -18
  116. data/ext/gsl_native/fresnel.c +312 -0
  117. data/ext/{function.c → gsl_native/function.c} +37 -43
  118. data/ext/{geometry.c → gsl_native/geometry.c} +16 -16
  119. data/ext/{graph.c → gsl_native/graph.c} +39 -89
  120. data/ext/{gsl.c → gsl_native/gsl.c} +12 -33
  121. data/ext/{gsl_narray.c → gsl_native/gsl_narray.c} +20 -30
  122. data/ext/{histogram.c → gsl_native/histogram.c} +133 -160
  123. data/ext/{histogram2d.c → gsl_native/histogram2d.c} +78 -104
  124. data/ext/{histogram3d.c → gsl_native/histogram3d.c} +76 -76
  125. data/ext/{histogram3d_source.c → gsl_native/histogram3d_source.c} +196 -197
  126. data/ext/{histogram_find.c → gsl_native/histogram_find.c} +32 -34
  127. data/ext/{histogram_oper.c → gsl_native/histogram_oper.c} +43 -52
  128. data/ext/{ieee.c → gsl_native/ieee.c} +9 -21
  129. data/{include → ext/gsl_native/include}/rb_gsl.h +4 -26
  130. data/{include → ext/gsl_native/include}/rb_gsl_array.h +15 -39
  131. data/{include → ext/gsl_native/include}/rb_gsl_cheb.h +0 -2
  132. data/{include → ext/gsl_native/include}/rb_gsl_common.h +61 -61
  133. data/{include → ext/gsl_native/include}/rb_gsl_complex.h +1 -1
  134. data/{include → ext/gsl_native/include}/rb_gsl_const.h +0 -6
  135. data/ext/gsl_native/include/rb_gsl_dirac.h +6 -0
  136. data/{include → ext/gsl_native/include}/rb_gsl_eigen.h +1 -1
  137. data/{include → ext/gsl_native/include}/rb_gsl_fft.h +0 -13
  138. data/{include → ext/gsl_native/include}/rb_gsl_fit.h +0 -2
  139. data/{include → ext/gsl_native/include}/rb_gsl_function.h +0 -4
  140. data/{include → ext/gsl_native/include}/rb_gsl_graph.h +2 -4
  141. data/{include → ext/gsl_native/include}/rb_gsl_histogram.h +8 -8
  142. data/{include → ext/gsl_native/include}/rb_gsl_histogram3d.h +50 -50
  143. data/{include → ext/gsl_native/include}/rb_gsl_integration.h +1 -1
  144. data/{include → ext/gsl_native/include}/rb_gsl_interp.h +0 -5
  145. data/{include → ext/gsl_native/include}/rb_gsl_linalg.h +2 -6
  146. data/{include → ext/gsl_native/include}/rb_gsl_math.h +0 -6
  147. data/{include → ext/gsl_native/include}/rb_gsl_odeiv.h +0 -3
  148. data/{include → ext/gsl_native/include}/rb_gsl_poly.h +3 -7
  149. data/{include → ext/gsl_native/include}/rb_gsl_rational.h +1 -8
  150. data/{include → ext/gsl_native/include}/rb_gsl_rng.h +0 -1
  151. data/{include → ext/gsl_native/include}/rb_gsl_root.h +1 -1
  152. data/{include → ext/gsl_native/include}/rb_gsl_sf.h +39 -48
  153. data/{include → ext/gsl_native/include}/rb_gsl_statistics.h +1 -1
  154. data/{include → ext/gsl_native/include}/rb_gsl_tensor.h +0 -2
  155. data/{include → ext/gsl_native/include}/rb_gsl_with_narray.h +3 -1
  156. data/{include → ext/gsl_native/include}/templates_off.h +0 -0
  157. data/{include → ext/gsl_native/include}/templates_on.h +1 -1
  158. data/ext/{integration.c → gsl_native/integration.c} +164 -189
  159. data/ext/{interp.c → gsl_native/interp.c} +25 -38
  160. data/ext/gsl_native/jacobi.c +733 -0
  161. data/ext/{linalg.c → gsl_native/linalg.c} +462 -589
  162. data/ext/{linalg_complex.c → gsl_native/linalg_complex.c} +93 -106
  163. data/ext/{math.c → gsl_native/math.c} +48 -67
  164. data/ext/{matrix.c → gsl_native/matrix.c} +13 -16
  165. data/ext/{matrix_complex.c → gsl_native/matrix_complex.c} +119 -123
  166. data/ext/{matrix_double.c → gsl_native/matrix_double.c} +79 -82
  167. data/ext/{matrix_int.c → gsl_native/matrix_int.c} +53 -54
  168. data/ext/{matrix_source.c → gsl_native/matrix_source.h} +292 -318
  169. data/ext/{min.c → gsl_native/min.c} +45 -76
  170. data/ext/{monte.c → gsl_native/monte.c} +50 -64
  171. data/ext/{multifit.c → gsl_native/multifit.c} +142 -151
  172. data/ext/{multimin.c → gsl_native/multimin.c} +64 -92
  173. data/ext/{multimin_fsdf.c → gsl_native/multimin_fsdf.c} +16 -16
  174. data/ext/{multiroots.c → gsl_native/multiroots.c} +73 -76
  175. data/ext/{multiset.c → gsl_native/multiset.c} +4 -8
  176. data/ext/{ndlinear.c → gsl_native/ndlinear.c} +320 -321
  177. data/ext/{nmf.c → gsl_native/nmf.c} +11 -11
  178. data/ext/{nmf_wrap.c → gsl_native/nmf_wrap.c} +1 -1
  179. data/ext/{ntuple.c → gsl_native/ntuple.c} +23 -23
  180. data/ext/{odeiv.c → gsl_native/odeiv.c} +101 -116
  181. data/ext/gsl_native/ool.c +879 -0
  182. data/ext/{permutation.c → gsl_native/permutation.c} +39 -37
  183. data/ext/{poly.c → gsl_native/poly.c} +10 -13
  184. data/ext/{poly2.c → gsl_native/poly2.c} +16 -16
  185. data/ext/{poly_source.c → gsl_native/poly_source.h} +249 -293
  186. data/ext/{qrng.c → gsl_native/qrng.c} +9 -20
  187. data/ext/{randist.c → gsl_native/randist.c} +222 -247
  188. data/ext/{rational.c → gsl_native/rational.c} +12 -12
  189. data/ext/{rng.c → gsl_native/rng.c} +30 -47
  190. data/ext/{root.c → gsl_native/root.c} +47 -48
  191. data/ext/{sf.c → gsl_native/sf.c} +196 -244
  192. data/ext/{sf_airy.c → gsl_native/sf_airy.c} +2 -2
  193. data/ext/{sf_bessel.c → gsl_native/sf_bessel.c} +7 -7
  194. data/ext/{sf_clausen.c → gsl_native/sf_clausen.c} +1 -1
  195. data/ext/{sf_coulomb.c → gsl_native/sf_coulomb.c} +40 -40
  196. data/ext/{sf_coupling.c → gsl_native/sf_coupling.c} +30 -30
  197. data/ext/{sf_dawson.c → gsl_native/sf_dawson.c} +1 -1
  198. data/ext/{sf_debye.c → gsl_native/sf_debye.c} +1 -10
  199. data/ext/{sf_dilog.c → gsl_native/sf_dilog.c} +1 -1
  200. data/ext/{sf_elementary.c → gsl_native/sf_elementary.c} +3 -3
  201. data/ext/{sf_ellint.c → gsl_native/sf_ellint.c} +43 -43
  202. data/ext/{sf_elljac.c → gsl_native/sf_elljac.c} +3 -3
  203. data/ext/{sf_erfc.c → gsl_native/sf_erfc.c} +1 -5
  204. data/ext/{sf_exp.c → gsl_native/sf_exp.c} +3 -3
  205. data/ext/{sf_expint.c → gsl_native/sf_expint.c} +2 -12
  206. data/ext/{sf_fermi_dirac.c → gsl_native/sf_fermi_dirac.c} +1 -1
  207. data/ext/{sf_gamma.c → gsl_native/sf_gamma.c} +2 -6
  208. data/ext/{sf_gegenbauer.c → gsl_native/sf_gegenbauer.c} +1 -1
  209. data/ext/{sf_hyperg.c → gsl_native/sf_hyperg.c} +1 -1
  210. data/ext/{sf_laguerre.c → gsl_native/sf_laguerre.c} +4 -4
  211. data/ext/{sf_lambert.c → gsl_native/sf_lambert.c} +1 -1
  212. data/ext/{sf_legendre.c → gsl_native/sf_legendre.c} +1 -1
  213. data/ext/{sf_log.c → gsl_native/sf_log.c} +4 -4
  214. data/ext/gsl_native/sf_mathieu.c +235 -0
  215. data/ext/{sf_power.c → gsl_native/sf_power.c} +1 -1
  216. data/ext/{sf_psi.c → gsl_native/sf_psi.c} +3 -12
  217. data/ext/{sf_synchrotron.c → gsl_native/sf_synchrotron.c} +1 -1
  218. data/ext/{sf_transport.c → gsl_native/sf_transport.c} +1 -1
  219. data/ext/{sf_trigonometric.c → gsl_native/sf_trigonometric.c} +4 -4
  220. data/ext/{sf_zeta.c → gsl_native/sf_zeta.c} +1 -5
  221. data/ext/{signal.c → gsl_native/signal.c} +63 -68
  222. data/ext/{siman.c → gsl_native/siman.c} +45 -49
  223. data/ext/{sort.c → gsl_native/sort.c} +6 -7
  224. data/ext/{spline.c → gsl_native/spline.c} +28 -46
  225. data/ext/{stats.c → gsl_native/stats.c} +105 -118
  226. data/ext/{sum.c → gsl_native/sum.c} +34 -34
  227. data/ext/{tamu_anova.c → gsl_native/tamu_anova.c} +1 -1
  228. data/ext/{tensor.c → gsl_native/tensor.c} +8 -11
  229. data/ext/{tensor_source.c → gsl_native/tensor_source.h} +147 -148
  230. data/ext/{vector.c → gsl_native/vector.c} +11 -14
  231. data/ext/{vector_complex.c → gsl_native/vector_complex.c} +179 -184
  232. data/ext/{vector_double.c → gsl_native/vector_double.c} +178 -183
  233. data/ext/{vector_int.c → gsl_native/vector_int.c} +27 -29
  234. data/ext/{vector_source.c → gsl_native/vector_source.h} +428 -443
  235. data/ext/{wavelet.c → gsl_native/wavelet.c} +224 -246
  236. data/gsl.gemspec +29 -0
  237. data/lib/gsl.rb +8 -3
  238. data/lib/gsl/gnuplot.rb +3 -3
  239. data/lib/gsl/oper.rb +35 -60
  240. data/lib/gsl/version.rb +3 -0
  241. data/lib/rbgsl.rb +1 -3
  242. data/rdoc/alf.rdoc +5 -5
  243. data/rdoc/blas.rdoc +9 -9
  244. data/rdoc/bspline.rdoc +17 -17
  245. data/rdoc/changes.rdoc +4 -9
  246. data/rdoc/cheb.rdoc +25 -25
  247. data/rdoc/cholesky_complex.rdoc +21 -21
  248. data/rdoc/combi.rdoc +37 -37
  249. data/rdoc/complex.rdoc +22 -22
  250. data/rdoc/const.rdoc +47 -47
  251. data/rdoc/dht.rdoc +49 -49
  252. data/rdoc/diff.rdoc +42 -42
  253. data/rdoc/ehandling.rdoc +6 -6
  254. data/rdoc/eigen.rdoc +153 -153
  255. data/rdoc/fft.rdoc +146 -146
  256. data/rdoc/fit.rdoc +109 -109
  257. data/rdoc/function.rdoc +11 -11
  258. data/rdoc/graph.rdoc +17 -17
  259. data/rdoc/hist.rdoc +103 -103
  260. data/rdoc/hist2d.rdoc +42 -42
  261. data/rdoc/hist3d.rdoc +9 -9
  262. data/rdoc/integration.rdoc +110 -110
  263. data/rdoc/interp.rdoc +71 -71
  264. data/rdoc/intro.rdoc +8 -8
  265. data/rdoc/linalg.rdoc +188 -188
  266. data/rdoc/linalg_complex.rdoc +1 -1
  267. data/rdoc/math.rdoc +58 -58
  268. data/rdoc/matrix.rdoc +275 -275
  269. data/rdoc/min.rdoc +57 -57
  270. data/rdoc/monte.rdoc +22 -22
  271. data/rdoc/multimin.rdoc +95 -95
  272. data/rdoc/multiroot.rdoc +80 -80
  273. data/rdoc/narray.rdoc +32 -32
  274. data/rdoc/ndlinear.rdoc +54 -54
  275. data/rdoc/nonlinearfit.rdoc +100 -100
  276. data/rdoc/ntuple.rdoc +31 -31
  277. data/rdoc/odeiv.rdoc +88 -88
  278. data/rdoc/perm.rdoc +90 -90
  279. data/rdoc/poly.rdoc +66 -66
  280. data/rdoc/qrng.rdoc +21 -21
  281. data/rdoc/randist.rdoc +82 -82
  282. data/rdoc/ref.rdoc +57 -57
  283. data/rdoc/rng.rdoc +85 -85
  284. data/rdoc/roots.rdoc +57 -57
  285. data/rdoc/sf.rdoc +428 -428
  286. data/rdoc/siman.rdoc +19 -19
  287. data/rdoc/sort.rdoc +30 -30
  288. data/rdoc/start.rdoc +8 -8
  289. data/rdoc/stats.rdoc +52 -52
  290. data/rdoc/sum.rdoc +12 -12
  291. data/rdoc/tensor.rdoc +31 -31
  292. data/rdoc/tut.rdoc +1 -1
  293. data/rdoc/use.rdoc +39 -39
  294. data/rdoc/vector.rdoc +188 -188
  295. data/rdoc/vector_complex.rdoc +24 -24
  296. data/rdoc/wavelet.rdoc +46 -46
  297. data/test/gsl/blas_test.rb +79 -0
  298. data/test/gsl/bspline_test.rb +63 -0
  299. data/test/gsl/cdf_test.rb +1512 -0
  300. data/test/gsl/cheb_test.rb +80 -0
  301. data/test/gsl/combination_test.rb +100 -0
  302. data/test/gsl/complex_test.rb +20 -0
  303. data/test/gsl/const_test.rb +29 -0
  304. data/test/gsl/deriv_test.rb +62 -0
  305. data/test/gsl/dht_test.rb +79 -0
  306. data/test/gsl/diff_test.rb +53 -0
  307. data/test/gsl/eigen_test.rb +563 -0
  308. data/test/gsl/err_test.rb +23 -0
  309. data/test/gsl/fit_test.rb +101 -0
  310. data/test/gsl/histo_test.rb +14 -0
  311. data/test/gsl/index_test.rb +61 -0
  312. data/test/gsl/integration_test.rb +274 -0
  313. data/test/gsl/interp_test.rb +27 -0
  314. data/test/gsl/linalg_test.rb +463 -0
  315. data/test/gsl/matrix_nmf_test.rb +37 -0
  316. data/test/gsl/matrix_test.rb +98 -0
  317. data/test/gsl/min_test.rb +89 -0
  318. data/test/gsl/monte_test.rb +77 -0
  319. data/test/gsl/multifit_test.rb +753 -0
  320. data/test/gsl/multimin_test.rb +157 -0
  321. data/test/gsl/multiroot_test.rb +135 -0
  322. data/test/gsl/multiset_test.rb +52 -0
  323. data/test/gsl/odeiv_test.rb +275 -0
  324. data/test/gsl/oper_test.rb +98 -0
  325. data/test/gsl/poly_test.rb +338 -0
  326. data/test/gsl/qrng_test.rb +94 -0
  327. data/test/gsl/quartic_test.rb +28 -0
  328. data/test/gsl/randist_test.rb +122 -0
  329. data/test/gsl/rng_test.rb +303 -0
  330. data/test/gsl/roots_test.rb +78 -0
  331. data/test/gsl/sf_test.rb +2079 -0
  332. data/test/gsl/stats_test.rb +122 -0
  333. data/test/gsl/sum_test.rb +69 -0
  334. data/test/gsl/tensor_test.rb +396 -0
  335. data/test/gsl/vector_test.rb +223 -0
  336. data/test/gsl/wavelet_test.rb +130 -0
  337. data/test/gsl_test.rb +321 -0
  338. data/test/test_helper.rb +42 -0
  339. data/uncrustify.cfg +1693 -0
  340. metadata +337 -378
  341. data/README +0 -32
  342. data/VERSION +0 -1
  343. data/ext/bspline.c +0 -130
  344. data/ext/const.c +0 -673
  345. data/ext/cqp.c +0 -283
  346. data/ext/extconf.rb +0 -295
  347. data/ext/fcmp.c +0 -66
  348. data/ext/fresnel.c +0 -312
  349. data/ext/jacobi.c +0 -739
  350. data/ext/ool.c +0 -879
  351. data/ext/oper_complex_source.c +0 -253
  352. data/ext/sf_mathieu.c +0 -238
  353. data/include/rb_gsl_config.h +0 -62
  354. data/include/rb_gsl_dirac.h +0 -13
  355. data/rdoc/index.rdoc +0 -62
  356. data/rdoc/rngextra.rdoc +0 -11
  357. data/rdoc/screenshot.rdoc +0 -40
  358. data/setup.rb +0 -1585
  359. data/tests/blas/amax.rb +0 -14
  360. data/tests/blas/asum.rb +0 -16
  361. data/tests/blas/axpy.rb +0 -25
  362. data/tests/blas/copy.rb +0 -23
  363. data/tests/blas/dot.rb +0 -23
  364. data/tests/bspline.rb +0 -53
  365. data/tests/cdf.rb +0 -1388
  366. data/tests/cheb.rb +0 -112
  367. data/tests/combination.rb +0 -123
  368. data/tests/complex.rb +0 -17
  369. data/tests/const.rb +0 -24
  370. data/tests/deriv.rb +0 -85
  371. data/tests/dht/dht1.rb +0 -17
  372. data/tests/dht/dht2.rb +0 -23
  373. data/tests/dht/dht3.rb +0 -23
  374. data/tests/dht/dht4.rb +0 -23
  375. data/tests/diff.rb +0 -78
  376. data/tests/eigen/eigen.rb +0 -220
  377. data/tests/eigen/gen.rb +0 -105
  378. data/tests/eigen/genherm.rb +0 -66
  379. data/tests/eigen/gensymm.rb +0 -68
  380. data/tests/eigen/nonsymm.rb +0 -53
  381. data/tests/eigen/nonsymmv.rb +0 -53
  382. data/tests/eigen/symm-herm.rb +0 -74
  383. data/tests/err.rb +0 -58
  384. data/tests/fit.rb +0 -124
  385. data/tests/gsl_test.rb +0 -118
  386. data/tests/gsl_test2.rb +0 -110
  387. data/tests/histo.rb +0 -12
  388. data/tests/integration/integration1.rb +0 -72
  389. data/tests/integration/integration2.rb +0 -71
  390. data/tests/integration/integration3.rb +0 -71
  391. data/tests/integration/integration4.rb +0 -71
  392. data/tests/interp.rb +0 -45
  393. data/tests/linalg/HH.rb +0 -64
  394. data/tests/linalg/LU.rb +0 -47
  395. data/tests/linalg/QR.rb +0 -77
  396. data/tests/linalg/SV.rb +0 -24
  397. data/tests/linalg/TDN.rb +0 -116
  398. data/tests/linalg/TDS.rb +0 -122
  399. data/tests/linalg/bidiag.rb +0 -73
  400. data/tests/linalg/cholesky.rb +0 -20
  401. data/tests/linalg/linalg.rb +0 -158
  402. data/tests/matrix/matrix_complex_test.rb +0 -36
  403. data/tests/matrix/matrix_nmf_test.rb +0 -39
  404. data/tests/matrix/matrix_test.rb +0 -48
  405. data/tests/min.rb +0 -99
  406. data/tests/monte/miser.rb +0 -31
  407. data/tests/monte/vegas.rb +0 -45
  408. data/tests/multifit/test_2dgauss.rb +0 -112
  409. data/tests/multifit/test_brown.rb +0 -90
  410. data/tests/multifit/test_enso.rb +0 -246
  411. data/tests/multifit/test_filip.rb +0 -155
  412. data/tests/multifit/test_gauss.rb +0 -97
  413. data/tests/multifit/test_longley.rb +0 -110
  414. data/tests/multifit/test_multifit.rb +0 -52
  415. data/tests/multimin.rb +0 -139
  416. data/tests/multiroot.rb +0 -131
  417. data/tests/multiset.rb +0 -52
  418. data/tests/narray/blas_dnrm2.rb +0 -20
  419. data/tests/odeiv.rb +0 -353
  420. data/tests/poly/poly.rb +0 -290
  421. data/tests/poly/special.rb +0 -65
  422. data/tests/qrng.rb +0 -131
  423. data/tests/quartic.rb +0 -29
  424. data/tests/randist.rb +0 -134
  425. data/tests/rng.rb +0 -305
  426. data/tests/roots.rb +0 -76
  427. data/tests/run-test.sh +0 -17
  428. data/tests/sf/gsl_test_sf.rb +0 -249
  429. data/tests/sf/test_airy.rb +0 -83
  430. data/tests/sf/test_bessel.rb +0 -306
  431. data/tests/sf/test_coulomb.rb +0 -17
  432. data/tests/sf/test_dilog.rb +0 -25
  433. data/tests/sf/test_gamma.rb +0 -209
  434. data/tests/sf/test_hyperg.rb +0 -356
  435. data/tests/sf/test_legendre.rb +0 -227
  436. data/tests/sf/test_mathieu.rb +0 -59
  437. data/tests/sf/test_mode.rb +0 -19
  438. data/tests/sf/test_sf.rb +0 -839
  439. data/tests/stats.rb +0 -174
  440. data/tests/stats_mt.rb +0 -16
  441. data/tests/sum.rb +0 -98
  442. data/tests/sys.rb +0 -323
  443. data/tests/tensor.rb +0 -419
  444. data/tests/vector/vector_complex_test.rb +0 -101
  445. data/tests/vector/vector_test.rb +0 -141
  446. data/tests/wavelet.rb +0 -142
@@ -8,17 +8,17 @@
8
8
  This library is distributed in the hope that it will be useful, but
9
9
  WITHOUT ANY WARRANTY.
10
10
  */
11
- #include "rb_gsl_config.h"
12
- #include "rb_gsl_array.h"
11
+
12
+ #include "include/rb_gsl_array.h"
13
13
  #include <gsl/gsl_permute.h>
14
14
  #include <gsl/gsl_permute_vector.h>
15
15
 
16
16
  VALUE rb_gsl_permutation_alloc(VALUE klass, VALUE nn);
17
17
 
18
18
  /*
19
- * Creates a new permutation of size n. The permutation is not initialized
20
- * and its elements are undefined. Use the method calloc if you want to create
21
- * a permutation which is initialized to the identity.
19
+ * Creates a new permutation of size n. The permutation is not initialized
20
+ * and its elements are undefined. Use the method calloc if you want to create
21
+ * a permutation which is initialized to the identity.
22
22
  */
23
23
  VALUE rb_gsl_permutation_alloc(VALUE klass, VALUE nn)
24
24
  {
@@ -51,12 +51,17 @@ static VALUE rb_gsl_permutation_init(VALUE obj)
51
51
  return obj;
52
52
  }
53
53
 
54
- void get_range_int_beg_en_n(VALUE range, int *beg, int *en, size_t *n, int *step);
54
+ #ifndef CHECK_RANGE_OFFSET
55
+ #define CHECK_RANGE_OFFSET(i) if (i < -((int) b->size) || i >= ((int) b->size)) \
56
+ rb_raise(rb_eRangeError, "offset %d out of range", i);
57
+ #endif
58
+
55
59
  static VALUE rb_gsl_permutation_get(int argc, VALUE *argv, VALUE obj)
56
60
  {
57
61
  gsl_permutation *b, *bnew;
58
62
  gsl_index *p;
59
- int beg, en, i, step;
63
+ long beg;
64
+ int i;
60
65
  size_t n, j, k;
61
66
  Data_Get_Struct(obj, gsl_permutation, b);
62
67
  switch (argc) {
@@ -67,6 +72,7 @@ static VALUE rb_gsl_permutation_get(int argc, VALUE *argv, VALUE obj)
67
72
  switch (TYPE(argv[0])) {
68
73
  case T_FIXNUM:
69
74
  i = FIX2INT(argv[0]);
75
+ CHECK_RANGE_OFFSET(i);
70
76
  if (i < 0) j = b->size + i; else j = (size_t) i;
71
77
  return INT2FIX((int) b->data[j]);
72
78
  break;
@@ -75,33 +81,36 @@ static VALUE rb_gsl_permutation_get(int argc, VALUE *argv, VALUE obj)
75
81
  n = RARRAY_LEN(argv[0]);
76
82
  bnew = gsl_permutation_alloc(n);
77
83
  for (j = 0; j < n; j++) {
78
- i = FIX2INT(rb_ary_entry(argv[0], j));
79
- if (i < 0) k = b->size + i; else k = i;
80
- bnew->data[j] = b->data[k];
84
+ i = FIX2INT(rb_ary_entry(argv[0], j));
85
+ CHECK_RANGE_OFFSET(i);
86
+ if (i < 0) k = b->size + i; else k = (size_t) i;
87
+ bnew->data[j] = b->data[k];
81
88
  }
82
- return Data_Wrap_Struct(CLASS_OF(argv[0]), 0, gsl_permutation_free, bnew);
89
+ return Data_Wrap_Struct(CLASS_OF(obj), 0, gsl_permutation_free, bnew);
83
90
  break;
84
91
  default:
85
92
  if (PERMUTATION_P(argv[0])) {
86
- Data_Get_Struct(argv[0], gsl_index, p);
87
- bnew = gsl_permutation_alloc(p->size);
88
- for (j = 0; j < p->size; j++) bnew->data[j] = b->data[p->data[j]];
89
- return Data_Wrap_Struct(CLASS_OF(argv[0]), 0, gsl_permutation_free, bnew);
93
+ Data_Get_Struct(argv[0], gsl_index, p);
94
+ bnew = gsl_permutation_alloc(p->size);
95
+ for (j = 0; j < p->size; j++) bnew->data[j] = b->data[p->data[j]];
96
+ return Data_Wrap_Struct(CLASS_OF(argv[0]), 0, gsl_permutation_free, bnew);
90
97
  } else if (CLASS_OF(argv[0]) == rb_cRange) {
91
- get_range_int_beg_en_n(argv[0], &beg, &en, &n, &step);
92
- bnew = gsl_permutation_alloc(n);
93
- for (j = 0; j < n; j++)
94
- bnew->data[j] = b->data[beg+j];
95
- return Data_Wrap_Struct(CLASS_OF(obj), 0, gsl_permutation_free, bnew);
98
+ rb_range_beg_len(argv[0], &beg, (long *) &n, (long) b->size, 2);
99
+ if (n == 0) rb_raise(rb_eRangeError, "range overflow");
100
+ if (n > b->size) n = b->size;
101
+ bnew = gsl_permutation_alloc(n);
102
+ for (j = 0; j < n; j++)
103
+ bnew->data[j] = b->data[beg+j];
104
+ return Data_Wrap_Struct(CLASS_OF(obj), 0, gsl_permutation_free, bnew);
96
105
  } else {
97
- rb_raise(rb_eArgError, "wrong argument type %s (Fixnum, Array, or Range expected)", rb_class2name(CLASS_OF(argv[0])));
98
- break;
106
+ rb_raise(rb_eArgError, "wrong argument type %s (Fixnum, Array, or Range expected)", rb_class2name(CLASS_OF(argv[0])));
107
+ break;
99
108
  }
100
109
  }
101
110
  break;
102
111
  default:
103
112
  bnew = gsl_permutation_alloc(argc);
104
- for (j = 0; j < argc; j++) {
113
+ for (j = 0; j < (size_t) argc; j++) {
105
114
  i = FIX2INT(argv[j]);
106
115
  if (i < 0) k = b->size + i; else k = i;
107
116
  bnew->data[j] = b->data[k];
@@ -112,7 +121,6 @@ static VALUE rb_gsl_permutation_get(int argc, VALUE *argv, VALUE obj)
112
121
  return Qnil;
113
122
  }
114
123
 
115
- #ifdef GSL_1_1_LATER
116
124
  static VALUE rb_gsl_permutation_clone(VALUE obj)
117
125
  {
118
126
  gsl_permutation *p, *p2 = NULL;
@@ -133,7 +141,6 @@ static VALUE rb_gsl_permutation_memcpy(VALUE obj, VALUE pp1, VALUE pp2)
133
141
  gsl_permutation_memcpy(p1, p2);
134
142
  return pp1;
135
143
  }
136
- #endif
137
144
 
138
145
  static VALUE rb_gsl_permutation_swap(VALUE obj, VALUE i, VALUE j)
139
146
  {
@@ -271,7 +278,6 @@ static VALUE rb_gsl_permute_vector_inverse(VALUE obj, VALUE pp, VALUE vv)
271
278
  }
272
279
 
273
280
  /* singleton method */
274
- #ifdef GSL_1_2_LATER
275
281
  static VALUE rb_gsl_permutation_mul(VALUE obj, VALUE ppa, VALUE ppb)
276
282
  {
277
283
  gsl_permutation *p = NULL;
@@ -291,7 +297,6 @@ static VALUE rb_gsl_permutation_mul(VALUE obj, VALUE ppa, VALUE ppb)
291
297
  if (flag == 1) return obj;
292
298
  else return Data_Wrap_Struct(cgsl_permutation, 0, gsl_permutation_free, p);
293
299
  }
294
- #endif
295
300
 
296
301
  static VALUE rb_gsl_permutation_print(VALUE obj);
297
302
 
@@ -367,9 +372,8 @@ static VALUE rb_gsl_permutation_fprintf(int argc, VALUE *argv, VALUE obj)
367
372
  FILE *fp = NULL;
368
373
  int status, flag = 0;
369
374
 
370
- if (argc != 1 && argc != 2) rb_raise(rb_eArgError,
371
- "wrong number of arguments (%d for 1 or 2)", argc);
372
-
375
+ if (argc != 1 && argc != 2) rb_raise(rb_eArgError,
376
+ "wrong number of arguments (%d for 1 or 2)", argc);
373
377
  Data_Get_Struct(obj, gsl_permutation, h);
374
378
  fp = rb_gsl_open_writefile(argv[0], &flag);
375
379
  if (argc == 1) {
@@ -409,7 +413,6 @@ static VALUE rb_gsl_permutation_fscanf(VALUE obj, VALUE io)
409
413
  return INT2FIX(status);
410
414
  }
411
415
 
412
- #ifdef GSL_1_2_LATER
413
416
  static VALUE rb_gsl_permutation_linear_to_canonical(int argc, VALUE *argv, VALUE obj)
414
417
  {
415
418
  gsl_permutation *p, *q;
@@ -476,7 +479,6 @@ static VALUE rb_gsl_permutation_canonical_cycles(VALUE obj)
476
479
  Data_Get_Struct(obj, gsl_permutation, p);
477
480
  return INT2FIX(gsl_permutation_canonical_cycles(p));
478
481
  }
479
- #endif
480
482
 
481
483
  static VALUE rb_gsl_vector_permute(VALUE obj, VALUE pp)
482
484
  {
@@ -537,10 +539,8 @@ void Init_gsl_permutation(VALUE module)
537
539
  rb_define_alias(cgsl_permutation, "[]", "get");
538
540
  rb_define_method(cgsl_permutation, "set", rb_gsl_permutation_set, 2);
539
541
  rb_define_alias(cgsl_permutation, "[]=", "set");
540
- #ifdef GSL_1_1_LATER
541
542
  rb_define_singleton_method(cgsl_permutation, "memcpy", rb_gsl_permutation_memcpy, 2);
542
543
  rb_define_method(cgsl_permutation, "clone", rb_gsl_permutation_clone, 0);
543
- #endif
544
544
  rb_define_method(cgsl_permutation, "swap", rb_gsl_permutation_swap, 2);
545
545
  rb_define_method(cgsl_permutation, "valid", rb_gsl_permutation_valid, 0);
546
546
  rb_define_method(cgsl_permutation, "valid?", rb_gsl_permutation_valid2, 0);
@@ -556,7 +556,7 @@ void Init_gsl_permutation(VALUE module)
556
556
  rb_define_alias(cgsl_permutation, "permute", "permute_vector");
557
557
  rb_define_method(cgsl_permutation, "permute_vector_inverse", rb_gsl_permutation_permute_vector_inverse, 1);
558
558
  rb_define_alias(cgsl_permutation, "permute_inverse", "permute_vector_inverse");
559
-
559
+
560
560
  rb_define_singleton_method(cgsl_permutation, "permute_vector", rb_gsl_permute_vector, 2);
561
561
  rb_define_singleton_method(cgsl_permutation, "permute_vector_inverse", rb_gsl_permute_vector_inverse, 2);
562
562
  rb_define_module_function(module, "permute_vector", rb_gsl_permute_vector, 2);
@@ -574,7 +574,6 @@ void Init_gsl_permutation(VALUE module)
574
574
  rb_define_method(cgsl_permutation, "fscanf", rb_gsl_permutation_fscanf, 1);
575
575
  rb_define_method(cgsl_permutation, "print", rb_gsl_permutation_print, 0);
576
576
 
577
- #ifdef GSL_1_2_LATER
578
577
  rb_define_singleton_method(cgsl_permutation, "mul", rb_gsl_permutation_mul, 2);
579
578
  rb_define_method(cgsl_permutation, "mul", rb_gsl_permutation_mul, 2);
580
579
  rb_define_method(cgsl_permutation, "linear_to_canonical", rb_gsl_permutation_linear_to_canonical, -1);
@@ -585,7 +584,6 @@ void Init_gsl_permutation(VALUE module)
585
584
  rb_define_method(cgsl_permutation, "inversions", rb_gsl_permutation_inversions, 0);
586
585
  rb_define_method(cgsl_permutation, "linear_cycles", rb_gsl_permutation_linear_cycles, 0);
587
586
  rb_define_method(cgsl_permutation, "canonical_cycles", rb_gsl_permutation_canonical_cycles, 0);
588
- #endif
589
587
 
590
588
  rb_define_method(cgsl_vector, "permute", rb_gsl_vector_permute, 1);
591
589
  rb_define_method(cgsl_vector, "permute_inverse", rb_gsl_vector_permute_inverse, 1);
@@ -594,3 +592,7 @@ void Init_gsl_permutation(VALUE module)
594
592
  rb_define_alias(cgsl_permutation, "==", "equal?");
595
593
 
596
594
  }
595
+
596
+ #ifdef CHECK_RANGE_OFFSET
597
+ #undef CHECK_RANGE_OFFSET
598
+ #endif
@@ -8,22 +8,19 @@
8
8
  This library is distributed in the hope that it will be useful, but
9
9
  WITHOUT ANY WARRANTY.
10
10
  */
11
- #include "rb_gsl_config.h"
12
- #include "rb_gsl_poly.h"
13
- #include "rb_gsl_array.h"
14
- #include "rb_gsl_common.h"
15
- #ifdef HAVE_NARARY_H
16
- #include "narray.h"
17
- #endif
11
+
12
+ #include "include/rb_gsl_poly.h"
13
+ #include "include/rb_gsl_array.h"
14
+ #include "include/rb_gsl_common.h"
18
15
 
19
16
  void Init_gsl_poly_init(VALUE module);
20
17
  void Init_gsl_poly_int_init(VALUE module);
21
18
  void Init_gsl_poly2(VALUE module);
22
19
 
23
20
  #define BASE_DOUBLE
24
- #include "templates_on.h"
25
- #include "poly_source.c"
26
- #include "templates_off.h"
21
+ #include "include/templates_on.h"
22
+ #include "poly_source.h"
23
+ #include "include/templates_off.h"
27
24
  void Init_gsl_poly(VALUE module)
28
25
  {
29
26
  Init_gsl_poly_init(module);
@@ -32,9 +29,9 @@ void Init_gsl_poly(VALUE module)
32
29
  #undef BASE_DOUBLE
33
30
 
34
31
  #define BASE_INT
35
- #include "templates_on.h"
36
- #include "poly_source.c"
37
- #include "templates_off.h"
32
+ #include "include/templates_on.h"
33
+ #include "poly_source.h"
34
+ #include "include/templates_off.h"
38
35
  void Init_gsl_poly_int(VALUE module)
39
36
  {
40
37
  Init_gsl_poly_int_init(module);
@@ -8,10 +8,10 @@
8
8
  This library is distributed in the hope that it will be useful, but
9
9
  WITHOUT ANY WARRANTY.
10
10
  */
11
- #include "rb_gsl_config.h"
12
- #include "rb_gsl_poly.h"
13
- #include "rb_gsl_math.h"
14
- #include "rb_gsl_array.h"
11
+
12
+ #include "include/rb_gsl_poly.h"
13
+ #include "include/rb_gsl_math.h"
14
+ #include "include/rb_gsl_array.h"
15
15
  #include <gsl/gsl_sf_gamma.h>
16
16
 
17
17
  static gsl_poly_int* mygsl_poly_hermite(int n1)
@@ -37,7 +37,7 @@ static gsl_poly_int* mygsl_poly_hermite(int n1)
37
37
  p2 = gsl_vector_int_calloc(n1 + 1);
38
38
  memcpy(p1->data, coef2, 3*sizeof(int));
39
39
  memcpy(p2->data, coef1, 2*sizeof(int));
40
- for (n = 2; n < n1; n++) {
40
+ for (n = 2; (int) n < n1; n++) {
41
41
  gsl_vector_int_memcpy(p0, p1);
42
42
  mygsl_vector_int_shift_scale2(p0, n);
43
43
  gsl_vector_int_scale(p2, 2*n);
@@ -48,7 +48,7 @@ static gsl_poly_int* mygsl_poly_hermite(int n1)
48
48
  gsl_vector_int_memcpy(p1, p0);
49
49
  }
50
50
  gsl_vector_int_free(p2);
51
- gsl_vector_int_free(p1);
51
+ gsl_vector_int_free(p1);
52
52
  break;
53
53
  }
54
54
  return p0;
@@ -77,7 +77,7 @@ static gsl_poly_int* mygsl_poly_cheb(int n1)
77
77
  p2 = gsl_vector_int_calloc(n1 + 1);
78
78
  memcpy(p1->data, coef2, 3*sizeof(int));
79
79
  memcpy(p2->data, coef1, 2*sizeof(int));
80
- for (n = 2; n < n1; n++) {
80
+ for (n = 2; (int) n < n1; n++) {
81
81
  gsl_vector_int_memcpy(p0, p1);
82
82
  mygsl_vector_int_shift_scale2(p0, n);
83
83
 
@@ -87,7 +87,7 @@ static gsl_poly_int* mygsl_poly_cheb(int n1)
87
87
  gsl_vector_int_memcpy(p1, p0);
88
88
  }
89
89
  gsl_vector_int_free(p2);
90
- gsl_vector_int_free(p1);
90
+ gsl_vector_int_free(p1);
91
91
  break;
92
92
  }
93
93
  return p0;
@@ -116,7 +116,7 @@ static gsl_poly_int* mygsl_poly_chebII(int n1)
116
116
  p2 = gsl_vector_int_calloc(n1 + 1);
117
117
  memcpy(p1->data, coef2, 3*sizeof(int));
118
118
  memcpy(p2->data, coef1, 2*sizeof(int));
119
- for (n = 2; n < n1; n++) {
119
+ for (n = 2; (int) n < n1; n++) {
120
120
  gsl_vector_int_memcpy(p0, p1);
121
121
  mygsl_vector_int_shift_scale2(p0, n);
122
122
  gsl_vector_int_sub(p0, p2);
@@ -125,7 +125,7 @@ static gsl_poly_int* mygsl_poly_chebII(int n1)
125
125
  gsl_vector_int_memcpy(p1, p0);
126
126
  }
127
127
  gsl_vector_int_free(p2);
128
- gsl_vector_int_free(p1);
128
+ gsl_vector_int_free(p1);
129
129
  break;
130
130
  }
131
131
  return p0;
@@ -148,7 +148,7 @@ static gsl_poly_int* mygsl_poly_laguerre(int n)
148
148
  break;
149
149
  default:
150
150
  k = gsl_sf_fact(n);
151
- for (m = 0; m <= n; m++) {
151
+ for (m = 0; (int) m <= n; m++) {
152
152
  val = k*k/gsl_sf_fact(n-m)/gsl_pow_2(gsl_sf_fact(m));
153
153
  if (m%2 == 1) val *= -1;
154
154
  gsl_vector_int_set(p0, m, val);
@@ -164,7 +164,7 @@ static gsl_poly_int* mygsl_poly_bessel(int n)
164
164
  gsl_vector_int *p0;
165
165
  if (n < 0) rb_raise(rb_eArgError, "order must be >= 0");
166
166
  p0 = gsl_vector_int_calloc(n + 1);
167
- for (k = 0; k <= n; k++) {
167
+ for (k = 0; (int) k <= n; k++) {
168
168
  gsl_vector_int_set(p0, k, gsl_sf_fact(n+k)/gsl_sf_fact(n-k)/gsl_sf_fact(k)/((int) pow(2, k)));
169
169
  }
170
170
  return p0;
@@ -191,11 +191,11 @@ static gsl_poly_int* mygsl_poly_bell(int n1)
191
191
  default:
192
192
  p1 = gsl_vector_int_calloc(n1 + 1);
193
193
  memcpy(p1->data, coef2, 3*sizeof(int));
194
- for (n = 2; n < n1; n++) {
194
+ for (n = 2; (int) n < n1; n++) {
195
195
  gsl_vector_int_memcpy(p0, p1);
196
196
  mygsl_vector_int_shift(p0, n);
197
197
  for (j = 0; j < n; j++) {
198
- gsl_vector_int_set(p1, j, gsl_vector_int_get(p1, j+1)*(j+1));
198
+ gsl_vector_int_set(p1, j, gsl_vector_int_get(p1, j+1)*(j+1));
199
199
  }
200
200
  gsl_vector_int_set(p1, n, 0);
201
201
  mygsl_vector_int_shift(p1, n);
@@ -203,14 +203,14 @@ static gsl_poly_int* mygsl_poly_bell(int n1)
203
203
  /* save for the next iteration */
204
204
  gsl_vector_int_memcpy(p1, p0);
205
205
  }
206
- gsl_vector_int_free(p1);
206
+ gsl_vector_int_free(p1);
207
207
  break;
208
208
  }
209
209
  return p0;
210
210
  }
211
211
 
212
212
  static VALUE rb_gsl_poly_define_poly(VALUE klass, VALUE order,
213
- gsl_poly_int* (*f)(int n1)) {
213
+ gsl_poly_int* (*f)(int n1)) {
214
214
  int n1;
215
215
  gsl_poly_int *pnew = NULL;
216
216
  CHECK_FIXNUM(order);
@@ -51,28 +51,21 @@
51
51
  VALUE cgsl_poly, cgsl_poly_int;
52
52
  VALUE cgsl_poly_workspace;
53
53
  VALUE cgsl_poly_complex_workspace;
54
- #ifdef GSL_1_1_LATER
55
54
  VALUE cgsl_poly_dd;
56
55
  VALUE cgsl_poly_taylor;
57
56
  #endif
58
- #endif
59
57
 
60
58
  #ifdef BASE_INT
61
59
  double gsl_poly_int_eval(const BASE c[], const int len, const double x)
62
60
  {
63
61
  int i;
64
62
  double ans = (double) c[len-1];
65
- for(i=len-1; i>0; i--) ans = (double) c[i-1] + x * ans;
63
+ for(i = len-1; i>0; i--) ans = (double) c[i-1] + x * ans;
66
64
  return ans;
67
65
  }
68
66
  #endif
69
67
  #ifdef BASE_DOUBLE
70
- #ifdef HAVE_NARRAY_H
71
- #include "rb_gsl_with_narray.h"
72
- #endif
73
- #ifdef GSL_1_11_LATER
74
68
  static VALUE rb_gsl_complex_poly_complex_eval(VALUE a, VALUE b);
75
- #endif
76
69
  static VALUE rb_gsl_poly_eval_singleton(VALUE klass, VALUE a, VALUE x)
77
70
  {
78
71
  gsl_vector *v = NULL, *vx, *vnew;
@@ -82,22 +75,15 @@ static VALUE rb_gsl_poly_eval_singleton(VALUE klass, VALUE a, VALUE x)
82
75
  size_t i, N, n;
83
76
  VALUE val;
84
77
  double *ptr0;
85
- double *ptr1, *ptr2;
86
- #ifdef HAVE_NARRAY_H
87
- int shape[1];
88
- #endif
89
- #ifdef GSL_1_11_LATER
78
+ double *ptr1, *ptr2;
90
79
  gsl_complex *z, zz;
91
80
  gsl_vector_complex *vz, *vznew;
92
- if (rb_obj_is_kind_of(a, cgsl_vector_complex))
81
+ if (rb_obj_is_kind_of(a, cgsl_vector_complex))
93
82
  return rb_gsl_complex_poly_complex_eval(a, x);
94
- #endif
95
83
  switch (TYPE(a)) {
96
84
  case T_ARRAY:
97
- #ifdef GSL_1_11_LATER
98
- if (rb_obj_is_kind_of(rb_ary_entry(a, 0), cgsl_complex))
85
+ if (rb_obj_is_kind_of(rb_ary_entry(a, 0), cgsl_complex))
99
86
  return rb_gsl_complex_poly_complex_eval(a, x);
100
- #endif
101
87
  v = make_cvector_from_rarray(a);
102
88
  N = v->size;
103
89
  ptr0 = v->data;
@@ -115,7 +101,7 @@ static VALUE rb_gsl_poly_eval_singleton(VALUE klass, VALUE a, VALUE x)
115
101
  #endif
116
102
  } else {
117
103
  rb_raise(rb_eTypeError, "Wrong argument type %s (Array, GSL::Vector or NArray expected)",
118
- rb_class2name(CLASS_OF(a)));
104
+ rb_class2name(CLASS_OF(a)));
119
105
  }
120
106
  }
121
107
  switch (TYPE(x)) {
@@ -123,7 +109,7 @@ static VALUE rb_gsl_poly_eval_singleton(VALUE klass, VALUE a, VALUE x)
123
109
  case T_BIGNUM:
124
110
  case T_FLOAT:
125
111
  val = rb_float_new(gsl_poly_eval(ptr0, N, NUM2DBL(x)));
126
- break;
112
+ break;
127
113
  case T_ARRAY:
128
114
  n = RARRAY_LEN(x);
129
115
  val = rb_ary_new2(n);
@@ -131,7 +117,7 @@ static VALUE rb_gsl_poly_eval_singleton(VALUE klass, VALUE a, VALUE x)
131
117
  rslt = gsl_poly_eval(ptr0, N, NUM2DBL(rb_ary_entry(x, i)));
132
118
  rb_ary_store(val, i, rb_float_new(rslt));
133
119
  }
134
- break;
120
+ break;
135
121
  default:
136
122
  if (rb_obj_is_kind_of(x, cgsl_vector)) {
137
123
  Data_Get_Struct(x, gsl_vector, vx);
@@ -143,19 +129,19 @@ static VALUE rb_gsl_poly_eval_singleton(VALUE klass, VALUE a, VALUE x)
143
129
  } else if (rb_obj_is_kind_of(x, cgsl_matrix)) {
144
130
  Data_Get_Struct(x, gsl_matrix, mx);
145
131
  mnew = gsl_matrix_alloc(mx->size1, mx->size2);
146
- val = Data_Wrap_Struct(cgsl_matrix, 0, gsl_matrix_free, mnew);
132
+ val = Data_Wrap_Struct(cgsl_matrix, 0, gsl_matrix_free, mnew);
147
133
  n = mx->size1*mx->size2;
148
134
  ptr1 = mx->data;
149
135
  ptr2 = mnew->data;
150
136
  #ifdef HAVE_NARRAY_H
151
137
  } else if (NA_IsNArray(x)) {
138
+ int shape[1];
152
139
  shape[0] = NA_TOTAL(x);
153
140
  n = shape[0];
154
141
  val = na_make_object(NA_DFLOAT, 1, shape, CLASS_OF(x));
155
142
  ptr1 = NA_PTR_TYPE(x, double*);
156
- ptr2 = NA_PTR_TYPE(val, double*);
143
+ ptr2 = NA_PTR_TYPE(val, double*);
157
144
  #endif
158
- #ifdef GSL_1_11_LATER
159
145
  } else if (rb_obj_is_kind_of(x, cgsl_complex)) {
160
146
  Data_Get_Struct(x, gsl_complex, z);
161
147
  zz = gsl_poly_complex_eval(ptr0, N, *z);
@@ -166,15 +152,14 @@ static VALUE rb_gsl_poly_eval_singleton(VALUE klass, VALUE a, VALUE x)
166
152
  Data_Get_Struct(x, gsl_vector_complex, vz);
167
153
  vznew = gsl_vector_complex_alloc(vz->size);
168
154
  for (i = 0; i < vz->size; i++) {
169
- zz = gsl_poly_complex_eval(ptr0, N, gsl_vector_complex_get(vz, i));
170
- gsl_vector_complex_set(vznew, i, zz);
155
+ zz = gsl_poly_complex_eval(ptr0, N, gsl_vector_complex_get(vz, i));
156
+ gsl_vector_complex_set(vznew, i, zz);
171
157
  }
172
158
  if (flag == 1) gsl_vector_free(v);
173
159
  return Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, vznew);
174
- #endif
175
160
  } else {
176
161
  rb_raise(rb_eTypeError, "Wrong argument type %s (A number, Array, GSL::Vector or NArray expected)",
177
- rb_class2name(CLASS_OF(a)));
162
+ rb_class2name(CLASS_OF(a)));
178
163
  }
179
164
  for (i = 0; i < n; i++) {
180
165
  ptr2[i] = gsl_poly_eval(ptr0, N, ptr1[i]);
@@ -183,10 +168,10 @@ static VALUE rb_gsl_poly_eval_singleton(VALUE klass, VALUE a, VALUE x)
183
168
  if (flag == 1) gsl_vector_free(v);
184
169
  return val;
185
170
  }
186
- #ifdef GSL_1_11_LATER
171
+
187
172
  static VALUE rb_gsl_complex_poly_complex_eval(VALUE a, VALUE b)
188
173
  {
189
- gsl_vector_complex *coef, *zb, *vnew;
174
+ gsl_vector_complex *coef = NULL, *zb, *vnew;
190
175
  gsl_complex *zc;
191
176
  gsl_complex z, *zx, *res;
192
177
  VALUE ret;
@@ -207,7 +192,6 @@ static VALUE rb_gsl_complex_poly_complex_eval(VALUE a, VALUE b)
207
192
  } else {
208
193
  rb_raise(rb_eTypeError, "rb_gsl_complex_poly_complex_solve: wrong argument type %s (GSL::Vector::Complex or Array expected)\n", rb_class2name(CLASS_OF(a)));
209
194
  }
210
-
211
195
  switch (TYPE(b)) {
212
196
  case T_FIXNUM:
213
197
  case T_BIGNUM:
@@ -220,7 +204,7 @@ static VALUE rb_gsl_complex_poly_complex_eval(VALUE a, VALUE b)
220
204
  break;
221
205
  case T_ARRAY:
222
206
  ret = rb_ary_new2(RARRAY_LEN(b));
223
- for (i = 0; i < RARRAY_LEN(b); i++) {
207
+ for (i = 0; (int) i < RARRAY_LEN(b); i++) {
224
208
  Data_Get_Struct(rb_ary_entry(b, i), gsl_complex, zx);
225
209
  res = (gsl_complex*) malloc(sizeof(gsl_complex));
226
210
  *res = gsl_complex_poly_complex_eval(zc, N, *zx);
@@ -238,8 +222,8 @@ static VALUE rb_gsl_complex_poly_complex_eval(VALUE a, VALUE b)
238
222
  vnew = gsl_vector_complex_alloc(zb->size);
239
223
  ret = Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, vnew);
240
224
  for (i = 0; i < zb->size; i++) {
241
- z = gsl_vector_complex_get(zb, i);
242
- gsl_vector_complex_set(vnew, i, gsl_complex_poly_complex_eval(zc, N, z));
225
+ z = gsl_vector_complex_get(zb, i);
226
+ gsl_vector_complex_set(vnew, i, gsl_complex_poly_complex_eval(zc, N, z));
243
227
  }
244
228
  } else {
245
229
  rb_raise(rb_eTypeError, "Wrong argument type %s.\n", rb_class2name(CLASS_OF(b)));
@@ -249,7 +233,6 @@ static VALUE rb_gsl_complex_poly_complex_eval(VALUE a, VALUE b)
249
233
  return ret;
250
234
  }
251
235
  #endif
252
- #endif
253
236
 
254
237
  static VALUE FUNCTION(rb_gsl_poly,eval)(VALUE obj, VALUE xx)
255
238
  {
@@ -261,15 +244,8 @@ static VALUE FUNCTION(rb_gsl_poly,eval)(VALUE obj, VALUE xx)
261
244
  VALUE x, ary;
262
245
  size_t i, j;
263
246
  #ifdef BASE_DOUBLE
264
- #ifdef HAVE_NARRAY_H
265
- struct NARRAY *na;
266
- double *ptr1, *ptr2;
267
- size_t n;
268
- #endif
269
- #ifdef GSL_1_11_LATER
270
247
  gsl_complex *z, zz;
271
248
  gsl_vector_complex *vz, *vznew;
272
- #endif
273
249
  #endif
274
250
 
275
251
  Data_Get_Struct(obj, GSL_TYPE(gsl_poly), p);
@@ -282,7 +258,7 @@ static VALUE FUNCTION(rb_gsl_poly,eval)(VALUE obj, VALUE xx)
282
258
  break;
283
259
  case T_ARRAY:
284
260
  ary = rb_ary_new2(RARRAY_LEN(xx));
285
- for (i = 0; i < RARRAY_LEN(xx); i++) {
261
+ for (i = 0; (int) i < RARRAY_LEN(xx); i++) {
286
262
  x = rb_ary_entry(xx, i);
287
263
  Need_Float(x);
288
264
  rb_ary_store(ary, i, rb_float_new(FUNCTION(gsl_poly,eval)(p->data, p->size, NUM2DBL(x))));
@@ -293,6 +269,9 @@ static VALUE FUNCTION(rb_gsl_poly,eval)(VALUE obj, VALUE xx)
293
269
  #ifdef BASE_DOUBLE
294
270
  #ifdef HAVE_NARRAY_H
295
271
  if (NA_IsNArray(xx)) {
272
+ struct NARRAY *na;
273
+ double *ptr1, *ptr2;
274
+ size_t n;
296
275
  GetNArray(xx, na);
297
276
  ptr1 = (double*) na->ptr;
298
277
  n = na->total;
@@ -307,21 +286,20 @@ static VALUE FUNCTION(rb_gsl_poly,eval)(VALUE obj, VALUE xx)
307
286
  Data_Get_Struct(xx, GSL_TYPE(gsl_vector), v);
308
287
  vnew = gsl_vector_alloc(v->size);
309
288
  for (i = 0; i < v->size; i++) {
310
- gsl_vector_set(vnew, i, FUNCTION(gsl_poly,eval)(p->data, p->size, FUNCTION(gsl_vector,get)(v, i)));
289
+ gsl_vector_set(vnew, i, FUNCTION(gsl_poly,eval)(p->data, p->size, FUNCTION(gsl_vector,get)(v, i)));
311
290
  }
312
291
  return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, vnew);
313
292
  } else if (MAT_P(xx)) {
314
293
  Data_Get_Struct(xx, GSL_TYPE(gsl_matrix), m);
315
294
  mnew = gsl_matrix_alloc(m->size1, m->size2);
316
295
  for (i = 0; i < m->size1; i++) {
317
- for (j = 0; j < m->size2; j++) {
318
- gsl_matrix_set(mnew, i, j,
319
- FUNCTION(gsl_poly,eval)(p->data, p->size, FUNCTION(gsl_matrix,get)(m, i, j)));
320
- }
296
+ for (j = 0; j < m->size2; j++) {
297
+ gsl_matrix_set(mnew, i, j,
298
+ FUNCTION(gsl_poly,eval)(p->data, p->size, FUNCTION(gsl_matrix,get)(m, i, j)));
299
+ }
321
300
  }
322
301
  return Data_Wrap_Struct(cgsl_matrix, 0, gsl_matrix_free, mnew);
323
302
  #ifdef BASE_DOUBLE
324
- #ifdef GSL_1_11_LATER
325
303
  } else if (rb_obj_is_kind_of(xx, cgsl_complex)) {
326
304
  Data_Get_Struct(xx, gsl_complex, z);
327
305
  zz = gsl_poly_complex_eval(p->data, p->size, *z);
@@ -331,11 +309,10 @@ static VALUE FUNCTION(rb_gsl_poly,eval)(VALUE obj, VALUE xx)
331
309
  Data_Get_Struct(xx, gsl_vector_complex, vz);
332
310
  vznew = gsl_vector_complex_alloc(vz->size);
333
311
  for (i = 0; i < vz->size; i++) {
334
- zz = gsl_poly_complex_eval(p->data, p->size, gsl_vector_complex_get(vz, i));
335
- gsl_vector_complex_set(vznew, i, zz);
312
+ zz = gsl_poly_complex_eval(p->data, p->size, gsl_vector_complex_get(vz, i));
313
+ gsl_vector_complex_set(vznew, i, zz);
336
314
  }
337
315
  return Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, vznew);
338
- #endif
339
316
  #endif
340
317
  } else {
341
318
  rb_raise(rb_eTypeError, "wrong argument type");
@@ -355,12 +332,6 @@ static VALUE FUNCTION(rb_gsl_poly,eval2)(int argc, VALUE *argv, VALUE obj)
355
332
  gsl_matrix *mnew = NULL;
356
333
  VALUE xx, x, ary;
357
334
  size_t i, j, size;
358
- #ifdef BASE_DOUBLE
359
- #ifdef HAVE_NARRAY_H
360
- struct NARRAY *na;
361
- double *ptr1, *ptr2;
362
- #endif
363
- #endif
364
335
  switch (argc) {
365
336
  case 2:
366
337
  Data_Get_Struct(argv[0], GSL_TYPE(gsl_poly), p);
@@ -385,7 +356,7 @@ static VALUE FUNCTION(rb_gsl_poly,eval2)(int argc, VALUE *argv, VALUE obj)
385
356
  break;
386
357
  case T_ARRAY:
387
358
  ary = rb_ary_new2(RARRAY_LEN(xx));
388
- for (i = 0; i < RARRAY_LEN(xx); i++) {
359
+ for (i = 0; (int) i < RARRAY_LEN(xx); i++) {
389
360
  x = rb_ary_entry(xx, i);
390
361
  Need_Float(x);
391
362
  rb_ary_store(ary, i, rb_float_new(FUNCTION(gsl_poly,eval)(p->data, size, NUM2DBL(x))));
@@ -396,6 +367,8 @@ static VALUE FUNCTION(rb_gsl_poly,eval2)(int argc, VALUE *argv, VALUE obj)
396
367
  #ifdef BASE_DOUBLE
397
368
  #ifdef HAVE_NARRAY_H
398
369
  if (NA_IsNArray(xx)) {
370
+ struct NARRAY *na;
371
+ double *ptr1, *ptr2;
399
372
  GetNArray(xx, na);
400
373
  ptr1 = (double*) na->ptr;
401
374
  size = na->total;
@@ -410,17 +383,17 @@ static VALUE FUNCTION(rb_gsl_poly,eval2)(int argc, VALUE *argv, VALUE obj)
410
383
  Data_Get_Struct(xx, GSL_TYPE(gsl_vector), v);
411
384
  vnew = gsl_vector_alloc(v->size);
412
385
  for (i = 0; i < v->size; i++) {
413
- gsl_vector_set(vnew, i, FUNCTION(gsl_poly,eval)(p->data, size, FUNCTION(gsl_vector,get)(v, i)));
386
+ gsl_vector_set(vnew, i, FUNCTION(gsl_poly,eval)(p->data, size, FUNCTION(gsl_vector,get)(v, i)));
414
387
  }
415
388
  return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, vnew);
416
389
  } else if (MAT_P(xx)) {
417
390
  Data_Get_Struct(xx, GSL_TYPE(gsl_matrix), m);
418
391
  mnew = gsl_matrix_alloc(m->size1, m->size2);
419
392
  for (i = 0; i < m->size1; i++) {
420
- for (j = 0; j < m->size2; j++) {
421
- gsl_matrix_set(mnew, i, j,
422
- FUNCTION(gsl_poly,eval)(p->data, size, FUNCTION(gsl_matrix,get)(m, i, j)));
423
- }
393
+ for (j = 0; j < m->size2; j++) {
394
+ gsl_matrix_set(mnew, i, j,
395
+ FUNCTION(gsl_poly,eval)(p->data, size, FUNCTION(gsl_matrix,get)(m, i, j)));
396
+ }
424
397
  }
425
398
  return Data_Wrap_Struct(cgsl_matrix, 0, gsl_matrix_free, mnew);
426
399
  } else {
@@ -441,29 +414,29 @@ static VALUE FUNCTION(rb_gsl_poly,solve_quadratic)(int argc, VALUE *argv, VALUE
441
414
  switch (argc) {
442
415
  case 3:
443
416
  n = gsl_poly_solve_quadratic(NUMCONV2(argv[0]), NUMCONV2(argv[1]), NUMCONV2(argv[2]),
444
- &x0, &x1);
417
+ &x0, &x1);
445
418
  break;
446
419
  case 1:
447
420
  switch (TYPE(argv[0])) {
448
421
  case T_ARRAY:
449
- n = gsl_poly_solve_quadratic(NUMCONV2(rb_ary_entry(argv[0], 0)),
450
- NUMCONV2(rb_ary_entry(argv[0], 1)),
451
- NUMCONV2(rb_ary_entry(argv[0], 2)),
452
- &x0, &x1);
422
+ n = gsl_poly_solve_quadratic(NUMCONV2(rb_ary_entry(argv[0], 0)),
423
+ NUMCONV2(rb_ary_entry(argv[0], 1)),
424
+ NUMCONV2(rb_ary_entry(argv[0], 2)),
425
+ &x0, &x1);
453
426
  break;
454
427
  default:
455
428
  CHECK_VEC(argv[0]);
456
429
  Data_Get_Struct(argv[0], GSL_TYPE(gsl_poly), v);
457
430
  n = gsl_poly_solve_quadratic(FUNCTION(gsl_vector,get)(v, 0),
458
- FUNCTION(gsl_vector,get)(v, 1),
459
- FUNCTION(gsl_vector,get)(v, 2),
460
- &x0, &x1);
431
+ FUNCTION(gsl_vector,get)(v, 1),
432
+ FUNCTION(gsl_vector,get)(v, 2),
433
+ &x0, &x1);
461
434
  break;
462
435
  }
463
436
  break;
464
437
  default:
465
- rb_raise(rb_eArgError,
466
- "wrong number of arguments (3 numbers or 1 array or 1 vector)");
438
+ rb_raise(rb_eArgError,
439
+ "wrong number of arguments (3 numbers or 1 array or 1 vector)");
467
440
  break;
468
441
  }
469
442
  // If n == 0, we want to return an empty gsl_vector, but gsl_vectors can'y be
@@ -473,8 +446,8 @@ static VALUE FUNCTION(rb_gsl_poly,solve_quadratic)(int argc, VALUE *argv, VALUE
473
446
  }
474
447
  r = gsl_vector_alloc(n);
475
448
  switch(n) {
476
- case 2: gsl_vector_set(r, 1, x1); /* fall through */
477
- case 1: gsl_vector_set(r, 0, x0);
449
+ case 2: gsl_vector_set(r, 1, x1); /* fall through */
450
+ case 1: gsl_vector_set(r, 0, x0);
478
451
  }
479
452
  return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, r);
480
453
  }
@@ -487,31 +460,31 @@ static VALUE FUNCTION(rb_gsl_poly,complex_solve_quadratic)(int argc, VALUE *argv
487
460
  int n;
488
461
  switch (argc) {
489
462
  case 3:
490
- n = gsl_poly_complex_solve_quadratic(NUMCONV2(argv[0]),
491
- NUMCONV2(argv[1]), NUMCONV2(argv[2]),
492
- &z0, &z1);
463
+ n = gsl_poly_complex_solve_quadratic(NUMCONV2(argv[0]),
464
+ NUMCONV2(argv[1]), NUMCONV2(argv[2]),
465
+ &z0, &z1);
493
466
  break;
494
467
  case 1:
495
468
  switch (TYPE(argv[0])) {
496
469
  case T_ARRAY:
497
- n = gsl_poly_complex_solve_quadratic(NUMCONV2(rb_ary_entry(argv[0], 0)),
498
- NUMCONV2(rb_ary_entry(argv[0], 1)),
499
- NUMCONV2(rb_ary_entry(argv[0], 2)),
500
- &z0, &z1);
470
+ n = gsl_poly_complex_solve_quadratic(NUMCONV2(rb_ary_entry(argv[0], 0)),
471
+ NUMCONV2(rb_ary_entry(argv[0], 1)),
472
+ NUMCONV2(rb_ary_entry(argv[0], 2)),
473
+ &z0, &z1);
501
474
  break;
502
475
  default:
503
476
  CHECK_VEC(argv[0]);
504
477
  Data_Get_Struct(argv[0], GSL_TYPE(gsl_vector), v);
505
478
  n = gsl_poly_complex_solve_quadratic(FUNCTION(gsl_vector,get)(v, 0),
506
- FUNCTION(gsl_vector,get)(v, 1),
507
- FUNCTION(gsl_vector,get)(v, 2),
508
- &z0, &z1);
479
+ FUNCTION(gsl_vector,get)(v, 1),
480
+ FUNCTION(gsl_vector,get)(v, 2),
481
+ &z0, &z1);
509
482
  break;
510
483
  }
511
484
  break;
512
485
  default:
513
- rb_raise(rb_eArgError,
514
- "wrong number of arguments (3 numbers or 1 array or 1 vector)");
486
+ rb_raise(rb_eArgError,
487
+ "wrong number of arguments (3 numbers or 1 array or 1 vector)");
515
488
  break;
516
489
  }
517
490
  // If n == 0, we want to return an empty gsl_vector, but gsl_vectors can'y be
@@ -521,8 +494,8 @@ static VALUE FUNCTION(rb_gsl_poly,complex_solve_quadratic)(int argc, VALUE *argv
521
494
  }
522
495
  r = gsl_vector_complex_alloc(n);
523
496
  switch(n) {
524
- case 2: gsl_vector_complex_set(r, 1, z1); /* fall through */
525
- case 1: gsl_vector_complex_set(r, 0, z0);
497
+ case 2: gsl_vector_complex_set(r, 1, z1); /* fall through */
498
+ case 1: gsl_vector_complex_set(r, 0, z0);
526
499
  }
527
500
  return Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, r);
528
501
  }
@@ -536,36 +509,36 @@ static VALUE FUNCTION(rb_gsl_poly,solve_cubic)(int argc, VALUE *argv, VALUE obj)
536
509
  switch (argc) {
537
510
  case 3:
538
511
  n = gsl_poly_solve_cubic(NUMCONV2(argv[0]), NUMCONV2(argv[1]), NUMCONV2(argv[2]),
539
- &x0, &x1, &x2);
512
+ &x0, &x1, &x2);
540
513
  break;
541
514
  case 1:
542
515
  switch (TYPE(argv[0])) {
543
516
  case T_ARRAY:
544
- n = gsl_poly_solve_cubic(NUMCONV2(rb_ary_entry(argv[0], 0)),
545
- NUMCONV2(rb_ary_entry(argv[0], 1)),
546
- NUMCONV2(rb_ary_entry(argv[0], 2)),
547
- &x0, &x1, &x2);
517
+ n = gsl_poly_solve_cubic(NUMCONV2(rb_ary_entry(argv[0], 0)),
518
+ NUMCONV2(rb_ary_entry(argv[0], 1)),
519
+ NUMCONV2(rb_ary_entry(argv[0], 2)),
520
+ &x0, &x1, &x2);
548
521
  break;
549
522
  default:
550
523
  CHECK_VEC(argv[0]);
551
524
  Data_Get_Struct(argv[0], GSL_TYPE(gsl_vector), v);
552
525
  n = gsl_poly_solve_cubic(FUNCTION(gsl_vector,get)(v, 0),
553
- FUNCTION(gsl_vector,get)(v, 1),
554
- FUNCTION(gsl_vector,get)(v, 2),
555
- &x0, &x1, &x2);
526
+ FUNCTION(gsl_vector,get)(v, 1),
527
+ FUNCTION(gsl_vector,get)(v, 2),
528
+ &x0, &x1, &x2);
556
529
  break;
557
530
  }
558
531
  break;
559
532
  default:
560
- rb_raise(rb_eArgError,
561
- "wrong number of arguments (3 numbers or 1 array or 1 vector)");
533
+ rb_raise(rb_eArgError,
534
+ "wrong number of arguments (3 numbers or 1 array or 1 vector)");
562
535
  break;
563
536
  }
564
537
  r = gsl_vector_alloc(n);
565
538
  switch(n) {
566
- case 3: gsl_vector_set(r, 2, x2); /* fall through */
567
- case 2: gsl_vector_set(r, 1, x1); /* fall through */
568
- case 1: gsl_vector_set(r, 0, x0);
539
+ case 3: gsl_vector_set(r, 2, x2); /* fall through */
540
+ case 2: gsl_vector_set(r, 1, x1); /* fall through */
541
+ case 1: gsl_vector_set(r, 0, x0);
569
542
  }
570
543
  return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, r);
571
544
  }
@@ -579,41 +552,41 @@ static VALUE FUNCTION(rb_gsl_poly,complex_solve_cubic)(int argc, VALUE *argv, VA
579
552
  switch (argc) {
580
553
  case 3:
581
554
  n = gsl_poly_complex_solve_cubic(NUMCONV2(argv[0]), NUMCONV2(argv[1]), NUMCONV2(argv[2]),
582
- &z0, &z1, &z2);
555
+ &z0, &z1, &z2);
583
556
  break;
584
557
  case 1:
585
558
  switch (TYPE(argv[0])) {
586
559
  case T_ARRAY:
587
- n = gsl_poly_complex_solve_cubic(NUMCONV2(rb_ary_entry(argv[0], 0)),
588
- NUMCONV2(rb_ary_entry(argv[0], 1)),
589
- NUMCONV2(rb_ary_entry(argv[0], 2)),
590
- &z0, &z1, &z2);
560
+ n = gsl_poly_complex_solve_cubic(NUMCONV2(rb_ary_entry(argv[0], 0)),
561
+ NUMCONV2(rb_ary_entry(argv[0], 1)),
562
+ NUMCONV2(rb_ary_entry(argv[0], 2)),
563
+ &z0, &z1, &z2);
591
564
  break;
592
565
  default:
593
566
  CHECK_VEC(argv[0]);
594
567
  Data_Get_Struct(argv[0], GSL_TYPE(gsl_vector), v);
595
568
  n = gsl_poly_complex_solve_cubic(FUNCTION(gsl_vector,get)(v, 0),
596
- FUNCTION(gsl_vector,get)(v, 1),
597
- FUNCTION(gsl_vector,get)(v, 2),
598
- &z0, &z1, &z2);
569
+ FUNCTION(gsl_vector,get)(v, 1),
570
+ FUNCTION(gsl_vector,get)(v, 2),
571
+ &z0, &z1, &z2);
599
572
  break;
600
573
  }
601
574
  break;
602
575
  default:
603
- rb_raise(rb_eArgError,
604
- "wrong number of arguments (3 numbers or 1 array or 1 vector)");
576
+ rb_raise(rb_eArgError,
577
+ "wrong number of arguments (3 numbers or 1 array or 1 vector)");
605
578
  break;
606
579
  }
607
580
  r = gsl_vector_complex_alloc(n);
608
581
  switch(n) {
609
- case 3: gsl_vector_complex_set(r, 2, z2); /* fall through */
610
- case 2: gsl_vector_complex_set(r, 1, z1); /* fall through */
611
- case 1: gsl_vector_complex_set(r, 0, z0);
582
+ case 3: gsl_vector_complex_set(r, 2, z2); /* fall through */
583
+ case 2: gsl_vector_complex_set(r, 1, z1); /* fall through */
584
+ case 1: gsl_vector_complex_set(r, 0, z0);
612
585
  }
613
586
  return Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, r);
614
587
  }
615
588
 
616
- #ifdef HAVE_POLY_SOLVE_QUARTIC
589
+ #ifdef HAVE_GSL_POLY_SOLVE_QUARTIC
617
590
  static VALUE FUNCTION(rb_gsl_poly,solve_quartic)(int argc, VALUE *argv, VALUE obj)
618
591
  {
619
592
  double x0, x1, x2, x3;
@@ -623,40 +596,40 @@ static VALUE FUNCTION(rb_gsl_poly,solve_quartic)(int argc, VALUE *argv, VALUE ob
623
596
  switch (argc) {
624
597
  case 4:
625
598
  n = gsl_poly_solve_quartic(NUMCONV2(argv[0]), NUMCONV2(argv[1]), NUMCONV2(argv[2]),
626
- NUMCONV2(argv[3]),
627
- &x0, &x1, &x2, &x3);
599
+ NUMCONV2(argv[3]),
600
+ &x0, &x1, &x2, &x3);
628
601
  break;
629
602
  case 1:
630
603
  switch (TYPE(argv[0])) {
631
604
  case T_ARRAY:
632
- n = gsl_poly_solve_quartic(NUMCONV2(rb_ary_entry(argv[0], 0)),
633
- NUMCONV2(rb_ary_entry(argv[0], 1)),
634
- NUMCONV2(rb_ary_entry(argv[0], 2)),
635
- NUMCONV2(rb_ary_entry(argv[0], 3)),
636
- &x0, &x1, &x2, &x3);
605
+ n = gsl_poly_solve_quartic(NUMCONV2(rb_ary_entry(argv[0], 0)),
606
+ NUMCONV2(rb_ary_entry(argv[0], 1)),
607
+ NUMCONV2(rb_ary_entry(argv[0], 2)),
608
+ NUMCONV2(rb_ary_entry(argv[0], 3)),
609
+ &x0, &x1, &x2, &x3);
637
610
  break;
638
611
  default:
639
612
  CHECK_VEC(argv[0]);
640
613
  Data_Get_Struct(argv[0], GSL_TYPE(gsl_vector), v);
641
614
  n = gsl_poly_solve_quartic(FUNCTION(gsl_vector,get)(v, 0),
642
- FUNCTION(gsl_vector,get)(v, 1),
643
- FUNCTION(gsl_vector,get)(v, 2),
644
- FUNCTION(gsl_vector,get)(v, 3),
645
- &x0, &x1, &x2, &x3);
615
+ FUNCTION(gsl_vector,get)(v, 1),
616
+ FUNCTION(gsl_vector,get)(v, 2),
617
+ FUNCTION(gsl_vector,get)(v, 3),
618
+ &x0, &x1, &x2, &x3);
646
619
  break;
647
620
  }
648
621
  break;
649
622
  default:
650
- rb_raise(rb_eArgError,
651
- "wrong number of arguments (3 numbers or 1 array or 1 vector)");
623
+ rb_raise(rb_eArgError,
624
+ "wrong number of arguments (3 numbers or 1 array or 1 vector)");
652
625
  break;
653
626
  }
654
627
  r = gsl_vector_alloc(n);
655
628
  switch(n) {
656
- case 4: gsl_vector_set(r, 3, x3); /* fall through */
657
- case 3: gsl_vector_set(r, 2, x2); /* fall through */
658
- case 2: gsl_vector_set(r, 1, x1); /* fall through */
659
- case 1: gsl_vector_set(r, 0, x0);
629
+ case 4: gsl_vector_set(r, 3, x3); /* fall through */
630
+ case 3: gsl_vector_set(r, 2, x2); /* fall through */
631
+ case 2: gsl_vector_set(r, 1, x1); /* fall through */
632
+ case 1: gsl_vector_set(r, 0, x0);
660
633
  }
661
634
  return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, r);
662
635
  }
@@ -669,41 +642,41 @@ static VALUE FUNCTION(rb_gsl_poly,complex_solve_quartic)(int argc, VALUE *argv,
669
642
  int n;
670
643
  switch (argc) {
671
644
  case 4:
672
- n = gsl_poly_complex_solve_quartic(NUMCONV2(argv[0]), NUMCONV2(argv[1]),
673
- NUMCONV2(argv[2]), NUMCONV2(argv[3]),
674
- &z0, &z1, &z2, &z3);
645
+ n = gsl_poly_complex_solve_quartic(NUMCONV2(argv[0]), NUMCONV2(argv[1]),
646
+ NUMCONV2(argv[2]), NUMCONV2(argv[3]),
647
+ &z0, &z1, &z2, &z3);
675
648
  break;
676
649
  case 1:
677
650
  switch (TYPE(argv[0])) {
678
651
  case T_ARRAY:
679
- n = gsl_poly_complex_solve_quartic(NUMCONV2(rb_ary_entry(argv[0], 0)),
680
- NUMCONV2(rb_ary_entry(argv[0], 1)),
681
- NUMCONV2(rb_ary_entry(argv[0], 2)),
682
- NUMCONV2(rb_ary_entry(argv[0], 3)),
683
- &z0, &z1, &z2, &z3);
652
+ n = gsl_poly_complex_solve_quartic(NUMCONV2(rb_ary_entry(argv[0], 0)),
653
+ NUMCONV2(rb_ary_entry(argv[0], 1)),
654
+ NUMCONV2(rb_ary_entry(argv[0], 2)),
655
+ NUMCONV2(rb_ary_entry(argv[0], 3)),
656
+ &z0, &z1, &z2, &z3);
684
657
  break;
685
658
  default:
686
659
  CHECK_VEC(argv[0]);
687
660
  Data_Get_Struct(argv[0], GSL_TYPE(gsl_vector), v);
688
661
  n = gsl_poly_complex_solve_quartic(FUNCTION(gsl_vector,get)(v, 0),
689
- FUNCTION(gsl_vector,get)(v, 1),
690
- FUNCTION(gsl_vector,get)(v, 2),
691
- FUNCTION(gsl_vector,get)(v, 3),
692
- &z0, &z1, &z2, &z3);
662
+ FUNCTION(gsl_vector,get)(v, 1),
663
+ FUNCTION(gsl_vector,get)(v, 2),
664
+ FUNCTION(gsl_vector,get)(v, 3),
665
+ &z0, &z1, &z2, &z3);
693
666
  break;
694
667
  }
695
668
  break;
696
669
  default:
697
- rb_raise(rb_eArgError,
698
- "wrong number of arguments (3 numbers or 1 array or 1 vector)");
670
+ rb_raise(rb_eArgError,
671
+ "wrong number of arguments (3 numbers or 1 array or 1 vector)");
699
672
  break;
700
673
  }
701
674
  r = gsl_vector_complex_alloc(n);
702
675
  switch(n) {
703
- case 4: gsl_vector_complex_set(r, 0, z0); /* fall through */
704
- case 3: gsl_vector_complex_set(r, 1, z1); /* fall through */
705
- case 2: gsl_vector_complex_set(r, 2, z2); /* fall through */
706
- case 1: gsl_vector_complex_set(r, 3, z3);
676
+ case 4: gsl_vector_complex_set(r, 0, z0); /* fall through */
677
+ case 3: gsl_vector_complex_set(r, 1, z1); /* fall through */
678
+ case 2: gsl_vector_complex_set(r, 2, z2); /* fall through */
679
+ case 1: gsl_vector_complex_set(r, 3, z3);
707
680
  }
708
681
  return Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, r);
709
682
  }
@@ -809,20 +782,19 @@ static VALUE FUNCTION(rb_gsl_poly,solve_quadratic2)(VALUE obj)
809
782
  n = gsl_poly_solve_quadratic(a2, a1, a0, &x0, &x1);
810
783
  r = gsl_vector_alloc(n);
811
784
  switch(n) {
812
- case 2: gsl_vector_set(r, 1, x1); /* fall through */
813
- case 1: gsl_vector_set(r, 0, x0);
785
+ case 2: gsl_vector_set(r, 1, x1); /* fall through */
786
+ case 1: gsl_vector_set(r, 0, x0);
814
787
  }
815
788
  return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, r);
816
789
  } else {
817
790
  n = gsl_poly_complex_solve_quadratic(a2, a1, a0, &z0, &z1);
818
791
  r2 = gsl_vector_complex_alloc(n);
819
792
  switch(n) {
820
- case 2: gsl_vector_complex_set(r2, 1, z1); /* fall through */
821
- case 1: gsl_vector_complex_set(r2, 0, z0);
793
+ case 2: gsl_vector_complex_set(r2, 1, z1); /* fall through */
794
+ case 1: gsl_vector_complex_set(r2, 0, z0);
822
795
  }
823
796
  return Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, r2);
824
797
  }
825
-
826
798
  }
827
799
 
828
800
 
@@ -843,8 +815,8 @@ static VALUE FUNCTION(rb_gsl_poly,complex_solve_quadratic2)(VALUE obj)
843
815
  n = gsl_poly_complex_solve_quadratic(a2, a1, a0, &z0, &z1);
844
816
  r = gsl_vector_complex_alloc(n);
845
817
  switch(n) {
846
- case 2: gsl_vector_complex_set(r, 1, z1); /* fall through */
847
- case 1: gsl_vector_complex_set(r, 0, z0);
818
+ case 2: gsl_vector_complex_set(r, 1, z1); /* fall through */
819
+ case 1: gsl_vector_complex_set(r, 0, z0);
848
820
  }
849
821
  return Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, r);
850
822
  }
@@ -862,16 +834,16 @@ static VALUE FUNCTION(rb_gsl_poly,solve_cubic2)(VALUE obj)
862
834
  if (v->size < 4) {
863
835
  rb_raise(rb_eArgError, "the order of the object is less than 4.");
864
836
  }
865
- a3 = FUNCTION(gsl_vector,get)(v, 3);
837
+ a3 = FUNCTION(gsl_vector,get)(v, 3);
866
838
  a2 = FUNCTION(gsl_vector,get)(v, 2)/a3; /* coefficients */
867
839
  a1 = FUNCTION(gsl_vector,get)(v, 1)/a3;
868
840
  a0 = FUNCTION(gsl_vector,get)(v, 0)/a3;
869
841
  n = gsl_poly_solve_cubic(a2, a1, a0, &x0, &x1, &x2);
870
842
  r = gsl_vector_alloc(n);
871
843
  switch(n) {
872
- case 3: gsl_vector_set(r, 2, x2); /* fall through */
873
- case 2: gsl_vector_set(r, 1, x1); /* fall through */
874
- case 1: gsl_vector_set(r, 0, x0);
844
+ case 3: gsl_vector_set(r, 2, x2); /* fall through */
845
+ case 2: gsl_vector_set(r, 1, x1); /* fall through */
846
+ case 1: gsl_vector_set(r, 0, x0);
875
847
  }
876
848
  return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, r);
877
849
  }
@@ -887,21 +859,21 @@ static VALUE FUNCTION(rb_gsl_poly,complex_solve_cubic2)(VALUE obj)
887
859
  if (v->size < 4) {
888
860
  rb_raise(rb_eArgError, "the order of the object is less than 4.");
889
861
  }
890
- a3 = FUNCTION(gsl_vector,get)(v, 3);
862
+ a3 = FUNCTION(gsl_vector,get)(v, 3);
891
863
  a2 = FUNCTION(gsl_vector,get)(v, 2)/a3; /* coefficients */
892
864
  a1 = FUNCTION(gsl_vector,get)(v, 1)/a3;
893
865
  a0 = FUNCTION(gsl_vector,get)(v, 0)/a3;
894
866
  n = gsl_poly_complex_solve_cubic(a2, a1, a0, &z0, &z1, &z2);
895
867
  r = gsl_vector_complex_alloc(n);
896
868
  switch(n) {
897
- case 3: gsl_vector_complex_set(r, 2, z2); /* fall through */
898
- case 2: gsl_vector_complex_set(r, 1, z1); /* fall through */
899
- case 1: gsl_vector_complex_set(r, 0, z0);
869
+ case 3: gsl_vector_complex_set(r, 2, z2); /* fall through */
870
+ case 2: gsl_vector_complex_set(r, 1, z1); /* fall through */
871
+ case 1: gsl_vector_complex_set(r, 0, z0);
900
872
  }
901
873
  return Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, r);
902
874
  }
903
875
 
904
- #ifdef HAVE_POLY_SOLVE_QUARTIC
876
+ #ifdef HAVE_GSL_POLY_SOLVE_QUARTIC
905
877
  /* a4 x**4 + a3 x**3 + a2 x**2 + a1 x + a0 = 0 */
906
878
  static VALUE FUNCTION(rb_gsl_poly,solve_quartic2)(VALUE obj)
907
879
  {
@@ -915,8 +887,8 @@ static VALUE FUNCTION(rb_gsl_poly,solve_quartic2)(VALUE obj)
915
887
  if (v->size < 5) {
916
888
  rb_raise(rb_eArgError, "the order of the object is less than 4.");
917
889
  }
918
- a4 = FUNCTION(gsl_vector,get)(v, 4);
919
- a3 = FUNCTION(gsl_vector,get)(v, 3)/a4;
890
+ a4 = FUNCTION(gsl_vector,get)(v, 4);
891
+ a3 = FUNCTION(gsl_vector,get)(v, 3)/a4;
920
892
  a2 = FUNCTION(gsl_vector,get)(v, 2)/a4; /* coefficients */
921
893
  a1 = FUNCTION(gsl_vector,get)(v, 1)/a4;
922
894
  a0 = FUNCTION(gsl_vector,get)(v, 0)/a4;
@@ -941,8 +913,8 @@ static VALUE FUNCTION(rb_gsl_poly,complex_solve_quartic2)(VALUE obj)
941
913
  if (v->size < 5) {
942
914
  rb_raise(rb_eArgError, "the order of the object is less than 4.");
943
915
  }
944
- a4 = FUNCTION(gsl_vector,get)(v, 4);
945
- a3 = FUNCTION(gsl_vector,get)(v, 3)/a4;
916
+ a4 = FUNCTION(gsl_vector,get)(v, 4);
917
+ a3 = FUNCTION(gsl_vector,get)(v, 3)/a4;
946
918
  a2 = FUNCTION(gsl_vector,get)(v, 2)/a4; /* coefficients */
947
919
  a1 = FUNCTION(gsl_vector,get)(v, 1)/a4;
948
920
  a0 = FUNCTION(gsl_vector,get)(v, 0)/a4;
@@ -978,7 +950,6 @@ VALUE FUNCTION(rb_gsl_poly,complex_solve2)(int argc, VALUE *argv, VALUE obj)
978
950
  for (i = 0; i < v->size; i++) {
979
951
  gsl_vector_set(a, i, FUNCTION(gsl_vector,get)(v, i));
980
952
  }
981
-
982
953
  if (argc == 1 && rb_obj_is_kind_of(argv[0], cgsl_poly_workspace)) {
983
954
  Data_Get_Struct(argv[0], gsl_poly_complex_workspace, w);
984
955
  flag = 0;
@@ -986,7 +957,6 @@ VALUE FUNCTION(rb_gsl_poly,complex_solve2)(int argc, VALUE *argv, VALUE obj)
986
957
  w = gsl_poly_complex_workspace_alloc(size);
987
958
  flag = 1;
988
959
  }
989
-
990
960
  /*status =*/ gsl_poly_complex_solve(a->data, size, w, z->data);
991
961
 
992
962
  r = gsl_vector_complex_alloc(size - 1);
@@ -1009,7 +979,7 @@ static VALUE rb_gsl_poly_int_to_f(VALUE obj)
1009
979
  size_t i;
1010
980
  Data_Get_Struct(obj, gsl_vector_int, vi);
1011
981
  v = gsl_vector_alloc(vi->size);
1012
- for (i = 0; i < v->size; i++)
982
+ for (i = 0; i < v->size; i++)
1013
983
  gsl_vector_set(v, i, (double) gsl_vector_int_get(vi, i));
1014
984
  return Data_Wrap_Struct(cgsl_poly, 0, gsl_vector_free, v);
1015
985
  }
@@ -1023,7 +993,7 @@ static VALUE rb_gsl_poly_to_i(VALUE obj)
1023
993
  size_t i;
1024
994
  Data_Get_Struct(obj, gsl_vector, v);
1025
995
  vi = gsl_vector_int_alloc(v->size);
1026
- for (i = 0; i < v->size; i++)
996
+ for (i = 0; i < v->size; i++)
1027
997
  gsl_vector_int_set(vi, i, (int) gsl_vector_get(v, i));
1028
998
  return Data_Wrap_Struct(cgsl_poly_int, 0, gsl_vector_int_free, vi);
1029
999
  }
@@ -1035,8 +1005,6 @@ static VALUE FUNCTION(rb_gsl_poly,workspace_new)(VALUE klass, VALUE n)
1035
1005
  return Data_Wrap_Struct(klass, 0, gsl_poly_complex_workspace_free, w);
1036
1006
  }
1037
1007
 
1038
- #ifdef GSL_1_1_LATER
1039
-
1040
1008
  /* singleton method of the class Poly */
1041
1009
  static VALUE rb_gsl_poly_dd_init(VALUE obj, VALUE vxa, VALUE vya)
1042
1010
  {
@@ -1065,7 +1033,7 @@ static VALUE rb_gsl_poly_dd_eval(VALUE obj, VALUE xxa, VALUE xx)
1065
1033
  case T_BIGNUM:
1066
1034
  case T_FLOAT:
1067
1035
  return rb_float_new(gsl_poly_dd_eval(dd->data, xa->data, dd->size,
1068
- NUM2DBL(xx)));
1036
+ NUM2DBL(xx)));
1069
1037
  break;
1070
1038
  case T_ARRAY:
1071
1039
  size = RARRAY_LEN(xx);
@@ -1073,9 +1041,9 @@ static VALUE rb_gsl_poly_dd_eval(VALUE obj, VALUE xxa, VALUE xx)
1073
1041
  for (i = 0; i < size; i++) {
1074
1042
  x = rb_ary_entry(xx, i);
1075
1043
  Need_Float(x);
1076
- rb_ary_store(ary, i,
1077
- rb_float_new(gsl_poly_dd_eval(dd->data, xa->data,
1078
- dd->size, NUM2DBL(x))));
1044
+ rb_ary_store(ary, i,
1045
+ rb_float_new(gsl_poly_dd_eval(dd->data, xa->data,
1046
+ dd->size, NUM2DBL(x))));
1079
1047
  }
1080
1048
  return ary;
1081
1049
  break;
@@ -1085,9 +1053,9 @@ static VALUE rb_gsl_poly_dd_eval(VALUE obj, VALUE xxa, VALUE xx)
1085
1053
  size = v->size;
1086
1054
  vnew = gsl_vector_alloc(v->size);
1087
1055
  for (i = 0; i < size; i++) {
1088
- gsl_vector_set(vnew, i,
1089
- gsl_poly_dd_eval(dd->data, xa->data,
1090
- dd->size, FUNCTION(gsl_vector,get)(v, i)));
1056
+ gsl_vector_set(vnew, i,
1057
+ gsl_poly_dd_eval(dd->data, xa->data,
1058
+ dd->size, FUNCTION(gsl_vector,get)(v, i)));
1091
1059
  }
1092
1060
  return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, vnew);
1093
1061
  } else if (MAT_P(xx)) {
@@ -1095,11 +1063,11 @@ static VALUE rb_gsl_poly_dd_eval(VALUE obj, VALUE xxa, VALUE xx)
1095
1063
  size = m->size1;
1096
1064
  mnew = gsl_matrix_alloc(m->size1, m->size2);
1097
1065
  for (i = 0; i < m->size1; i++) {
1098
- for (j = 0; j < m->size2; j++) {
1099
- gsl_matrix_set(mnew, i, j,
1100
- gsl_poly_dd_eval(dd->data, xa->data,
1101
- dd->size, gsl_matrix_get(m, i, j)));
1102
- }
1066
+ for (j = 0; j < m->size2; j++) {
1067
+ gsl_matrix_set(mnew, i, j,
1068
+ gsl_poly_dd_eval(dd->data, xa->data,
1069
+ dd->size, gsl_matrix_get(m, i, j)));
1070
+ }
1103
1071
  }
1104
1072
  return Data_Wrap_Struct(cgsl_matrix, 0, gsl_matrix_free, mnew);
1105
1073
  } else {
@@ -1160,7 +1128,6 @@ static VALUE rb_gsl_poly_dd_taylor(int argc, VALUE *argv, VALUE obj)
1160
1128
  return Data_Wrap_Struct(cgsl_poly_taylor, 0, gsl_vector_free, c);
1161
1129
  }
1162
1130
 
1163
- #endif
1164
1131
  #endif
1165
1132
 
1166
1133
  static VALUE FUNCTION(rb_gsl_poly,order)(VALUE obj)
@@ -1171,7 +1138,7 @@ static VALUE FUNCTION(rb_gsl_poly,order)(VALUE obj)
1171
1138
  }
1172
1139
 
1173
1140
  int FUNCTION(gsl_poly,conv)(const BASE *a, size_t na, const BASE *b, size_t nb,
1174
- BASE *c, size_t *nc)
1141
+ BASE *c, size_t *nc)
1175
1142
  {
1176
1143
  BASE x;
1177
1144
  size_t i, j;
@@ -1192,7 +1159,7 @@ GSL_TYPE(gsl_vector)* FUNCTION(gsl_poly,conv_vector)(const GSL_TYPE(gsl_vector)
1192
1159
  {
1193
1160
  GSL_TYPE(gsl_vector) *vnew = NULL;
1194
1161
  size_t n, tmp;
1195
- if (v1->size == 1) {
1162
+ if (v1->size == 1) {
1196
1163
  vnew = FUNCTION(make_vector,clone)(v2);
1197
1164
  FUNCTION(gsl_vector,scale)(vnew, FUNCTION(gsl_vector,get)(v1, 0));
1198
1165
  return vnew;
@@ -1249,8 +1216,8 @@ GSL_TYPE(gsl_vector)* FUNCTION(gsl_poly,integ)(const GSL_TYPE(gsl_vector) *v)
1249
1216
  return vnew;
1250
1217
  }
1251
1218
 
1252
- GSL_TYPE(gsl_vector)* FUNCTION(gsl_poly,deconv_vector)(const GSL_TYPE(gsl_vector) *c, const GSL_TYPE(gsl_vector) *a,
1253
- GSL_TYPE(gsl_vector) **r)
1219
+ GSL_TYPE(gsl_vector)* FUNCTION(gsl_poly,deconv_vector)(const GSL_TYPE(gsl_vector) *c, const GSL_TYPE(gsl_vector) *a,
1220
+ GSL_TYPE(gsl_vector) **r)
1254
1221
  {
1255
1222
  GSL_TYPE(gsl_vector) *vnew = NULL, *a2 = NULL, *c2 = NULL, *vtmp = NULL;
1256
1223
  GSL_TYPE(gsl_vector) *rtmp = NULL;
@@ -1265,12 +1232,15 @@ GSL_TYPE(gsl_vector)* FUNCTION(gsl_poly,deconv_vector)(const GSL_TYPE(gsl_vector
1265
1232
  FUNCTION(gsl_vector,set)(vnew, n-1, FUNCTION(gsl_vector,get)(c2, c2->size-1)/aa);
1266
1233
  for (i = n - 2, k = 1; k < n; i--, k++) {
1267
1234
  x = FUNCTION(gsl_vector,get)(c2, c2->size-1-k);
1268
- for (j = n-1; j >= 0; j--) {
1235
+ for (j = n-1;; j--) {
1269
1236
  z = FUNCTION(gsl_vector,get)(vnew, j);
1270
1237
  jj = c2->size-1-k-j;
1271
- if (jj > k || jj < 0) continue;
1272
- y = FUNCTION(gsl_vector,get)(a2, jj);
1273
- x -= y*z;
1238
+ //if (jj > k || jj < 0) continue;
1239
+ if (jj <= k) {
1240
+ y = FUNCTION(gsl_vector,get)(a2, jj);
1241
+ x -= y*z;
1242
+ }
1243
+ if (j == 0) break;
1274
1244
  }
1275
1245
  FUNCTION(gsl_vector,set)(vnew, i, x/aa);
1276
1246
  }
@@ -1354,11 +1324,11 @@ VALUE FUNCTION(rb_gsl_poly,deconv)(VALUE obj, VALUE bb)
1354
1324
  }
1355
1325
  vnew = FUNCTION(gsl_poly,deconv_vector)(v, v2, &r);
1356
1326
  if (flag == 1) FUNCTION(gsl_vector,free)(v2);
1357
- if (FUNCTION(gsl_vector,isnull)(r))
1327
+ if (FUNCTION(gsl_vector,isnull)(r))
1358
1328
  return Data_Wrap_Struct(GSL_TYPE(cgsl_poly), 0, FUNCTION(gsl_vector,free), vnew);
1359
1329
  else
1360
1330
  return rb_ary_new3(2, Data_Wrap_Struct(GSL_TYPE(cgsl_poly), 0, FUNCTION(gsl_vector,free), vnew),
1361
- Data_Wrap_Struct(GSL_TYPE(cgsl_poly), 0, FUNCTION(gsl_vector,free), r));
1331
+ Data_Wrap_Struct(GSL_TYPE(cgsl_poly), 0, FUNCTION(gsl_vector,free), r));
1362
1332
  }
1363
1333
 
1364
1334
  static VALUE FUNCTION(rb_gsl_poly,reduce)(VALUE obj)
@@ -1407,7 +1377,7 @@ static VALUE FUNCTION(rb_gsl_poly,conv2)(VALUE klass, VALUE v1, VALUE v2)
1407
1377
  p3 = FUNCTION(gsl_poly,conv_vector)(p1, p2);
1408
1378
  if (flag1 == 1) FUNCTION(gsl_vector,free)(p1);
1409
1379
  if (flag2 == 1) FUNCTION(gsl_vector,free)(p2);
1410
- if (flag1 == 1 && flag2 == 1) {
1380
+ if (flag1 == 1 && flag2 == 1) {
1411
1381
  ary = rb_ary_new2(p3->size);
1412
1382
  for (i = 0; i < p3->size; i++)
1413
1383
  rb_ary_store(ary, i, C_TO_VALUE2(FUNCTION(gsl_vector,get)(p3, i)));
@@ -1428,15 +1398,15 @@ static VALUE FUNCTION(rb_gsl_poly,deconv2)(VALUE klass, VALUE v1, VALUE v2)
1428
1398
  vnew = FUNCTION(gsl_poly,deconv_vector)(p1, p2, &r);
1429
1399
  if (flag1 == 1) FUNCTION(gsl_vector,free)(p1);
1430
1400
  if (flag2 == 1) FUNCTION(gsl_vector,free)(p2);
1431
- if (FUNCTION(gsl_vector,isnull)(r))
1401
+ if (FUNCTION(gsl_vector,isnull)(r))
1432
1402
  return Data_Wrap_Struct(GSL_TYPE(cgsl_poly), 0, FUNCTION(gsl_vector,free), vnew);
1433
1403
  else
1434
1404
  return rb_ary_new3(2, Data_Wrap_Struct(GSL_TYPE(cgsl_poly), 0, FUNCTION(gsl_vector,free), vnew),
1435
- Data_Wrap_Struct(GSL_TYPE(cgsl_poly), 0, FUNCTION(gsl_vector,free), r));
1405
+ Data_Wrap_Struct(GSL_TYPE(cgsl_poly), 0, FUNCTION(gsl_vector,free), r));
1436
1406
  }
1437
1407
 
1438
- GSL_TYPE(gsl_poly)* FUNCTION(gsl_poly,add)(const GSL_TYPE(gsl_poly) *a,
1439
- const GSL_TYPE(gsl_poly) *b)
1408
+ GSL_TYPE(gsl_poly)* FUNCTION(gsl_poly,add)(const GSL_TYPE(gsl_poly) *a,
1409
+ const GSL_TYPE(gsl_poly) *b)
1440
1410
  {
1441
1411
  GSL_TYPE(gsl_poly) *c = NULL;
1442
1412
  const GSL_TYPE(gsl_poly) *longer;
@@ -1446,7 +1416,7 @@ GSL_TYPE(gsl_poly)* FUNCTION(gsl_poly,add)(const GSL_TYPE(gsl_poly) *a,
1446
1416
  longer = a;
1447
1417
  } else {
1448
1418
  c = FUNCTION(gsl_vector,alloc)(b->size);
1449
- longer = b;
1419
+ longer = b;
1450
1420
  }
1451
1421
  n = GSL_MIN(a->size, b->size);
1452
1422
  for (i = 0; i < n; i++) {
@@ -1518,7 +1488,7 @@ static VALUE FUNCTION(rb_gsl_poly,coerce)(VALUE obj, VALUE other)
1518
1488
  vb = FUNCTION(gsl_vector,calloc)(1);
1519
1489
  FUNCTION(gsl_vector,set)(vb, 0, (BASE) NUM2DBL(other));
1520
1490
  return rb_ary_new3(2, Data_Wrap_Struct(CLASS_OF(obj), 0, FUNCTION(gsl_vector,free), vb),
1521
- obj);
1491
+ obj);
1522
1492
  break;
1523
1493
  default:
1524
1494
  CHECK_VEC(other);
@@ -1545,10 +1515,10 @@ static VALUE FUNCTION(rb_gsl_poly,companion_matrix)(VALUE obj)
1545
1515
  size = p->size - 1;
1546
1516
  m = gsl_matrix_calloc(size, size);
1547
1517
  z = FUNCTION(gsl_vector,get)(p, size);
1548
- for (j = 0; j < size; j++)
1518
+ for (j = 0; j < size; j++)
1549
1519
  gsl_matrix_set(m, 0, size-j-1, -FUNCTION(gsl_vector,get)(p, j)/z);
1550
1520
  for (i = 1; i < size; i++) {
1551
- gsl_matrix_set(m, i, i-1, 1.0);
1521
+ gsl_matrix_set(m, i, i-1, 1.0);
1552
1522
  }
1553
1523
  return Data_Wrap_Struct(cgsl_matrix, 0, gsl_matrix_free, m);
1554
1524
  }
@@ -1559,17 +1529,13 @@ static VALUE FUNCTION(rb_gsl_poly,info)(VALUE obj)
1559
1529
  char buf[256];
1560
1530
  Data_Get_Struct(obj, GSL_TYPE(gsl_poly), v);
1561
1531
  sprintf(buf, "Class: %s\n", rb_class2name(CLASS_OF(obj)));
1562
- #ifdef RUBY_1_9_LATER
1563
1532
  sprintf(buf, "%sSuperClass: %s\n", buf, rb_class2name(RCLASS_SUPER(CLASS_OF(obj))));
1564
- #else
1565
- sprintf(buf, "%sSuperClass: %s\n", buf, rb_class2name(RCLASS(CLASS_OF(obj))->super));
1566
- #endif
1567
1533
  sprintf(buf, "%sOrder: %d\n", buf, (int) v->size-1);
1568
1534
  return rb_str_new2(buf);
1569
1535
  }
1570
1536
 
1571
1537
  #ifdef BASE_DOUBLE
1572
- #include "rb_gsl_fit.h"
1538
+ #include "include/rb_gsl_fit.h"
1573
1539
  /* singleton */
1574
1540
  static VALUE rb_gsl_poly_fit(int argc, VALUE *argv, VALUE obj)
1575
1541
  {
@@ -1581,7 +1547,7 @@ static VALUE rb_gsl_poly_fit(int argc, VALUE *argv, VALUE obj)
1581
1547
  double chisq, val;
1582
1548
  int status, flag = 0;
1583
1549
  VALUE vc, vcov;
1584
- if (argc != 3 && argc != 4)
1550
+ if (argc != 3 && argc != 4)
1585
1551
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 3 or 4)", argc);
1586
1552
  x = &xx.vector;
1587
1553
  y = &yy.vector;
@@ -1622,7 +1588,7 @@ static VALUE rb_gsl_poly_wfit(int argc, VALUE *argv, VALUE obj)
1622
1588
  double chisq, val;
1623
1589
  int status, flag = 0;
1624
1590
  VALUE vc, vcov;
1625
- if (argc != 4 && argc != 5)
1591
+ if (argc != 4 && argc != 5)
1626
1592
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 4 or 5)", argc);
1627
1593
  Data_Get_Vector(argv[0], x);
1628
1594
  Data_Get_Vector(argv[1], w);
@@ -1655,17 +1621,11 @@ static VALUE rb_gsl_poly_wfit(int argc, VALUE *argv, VALUE obj)
1655
1621
  #endif
1656
1622
 
1657
1623
  #ifdef BASE_DOUBLE
1658
- #ifdef GSL_1_13_LATER
1659
1624
  static VALUE rb_gsl_poly_eval_derivs_singleton(int argc, VALUE *argv, VALUE klass)
1660
1625
  {
1661
1626
  VALUE ary;
1662
1627
  gsl_vector *v = NULL, *v2 = NULL;
1663
1628
  size_t i, lenc, lenres;
1664
- #ifdef HAVE_NARRAY_H
1665
- struct NARRAY *na;
1666
- double *ptr1, *ptr2;
1667
- int shape[1];
1668
- #endif
1669
1629
 
1670
1630
  if (argc < 2) rb_raise(rb_eArgError, "Wrong number of arguments (%d for >= 2)", argc);
1671
1631
  if (rb_obj_is_kind_of(argv[0], rb_cArray)) {
@@ -1697,6 +1657,9 @@ static VALUE rb_gsl_poly_eval_derivs_singleton(int argc, VALUE *argv, VALUE klas
1697
1657
  }
1698
1658
  #ifdef HAVE_NARRAY_H
1699
1659
  if (NA_IsNArray(argv[0])) {
1660
+ struct NARRAY *na;
1661
+ double *ptr1, *ptr2;
1662
+ int shape[1];
1700
1663
  GetNArray(argv[0], na);
1701
1664
  ptr1 = (double*) na->ptr;
1702
1665
  lenc = na->total;
@@ -1732,7 +1695,6 @@ static VALUE rb_gsl_poly_eval_derivs(int argc, VALUE *argv, VALUE obj)
1732
1695
  return Data_Wrap_Struct(cgsl_poly, 0, gsl_vector_free, v2);
1733
1696
  }
1734
1697
  #endif
1735
- #endif
1736
1698
 
1737
1699
  void FUNCTION(Init_gsl_poly,init)(VALUE module)
1738
1700
  {
@@ -1743,78 +1705,78 @@ void FUNCTION(Init_gsl_poly,init)(VALUE module)
1743
1705
 
1744
1706
  cgsl_poly_workspace = rb_define_class_under(cgsl_poly, "Workspace", cGSL_Object);
1745
1707
  mgsl_poly_complex = rb_define_module_under(cgsl_poly, "Complex");
1746
- cgsl_poly_complex_workspace = rb_define_class_under(mgsl_poly_complex,
1747
- "Workspace", cGSL_Object);
1748
- rb_define_singleton_method(cgsl_poly_workspace, "alloc",
1749
- rb_gsl_poly_workspace_new, 1);
1708
+ cgsl_poly_complex_workspace = rb_define_class_under(mgsl_poly_complex,
1709
+ "Workspace", cGSL_Object);
1710
+ rb_define_singleton_method(cgsl_poly_workspace, "alloc",
1711
+ rb_gsl_poly_workspace_new, 1);
1750
1712
  rb_define_singleton_method(cgsl_poly_complex_workspace, "alloc",
1751
- rb_gsl_poly_workspace_new, 1);
1713
+ rb_gsl_poly_workspace_new, 1);
1752
1714
 
1753
- rb_define_singleton_method(mgsl_poly_complex, "solve_quadratic",
1754
- FUNCTION(rb_gsl_poly,complex_solve_quadratic), -1);
1715
+ rb_define_singleton_method(mgsl_poly_complex, "solve_quadratic",
1716
+ FUNCTION(rb_gsl_poly,complex_solve_quadratic), -1);
1755
1717
  rb_define_singleton_method(mgsl_poly_complex, "solve_cubic",
1756
- FUNCTION(rb_gsl_poly,complex_solve_cubic), -1);
1757
- #ifdef HAVE_POLY_SOLVE_QUARTIC
1718
+ FUNCTION(rb_gsl_poly,complex_solve_cubic), -1);
1719
+ #ifdef HAVE_GSL_POLY_SOLVE_QUARTIC
1758
1720
  rb_define_singleton_method(mgsl_poly_complex, "solve_quartic",
1759
- FUNCTION(rb_gsl_poly,complex_solve_quartic), -1);
1721
+ FUNCTION(rb_gsl_poly,complex_solve_quartic), -1);
1760
1722
  #endif
1761
1723
 
1762
1724
  rb_define_singleton_method(mgsl_poly_complex, "solve",
1763
- FUNCTION(rb_gsl_poly,complex_solve), -1);
1764
- rb_define_singleton_method(mgsl_poly_complex, "roots",
1765
- FUNCTION(rb_gsl_poly,complex_solve), -1);
1725
+ FUNCTION(rb_gsl_poly,complex_solve), -1);
1726
+ rb_define_singleton_method(mgsl_poly_complex, "roots",
1727
+ FUNCTION(rb_gsl_poly,complex_solve), -1);
1766
1728
  #endif
1767
1729
 
1768
- rb_define_singleton_method(GSL_TYPE(cgsl_poly), "solve_quadratic",
1769
- FUNCTION(rb_gsl_poly,solve_quadratic), -1);
1770
- rb_define_singleton_method(GSL_TYPE(cgsl_poly), "solve_cubic",
1771
- FUNCTION(rb_gsl_poly,solve_cubic), -1);
1730
+ rb_define_singleton_method(GSL_TYPE(cgsl_poly), "solve_quadratic",
1731
+ FUNCTION(rb_gsl_poly,solve_quadratic), -1);
1732
+ rb_define_singleton_method(GSL_TYPE(cgsl_poly), "solve_cubic",
1733
+ FUNCTION(rb_gsl_poly,solve_cubic), -1);
1772
1734
 
1773
- rb_define_singleton_method(GSL_TYPE(cgsl_poly), "complex_solve_quadratic",
1774
- FUNCTION(rb_gsl_poly,complex_solve_quadratic), -1);
1775
- rb_define_singleton_method(GSL_TYPE(cgsl_poly), "complex_solve_cubic",
1776
- FUNCTION(rb_gsl_poly,complex_solve_cubic), -1);
1777
- #ifdef HAVE_POLY_SOLVE_QUARTIC
1735
+ rb_define_singleton_method(GSL_TYPE(cgsl_poly), "complex_solve_quadratic",
1736
+ FUNCTION(rb_gsl_poly,complex_solve_quadratic), -1);
1737
+ rb_define_singleton_method(GSL_TYPE(cgsl_poly), "complex_solve_cubic",
1738
+ FUNCTION(rb_gsl_poly,complex_solve_cubic), -1);
1739
+ #ifdef HAVE_GSL_POLY_SOLVE_QUARTIC
1778
1740
  rb_define_singleton_method(GSL_TYPE(cgsl_poly), "solve_quartic",
1779
- FUNCTION(rb_gsl_poly,solve_quartic), -1);
1741
+ FUNCTION(rb_gsl_poly,solve_quartic), -1);
1780
1742
 
1781
1743
  rb_define_singleton_method(GSL_TYPE(cgsl_poly), "complex_solve_quartic",
1782
- FUNCTION(rb_gsl_poly,complex_solve_quartic), -1);
1744
+ FUNCTION(rb_gsl_poly,complex_solve_quartic), -1);
1783
1745
  #endif
1784
1746
  rb_define_singleton_method(GSL_TYPE(cgsl_poly), "complex_solve",
1785
- FUNCTION(rb_gsl_poly,complex_solve), -1);
1747
+ FUNCTION(rb_gsl_poly,complex_solve), -1);
1786
1748
 
1787
1749
  rb_define_singleton_method(GSL_TYPE(cgsl_poly), "solve",
1788
- FUNCTION(rb_gsl_poly,complex_solve), -1);
1789
- rb_define_singleton_method(GSL_TYPE(cgsl_poly), "roots",
1790
- FUNCTION(rb_gsl_poly,complex_solve), -1);
1750
+ FUNCTION(rb_gsl_poly,complex_solve), -1);
1751
+ rb_define_singleton_method(GSL_TYPE(cgsl_poly), "roots",
1752
+ FUNCTION(rb_gsl_poly,complex_solve), -1);
1791
1753
 
1792
- rb_define_singleton_method(GSL_TYPE(cgsl_poly), "eval",
1793
- FUNCTION(rb_gsl_poly,eval2), -1);
1754
+ rb_define_singleton_method(GSL_TYPE(cgsl_poly), "eval",
1755
+ FUNCTION(rb_gsl_poly,eval2), -1);
1794
1756
 
1795
1757
  rb_define_method(GSL_TYPE(cgsl_poly), "eval",
1796
- FUNCTION(rb_gsl_poly,eval), 1);
1758
+ FUNCTION(rb_gsl_poly,eval), 1);
1797
1759
  rb_define_alias(GSL_TYPE(cgsl_poly), "at", "eval");
1798
1760
 
1799
- rb_define_method(GSL_TYPE(cgsl_poly), "solve_quadratic",
1800
- FUNCTION(rb_gsl_poly,solve_quadratic2), 0);
1801
- rb_define_method(GSL_TYPE(cgsl_poly), "complex_solve_quadratic",
1802
- FUNCTION(rb_gsl_poly,complex_solve_quadratic2), 0);
1803
-
1804
- rb_define_method(GSL_TYPE(cgsl_poly), "solve_cubic",
1805
- FUNCTION(rb_gsl_poly,solve_cubic2), 0);
1806
- rb_define_method(GSL_TYPE(cgsl_poly), "complex_solve_cubic",
1807
- FUNCTION(rb_gsl_poly,complex_solve_cubic2), 0);
1808
-
1809
- #ifdef HAVE_POLY_SOLVE_QUARTIC
1810
- rb_define_method(GSL_TYPE(cgsl_poly), "solve_quartic",
1811
- FUNCTION(rb_gsl_poly,solve_quartic2), 0);
1812
- rb_define_method(GSL_TYPE(cgsl_poly), "complex_solve_quartic",
1813
- FUNCTION(rb_gsl_poly,complex_solve_quartic2), 0);
1761
+ rb_define_method(GSL_TYPE(cgsl_poly), "solve_quadratic",
1762
+ FUNCTION(rb_gsl_poly,solve_quadratic2), 0);
1763
+ rb_define_method(GSL_TYPE(cgsl_poly), "complex_solve_quadratic",
1764
+ FUNCTION(rb_gsl_poly,complex_solve_quadratic2), 0);
1765
+
1766
+ rb_define_method(GSL_TYPE(cgsl_poly), "solve_cubic",
1767
+ FUNCTION(rb_gsl_poly,solve_cubic2), 0);
1768
+ rb_define_method(GSL_TYPE(cgsl_poly), "complex_solve_cubic",
1769
+ FUNCTION(rb_gsl_poly,complex_solve_cubic2), 0);
1770
+
1771
+ #ifdef HAVE_GSL_POLY_SOLVE_QUARTIC
1772
+ rb_define_method(GSL_TYPE(cgsl_poly), "solve_quartic",
1773
+ FUNCTION(rb_gsl_poly,solve_quartic2), 0);
1774
+ rb_define_method(GSL_TYPE(cgsl_poly), "complex_solve_quartic",
1775
+ FUNCTION(rb_gsl_poly,complex_solve_quartic2), 0);
1814
1776
  #endif
1815
1777
 
1816
- rb_define_method(GSL_TYPE(cgsl_poly), "complex_solve",
1817
- FUNCTION(rb_gsl_poly,complex_solve2), -1);
1778
+ rb_define_method(GSL_TYPE(cgsl_poly), "complex_solve",
1779
+ FUNCTION(rb_gsl_poly,complex_solve2), -1);
1818
1780
  rb_define_alias(GSL_TYPE(cgsl_poly), "solve", "complex_solve");
1819
1781
  rb_define_alias(GSL_TYPE(cgsl_poly), "roots", "complex_solve");
1820
1782
 
@@ -1825,18 +1787,14 @@ void FUNCTION(Init_gsl_poly,init)(VALUE module)
1825
1787
  #ifdef BASE_DOUBLE
1826
1788
  // rb_define_singleton_method(cgsl_poly, "eval", rb_gsl_poly_eval_singleton, 2);
1827
1789
  rb_define_method(cgsl_poly, "to_i", rb_gsl_poly_to_i, 0);
1828
- #ifdef GSL_1_11_LATER
1829
1790
  rb_define_singleton_method(cgsl_poly, "complex_eval", rb_gsl_poly_eval_singleton, 2);
1830
1791
  rb_define_method(cgsl_vector_complex, "eval", rb_gsl_complex_poly_complex_eval, 1);
1831
- #endif
1832
- #ifdef GSL_1_1_LATER
1833
1792
  cgsl_poly_dd = rb_define_class_under(cgsl_poly, "DividedDifference", cgsl_poly);
1834
1793
  cgsl_poly_taylor = rb_define_class_under(cgsl_poly, "Taylor", cgsl_poly);
1835
1794
  rb_define_singleton_method(cgsl_poly, "dd_init", rb_gsl_poly_dd_init, 2);
1836
1795
 
1837
1796
  rb_define_method(cgsl_poly_dd, "eval",rb_gsl_poly_dd_eval, 2);
1838
1797
  rb_define_method(cgsl_poly_dd, "taylor", rb_gsl_poly_dd_taylor, -1);
1839
- #endif
1840
1798
  #endif
1841
1799
 
1842
1800
  rb_define_method(GSL_TYPE(cgsl_poly), "order", FUNCTION(rb_gsl_poly,order), 0);
@@ -1845,15 +1803,15 @@ void FUNCTION(Init_gsl_poly,init)(VALUE module)
1845
1803
  rb_define_method(GSL_TYPE(cgsl_poly), "conv", FUNCTION(rb_gsl_poly,conv), 1);
1846
1804
  rb_define_alias(GSL_TYPE(cgsl_poly), "*", "conv");
1847
1805
  rb_define_singleton_method(GSL_TYPE(cgsl_poly), "conv",
1848
- FUNCTION(rb_gsl_poly,conv2), 2);
1806
+ FUNCTION(rb_gsl_poly,conv2), 2);
1849
1807
 
1850
1808
  rb_define_method(GSL_TYPE(cgsl_poly), "deconv",
1851
- FUNCTION(rb_gsl_poly,deconv), 1);
1809
+ FUNCTION(rb_gsl_poly,deconv), 1);
1852
1810
  rb_define_singleton_method(GSL_TYPE(cgsl_poly), "deconv",
1853
- FUNCTION(rb_gsl_poly,deconv2), 2);
1811
+ FUNCTION(rb_gsl_poly,deconv2), 2);
1854
1812
 
1855
- rb_define_method(GSL_TYPE(cgsl_poly), "reduce",
1856
- FUNCTION(rb_gsl_poly,reduce), 1);
1813
+ rb_define_method(GSL_TYPE(cgsl_poly), "reduce",
1814
+ FUNCTION(rb_gsl_poly,reduce), 1);
1857
1815
  rb_define_method(GSL_TYPE(cgsl_poly), "deriv", FUNCTION(rb_gsl_poly,deriv), 1);
1858
1816
  rb_define_method(GSL_TYPE(cgsl_poly), "integ", FUNCTION(rb_gsl_poly,integ), 1);
1859
1817
 
@@ -1867,29 +1825,27 @@ void FUNCTION(Init_gsl_poly,init)(VALUE module)
1867
1825
  rb_define_method(GSL_TYPE(cgsl_poly), "-@", FUNCTION(rb_gsl_poly,uminus), 0);
1868
1826
  rb_define_method(GSL_TYPE(cgsl_poly), "+@", FUNCTION(rb_gsl_poly,uplus), 0);
1869
1827
 
1870
- rb_define_method(GSL_TYPE(cgsl_poly), "coerce",
1871
- FUNCTION(rb_gsl_poly,coerce), 1);
1828
+ rb_define_method(GSL_TYPE(cgsl_poly), "coerce",
1829
+ FUNCTION(rb_gsl_poly,coerce), 1);
1872
1830
  rb_define_method(GSL_TYPE(cgsl_poly), "to_gv", FUNCTION(rb_gsl_poly,to_gv), 0);
1873
1831
  rb_define_alias(GSL_TYPE(cgsl_poly), "to_v", "to_gv");
1874
1832
 
1875
- rb_define_method(GSL_TYPE(cgsl_poly), "companion_matrix",
1876
- FUNCTION(rb_gsl_poly,companion_matrix), 0);
1833
+ rb_define_method(GSL_TYPE(cgsl_poly), "companion_matrix",
1834
+ FUNCTION(rb_gsl_poly,companion_matrix), 0);
1877
1835
  rb_define_alias(GSL_TYPE(cgsl_poly), "compan", "companion_matrix");
1878
1836
 
1879
1837
  /*****/
1880
- rb_define_method(GSL_TYPE(cgsl_poly), "info",
1881
- FUNCTION(rb_gsl_poly,info), 0);
1838
+ rb_define_method(GSL_TYPE(cgsl_poly), "info",
1839
+ FUNCTION(rb_gsl_poly,info), 0);
1882
1840
 
1883
1841
  #ifdef BASE_DOUBLE
1884
- rb_define_singleton_method(GSL_TYPE(cgsl_poly), "fit",
1885
- FUNCTION(rb_gsl_poly,fit), -1);
1886
- rb_define_singleton_method(GSL_TYPE(cgsl_poly), "wfit",
1887
- FUNCTION(rb_gsl_poly,wfit), -1);
1842
+ rb_define_singleton_method(GSL_TYPE(cgsl_poly), "fit",
1843
+ FUNCTION(rb_gsl_poly,fit), -1);
1844
+ rb_define_singleton_method(GSL_TYPE(cgsl_poly), "wfit",
1845
+ FUNCTION(rb_gsl_poly,wfit), -1);
1888
1846
 
1889
- #ifdef GSL_1_13_LATER
1890
1847
  rb_define_singleton_method(cgsl_poly, "eval_derivs", rb_gsl_poly_eval_derivs_singleton, -1);
1891
1848
  rb_define_method(cgsl_vector, "eval_derivs", rb_gsl_poly_eval_derivs, -1);
1892
- #endif
1893
1849
 
1894
1850
  #endif
1895
1851
  }