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
@@ -9,12 +9,10 @@
9
9
  This library is distributed in the hope that it will be useful, but
10
10
  WITHOUT ANY WARRANTY.
11
11
  */
12
- #include "rb_gsl_config.h"
13
- #include "rb_gsl_array.h"
14
- #include "rb_gsl_complex.h"
15
- #ifdef HAVE_NARRAY_H
16
- #include "rb_gsl_with_narray.h"
17
- #endif
12
+
13
+ #include "include/rb_gsl_array.h"
14
+ #include "include/rb_gsl_complex.h"
15
+ #include "include/rb_gsl_with_narray.h"
18
16
 
19
17
  VALUE rb_gsl_vector_int_inner_product(int argc, VALUE *argv, VALUE obj);
20
18
  VALUE rb_gsl_vector_int_do_something(VALUE obj, void (*func)(gsl_vector_int*));
@@ -31,7 +29,7 @@ VALUE rb_gsl_vector_int_to_f(VALUE obj)
31
29
  size_t i;
32
30
  Data_Get_Struct(obj, gsl_vector_int, v);
33
31
  vnew = gsl_vector_alloc(v->size);
34
- for (i = 0; i < v->size; i++)
32
+ for (i = 0; i < v->size; i++)
35
33
  gsl_vector_set(vnew, i, (double) gsl_vector_int_get(v, i));
36
34
  if (VECTOR_INT_COL_P(obj))
37
35
  return Data_Wrap_Struct(cgsl_vector_col, 0, gsl_vector_free, vnew);
@@ -92,17 +90,17 @@ static VALUE rb_gsl_vector_int_add(VALUE obj, VALUE b)
92
90
  return rb_gsl_vector_add_constant(rb_gsl_vector_int_to_f(obj), b);
93
91
  break;
94
92
  default:
95
- if (rb_obj_is_kind_of(b, cgsl_vector_int)) {
96
- Data_Get_Struct(obj, gsl_vector_int, v);
97
- Data_Get_Struct(b, gsl_vector_int, vb);
98
- vnew = gsl_vector_int_alloc(v->size);
99
- gsl_vector_int_memcpy(vnew, v);
100
- gsl_vector_int_add(vnew, vb);
101
- return Data_Wrap_Struct(VECTOR_INT_ROW_COL(obj), 0, gsl_vector_int_free, vnew);
102
- } else {
103
- return rb_gsl_vector_add(rb_gsl_vector_int_to_f(obj), b);
104
- }
105
- break;
93
+ if (rb_obj_is_kind_of(b, cgsl_vector_int)) {
94
+ Data_Get_Struct(obj, gsl_vector_int, v);
95
+ Data_Get_Struct(b, gsl_vector_int, vb);
96
+ vnew = gsl_vector_int_alloc(v->size);
97
+ gsl_vector_int_memcpy(vnew, v);
98
+ gsl_vector_int_add(vnew, vb);
99
+ return Data_Wrap_Struct(VECTOR_INT_ROW_COL(obj), 0, gsl_vector_int_free, vnew);
100
+ } else {
101
+ return rb_gsl_vector_add(rb_gsl_vector_int_to_f(obj), b);
102
+ }
103
+ break;
106
104
  }
107
105
  }
108
106
 
@@ -119,12 +117,12 @@ static VALUE rb_gsl_vector_int_sub(VALUE obj, VALUE b)
119
117
  break;
120
118
  default:
121
119
  if (rb_obj_is_kind_of(b, cgsl_vector_int)) {
122
- Data_Get_Struct(obj, gsl_vector_int, v);
123
- Data_Get_Struct(b, gsl_vector_int, vb);
124
- vnew = gsl_vector_int_alloc(v->size);
125
- gsl_vector_int_memcpy(vnew, v);
126
- gsl_vector_int_sub(vnew, vb);
127
- return Data_Wrap_Struct(VECTOR_INT_ROW_COL(obj), 0, gsl_vector_int_free, vnew);
120
+ Data_Get_Struct(obj, gsl_vector_int, v);
121
+ Data_Get_Struct(b, gsl_vector_int, vb);
122
+ vnew = gsl_vector_int_alloc(v->size);
123
+ gsl_vector_int_memcpy(vnew, v);
124
+ gsl_vector_int_sub(vnew, vb);
125
+ return Data_Wrap_Struct(VECTOR_INT_ROW_COL(obj), 0, gsl_vector_int_free, vnew);
128
126
  } else {
129
127
  return rb_gsl_vector_sub(rb_gsl_vector_int_to_f(obj), b);
130
128
  }
@@ -151,7 +149,7 @@ static VALUE rb_gsl_vector_int_mul(VALUE obj, VALUE b)
151
149
  argv[0] = obj;
152
150
  argv[1] = b;
153
151
  return rb_gsl_vector_int_inner_product(2, argv, CLASS_OF(obj));
154
- } else if (VECTOR_INT_ROW_P(obj) && MATRIX_INT_P(b)) {
152
+ } else if (VECTOR_INT_ROW_P(obj) && MATRIX_INT_P(b)) {
155
153
  Data_Get_Struct(obj, gsl_vector_int, v);
156
154
  Data_Get_Struct(b, gsl_matrix_int, m);
157
155
  vnew = mygsl_vector_int_mul_matrix(v, m);
@@ -162,10 +160,10 @@ static VALUE rb_gsl_vector_int_mul(VALUE obj, VALUE b)
162
160
  if (v->size != v2->size) rb_raise(rb_eIndexError, "Vector sizes does not match.");
163
161
  m = gsl_matrix_int_alloc(v->size, v2->size);
164
162
  for (i = 0; i < v->size; i++) {
165
- for (j = 0; j < v2->size; j++) {
166
- val = gsl_vector_int_get(v, i)*gsl_vector_int_get(v2, j);
167
- gsl_matrix_int_set(m, i, j, val);
168
- }
163
+ for (j = 0; j < v2->size; j++) {
164
+ val = gsl_vector_int_get(v, i)*gsl_vector_int_get(v2, j);
165
+ gsl_matrix_int_set(m, i, j, val);
166
+ }
169
167
  }
170
168
  return Data_Wrap_Struct(cgsl_matrix_int, 0, gsl_matrix_int_free, m);
171
169
  } else {
@@ -39,10 +39,10 @@
39
39
  void FUNCTION(get_range,beg_en_n)(VALUE range, BASE *beg, BASE *en, size_t *n, int *step);
40
40
 
41
41
  void get_range_beg_en_n_for_size(VALUE range,
42
- int *beg, int *en, size_t *n, int *step, size_t size);
42
+ int *beg, int *en, size_t *n, int *step, size_t size);
43
43
 
44
44
  void parse_subvector_args(int argc, VALUE *argv, size_t size,
45
- size_t *offset, size_t *stride, size_t *n);
45
+ size_t *offset, size_t *stride, size_t *n);
46
46
 
47
47
  void FUNCTION(get_range,beg_en_n)(VALUE range, BASE *beg, BASE *en, size_t *n, int *step)
48
48
  {
@@ -66,7 +66,7 @@ void get_range_beg_en_n_for_size(VALUE range, int *beg, int *en, size_t *n, int
66
66
  }
67
67
 
68
68
  void parse_subvector_args(int argc, VALUE *argv, size_t size,
69
- size_t *offset, size_t *stride, size_t *n)
69
+ size_t *offset, size_t *stride, size_t *n)
70
70
  {
71
71
  int begin = 0, end, step, length;
72
72
  *stride = 1;
@@ -83,22 +83,22 @@ void parse_subvector_args(int argc, VALUE *argv, size_t size,
83
83
  // want to let Ruby crash if GSL does not have bounds checking enabled.
84
84
  if(begin < 0 || (size_t)begin >= size) {
85
85
  rb_raise(rb_eRangeError,
86
- "begin value %d is out of range for Vector of length %d",
87
- begin, (int) size);
86
+ "begin value %d is out of range for Vector of length %d",
87
+ begin, (int) size);
88
88
  }
89
89
  if(end < 0 || (size_t)end >= size) {
90
90
  rb_raise(rb_eRangeError,
91
- "end value %d is out of range for Vector of length %d",
92
- end, (int) size);
91
+ "end value %d is out of range for Vector of length %d",
92
+ end, (int) size);
93
93
  }
94
94
  *stride = (size_t)step;
95
95
  } else {
96
96
  CHECK_FIXNUM(argv[0]);
97
97
  length = FIX2INT(argv[0]);
98
- if((length < 0 && -length > size) || (length > 0 && length > size)) {
98
+ if((length < 0 && -length > (int) size) || (length > 0 && length > (int) size)) {
99
99
  rb_raise(rb_eRangeError,
100
- "length %d is out of range for Vector of length %d",
101
- length, (int) size);
100
+ "length %d is out of range for Vector of length %d",
101
+ length, (int) size);
102
102
  } else if(length < 0) {
103
103
  begin = length;
104
104
  *n = (size_t)(-length);
@@ -113,13 +113,13 @@ void parse_subvector_args(int argc, VALUE *argv, size_t size,
113
113
  get_range_beg_en_n_for_size(argv[0], &begin, &end, n, &step, size);
114
114
  if(begin < 0 || (size_t)begin >= size) {
115
115
  rb_raise(rb_eRangeError,
116
- "begin value %d is out of range for Vector of length %d",
117
- (int) begin, (int) size);
116
+ "begin value %d is out of range for Vector of length %d",
117
+ (int) begin, (int) size);
118
118
  }
119
119
  if(end < 0 || (size_t)end >= size) {
120
120
  rb_raise(rb_eRangeError,
121
- "end value %d is out of range for Vector of length %d",
122
- (int) end, (int) size);
121
+ "end value %d is out of range for Vector of length %d",
122
+ (int) end, (int) size);
123
123
  }
124
124
  CHECK_FIXNUM(argv[1]);
125
125
  step = FIX2INT(argv[1]);
@@ -188,11 +188,7 @@ void FUNCTION(cvector,set_from_rarray)(GSL_TYPE(gsl_vector) *v, VALUE ary)
188
188
  size_t i;
189
189
  if (CLASS_OF(ary) == rb_cRange) ary = rb_gsl_range2ary(ary);
190
190
  Check_Type(ary, T_ARRAY);
191
- #ifdef RUBY_1_9_LATER
192
191
  if (RARRAY_LEN(ary) == 0) return;
193
- #else
194
- if (RARRAY_LEN(ary) == 0) return;
195
- #endif
196
192
  for (i = 0; i < v->size; i++) FUNCTION(gsl_vector,set)(v, i, NUMCONV(rb_ary_entry(ary, i)));
197
193
  }
198
194
 
@@ -214,13 +210,11 @@ VALUE FUNCTION(rb_gsl_vector,new)(int argc, VALUE *argv, VALUE klass)
214
210
  size_t n, i;
215
211
  BASE beg, en;
216
212
  int step;
217
- #ifdef HAVE_NARRAY_H
218
- VALUE ary2;
219
- #endif
220
213
  switch (argc) {
221
214
  case 1:
222
215
  #ifdef HAVE_NARRAY_H
223
216
  if (NA_IsNArray(argv[0])) {
217
+ VALUE ary2;
224
218
  n = NA_TOTAL(argv[0]);
225
219
  v = FUNCTION(gsl_vector,alloc)(n);
226
220
  if (v == NULL) rb_raise(rb_eNoMemError, "gsl_vector_alloc failed");
@@ -234,7 +228,7 @@ VALUE FUNCTION(rb_gsl_vector,new)(int argc, VALUE *argv, VALUE klass)
234
228
  }
235
229
  #endif
236
230
  switch (TYPE(argv[0])) {
237
- case T_FIXNUM:
231
+ case T_FIXNUM:
238
232
  /*! if an integer n is given, create an empty vector of length n */
239
233
  CHECK_FIXNUM(argv[0]);
240
234
  n = FIX2INT(argv[0]);
@@ -247,35 +241,35 @@ VALUE FUNCTION(rb_gsl_vector,new)(int argc, VALUE *argv, VALUE klass)
247
241
  case T_FLOAT:
248
242
  v = FUNCTION(gsl_vector,alloc)(1);
249
243
  switch(TYPE(argv[0])) {
250
- case T_FIXNUM: case T_BIGNUM: case T_FLOAT:
251
- xnative = NUMCONV2(argv[0]);
252
- break;
253
- default:
254
- xnative = (BASE)0;
244
+ case T_FIXNUM: case T_BIGNUM: case T_FLOAT:
245
+ xnative = NUMCONV2(argv[0]);
246
+ break;
247
+ default:
248
+ xnative = (BASE)0;
255
249
  }
256
250
  FUNCTION(gsl_vector,set)(v, 0, xnative);
257
251
  break;
258
252
  #ifdef BASE_DOUBLE
259
- case T_ARRAY:
253
+ case T_ARRAY:
260
254
  v = make_cvector_from_rarrays(argv[0]);
261
255
  break;
262
256
  #endif
263
257
  default:
264
258
  if (CLASS_OF(argv[0]) == rb_cRange) {
265
- FUNCTION(get_range,beg_en_n)(argv[0], &beg, &en, &n, &step);
266
- v = FUNCTION(gsl_vector,alloc)(n);
267
- FUNCTION(set_ptr_data,by_range)(v->data, v->size, argv[0]);
268
- return Data_Wrap_Struct(klass, 0, FUNCTION(gsl_vector,free), v);
259
+ FUNCTION(get_range,beg_en_n)(argv[0], &beg, &en, &n, &step);
260
+ v = FUNCTION(gsl_vector,alloc)(n);
261
+ FUNCTION(set_ptr_data,by_range)(v->data, v->size, argv[0]);
262
+ return Data_Wrap_Struct(klass, 0, FUNCTION(gsl_vector,free), v);
269
263
  } else if (VEC_P(argv[0])) {
270
- /*! Create a new vector with the same elements of the vector given */
271
- Data_Get_Struct(argv[0], GSL_TYPE(gsl_vector), vtmp);
272
- v = FUNCTION(gsl_vector,alloc)(vtmp->size);
273
- for (i = 0; i < vtmp->size; i++)
274
- FUNCTION(gsl_vector,set)(v, i, FUNCTION(gsl_vector,get)(vtmp, i));
275
- return Data_Wrap_Struct(VEC_ROW_COL(argv[0]), 0, FUNCTION(gsl_vector,free), v);
264
+ /*! Create a new vector with the same elements of the vector given */
265
+ Data_Get_Struct(argv[0], GSL_TYPE(gsl_vector), vtmp);
266
+ v = FUNCTION(gsl_vector,alloc)(vtmp->size);
267
+ for (i = 0; i < vtmp->size; i++)
268
+ FUNCTION(gsl_vector,set)(v, i, FUNCTION(gsl_vector,get)(vtmp, i));
269
+ return Data_Wrap_Struct(VEC_ROW_COL(argv[0]), 0, FUNCTION(gsl_vector,free), v);
276
270
  } else {
277
- rb_raise(rb_eTypeError,
278
- "wrong argument type %s", rb_class2name(CLASS_OF(argv[0])));
271
+ rb_raise(rb_eTypeError,
272
+ "wrong argument type %s", rb_class2name(CLASS_OF(argv[0])));
279
273
  }
280
274
  break;
281
275
  }
@@ -283,13 +277,13 @@ VALUE FUNCTION(rb_gsl_vector,new)(int argc, VALUE *argv, VALUE klass)
283
277
  default:
284
278
  v = FUNCTION(gsl_vector,alloc)(argc);
285
279
  if (v == NULL) rb_raise(rb_eNoMemError, "gsl_vector_alloc failed");
286
- for (i = 0; i < argc; i++) {
280
+ for (i = 0; (int) i < argc; i++) {
287
281
  switch(TYPE(argv[i])) {
288
- case T_FIXNUM: case T_BIGNUM: case T_FLOAT:
289
- xnative = NUMCONV2(argv[i]);
290
- break;
291
- default:
292
- xnative = (BASE)0;
282
+ case T_FIXNUM: case T_BIGNUM: case T_FLOAT:
283
+ xnative = NUMCONV2(argv[i]);
284
+ break;
285
+ default:
286
+ xnative = (BASE)0;
293
287
  }
294
288
  FUNCTION(gsl_vector,set)(v, i, xnative);
295
289
  }
@@ -326,7 +320,7 @@ static VALUE FUNCTION(rb_gsl_vector,get)(int argc, VALUE *argv, VALUE obj)
326
320
  switch (TYPE(argv[0])) {
327
321
  case T_FIXNUM:
328
322
  i = FIX2INT(argv[0]);
329
- if (i < 0)
323
+ if (i < 0)
330
324
  retval = C_TO_VALUE2(FUNCTION(gsl_vector,get)(v, (size_t) (v->size + i)));
331
325
  else
332
326
  retval = C_TO_VALUE2(FUNCTION(gsl_vector,get)(v, (size_t) (i)));
@@ -336,7 +330,7 @@ static VALUE FUNCTION(rb_gsl_vector,get)(int argc, VALUE *argv, VALUE obj)
336
330
  for (j = 0; j < vnew->size; j++) {
337
331
  i = NUMCONV(rb_ary_entry(argv[0], j));
338
332
  if (i < 0) k = v->size + i;
339
- // else k = j;
333
+ // else k = j;
340
334
  else k = i;
341
335
  FUNCTION(gsl_vector,set)(vnew, j, FUNCTION(gsl_vector,get)(v, k));
342
336
  }
@@ -348,7 +342,7 @@ static VALUE FUNCTION(rb_gsl_vector,get)(int argc, VALUE *argv, VALUE obj)
348
342
  vnew = FUNCTION(gsl_vector,alloc)(p->size);
349
343
  for (j = 0; j < p->size; j++) {
350
344
  k = p->data[j];
351
- if (k < 0) k = p->size + j;
345
+ //if (k < 0) k = p->size + j;
352
346
  FUNCTION(gsl_vector,set)(vnew, j, FUNCTION(gsl_vector,get)(v, k));
353
347
  }
354
348
  retval = Data_Wrap_Struct(GSL_TYPE(cgsl_vector), 0, FUNCTION(gsl_vector,free), vnew);
@@ -412,7 +406,7 @@ void FUNCTION(rb_gsl_vector,set_subvector)(int argc, VALUE *argv, GSL_TYPE(gsl_v
412
406
  // Views) well.
413
407
  FUNCTION(gsl_vector,memcpy)(&vv.vector, vother);
414
408
  } else if(rb_obj_is_kind_of(other, rb_cArray)) {
415
- if(n != RARRAY_LEN(other)) {
409
+ if((int) n != RARRAY_LEN(other)) {
416
410
  rb_raise(rb_eRangeError, "lengths do not match (%d != %d)", (int) n, (int) RARRAY_LEN(other));
417
411
  }
418
412
  for(i = 0; i < n; i++) {
@@ -441,7 +435,6 @@ static VALUE FUNCTION(rb_gsl_vector,set)(int argc, VALUE *argv, VALUE obj)
441
435
  if(argc < 1 || argc > 4) {
442
436
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 1-4)", argc);
443
437
  }
444
-
445
438
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
446
439
  other = argv[argc-1];
447
440
 
@@ -462,7 +455,6 @@ static VALUE FUNCTION(rb_gsl_vector,set)(int argc, VALUE *argv, VALUE obj)
462
455
  // assignment to v.subvector(...)
463
456
  FUNCTION(rb_gsl_vector,set_subvector)(argc-1, argv, v, other);
464
457
  }
465
-
466
458
  return obj;
467
459
  }
468
460
 
@@ -475,7 +467,7 @@ static VALUE FUNCTION(rb_gsl_vector,set_all)(VALUE obj, VALUE xx)
475
467
  return obj;
476
468
  }
477
469
 
478
- VALUE FUNCTION(rb_gsl_vector,do_something)(VALUE obj, void (*func)(GSL_TYPE(gsl_vector)*))
470
+ VALUE FUNCTION(rb_gsl_vector,do_something)(VALUE obj, void (*func)(GSL_TYPE (gsl_vector)*))
479
471
  {
480
472
  GSL_TYPE(gsl_vector) *v = NULL;
481
473
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
@@ -511,7 +503,7 @@ static VALUE FUNCTION(rb_gsl_vector,reverse_each)(VALUE obj)
511
503
  GSL_TYPE(gsl_vector) *v = NULL;
512
504
  size_t i;
513
505
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
514
- for (i = v->size-1; i >= 0; i--) {
506
+ for (i = v->size-1;; i--) {
515
507
  rb_yield(C_TO_VALUE2(FUNCTION(gsl_vector,get)(v, i)));
516
508
  if (i == 0) break;
517
509
  }
@@ -532,7 +524,7 @@ static VALUE FUNCTION(rb_gsl_vector,reverse_each_index)(VALUE obj)
532
524
  GSL_TYPE(gsl_vector) *v = NULL;
533
525
  size_t i;
534
526
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
535
- for (i = v->size-1; i >= 0; i--) {
527
+ for (i = v->size-1;; i--) {
536
528
  rb_yield(INT2FIX(i));
537
529
  if (i == 0) break;
538
530
  }
@@ -663,9 +655,9 @@ static VALUE FUNCTION(rb_gsl_vector,trans)(VALUE obj)
663
655
  return Data_Wrap_Struct(cgsl_vector_int_col, 0, gsl_vector_int_free, vnew);
664
656
  else if (VECTOR_INT_COL_P(obj))
665
657
  return Data_Wrap_Struct(cgsl_vector_int, 0, gsl_vector_int_free, vnew);
666
- else rb_raise(rb_eTypeError,
667
- "wrong type %s (Vector::Int or Vector::Int::Col expected)",
668
- rb_class2name(CLASS_OF(obj)));
658
+ else rb_raise(rb_eTypeError,
659
+ "wrong type %s (Vector::Int or Vector::Int::Col expected)",
660
+ rb_class2name(CLASS_OF(obj)));
669
661
  #endif
670
662
  return Qnil;
671
663
  }
@@ -673,18 +665,18 @@ static VALUE FUNCTION(rb_gsl_vector,trans)(VALUE obj)
673
665
  static VALUE FUNCTION(rb_gsl_vector,trans_bang)(VALUE obj)
674
666
  {
675
667
  #ifdef BASE_DOUBLE
676
- if (CLASS_OF(obj) == cgsl_vector) RBASIC(obj)->klass = cgsl_vector_col;
677
- else if (CLASS_OF(obj) == cgsl_vector_col) RBASIC(obj)->klass = cgsl_vector;
668
+ if (CLASS_OF(obj) == cgsl_vector) RBGSL_SET_CLASS(obj, cgsl_vector_col);
669
+ else if (CLASS_OF(obj) == cgsl_vector_col) RBGSL_SET_CLASS(obj, cgsl_vector);
678
670
  else {
679
671
  rb_raise(rb_eRuntimeError, "method trans! for %s is not permitted.",
680
- rb_class2name(CLASS_OF(obj)));
681
- }
672
+ rb_class2name(CLASS_OF(obj)));
673
+ }
682
674
  #elif defined(BASE_INT)
683
- if (CLASS_OF(obj) == cgsl_vector_int) RBASIC(obj)->klass = cgsl_vector_int_col;
684
- else if (CLASS_OF(obj) == cgsl_vector_int_col) RBASIC(obj)->klass = cgsl_vector_int;
675
+ if (CLASS_OF(obj) == cgsl_vector_int) RBGSL_SET_CLASS(obj, cgsl_vector_int_col);
676
+ else if (CLASS_OF(obj) == cgsl_vector_int_col) RBGSL_SET_CLASS(obj, cgsl_vector_int);
685
677
  else {
686
678
  rb_raise(rb_eRuntimeError, "method trans! for %s is not permitted.",
687
- rb_class2name(CLASS_OF(obj)));
679
+ rb_class2name(CLASS_OF(obj)));
688
680
  }
689
681
  #endif
690
682
  return obj;
@@ -708,7 +700,7 @@ VALUE FUNCTION(rb_gsl_vector,uminus)(VALUE obj)
708
700
  }
709
701
  if (CLASS_OF(obj) == GSL_TYPE(cgsl_poly))
710
702
  return Data_Wrap_Struct(GSL_TYPE(cgsl_poly), 0, FUNCTION(gsl_vector,free), vnew);
711
- else
703
+ else
712
704
  return Data_Wrap_Struct(VEC_ROW_COL(obj), 0, FUNCTION(gsl_vector,free), vnew);
713
705
  }
714
706
 
@@ -757,7 +749,7 @@ static VALUE FUNCTION(rb_gsl_vector,connect)(int argc, VALUE *argv, VALUE obj)
757
749
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
758
750
  total += v->size;
759
751
  }
760
- for (i = 0; i < argc; i++) {
752
+ for (i = 0; (int) i < argc; i++) {
761
753
  CHECK_VEC(argv[i]);
762
754
  Data_Get_Struct(argv[i], GSL_TYPE(gsl_vector), v);
763
755
  total += v->size;
@@ -769,7 +761,7 @@ static VALUE FUNCTION(rb_gsl_vector,connect)(int argc, VALUE *argv, VALUE obj)
769
761
  memcpy(ptr, v->data, sizeof(BASE)*v->size);
770
762
  ptr += v->size;
771
763
  }
772
- for (i = 0; i < argc; i++) {
764
+ for (i = 0; (int) i < argc; i++) {
773
765
  Data_Get_Struct(argv[i], GSL_TYPE(gsl_vector), v);
774
766
  memcpy(ptr, v->data, sizeof(BASE)*v->size);
775
767
  ptr += v->size;
@@ -814,7 +806,7 @@ static VALUE FUNCTION(rb_gsl_vector,sgn)(VALUE obj)
814
806
  x = FUNCTION(gsl_vector,get)(v, i);
815
807
  FUNCTION(gsl_vector,set)(vnew, i, (BASE)(x>0 ? 1 : (x<0 ? -1 : 0)));
816
808
  }
817
- return Data_Wrap_Struct(VEC_ROW_COL(obj), 0, FUNCTION(gsl_vector,free), vnew);
809
+ return Data_Wrap_Struct(VEC_ROW_COL(obj), 0, FUNCTION(gsl_vector,free), vnew);
818
810
  }
819
811
 
820
812
  static VALUE FUNCTION(rb_gsl_vector,abs)(VALUE obj)
@@ -826,7 +818,7 @@ static VALUE FUNCTION(rb_gsl_vector,abs)(VALUE obj)
826
818
  for (i = 0; i < v->size; i++) {
827
819
  FUNCTION(gsl_vector,set)(vnew, i, (BASE) fabs(FUNCTION(gsl_vector,get)(v, i)));
828
820
  }
829
- return Data_Wrap_Struct(VEC_ROW_COL(obj), 0, FUNCTION(gsl_vector,free), vnew);
821
+ return Data_Wrap_Struct(VEC_ROW_COL(obj), 0, FUNCTION(gsl_vector,free), vnew);
830
822
  }
831
823
 
832
824
  static VALUE FUNCTION(rb_gsl_vector,square)(VALUE obj)
@@ -838,7 +830,7 @@ static VALUE FUNCTION(rb_gsl_vector,square)(VALUE obj)
838
830
  for (i = 0; i < v->size; i++) {
839
831
  FUNCTION(gsl_vector,set)(vnew, i, gsl_pow_2(FUNCTION(gsl_vector,get)(v, i)));
840
832
  }
841
- return Data_Wrap_Struct(VEC_ROW_COL(obj), 0, FUNCTION(gsl_vector,free), vnew);
833
+ return Data_Wrap_Struct(VEC_ROW_COL(obj), 0, FUNCTION(gsl_vector,free), vnew);
842
834
  }
843
835
 
844
836
  static VALUE FUNCTION(rb_gsl_vector,sqrt)(VALUE obj)
@@ -850,7 +842,7 @@ static VALUE FUNCTION(rb_gsl_vector,sqrt)(VALUE obj)
850
842
  for (i = 0; i < v->size; i++) {
851
843
  FUNCTION(gsl_vector,set)(vnew, i, sqrt(FUNCTION(gsl_vector,get)(v, i)));
852
844
  }
853
- return Data_Wrap_Struct(VEC_ROW_COL(obj), 0, FUNCTION(gsl_vector,free), vnew);
845
+ return Data_Wrap_Struct(VEC_ROW_COL(obj), 0, FUNCTION(gsl_vector,free), vnew);
854
846
  }
855
847
 
856
848
  static VALUE FUNCTION(rb_gsl_vector,memcpy)(VALUE obj, VALUE dest, VALUE src)
@@ -871,7 +863,7 @@ static VALUE FUNCTION(rb_gsl_vector,clone)(VALUE obj)
871
863
  FUNCTION(gsl_vector,memcpy)(vnew, v);
872
864
  if (!VEC_VIEW_P(obj))
873
865
  return Data_Wrap_Struct(CLASS_OF(obj), 0, FUNCTION(gsl_vector,free), vnew);
874
- else
866
+ else
875
867
  return Data_Wrap_Struct(VEC_ROW_COL(obj), 0, FUNCTION(gsl_vector,free), vnew);
876
868
  }
877
869
 
@@ -923,7 +915,7 @@ static VALUE FUNCTION(rb_gsl_vector,fprintf)(int argc, VALUE *argv, VALUE obj)
923
915
  GSL_TYPE(gsl_vector) *h = NULL;
924
916
  FILE *fp = NULL;
925
917
  int status, flag = 0;
926
- if (argc != 1 && argc != 2)
918
+ if (argc != 1 && argc != 2)
927
919
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 1 or 2)", argc);
928
920
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), h);
929
921
  fp = rb_gsl_open_writefile(argv[0], &flag);
@@ -945,7 +937,7 @@ static VALUE FUNCTION(rb_gsl_vector,printf)(int argc, VALUE *argv, VALUE obj)
945
937
  int status;
946
938
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), h);
947
939
  if (argc == 1) {
948
- if (TYPE(argv[0]) != T_STRING)
940
+ if (TYPE(argv[0]) != T_STRING)
949
941
  rb_raise(rb_eTypeError, "String expected");
950
942
  else
951
943
  status = FUNCTION(gsl_vector,fprintf)(stdout, h, STR2CSTR(argv[0]));
@@ -978,7 +970,7 @@ VALUE FUNCTION(rb_gsl_vector,inner_product)(int argc, VALUE *argv, VALUE obj)
978
970
  switch (TYPE(obj)) {
979
971
  case T_MODULE: case T_CLASS: case T_OBJECT:
980
972
  if (argc != 2) rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)",
981
- argc);
973
+ argc);
982
974
  CHECK_VEC(argv[0]);
983
975
  CHECK_VEC(argv[1]);
984
976
  Data_Get_Struct(argv[0], GSL_TYPE(gsl_vector), v);
@@ -986,7 +978,7 @@ VALUE FUNCTION(rb_gsl_vector,inner_product)(int argc, VALUE *argv, VALUE obj)
986
978
  break;
987
979
  default:
988
980
  if (argc != 1) rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)",
989
- argc);
981
+ argc);
990
982
  CHECK_VEC(argv[0]);
991
983
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
992
984
  Data_Get_Struct(argv[0], GSL_TYPE(gsl_vector), v2);
@@ -1056,7 +1048,7 @@ static VALUE FUNCTION(rb_gsl_vector,equal)(int argc, VALUE *argv, VALUE obj)
1056
1048
  case T_FLOAT:
1057
1049
  x = NUM2DBL(other);
1058
1050
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v1);
1059
- for (i = 0; i < v1->size; i++)
1051
+ for (i = 0; i < v1->size; i++)
1060
1052
  if (fabs(x-FUNCTION(gsl_vector,get)(v1, i)) > eps) return Qfalse;
1061
1053
  return Qtrue;
1062
1054
  break;
@@ -1112,14 +1104,14 @@ static VALUE FUNCTION(rb_gsl_vector,graph)(int argc, VALUE *argv, VALUE obj)
1112
1104
  if (TYPE(argv[1]) == T_STRING) {
1113
1105
  make_graphcommand(command, argv[1]);
1114
1106
  if (VEC_P(argv[0])) {
1115
- Data_Get_Struct(argv[0], GSL_TYPE(gsl_vector), x);
1107
+ Data_Get_Struct(argv[0], GSL_TYPE(gsl_vector), x);
1116
1108
  } else {
1117
- rb_raise(rb_eTypeError, "argv[0] wrong type %s (String or Vector expected)",
1118
- rb_class2name(CLASS_OF(argv[0])));
1109
+ rb_raise(rb_eTypeError, "argv[0] wrong type %s (String or Vector expected)",
1110
+ rb_class2name(CLASS_OF(argv[0])));
1119
1111
  }
1120
1112
  } else {
1121
- rb_raise(rb_eTypeError, "argv[1] wrong type %s (String or Vector expected)",
1122
- rb_class2name(CLASS_OF(argv[1])));
1113
+ rb_raise(rb_eTypeError, "argv[1] wrong type %s (String or Vector expected)",
1114
+ rb_class2name(CLASS_OF(argv[1])));
1123
1115
  }
1124
1116
  break;
1125
1117
  default:
@@ -1129,7 +1121,7 @@ static VALUE FUNCTION(rb_gsl_vector,graph)(int argc, VALUE *argv, VALUE obj)
1129
1121
  if (y == NULL) rb_raise(rb_eRuntimeError, "ydata not given");
1130
1122
  fp = popen(command, "w");
1131
1123
  for (i = 0; i < y->size; i++) {
1132
- if (x == NULL)
1124
+ if (x == NULL)
1133
1125
  fprintf(fp, "%d %e\n", (int) i, (double) FUNCTION(gsl_vector,get)(y, i));
1134
1126
  else
1135
1127
  fprintf(fp, "%e %e\n", (double) FUNCTION(gsl_vector,get)(x, i), (double) FUNCTION(gsl_vector,get)(y, i));
@@ -1169,14 +1161,14 @@ static VALUE FUNCTION(rb_gsl_vector,graph_step)(int argc, VALUE *argv, VALUE obj
1169
1161
  if (TYPE(argv[1]) == T_STRING) {
1170
1162
  make_graphcommand(command, argv[1]);
1171
1163
  if (VEC_P(argv[0])) {
1172
- Data_Get_Struct(argv[0], GSL_TYPE(gsl_vector), x);
1164
+ Data_Get_Struct(argv[0], GSL_TYPE(gsl_vector), x);
1173
1165
  } else {
1174
- rb_raise(rb_eTypeError, "argv[0] wrong type %s (String or Vector expected)",
1175
- rb_class2name(CLASS_OF(argv[0])));
1166
+ rb_raise(rb_eTypeError, "argv[0] wrong type %s (String or Vector expected)",
1167
+ rb_class2name(CLASS_OF(argv[0])));
1176
1168
  }
1177
1169
  } else {
1178
- rb_raise(rb_eTypeError, "argv[1] wrong type %s (String or Vector expected)",
1179
- rb_class2name(CLASS_OF(argv[1])));
1170
+ rb_raise(rb_eTypeError, "argv[1] wrong type %s (String or Vector expected)",
1171
+ rb_class2name(CLASS_OF(argv[1])));
1180
1172
  }
1181
1173
  break;
1182
1174
  default:
@@ -1188,19 +1180,19 @@ static VALUE FUNCTION(rb_gsl_vector,graph_step)(int argc, VALUE *argv, VALUE obj
1188
1180
  for (i = 0; i < y->size; i++) {
1189
1181
  if (x == NULL) {
1190
1182
  fprintf(fp, "%d %e\n%d %e\n", (int) i, (double) FUNCTION(gsl_vector,get)(y, i),
1191
- (int) (i+1), (double) FUNCTION(gsl_vector,get)(y, i));
1183
+ (int) (i+1), (double) FUNCTION(gsl_vector,get)(y, i));
1192
1184
  } else {
1193
- if (i != y->size-1)
1194
- fprintf(fp, "%e %e\n%e %e\n", (double) FUNCTION(gsl_vector,get)(x, i),
1195
- (double) FUNCTION(gsl_vector,get)(y, i),
1196
- (double) FUNCTION(gsl_vector,get)(x, i+1),
1197
- (double) FUNCTION(gsl_vector,get)(y, i));
1185
+ if (i != y->size-1)
1186
+ fprintf(fp, "%e %e\n%e %e\n", (double) FUNCTION(gsl_vector,get)(x, i),
1187
+ (double) FUNCTION(gsl_vector,get)(y, i),
1188
+ (double) FUNCTION(gsl_vector,get)(x, i+1),
1189
+ (double) FUNCTION(gsl_vector,get)(y, i));
1198
1190
  else
1199
- fprintf(fp, "%e %e\n%e %e",
1200
- (double) FUNCTION(gsl_vector,get)(x, i),
1201
- (double) FUNCTION(gsl_vector,get)(y, i),
1202
- 2.0*FUNCTION(gsl_vector,get)(x, i)-FUNCTION(gsl_vector,get)(x, i-1),
1203
- (double) FUNCTION(gsl_vector,get)(y, i));
1191
+ fprintf(fp, "%e %e\n%e %e",
1192
+ (double) FUNCTION(gsl_vector,get)(x, i),
1193
+ (double) FUNCTION(gsl_vector,get)(y, i),
1194
+ 2.0*FUNCTION(gsl_vector,get)(x, i)-FUNCTION(gsl_vector,get)(x, i-1),
1195
+ (double) FUNCTION(gsl_vector,get)(y, i));
1204
1196
  }
1205
1197
  }
1206
1198
  fflush(fp);
@@ -1232,7 +1224,7 @@ static VALUE FUNCTION(rb_gsl_vector,plot)(int argc, VALUE *argv, VALUE obj)
1232
1224
  Data_Get_Struct(argv[0], GSL_TYPE(gsl_vector), x);
1233
1225
  } else {
1234
1226
  rb_raise(rb_eTypeError, "wrong argument type %s (String or Vector expected)",
1235
- rb_class2name(CLASS_OF(argv[0])));
1227
+ rb_class2name(CLASS_OF(argv[0])));
1236
1228
  }
1237
1229
  break;
1238
1230
  case 2:
@@ -1247,11 +1239,11 @@ static VALUE FUNCTION(rb_gsl_vector,plot)(int argc, VALUE *argv, VALUE obj)
1247
1239
  }
1248
1240
  if (y == NULL) rb_raise(rb_eRuntimeError, "ydata not given");
1249
1241
  for (i = 0; i < y->size; i++) {
1250
- if (x == NULL)
1242
+ if (x == NULL)
1251
1243
  fprintf(fp, "%d %e\n", (int) i, (double) FUNCTION(gsl_vector,get)(y, i));
1252
1244
  else
1253
- fprintf(fp, "%e %e\n", (double) FUNCTION(gsl_vector,get)(x, i),
1254
- (double) FUNCTION(gsl_vector,get)(y, i));
1245
+ fprintf(fp, "%e %e\n", (double) FUNCTION(gsl_vector,get)(x, i),
1246
+ (double) FUNCTION(gsl_vector,get)(y, i));
1255
1247
  }
1256
1248
  fprintf(fp, "e\n");
1257
1249
  fflush(fp);
@@ -1265,11 +1257,11 @@ void FUNCTION(gsl_vector,print)(const GSL_TYPE(gsl_vector) *v, VALUE klass)
1265
1257
  size_t i;
1266
1258
  printf("[ ");
1267
1259
  if (klass == cgsl_vector_col || klass == cgsl_vector_col_view
1268
- || klass == cgsl_vector_col_view_ro
1269
- || klass == cgsl_vector_int_col || klass == cgsl_vector_int_col_view
1270
- || klass == cgsl_vector_int_col_view_ro) {
1260
+ || klass == cgsl_vector_col_view_ro
1261
+ || klass == cgsl_vector_int_col || klass == cgsl_vector_int_col_view
1262
+ || klass == cgsl_vector_int_col_view_ro) {
1271
1263
  printf(PRINTF_FORMAT, FUNCTION(gsl_vector,get)(v, 0));
1272
- for (i = 1; i < v->size; i++) {
1264
+ for (i = 1; i < v->size; i++) {
1273
1265
  printf(PRINTF_FORMAT, FUNCTION(gsl_vector,get)(v, i));
1274
1266
  if (i != v->size-1) printf("\n");
1275
1267
  }
@@ -1321,16 +1313,16 @@ VALUE FUNCTION(rb_gsl_vector,to_s)(VALUE obj)
1321
1313
  strcpy(format2, format);
1322
1314
  #else
1323
1315
  strcpy(format, PRINTF_FORMAT);
1324
- strcpy(format2, " "PRINTF_FORMAT);
1316
+ strcpy(format2, " " PRINTF_FORMAT);
1325
1317
  #endif
1326
1318
  for (i = 0; i < v->size; i++) {
1327
1319
  if (i != 0) {
1328
- strcpy(buf, " ");
1329
- rb_str_cat(str, buf, strlen(buf));
1320
+ strcpy(buf, " ");
1321
+ rb_str_cat(str, buf, strlen(buf));
1330
1322
  }
1331
1323
  x = FUNCTION(gsl_vector,get)(v, i);
1332
- if (x < 0) sprintf(buf, format, x);
1333
- else sprintf(buf, format2, x);
1324
+ if (x < 0) sprintf(buf, format, x);
1325
+ else sprintf(buf, format2, x);
1334
1326
  if (i != v->size-1) strcat(buf, "\n");
1335
1327
  rb_str_cat(str, buf, strlen(buf));
1336
1328
  if (i >= 20 && i != v->size-1) {
@@ -1345,7 +1337,7 @@ VALUE FUNCTION(rb_gsl_vector,to_s)(VALUE obj)
1345
1337
  for (i = 1; i < v->size; i++) {
1346
1338
  sprintf(buf, PRINTF_FORMAT, FUNCTION(gsl_vector,get)(v, i));
1347
1339
  rb_str_cat(str, buf, strlen(buf));
1348
- if (i >= (55/dig) && i != v->size-1) {
1340
+ if ((int) i >= (55/dig) && i != v->size-1) {
1349
1341
  strcpy(buf, "... ");
1350
1342
  rb_str_cat(str, buf, strlen(buf));
1351
1343
  break;
@@ -1409,7 +1401,7 @@ static VALUE FUNCTION(rb_gsl_vector,subvector_with_stride)(int argc, VALUE *argv
1409
1401
  if(offset < 0) {
1410
1402
  rb_raise(rb_eRangeError, "offset %d out of range", offset - (int)v->size);
1411
1403
  }
1412
- } else if(offset >= v->size) {
1404
+ } else if(offset >= (int) v->size) {
1413
1405
  rb_raise(rb_eRangeError, "offset %d out of range", offset);
1414
1406
  }
1415
1407
  if(step == 0) {
@@ -1463,8 +1455,8 @@ static VALUE FUNCTION(rb_gsl_vector,matrix_view)(int argc, VALUE *argv, VALUE ob
1463
1455
  break;
1464
1456
  case 3:
1465
1457
  mv = ALLOC(QUALIFIED_VIEW(gsl_matrix,view));
1466
- *mv = FUNCTION(gsl_matrix,view_vector_with_tda)(v, FIX2INT(argv[0]), FIX2INT(argv[1]),
1467
- FIX2INT(argv[2]));
1458
+ *mv = FUNCTION(gsl_matrix,view_vector_with_tda)(v, FIX2INT(argv[0]), FIX2INT(argv[1]),
1459
+ FIX2INT(argv[2]));
1468
1460
  break;
1469
1461
  default:
1470
1462
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 2 or 3)", argc);
@@ -1474,7 +1466,7 @@ static VALUE FUNCTION(rb_gsl_vector,matrix_view)(int argc, VALUE *argv, VALUE ob
1474
1466
  }
1475
1467
 
1476
1468
  static VALUE FUNCTION(rb_gsl_vector,matrix_view_with_tda)(VALUE obj, VALUE nn1, VALUE nn2,
1477
- VALUE tda)
1469
+ VALUE tda)
1478
1470
  {
1479
1471
  GSL_TYPE(gsl_vector) *v = NULL;
1480
1472
  QUALIFIED_VIEW(gsl_matrix,view) *mv = NULL;
@@ -1487,7 +1479,7 @@ static VALUE FUNCTION(rb_gsl_vector,matrix_view_with_tda)(VALUE obj, VALUE nn1,
1487
1479
  void FUNCTION(mygsl_vector,shift)(GSL_TYPE(gsl_vector) *p, size_t n)
1488
1480
  {
1489
1481
  size_t i;
1490
- for (i = n; i >= 0; i--) {
1482
+ for (i = n;; i--) {
1491
1483
  FUNCTION(gsl_vector,set)(p, i+1, FUNCTION(gsl_vector,get)(p, i));
1492
1484
  if (i == 0) break;
1493
1485
  }
@@ -1497,7 +1489,7 @@ void FUNCTION(mygsl_vector,shift)(GSL_TYPE(gsl_vector) *p, size_t n)
1497
1489
  void FUNCTION(mygsl_vector,shift_scale2)(GSL_TYPE(gsl_vector) *p, size_t n)
1498
1490
  {
1499
1491
  size_t i;
1500
- for (i = n; i >= 0; i--) {
1492
+ for (i = n;; i--) {
1501
1493
  FUNCTION(gsl_vector,set)(p, i+1, 2*FUNCTION(gsl_vector,get)(p, i));
1502
1494
  if (i == 0) break;
1503
1495
  }
@@ -1518,16 +1510,16 @@ VALUE FUNCTION(rb_gsl_vector,scale)(VALUE obj, VALUE x)
1518
1510
  GSL_TYPE(gsl_vector) *v, *vnew;
1519
1511
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
1520
1512
  vnew = FUNCTION(make_vector,clone)(v);
1521
- FUNCTION(gsl_vector,scale)(vnew, NUMCONV(x));
1513
+ FUNCTION(gsl_vector,scale)(vnew, NUMCONV2(x));
1522
1514
  // return Data_Wrap_Struct(GSL_TYPE(cgsl_vector), 0, FUNCTION(gsl_vector,free), vnew);
1523
- return Data_Wrap_Struct(VEC_ROW_COL(obj), 0, FUNCTION(gsl_vector,free), vnew);
1515
+ return Data_Wrap_Struct(VEC_ROW_COL(obj), 0, FUNCTION(gsl_vector,free), vnew);
1524
1516
  }
1525
1517
 
1526
1518
  VALUE FUNCTION(rb_gsl_vector,scale_bang)(VALUE obj, VALUE x)
1527
1519
  {
1528
1520
  GSL_TYPE(gsl_vector) *v = NULL;
1529
1521
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
1530
- FUNCTION(gsl_vector,scale)(v, NUMCONV(x));
1522
+ FUNCTION(gsl_vector,scale)(v, NUMCONV2(x));
1531
1523
  return obj;
1532
1524
  }
1533
1525
 
@@ -1536,7 +1528,7 @@ VALUE FUNCTION(rb_gsl_vector,add_constant)(VALUE obj, VALUE x)
1536
1528
  GSL_TYPE(gsl_vector) *v, *vnew;
1537
1529
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
1538
1530
  vnew = FUNCTION(make_vector,clone)(v);
1539
- FUNCTION(gsl_vector,add_constant)(vnew, NUMCONV(x));
1531
+ FUNCTION(gsl_vector,add_constant)(vnew, NUMCONV2(x));
1540
1532
  // return Data_Wrap_Struct(GSL_TYPE(cgsl_vector), 0, FUNCTION(gsl_vector,free), vnew);
1541
1533
  return Data_Wrap_Struct(VEC_ROW_COL(obj), 0, FUNCTION(gsl_vector,free), vnew);
1542
1534
  }
@@ -1545,7 +1537,7 @@ VALUE FUNCTION(rb_gsl_vector,add_constant_bang)(VALUE obj, VALUE x)
1545
1537
  {
1546
1538
  GSL_TYPE(gsl_vector) *v = NULL;
1547
1539
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
1548
- FUNCTION(gsl_vector,add_constant)(v, NUMCONV(x));
1540
+ FUNCTION(gsl_vector,add_constant)(v, NUMCONV2(x));
1549
1541
  return obj;
1550
1542
  }
1551
1543
 
@@ -1561,7 +1553,7 @@ QUALIFIED_VIEW(gsl_vector,view)* FUNCTION(rb_gsl_make_vector,view)(BASE *data, s
1561
1553
  }
1562
1554
 
1563
1555
  #ifdef HAVE_TENSOR_TENSOR_H
1564
- #include "rb_gsl_tensor.h"
1556
+ #include "include/rb_gsl_tensor.h"
1565
1557
  static VALUE FUNCTION(rb_gsl_vector,to_tensor)(int argc, VALUE *argv, VALUE obj)
1566
1558
  {
1567
1559
  GSL_TYPE(gsl_vector) *v = NULL;
@@ -1604,7 +1596,7 @@ static VALUE FUNCTION(rb_gsl_vector,to_gplot)(int argc, VALUE *argv, VALUE obj)
1604
1596
  if (argc < 1) rb_raise(rb_eArgError, "no vectors given");
1605
1597
  if (TYPE(argv[0]) == T_ARRAY) nv = RARRAY_LEN(argv[0]);
1606
1598
  else nv = argc;
1607
- vp = (GSL_TYPE(gsl_vector)**) ALLOC_N(GSL_TYPE(gsl_vector)*, nv);
1599
+ vp = (GSL_TYPE(gsl_vector)**)ALLOC_N(GSL_TYPE(gsl_vector)*, nv);
1608
1600
  istart = 0;
1609
1601
  break;
1610
1602
  default:
@@ -1612,18 +1604,18 @@ static VALUE FUNCTION(rb_gsl_vector,to_gplot)(int argc, VALUE *argv, VALUE obj)
1612
1604
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
1613
1605
  if (argc >= 1 && TYPE(argv[0]) == T_ARRAY) nv = 1 + RARRAY_LEN(argv[0]);
1614
1606
  else nv = argc + 1;
1615
- vp = (GSL_TYPE(gsl_vector)**) ALLOC_N(GSL_TYPE(gsl_vector)*, nv);
1607
+ vp = (GSL_TYPE(gsl_vector)**)ALLOC_N(GSL_TYPE(gsl_vector)*, nv);
1616
1608
  vp[0] = v; len = v->size;
1617
1609
  istart = 1;
1618
1610
  break;
1619
1611
  }
1620
- for (i = 0; i < argc; i++) {
1612
+ for (i = 0; (int) i < argc; i++) {
1621
1613
  if (TYPE(argv[0]) == T_ARRAY) tmp = rb_ary_entry(argv[0], i);
1622
1614
  else tmp = argv[i];
1623
1615
  CHECK_VEC(tmp);
1624
1616
  Data_Get_Struct(tmp, GSL_TYPE(gsl_vector), v);
1625
1617
  if (len == 0) len = v->size;
1626
- if (len != v->size)
1618
+ if (len != v->size)
1627
1619
  rb_raise(rb_eRuntimeError, "vectors must have equal lengths");
1628
1620
  vp[i+istart] = v;
1629
1621
  }
@@ -1679,7 +1671,7 @@ static VALUE FUNCTION(rb_gsl_vector,collect_bang)(VALUE obj)
1679
1671
 
1680
1672
  /* Modified 2006/Sep/26 */
1681
1673
  GSL_TYPE(gsl_vector)* FUNCTION(mygsl_vector,mul_matrix)(GSL_TYPE(gsl_vector) *v,
1682
- GSL_TYPE(gsl_matrix) *m)
1674
+ GSL_TYPE(gsl_matrix) *m)
1683
1675
  {
1684
1676
  GSL_TYPE(gsl_vector) *vnew;
1685
1677
  size_t i, j;
@@ -1699,7 +1691,7 @@ GSL_TYPE(gsl_vector)* FUNCTION(mygsl_vector,mul_matrix)(GSL_TYPE(gsl_vector) *v,
1699
1691
  void FUNCTION(mygsl_vector,to_m_circulant)(GSL_TYPE(gsl_matrix) *m, GSL_TYPE(gsl_vector) *v)
1700
1692
  {
1701
1693
  size_t i, j;
1702
- for (i = v->size-1; i >= 0; i--) {
1694
+ for (i = v->size-1;; i--) {
1703
1695
  for (j = 0; j < v->size; j++) {
1704
1696
  if (j <= i) FUNCTION(gsl_matrix,set)(m, i, j, FUNCTION(gsl_vector,get)(v, v->size-1-i+j));
1705
1697
  else FUNCTION(gsl_matrix,set)(m, i, j, FUNCTION(gsl_vector,get)(v, j-i-1));
@@ -1719,7 +1711,7 @@ static VALUE FUNCTION(rb_gsl_vector,to_m_circulant)(VALUE obj)
1719
1711
  }
1720
1712
 
1721
1713
  static void FUNCTION(mygsl_vector,indgen)(GSL_TYPE(gsl_vector) *v,
1722
- BASE start, BASE step)
1714
+ BASE start, BASE step)
1723
1715
  {
1724
1716
  size_t k = 0;
1725
1717
  BASE i;
@@ -1738,10 +1730,10 @@ static VALUE FUNCTION(rb_gsl_vector,indgen_singleton)(int argc, VALUE *argv, VAL
1738
1730
  switch (argc) {
1739
1731
  case 3:
1740
1732
  step = NUMCONV2(argv[2]);
1741
- /* no break */
1733
+ /* no break */
1742
1734
  case 2:
1743
1735
  start = NUMCONV2(argv[1]);
1744
- /* no break */
1736
+ /* no break */
1745
1737
  case 1:
1746
1738
  n = NUM2INT(argv[0]);
1747
1739
  break;
@@ -1761,7 +1753,7 @@ static VALUE FUNCTION(rb_gsl_vector,indgen)(int argc, VALUE *argv, VALUE obj)
1761
1753
  switch (argc) {
1762
1754
  case 2:
1763
1755
  step = NUMCONV2(argv[1]);
1764
- /* no break */
1756
+ /* no break */
1765
1757
  case 1:
1766
1758
  start = NUMCONV2(argv[0]);
1767
1759
  break;
@@ -1784,7 +1776,7 @@ static VALUE FUNCTION(rb_gsl_vector,indgen_bang)(int argc, VALUE *argv, VALUE ob
1784
1776
  switch (argc) {
1785
1777
  case 2:
1786
1778
  step = NUMCONV2(argv[1]);
1787
- /* no break */
1779
+ /* no break */
1788
1780
  case 1:
1789
1781
  start = NUMCONV2(argv[0]);
1790
1782
  break;
@@ -1910,7 +1902,7 @@ static VALUE FUNCTION(rb_gsl_vector,histogram)(int argc, VALUE *argv, VALUE obj)
1910
1902
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
1911
1903
  switch (argc) {
1912
1904
  case 1:
1913
- if (rb_obj_is_kind_of(argv[0], rb_cRange))
1905
+ if (rb_obj_is_kind_of(argv[0], rb_cRange))
1914
1906
  argv[0] = rb_gsl_range2ary(argv[0]);
1915
1907
  switch (TYPE(argv[0])) {
1916
1908
  case T_FIXNUM:
@@ -1943,7 +1935,7 @@ static VALUE FUNCTION(rb_gsl_vector,histogram)(int argc, VALUE *argv, VALUE obj)
1943
1935
  break;
1944
1936
  default:
1945
1937
  rb_raise(rb_eTypeError, "wrong argument type %s (Array expected)",
1946
- rb_class2name(CLASS_OF(argv[1])));
1938
+ rb_class2name(CLASS_OF(argv[1])));
1947
1939
  break;
1948
1940
  }
1949
1941
  h = gsl_histogram_alloc(n);
@@ -1990,56 +1982,56 @@ static VALUE FUNCTION(rb_gsl_vector,concat)(VALUE obj, VALUE other)
1990
1982
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
1991
1983
 
1992
1984
  switch(TYPE(other)) {
1993
- case T_FIXNUM:
1994
- case T_BIGNUM:
1995
- case T_FLOAT:
1996
- vnew = FUNCTION(gsl_vector,alloc)(v->size + 1);
1997
- vv = FUNCTION(gsl_vector,subvector)(vnew, 0, v->size);
1998
- FUNCTION(gsl_vector,memcpy)(&vv.vector, v);
1999
- FUNCTION(gsl_vector,set)(vnew, v->size, NUMCONV2(other));
2000
- break;
1985
+ case T_FIXNUM:
1986
+ case T_BIGNUM:
1987
+ case T_FLOAT:
1988
+ vnew = FUNCTION(gsl_vector,alloc)(v->size + 1);
1989
+ vv = FUNCTION(gsl_vector,subvector)(vnew, 0, v->size);
1990
+ FUNCTION(gsl_vector,memcpy)(&vv.vector, v);
1991
+ FUNCTION(gsl_vector,set)(vnew, v->size, NUMCONV2(other));
1992
+ break;
2001
1993
 
2002
- case T_ARRAY:
2003
- size2 = RARRAY_LEN(other);
1994
+ case T_ARRAY:
1995
+ size2 = RARRAY_LEN(other);
1996
+ vnew = FUNCTION(gsl_vector,alloc)(v->size + size2);
1997
+ vv = FUNCTION(gsl_vector,subvector)(vnew, 0, v->size);
1998
+ FUNCTION(gsl_vector,memcpy)(&vv.vector, v);
1999
+ for (i = 0; i < size2; i++) {
2000
+ x = rb_ary_entry(other, i);
2001
+ FUNCTION(gsl_vector,set)(vnew, v->size + i, NUMCONV2(x));
2002
+ }
2003
+ break;
2004
+
2005
+ default:
2006
+ if(rb_obj_is_kind_of(other, rb_cRange)) {
2007
+ FUNCTION(get_range,beg_en_n)(other, &beg, &end, &size2, &step);
2004
2008
  vnew = FUNCTION(gsl_vector,alloc)(v->size + size2);
2005
2009
  vv = FUNCTION(gsl_vector,subvector)(vnew, 0, v->size);
2006
2010
  FUNCTION(gsl_vector,memcpy)(&vv.vector, v);
2007
2011
  for (i = 0; i < size2; i++) {
2008
- x = rb_ary_entry(other, i);
2009
- FUNCTION(gsl_vector,set)(vnew, v->size + i, NUMCONV2(x));
2010
- }
2011
- break;
2012
-
2013
- default:
2014
- if(rb_obj_is_kind_of(other, rb_cRange)) {
2015
- FUNCTION(get_range,beg_en_n)(other, &beg, &end, &size2, &step);
2016
- vnew = FUNCTION(gsl_vector,alloc)(v->size + size2);
2017
- vv = FUNCTION(gsl_vector,subvector)(vnew, 0, v->size);
2018
- FUNCTION(gsl_vector,memcpy)(&vv.vector, v);
2019
- for (i = 0; i < size2; i++) {
2020
- FUNCTION(gsl_vector,set)(vnew, v->size + i, beg);
2021
- beg += step;
2022
- }
2023
- } else if (rb_obj_is_kind_of(other, GSL_TYPE(cgsl_vector))) {
2024
- Data_Get_Struct(other, GSL_TYPE(gsl_vector), v2);
2025
- size2 = v2->size;
2026
- vnew = FUNCTION(gsl_vector,alloc)(v->size + size2);
2027
- vv = FUNCTION(gsl_vector,subvector)(vnew, 0, v->size);
2028
- FUNCTION(gsl_vector,memcpy)(&vv.vector, v);
2029
- vv = FUNCTION(gsl_vector,subvector)(vnew, v->size, size2);
2030
- FUNCTION(gsl_vector,memcpy)(&vv.vector, v2);
2031
- } else {
2032
- rb_raise(rb_eTypeError, "wrong argument type %s (Array, Numeric, Range, or %s expected)",
2033
- rb_class2name(CLASS_OF(other)), rb_class2name(GSL_TYPE(cgsl_vector)));
2012
+ FUNCTION(gsl_vector,set)(vnew, v->size + i, beg);
2013
+ beg += step;
2034
2014
  }
2035
- break;
2015
+ } else if (rb_obj_is_kind_of(other, GSL_TYPE(cgsl_vector))) {
2016
+ Data_Get_Struct(other, GSL_TYPE(gsl_vector), v2);
2017
+ size2 = v2->size;
2018
+ vnew = FUNCTION(gsl_vector,alloc)(v->size + size2);
2019
+ vv = FUNCTION(gsl_vector,subvector)(vnew, 0, v->size);
2020
+ FUNCTION(gsl_vector,memcpy)(&vv.vector, v);
2021
+ vv = FUNCTION(gsl_vector,subvector)(vnew, v->size, size2);
2022
+ FUNCTION(gsl_vector,memcpy)(&vv.vector, v2);
2023
+ } else {
2024
+ rb_raise(rb_eTypeError, "wrong argument type %s (Array, Numeric, Range, or %s expected)",
2025
+ rb_class2name(CLASS_OF(other)), rb_class2name(GSL_TYPE(cgsl_vector)));
2026
+ }
2027
+ break;
2036
2028
  }
2037
2029
 
2038
- return Data_Wrap_Struct(VEC_ROW_COL(obj), 0, FUNCTION(gsl_vector,free), vnew);
2030
+ return Data_Wrap_Struct(VEC_ROW_COL(obj), 0, FUNCTION(gsl_vector,free), vnew);
2039
2031
  }
2040
2032
 
2041
2033
  void FUNCTION(mygsl_vector,diff)(GSL_TYPE(gsl_vector) *vdst,
2042
- GSL_TYPE(gsl_vector) *vsrc, size_t n)
2034
+ GSL_TYPE(gsl_vector) *vsrc, size_t n)
2043
2035
  {
2044
2036
  BASE a, b;
2045
2037
  int coef, fac, nn, ff;
@@ -2090,7 +2082,7 @@ static VALUE FUNCTION(rb_gsl_vector,test)(VALUE obj, int (*f)(const double))
2090
2082
  size_t i;
2091
2083
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
2092
2084
  vi = gsl_vector_int_alloc(v->size);
2093
- for (i = 0; i < v->size; i++)
2085
+ for (i = 0; i < v->size; i++)
2094
2086
  gsl_vector_int_set(vi, i, (*f)(FUNCTION(gsl_vector,get)(v, i)));
2095
2087
  return Data_Wrap_Struct(cgsl_vector_int, 0, gsl_vector_int_free, vi);
2096
2088
  }
@@ -2157,7 +2149,7 @@ static VALUE FUNCTION(rb_gsl_vector,delete_at)(VALUE obj, VALUE ii)
2157
2149
  if (i2 < 0) {
2158
2150
  i2 += v->size;
2159
2151
  }
2160
- if (i2 < 0 || i2 > v->size-1) return Qnil;
2152
+ if (i2 < 0 || i2 > (int) (v->size-1)) return Qnil;
2161
2153
  i = (size_t) i2;
2162
2154
  x = FUNCTION(gsl_vector,get)(v, i);
2163
2155
  memmove(v->data+i, v->data+i+1, sizeof(BASE)*(v->size-1-i));
@@ -2209,7 +2201,7 @@ static VALUE FUNCTION(rb_gsl_vector,delete)(VALUE obj, VALUE yy)
2209
2201
  }
2210
2202
  }
2211
2203
  v->size -= count;
2212
- return count ? y : Qnil;
2204
+ return count ? (VALUE) y : Qnil;
2213
2205
  }
2214
2206
 
2215
2207
  /* singleton method */
@@ -2231,21 +2223,23 @@ static VALUE FUNCTION(rb_gsl_vector,filescan)(VALUE klass, VALUE file)
2231
2223
  Check_Type(file, T_STRING);
2232
2224
  strcpy(filename, STR2CSTR(file));
2233
2225
  sprintf(buf, "sed '/^#/d' %s | wc", filename);
2234
- if ((fp = popen(buf, "r")) == NULL)
2226
+ if ((fp = popen(buf, "r")) == NULL)
2235
2227
  rb_raise(rb_eIOError, "popen failed.");
2236
- fgets(buf, 1024, fp);
2228
+ if (fgets(buf, 1024, fp) == NULL)
2229
+ rb_sys_fail(0);
2237
2230
  pclose(fp);
2238
2231
  sscanf(buf, "%d", &nn);
2239
2232
  lines = (size_t) nn; /* vector length */
2240
- if ((fp = fopen(filename, "r")) == NULL)
2233
+ if ((fp = fopen(filename, "r")) == NULL)
2241
2234
  rb_raise(rb_eIOError, "cannot open file %s.", filename);
2242
2235
  while (1) {
2243
- fgets(buf, 1024, fp); /* read the first line to count number of columns */
2244
- if (buf[0] == '#') continue;
2245
- else break;
2246
- }
2236
+ if (fgets(buf, 1024, fp) == NULL) /* read the first line to count number of columns */
2237
+ rb_sys_fail(0);
2238
+ if (buf[0] == '#') continue;
2239
+ else break;
2240
+ }
2247
2241
  n = count_columns(buf); /* number of vectors to be created */
2248
- x = (GSL_TYPE(gsl_vector)**) xmalloc(sizeof(GSL_TYPE(gsl_vector)*)*n);
2242
+ x = (GSL_TYPE(gsl_vector)**)xmalloc(sizeof(GSL_TYPE(gsl_vector)*)*n);
2249
2243
  ary = rb_ary_new2(n);
2250
2244
  for (j = 0; j < n; j++) {
2251
2245
  x[j] = FUNCTION(gsl_vector,alloc)(lines);
@@ -2253,10 +2247,11 @@ static VALUE FUNCTION(rb_gsl_vector,filescan)(VALUE klass, VALUE file)
2253
2247
  }
2254
2248
  rewind(fp);
2255
2249
  for (i = 0, ii = 0; ii < lines; i++) {
2256
- pos = ftell(fp);
2257
- fgets(buf, 1024, fp);
2258
- if (buf[0] == '#') continue;
2259
- fseek(fp, pos, SEEK_SET);
2250
+ pos = ftell(fp);
2251
+ if (fgets(buf, 1024, fp) == NULL)
2252
+ rb_sys_fail(0);
2253
+ if (buf[0] == '#') continue;
2254
+ fseek(fp, pos, SEEK_SET);
2260
2255
  for (j = 0, jj = 0; jj < n; j++) {
2261
2256
  k = fscanf(fp, FORMAT_TMP, &val);
2262
2257
  if (k != 1) continue;
@@ -2270,9 +2265,9 @@ static VALUE FUNCTION(rb_gsl_vector,filescan)(VALUE klass, VALUE file)
2270
2265
  }
2271
2266
  #undef FORMAT_TMP
2272
2267
 
2273
- static int FUNCTION(gsl_vector,eq)(const GSL_TYPE(gsl_vector) *a,
2274
- const GSL_TYPE(gsl_vector) *b,
2275
- gsl_block_uchar *c)
2268
+ static int FUNCTION(gsl_vector,eq)(const GSL_TYPE(gsl_vector) *a,
2269
+ const GSL_TYPE(gsl_vector) *b,
2270
+ gsl_block_uchar *c)
2276
2271
  {
2277
2272
  size_t i;
2278
2273
  BASE x, y;
@@ -2286,9 +2281,9 @@ static int FUNCTION(gsl_vector,eq)(const GSL_TYPE(gsl_vector) *a,
2286
2281
  return 0;
2287
2282
  }
2288
2283
 
2289
- static int FUNCTION(gsl_vector,ne)(const GSL_TYPE(gsl_vector) *a,
2290
- const GSL_TYPE(gsl_vector) *b,
2291
- gsl_block_uchar *c)
2284
+ static int FUNCTION(gsl_vector,ne)(const GSL_TYPE(gsl_vector) *a,
2285
+ const GSL_TYPE(gsl_vector) *b,
2286
+ gsl_block_uchar *c)
2292
2287
  {
2293
2288
  size_t i;
2294
2289
  BASE x, y;
@@ -2302,9 +2297,9 @@ static int FUNCTION(gsl_vector,ne)(const GSL_TYPE(gsl_vector) *a,
2302
2297
  return 0;
2303
2298
  }
2304
2299
 
2305
- static int FUNCTION(gsl_vector,gt)(const GSL_TYPE(gsl_vector) *a,
2306
- const GSL_TYPE(gsl_vector) *b,
2307
- gsl_block_uchar *c)
2300
+ static int FUNCTION(gsl_vector,gt)(const GSL_TYPE(gsl_vector) *a,
2301
+ const GSL_TYPE(gsl_vector) *b,
2302
+ gsl_block_uchar *c)
2308
2303
  {
2309
2304
  size_t i;
2310
2305
  BASE x, y;
@@ -2318,9 +2313,9 @@ static int FUNCTION(gsl_vector,gt)(const GSL_TYPE(gsl_vector) *a,
2318
2313
  return 0;
2319
2314
  }
2320
2315
 
2321
- static int FUNCTION(gsl_vector,ge)(const GSL_TYPE(gsl_vector) *a,
2322
- const GSL_TYPE(gsl_vector) *b,
2323
- gsl_block_uchar *c)
2316
+ static int FUNCTION(gsl_vector,ge)(const GSL_TYPE(gsl_vector) *a,
2317
+ const GSL_TYPE(gsl_vector) *b,
2318
+ gsl_block_uchar *c)
2324
2319
  {
2325
2320
  size_t i;
2326
2321
  BASE x, y;
@@ -2334,9 +2329,9 @@ static int FUNCTION(gsl_vector,ge)(const GSL_TYPE(gsl_vector) *a,
2334
2329
  return 0;
2335
2330
  }
2336
2331
 
2337
- static int FUNCTION(gsl_vector,lt)(const GSL_TYPE(gsl_vector) *a,
2338
- const GSL_TYPE(gsl_vector) *b,
2339
- gsl_block_uchar *c)
2332
+ static int FUNCTION(gsl_vector,lt)(const GSL_TYPE(gsl_vector) *a,
2333
+ const GSL_TYPE(gsl_vector) *b,
2334
+ gsl_block_uchar *c)
2340
2335
  {
2341
2336
  size_t i;
2342
2337
  BASE x, y;
@@ -2350,9 +2345,9 @@ static int FUNCTION(gsl_vector,lt)(const GSL_TYPE(gsl_vector) *a,
2350
2345
  return 0;
2351
2346
  }
2352
2347
 
2353
- static int FUNCTION(gsl_vector,le)(const GSL_TYPE(gsl_vector) *a,
2354
- const GSL_TYPE(gsl_vector) *b,
2355
- gsl_block_uchar *c)
2348
+ static int FUNCTION(gsl_vector,le)(const GSL_TYPE(gsl_vector) *a,
2349
+ const GSL_TYPE(gsl_vector) *b,
2350
+ gsl_block_uchar *c)
2356
2351
  {
2357
2352
  size_t i;
2358
2353
  BASE x, y;
@@ -2366,9 +2361,9 @@ static int FUNCTION(gsl_vector,le)(const GSL_TYPE(gsl_vector) *a,
2366
2361
  return 0;
2367
2362
  }
2368
2363
 
2369
- static int FUNCTION(gsl_vector,and)(const GSL_TYPE(gsl_vector) *a,
2370
- const GSL_TYPE(gsl_vector) *b,
2371
- gsl_block_uchar *c)
2364
+ static int FUNCTION(gsl_vector,and)(const GSL_TYPE(gsl_vector) *a,
2365
+ const GSL_TYPE(gsl_vector) *b,
2366
+ gsl_block_uchar *c)
2372
2367
  {
2373
2368
  size_t i;
2374
2369
  BASE x, y;
@@ -2382,9 +2377,9 @@ static int FUNCTION(gsl_vector,and)(const GSL_TYPE(gsl_vector) *a,
2382
2377
  return 0;
2383
2378
  }
2384
2379
 
2385
- static int FUNCTION(gsl_vector,or)(const GSL_TYPE(gsl_vector) *a,
2386
- const GSL_TYPE(gsl_vector) *b,
2387
- gsl_block_uchar *c)
2380
+ static int FUNCTION(gsl_vector,or)(const GSL_TYPE(gsl_vector) *a,
2381
+ const GSL_TYPE(gsl_vector) *b,
2382
+ gsl_block_uchar *c)
2388
2383
  {
2389
2384
  size_t i;
2390
2385
  BASE x, y;
@@ -2398,9 +2393,9 @@ static int FUNCTION(gsl_vector,or)(const GSL_TYPE(gsl_vector) *a,
2398
2393
  return 0;
2399
2394
  }
2400
2395
 
2401
- static int FUNCTION(gsl_vector,xor)(const GSL_TYPE(gsl_vector) *a,
2402
- const GSL_TYPE(gsl_vector) *b,
2403
- gsl_block_uchar *c)
2396
+ static int FUNCTION(gsl_vector,xor)(const GSL_TYPE(gsl_vector) *a,
2397
+ const GSL_TYPE(gsl_vector) *b,
2398
+ gsl_block_uchar *c)
2404
2399
  {
2405
2400
  size_t i;
2406
2401
  BASE x, y;
@@ -2414,8 +2409,8 @@ static int FUNCTION(gsl_vector,xor)(const GSL_TYPE(gsl_vector) *a,
2414
2409
  return 0;
2415
2410
  }
2416
2411
 
2417
- static int FUNCTION(gsl_vector,eq2)(const GSL_TYPE(gsl_vector) *a,
2418
- BASE b, gsl_block_uchar *c)
2412
+ static int FUNCTION(gsl_vector,eq2)(const GSL_TYPE(gsl_vector) *a,
2413
+ BASE b, gsl_block_uchar *c)
2419
2414
  {
2420
2415
  size_t i;
2421
2416
  BASE x, y;
@@ -2428,9 +2423,9 @@ static int FUNCTION(gsl_vector,eq2)(const GSL_TYPE(gsl_vector) *a,
2428
2423
  return 0;
2429
2424
  }
2430
2425
 
2431
- static int FUNCTION(gsl_vector,ne2)(const GSL_TYPE(gsl_vector) *a,
2432
- BASE b,
2433
- gsl_block_uchar *c)
2426
+ static int FUNCTION(gsl_vector,ne2)(const GSL_TYPE(gsl_vector) *a,
2427
+ BASE b,
2428
+ gsl_block_uchar *c)
2434
2429
  {
2435
2430
  size_t i;
2436
2431
  BASE x, y;
@@ -2443,9 +2438,9 @@ static int FUNCTION(gsl_vector,ne2)(const GSL_TYPE(gsl_vector) *a,
2443
2438
  return 0;
2444
2439
  }
2445
2440
 
2446
- static int FUNCTION(gsl_vector,gt2)(const GSL_TYPE(gsl_vector) *a,
2447
- BASE b,
2448
- gsl_block_uchar *c)
2441
+ static int FUNCTION(gsl_vector,gt2)(const GSL_TYPE(gsl_vector) *a,
2442
+ BASE b,
2443
+ gsl_block_uchar *c)
2449
2444
  {
2450
2445
  size_t i;
2451
2446
  BASE x, y;
@@ -2458,9 +2453,9 @@ static int FUNCTION(gsl_vector,gt2)(const GSL_TYPE(gsl_vector) *a,
2458
2453
  return 0;
2459
2454
  }
2460
2455
 
2461
- static int FUNCTION(gsl_vector,ge2)(const GSL_TYPE(gsl_vector) *a,
2462
- BASE b,
2463
- gsl_block_uchar *c)
2456
+ static int FUNCTION(gsl_vector,ge2)(const GSL_TYPE(gsl_vector) *a,
2457
+ BASE b,
2458
+ gsl_block_uchar *c)
2464
2459
  {
2465
2460
  size_t i;
2466
2461
  BASE x, y;
@@ -2473,9 +2468,9 @@ static int FUNCTION(gsl_vector,ge2)(const GSL_TYPE(gsl_vector) *a,
2473
2468
  return 0;
2474
2469
  }
2475
2470
 
2476
- static int FUNCTION(gsl_vector,lt2)(const GSL_TYPE(gsl_vector) *a,
2477
- BASE b,
2478
- gsl_block_uchar *c)
2471
+ static int FUNCTION(gsl_vector,lt2)(const GSL_TYPE(gsl_vector) *a,
2472
+ BASE b,
2473
+ gsl_block_uchar *c)
2479
2474
  {
2480
2475
  size_t i;
2481
2476
  BASE x, y;
@@ -2488,9 +2483,9 @@ static int FUNCTION(gsl_vector,lt2)(const GSL_TYPE(gsl_vector) *a,
2488
2483
  return 0;
2489
2484
  }
2490
2485
 
2491
- static int FUNCTION(gsl_vector,le2)(const GSL_TYPE(gsl_vector) *a,
2492
- BASE b,
2493
- gsl_block_uchar *c)
2486
+ static int FUNCTION(gsl_vector,le2)(const GSL_TYPE(gsl_vector) *a,
2487
+ BASE b,
2488
+ gsl_block_uchar *c)
2494
2489
  {
2495
2490
  size_t i;
2496
2491
  BASE x, y;
@@ -2503,9 +2498,9 @@ static int FUNCTION(gsl_vector,le2)(const GSL_TYPE(gsl_vector) *a,
2503
2498
  return 0;
2504
2499
  }
2505
2500
 
2506
- static int FUNCTION(gsl_vector,and2)(const GSL_TYPE(gsl_vector) *a,
2507
- BASE b,
2508
- gsl_block_uchar *c)
2501
+ static int FUNCTION(gsl_vector,and2)(const GSL_TYPE(gsl_vector) *a,
2502
+ BASE b,
2503
+ gsl_block_uchar *c)
2509
2504
  {
2510
2505
  size_t i;
2511
2506
  BASE x, y;
@@ -2518,9 +2513,9 @@ static int FUNCTION(gsl_vector,and2)(const GSL_TYPE(gsl_vector) *a,
2518
2513
  return 0;
2519
2514
  }
2520
2515
 
2521
- static int FUNCTION(gsl_vector,or2)(const GSL_TYPE(gsl_vector) *a,
2522
- BASE b,
2523
- gsl_block_uchar *c)
2516
+ static int FUNCTION(gsl_vector,or2)(const GSL_TYPE(gsl_vector) *a,
2517
+ BASE b,
2518
+ gsl_block_uchar *c)
2524
2519
  {
2525
2520
  size_t i;
2526
2521
  BASE x, y;
@@ -2533,9 +2528,9 @@ static int FUNCTION(gsl_vector,or2)(const GSL_TYPE(gsl_vector) *a,
2533
2528
  return 0;
2534
2529
  }
2535
2530
 
2536
- static int FUNCTION(gsl_vector,xor2)(const GSL_TYPE(gsl_vector) *a,
2537
- BASE b,
2538
- gsl_block_uchar *c)
2531
+ static int FUNCTION(gsl_vector,xor2)(const GSL_TYPE(gsl_vector) *a,
2532
+ BASE b,
2533
+ gsl_block_uchar *c)
2539
2534
  {
2540
2535
  size_t i;
2541
2536
  BASE x, y;
@@ -2550,12 +2545,12 @@ static int FUNCTION(gsl_vector,xor2)(const GSL_TYPE(gsl_vector) *a,
2550
2545
 
2551
2546
 
2552
2547
  static VALUE FUNCTION(rb_gsl_vector,compare)(VALUE aa, VALUE bb,
2553
- int (*cmp)(const GSL_TYPE(gsl_vector)*,
2554
- const GSL_TYPE(gsl_vector)*,
2555
- gsl_block_uchar*),
2556
- int (*cmp2)(const GSL_TYPE(gsl_vector)*,
2557
- BASE,
2558
- gsl_block_uchar*))
2548
+ int (*cmp)(const GSL_TYPE (gsl_vector)*,
2549
+ const GSL_TYPE (gsl_vector)*,
2550
+ gsl_block_uchar*),
2551
+ int (*cmp2)(const GSL_TYPE (gsl_vector)*,
2552
+ BASE,
2553
+ gsl_block_uchar*))
2559
2554
  {
2560
2555
  GSL_TYPE(gsl_vector) *a, *b;
2561
2556
  /* gsl_vector_int *c;*/
@@ -2565,9 +2560,9 @@ static VALUE FUNCTION(rb_gsl_vector,compare)(VALUE aa, VALUE bb,
2565
2560
  c = gsl_block_uchar_alloc(a->size);
2566
2561
  if (VEC_P(bb)) {
2567
2562
  Data_Get_Struct(bb, GSL_TYPE(gsl_vector), b);
2568
- if (a->size != b->size)
2569
- rb_raise(rb_eRuntimeError, "Vector size mismatch, %d and %d", (int) a->size,
2570
- (int) b->size);
2563
+ if (a->size != b->size)
2564
+ rb_raise(rb_eRuntimeError, "Vector size mismatch, %d and %d", (int) a->size,
2565
+ (int) b->size);
2571
2566
  /*status =*/ (*cmp)(a, b, c);
2572
2567
  } else {
2573
2568
  /*status =*/ (*cmp2)(a, NUMCONV(bb), c);
@@ -2578,55 +2573,55 @@ static VALUE FUNCTION(rb_gsl_vector,compare)(VALUE aa, VALUE bb,
2578
2573
  static VALUE FUNCTION(rb_gsl_vector,eq)(VALUE aa, VALUE bb)
2579
2574
  {
2580
2575
  return FUNCTION(rb_gsl_vector,compare)(aa, bb, FUNCTION(gsl_vector,eq),
2581
- FUNCTION(gsl_vector,eq2));
2576
+ FUNCTION(gsl_vector,eq2));
2582
2577
  }
2583
2578
 
2584
2579
  static VALUE FUNCTION(rb_gsl_vector,ne)(VALUE aa, VALUE bb)
2585
2580
  {
2586
2581
  return FUNCTION(rb_gsl_vector,compare)(aa, bb, FUNCTION(gsl_vector,ne),
2587
- FUNCTION(gsl_vector,ne2));
2582
+ FUNCTION(gsl_vector,ne2));
2588
2583
  }
2589
2584
 
2590
2585
  static VALUE FUNCTION(rb_gsl_vector,gt)(VALUE aa, VALUE bb)
2591
2586
  {
2592
2587
  return FUNCTION(rb_gsl_vector,compare)(aa, bb, FUNCTION(gsl_vector,gt),
2593
- FUNCTION(gsl_vector,gt2));
2588
+ FUNCTION(gsl_vector,gt2));
2594
2589
  }
2595
2590
 
2596
2591
  static VALUE FUNCTION(rb_gsl_vector,ge)(VALUE aa, VALUE bb)
2597
2592
  {
2598
2593
  return FUNCTION(rb_gsl_vector,compare)(aa, bb, FUNCTION(gsl_vector,ge),
2599
- FUNCTION(gsl_vector,ge2));
2594
+ FUNCTION(gsl_vector,ge2));
2600
2595
  }
2601
2596
 
2602
2597
  static VALUE FUNCTION(rb_gsl_vector,lt)(VALUE aa, VALUE bb)
2603
2598
  {
2604
2599
  return FUNCTION(rb_gsl_vector,compare)(aa, bb, FUNCTION(gsl_vector,lt),
2605
- FUNCTION(gsl_vector,lt2));
2600
+ FUNCTION(gsl_vector,lt2));
2606
2601
  }
2607
2602
 
2608
2603
  static VALUE FUNCTION(rb_gsl_vector,le)(VALUE aa, VALUE bb)
2609
2604
  {
2610
2605
  return FUNCTION(rb_gsl_vector,compare)(aa, bb, FUNCTION(gsl_vector,le),
2611
- FUNCTION(gsl_vector,le2));
2606
+ FUNCTION(gsl_vector,le2));
2612
2607
  }
2613
2608
 
2614
2609
  static VALUE FUNCTION(rb_gsl_vector,and)(VALUE aa, VALUE bb)
2615
2610
  {
2616
2611
  return FUNCTION(rb_gsl_vector,compare)(aa, bb, FUNCTION(gsl_vector,and),
2617
- FUNCTION(gsl_vector,and2));
2612
+ FUNCTION(gsl_vector,and2));
2618
2613
  }
2619
2614
 
2620
2615
  static VALUE FUNCTION(rb_gsl_vector,or)(VALUE aa, VALUE bb)
2621
2616
  {
2622
2617
  return FUNCTION(rb_gsl_vector,compare)(aa, bb, FUNCTION(gsl_vector,or),
2623
- FUNCTION(gsl_vector,or2));
2618
+ FUNCTION(gsl_vector,or2));
2624
2619
  }
2625
2620
 
2626
2621
  static VALUE FUNCTION(rb_gsl_vector,xor)(VALUE aa, VALUE bb)
2627
2622
  {
2628
2623
  return FUNCTION(rb_gsl_vector,compare)(aa, bb, FUNCTION(gsl_vector,xor),
2629
- FUNCTION(gsl_vector,xor2));
2624
+ FUNCTION(gsl_vector,xor2));
2630
2625
  }
2631
2626
 
2632
2627
  static VALUE FUNCTION(rb_gsl_vector,not)(VALUE obj)
@@ -2664,11 +2659,11 @@ static VALUE FUNCTION(rb_gsl_vector,any2)(VALUE obj)
2664
2659
 
2665
2660
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
2666
2661
  if (rb_block_given_p()) {
2667
- for (i = 0; i < v->size; i++)
2662
+ for (i = 0; i < v->size; i++)
2668
2663
  if (rb_yield(C_TO_VALUE(FUNCTION(gsl_vector,get)(v, i)))) return Qtrue;
2669
2664
  return Qfalse;
2670
2665
  } else {
2671
- for (i = 0; i < v->size; i++)
2666
+ for (i = 0; i < v->size; i++)
2672
2667
  if (v->data[i*v->stride]) return Qtrue;
2673
2668
  return Qfalse;
2674
2669
  }
@@ -2681,11 +2676,11 @@ static VALUE FUNCTION(rb_gsl_vector,none)(VALUE obj)
2681
2676
 
2682
2677
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
2683
2678
  if (rb_block_given_p()) {
2684
- for (i = 0; i < v->size; i++)
2679
+ for (i = 0; i < v->size; i++)
2685
2680
  if (rb_yield(C_TO_VALUE(FUNCTION(gsl_vector,get)(v, i)))) return Qfalse;
2686
2681
  return Qtrue;
2687
2682
  } else {
2688
- for (i = 0; i < v->size; i++)
2683
+ for (i = 0; i < v->size; i++)
2689
2684
  if (v->data[i*v->stride]) return Qfalse;
2690
2685
  return Qtrue;
2691
2686
  }
@@ -2698,11 +2693,11 @@ static VALUE FUNCTION(rb_gsl_vector,all)(VALUE obj)
2698
2693
 
2699
2694
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
2700
2695
  if (rb_block_given_p()) {
2701
- for (i = 0; i < v->size; i++)
2696
+ for (i = 0; i < v->size; i++)
2702
2697
  if (!rb_yield(C_TO_VALUE(FUNCTION(gsl_vector,get)(v, i)))) return Qfalse;
2703
2698
  return Qtrue;
2704
2699
  } else {
2705
- for (i = 0; i < v->size; i++)
2700
+ for (i = 0; i < v->size; i++)
2706
2701
  if (!v->data[i*v->stride]) return Qfalse;
2707
2702
  return Qtrue;
2708
2703
  }
@@ -2720,10 +2715,10 @@ static VALUE FUNCTION(rb_gsl_vector,where)(VALUE obj)
2720
2715
  btmp = gsl_block_uchar_alloc(v->size);
2721
2716
  for (i = 0; i < v->size; i++) {
2722
2717
  if (rb_yield(C_TO_VALUE(FUNCTION(gsl_vector,get)(v, i)))) {
2723
- btmp->data[i] = 1;
2724
- n++;
2718
+ btmp->data[i] = 1;
2719
+ n++;
2725
2720
  } else {
2726
- btmp->data[i] = 0;
2721
+ btmp->data[i] = 0;
2727
2722
  }
2728
2723
  } /* for */
2729
2724
  } else { /* block is not given */
@@ -2755,10 +2750,10 @@ static VALUE FUNCTION(rb_gsl_vector,where2)(VALUE obj)
2755
2750
  btmp = gsl_block_uchar_alloc(v->size);
2756
2751
  for (i = 0; i < v->size; i++) {
2757
2752
  if (rb_yield(C_TO_VALUE(FUNCTION(gsl_vector,get)(v, i)))) {
2758
- btmp->data[i] = 1;
2759
- n++;
2753
+ btmp->data[i] = 1;
2754
+ n++;
2760
2755
  } else {
2761
- btmp->data[i] = 0;
2756
+ btmp->data[i] = 0;
2762
2757
  }
2763
2758
  } /* for */
2764
2759
  } else { /* block is not given */
@@ -2769,11 +2764,11 @@ static VALUE FUNCTION(rb_gsl_vector,where2)(VALUE obj)
2769
2764
  v2 = gsl_permutation_calloc(v->size); /* calloc() initializes v2 */
2770
2765
  vv1 = Qnil;
2771
2766
  vv2 = Data_Wrap_Struct(cgsl_index, 0, gsl_permutation_free, v2);
2772
- } else if (v->size-n == 0) {
2767
+ } else if (v->size-n == 0) {
2773
2768
  v1 = gsl_permutation_calloc(n); /* calloc() initializes v1 */
2774
- vv1 = Data_Wrap_Struct(cgsl_index, 0, gsl_permutation_free, v1);
2769
+ vv1 = Data_Wrap_Struct(cgsl_index, 0, gsl_permutation_free, v1);
2775
2770
  vv2 = Qnil;
2776
- } else {
2771
+ } else {
2777
2772
  /* same case as 'where' */
2778
2773
  v1 = gsl_permutation_alloc(n);
2779
2774
  v2 = gsl_permutation_alloc(v->size-n);
@@ -2788,8 +2783,8 @@ static VALUE FUNCTION(rb_gsl_vector,where2)(VALUE obj)
2788
2783
  return rb_ary_new3(2, vv1, vv2);
2789
2784
  }
2790
2785
 
2791
- static VALUE FUNCTION(rb_gsl_vector,op_inplace)(VALUE vv1, VALUE vv2,
2792
- int (*f)(GSL_TYPE(gsl_vector)*, const GSL_TYPE(gsl_vector)*))
2786
+ static VALUE FUNCTION(rb_gsl_vector,op_inplace)(VALUE vv1, VALUE vv2,
2787
+ int (*f)(GSL_TYPE (gsl_vector)*, const GSL_TYPE (gsl_vector)*))
2793
2788
  {
2794
2789
  GSL_TYPE(gsl_vector) *v1, *v2;
2795
2790
  Data_Get_Struct(vv1, GSL_TYPE(gsl_vector), v1);
@@ -2867,32 +2862,31 @@ static VALUE FUNCTION(rb_gsl_vector,zip)(int argc, VALUE *argv, VALUE obj)
2867
2862
  argv2 = argv;
2868
2863
  } else {
2869
2864
  if (argc < 1) rb_raise(rb_eArgError, "Too few arguments.");
2870
- Data_Get_Struct(argv[0], GSL_TYPE(gsl_vector), v0);
2865
+ Data_Get_Struct(argv[0], GSL_TYPE(gsl_vector), v0);
2871
2866
  argc2 = argc - 1;
2872
2867
  argv2 = argv + 1;
2873
2868
  }
2874
- for (i = 0; i < argc2; i++) {
2869
+ for (i = 0; (int) i < argc2; i++) {
2875
2870
  CHECK_VEC(argv2[i]);
2876
2871
  }
2877
- vp = (GSL_TYPE(gsl_vector)**) malloc(sizeof(GSL_TYPE(gsl_vector)**));
2878
- for (i = 0; i < argc2; i++) {
2872
+ vp = (GSL_TYPE(gsl_vector)**)malloc(sizeof(GSL_TYPE(gsl_vector)**));
2873
+ for (i = 0; (int) i < argc2; i++) {
2879
2874
  Data_Get_Struct(argv2[i], GSL_TYPE(gsl_vector), vp[i]);
2880
2875
  }
2881
2876
  ary = rb_ary_new2(v0->size);
2882
2877
  for (i = 0; i < v0->size; i++) {
2883
2878
  vnew = FUNCTION(gsl_vector,alloc)(argc2 + 1);
2884
2879
  FUNCTION(gsl_vector,set)(vnew, 0, FUNCTION(gsl_vector,get)(v0, i));
2885
- for (j = 0; j < argc2; j++) {
2880
+ for (j = 0; (int) j < argc2; j++) {
2886
2881
  if (i < vp[j]->size) {
2887
- FUNCTION(gsl_vector,set)(vnew, j+1, FUNCTION(gsl_vector,get)(vp[j], i));
2882
+ FUNCTION(gsl_vector,set)(vnew, j+1, FUNCTION(gsl_vector,get)(vp[j], i));
2888
2883
  } else {
2889
- FUNCTION(gsl_vector,set)(vnew, j+1, 0.0);
2884
+ FUNCTION(gsl_vector,set)(vnew, j+1, 0.0);
2890
2885
  }
2891
2886
  }
2892
2887
  rb_ary_store(ary, i, Data_Wrap_Struct(GSL_TYPE(cgsl_vector), 0, FUNCTION(gsl_vector,free), vnew));
2893
2888
  }
2894
-
2895
- free((GSL_TYPE(gsl_vector)**) vp);
2889
+ free((GSL_TYPE(gsl_vector)**)vp);
2896
2890
  return ary;
2897
2891
  }
2898
2892
 
@@ -2956,17 +2950,16 @@ static VALUE FUNCTION(rb_gsl_vector,cumprod)(VALUE obj)
2956
2950
  return Data_Wrap_Struct(VEC_ROW_COL(obj), 0, FUNCTION(gsl_vector,free), vnew);
2957
2951
  }
2958
2952
 
2959
- #ifdef GSL_1_9_LATER
2960
2953
  static VALUE FUNCTION(rb_gsl_vector,property)(VALUE obj,
2961
- int (*f)(const GSL_TYPE(gsl_vector) *)) {
2954
+ int (*f)(const GSL_TYPE (gsl_vector) *)) {
2962
2955
  GSL_TYPE(gsl_vector) *v;
2963
2956
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
2964
- return INT2FIX((*f)(v));
2957
+ return INT2FIX((*f)(v));
2965
2958
  }
2966
2959
 
2967
2960
  static VALUE FUNCTION(rb_gsl_vector,property2)(VALUE obj,
2968
- int (*f)(const GSL_TYPE(gsl_vector) *)) {
2969
- GSL_TYPE(gsl_vector) *v;
2961
+ int (*f)(const GSL_TYPE (gsl_vector) *)) {
2962
+ GSL_TYPE(gsl_vector) *v;
2970
2963
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
2971
2964
  if ((*f)(v)) return Qtrue;
2972
2965
  else return Qfalse;
@@ -2978,19 +2971,17 @@ static VALUE FUNCTION(rb_gsl_vector,ispos)(VALUE obj)
2978
2971
  }
2979
2972
  static VALUE FUNCTION(rb_gsl_vector,ispos2)(VALUE obj)
2980
2973
  {
2981
- return FUNCTION(rb_gsl_vector,property2)(obj, FUNCTION(gsl_vector, ispos));
2974
+ return FUNCTION(rb_gsl_vector,property2)(obj, FUNCTION(gsl_vector, ispos));
2982
2975
  }
2983
2976
  static VALUE FUNCTION(rb_gsl_vector,isneg)(VALUE obj)
2984
2977
  {
2985
- return FUNCTION(rb_gsl_vector,property)(obj, FUNCTION(gsl_vector, isneg));
2978
+ return FUNCTION(rb_gsl_vector,property)(obj, FUNCTION(gsl_vector, isneg));
2986
2979
  }
2987
2980
  static VALUE FUNCTION(rb_gsl_vector,isneg2)(VALUE obj)
2988
2981
  {
2989
- return FUNCTION(rb_gsl_vector,property2)(obj, FUNCTION(gsl_vector, isneg));
2982
+ return FUNCTION(rb_gsl_vector,property2)(obj, FUNCTION(gsl_vector, isneg));
2990
2983
  }
2991
- #endif
2992
2984
 
2993
- #ifdef GSL_1_10_LATER
2994
2985
  static VALUE FUNCTION(rb_gsl_vector,isnonneg)(VALUE obj)
2995
2986
  {
2996
2987
  return FUNCTION(rb_gsl_vector,property)(obj, FUNCTION(gsl_vector, isnonneg));
@@ -2998,19 +2989,18 @@ static VALUE FUNCTION(rb_gsl_vector,isnonneg)(VALUE obj)
2998
2989
  static VALUE FUNCTION(rb_gsl_vector,isnonneg2)(VALUE obj)
2999
2990
  {
3000
2991
  return FUNCTION(rb_gsl_vector,property2)(obj, FUNCTION(gsl_vector, isnonneg));
3001
- }
3002
- #endif
2992
+ }
3003
2993
 
3004
2994
  void FUNCTION(Init_gsl_vector,init)(VALUE module)
3005
2995
  {
3006
- /* rb_define_singleton_method(GSL_TYPE(cgsl_vector), "new",
2996
+ /* rb_define_singleton_method(GSL_TYPE(cgsl_vector), "new",
3007
2997
  FUNCTION(rb_gsl_vector,new), -1);*/
3008
- rb_define_singleton_method(GSL_TYPE(cgsl_vector), "[]",
3009
- FUNCTION(rb_gsl_vector,new), -1);
3010
- rb_define_singleton_method(GSL_TYPE(cgsl_vector), "alloc",
3011
- FUNCTION(rb_gsl_vector,new), -1);
3012
- rb_define_singleton_method(GSL_TYPE(cgsl_vector), "calloc",
3013
- FUNCTION(rb_gsl_vector,calloc), 1);
2998
+ rb_define_singleton_method(GSL_TYPE(cgsl_vector), "[]",
2999
+ FUNCTION(rb_gsl_vector,new), -1);
3000
+ rb_define_singleton_method(GSL_TYPE(cgsl_vector), "alloc",
3001
+ FUNCTION(rb_gsl_vector,new), -1);
3002
+ rb_define_singleton_method(GSL_TYPE(cgsl_vector), "calloc",
3003
+ FUNCTION(rb_gsl_vector,calloc), 1);
3014
3004
 
3015
3005
  /*****/
3016
3006
  rb_define_method(GSL_TYPE(cgsl_vector), "get", FUNCTION(rb_gsl_vector,get), -1);
@@ -3079,86 +3069,86 @@ void FUNCTION(Init_gsl_vector,init)(VALUE module)
3079
3069
  rb_define_method(GSL_TYPE(cgsl_vector), "cumsum", FUNCTION(rb_gsl_vector,cumsum), 0);
3080
3070
  rb_define_method(GSL_TYPE(cgsl_vector), "cumprod", FUNCTION(rb_gsl_vector,cumprod), 0);
3081
3071
 
3082
- rb_define_method(GSL_TYPE(cgsl_vector), "connect",
3083
- FUNCTION(rb_gsl_vector,connect), -1);
3084
- rb_define_singleton_method(GSL_TYPE(cgsl_vector), "connect",
3085
- FUNCTION(rb_gsl_vector,connect), -1);
3072
+ rb_define_method(GSL_TYPE(cgsl_vector), "connect",
3073
+ FUNCTION(rb_gsl_vector,connect), -1);
3074
+ rb_define_singleton_method(GSL_TYPE(cgsl_vector), "connect",
3075
+ FUNCTION(rb_gsl_vector,connect), -1);
3086
3076
 
3087
3077
 
3088
3078
  rb_define_method(GSL_TYPE(cgsl_vector), "sgn", FUNCTION(rb_gsl_vector,sgn), 0);
3089
3079
  rb_define_alias(GSL_TYPE(cgsl_vector), "signum", "sgn");
3090
3080
  rb_define_method(GSL_TYPE(cgsl_vector), "abs", FUNCTION(rb_gsl_vector,abs), 0);
3091
3081
  rb_define_alias(GSL_TYPE(cgsl_vector), "fabs", "abs");
3092
- rb_define_method(GSL_TYPE(cgsl_vector), "square",
3093
- FUNCTION(rb_gsl_vector,square), 0);
3082
+ rb_define_method(GSL_TYPE(cgsl_vector), "square",
3083
+ FUNCTION(rb_gsl_vector,square), 0);
3094
3084
  rb_define_alias(GSL_TYPE(cgsl_vector), "abs2", "square");
3095
3085
  rb_define_method(GSL_TYPE(cgsl_vector), "sqrt", FUNCTION(rb_gsl_vector,sqrt), 0);
3096
3086
 
3097
- rb_define_singleton_method(GSL_TYPE(cgsl_vector), "memcpy",
3098
- FUNCTION(rb_gsl_vector,memcpy), 2);
3099
- rb_define_method(GSL_TYPE(cgsl_vector), "clone",
3100
- FUNCTION(rb_gsl_vector,clone), 0);
3087
+ rb_define_singleton_method(GSL_TYPE(cgsl_vector), "memcpy",
3088
+ FUNCTION(rb_gsl_vector,memcpy), 2);
3089
+ rb_define_method(GSL_TYPE(cgsl_vector), "clone",
3090
+ FUNCTION(rb_gsl_vector,clone), 0);
3101
3091
  rb_define_alias(GSL_TYPE(cgsl_vector), "duplicate", "clone");
3102
3092
  rb_define_alias(GSL_TYPE(cgsl_vector), "dup", "clone");
3103
- rb_define_singleton_method(GSL_TYPE(cgsl_vector), "swap",
3104
- FUNCTION(rb_gsl_vector,swap), 2);
3105
- rb_define_method(GSL_TYPE(cgsl_vector), "swap_elements",
3106
- FUNCTION(rb_gsl_vector,swap_elements), 2);
3107
-
3108
- rb_define_method(GSL_TYPE(cgsl_vector), "fwrite",
3109
- FUNCTION(rb_gsl_vector,fwrite), 1);
3110
- rb_define_method(GSL_TYPE(cgsl_vector), "fread",
3111
- FUNCTION(rb_gsl_vector,fread), 1);
3112
- rb_define_method(GSL_TYPE(cgsl_vector), "fprintf",
3113
- FUNCTION(rb_gsl_vector,fprintf), -1);
3114
- rb_define_method(GSL_TYPE(cgsl_vector), "printf",
3115
- FUNCTION(rb_gsl_vector,printf), -1);
3116
- rb_define_method(GSL_TYPE(cgsl_vector), "fscanf",
3117
- FUNCTION(rb_gsl_vector,fscanf), 1);
3093
+ rb_define_singleton_method(GSL_TYPE(cgsl_vector), "swap",
3094
+ FUNCTION(rb_gsl_vector,swap), 2);
3095
+ rb_define_method(GSL_TYPE(cgsl_vector), "swap_elements",
3096
+ FUNCTION(rb_gsl_vector,swap_elements), 2);
3097
+
3098
+ rb_define_method(GSL_TYPE(cgsl_vector), "fwrite",
3099
+ FUNCTION(rb_gsl_vector,fwrite), 1);
3100
+ rb_define_method(GSL_TYPE(cgsl_vector), "fread",
3101
+ FUNCTION(rb_gsl_vector,fread), 1);
3102
+ rb_define_method(GSL_TYPE(cgsl_vector), "fprintf",
3103
+ FUNCTION(rb_gsl_vector,fprintf), -1);
3104
+ rb_define_method(GSL_TYPE(cgsl_vector), "printf",
3105
+ FUNCTION(rb_gsl_vector,printf), -1);
3106
+ rb_define_method(GSL_TYPE(cgsl_vector), "fscanf",
3107
+ FUNCTION(rb_gsl_vector,fscanf), 1);
3118
3108
 
3119
3109
  /* 2.Aug.2004 */
3120
- rb_define_singleton_method(GSL_TYPE(cgsl_vector), "inner_product",
3121
- FUNCTION(rb_gsl_vector,inner_product), -1);
3122
- rb_define_singleton_method(GSL_TYPE(cgsl_vector), "dot",
3123
- FUNCTION(rb_gsl_vector,inner_product), -1);
3110
+ rb_define_singleton_method(GSL_TYPE(cgsl_vector), "inner_product",
3111
+ FUNCTION(rb_gsl_vector,inner_product), -1);
3112
+ rb_define_singleton_method(GSL_TYPE(cgsl_vector), "dot",
3113
+ FUNCTION(rb_gsl_vector,inner_product), -1);
3124
3114
  rb_define_method(GSL_TYPE(cgsl_vector), "inner_product",
3125
- FUNCTION(rb_gsl_vector,inner_product), -1);
3115
+ FUNCTION(rb_gsl_vector,inner_product), -1);
3126
3116
  rb_define_alias(GSL_TYPE(cgsl_vector), "dot", "inner_product");
3127
3117
 
3128
- rb_define_method(GSL_TYPE(cgsl_vector), "equal?",
3129
- FUNCTION(rb_gsl_vector,equal), -1);
3118
+ rb_define_method(GSL_TYPE(cgsl_vector), "equal?",
3119
+ FUNCTION(rb_gsl_vector,equal), -1);
3130
3120
  rb_define_alias(GSL_TYPE(cgsl_vector), "==", "equal?");
3131
3121
 
3132
- rb_define_method(GSL_TYPE(cgsl_vector), "to_poly",
3133
- FUNCTION(rb_gsl_vector,to_poly), 0);
3122
+ rb_define_method(GSL_TYPE(cgsl_vector), "to_poly",
3123
+ FUNCTION(rb_gsl_vector,to_poly), 0);
3134
3124
 
3135
3125
  /*****/
3136
- rb_define_method(GSL_TYPE(cgsl_vector), "graph",
3137
- FUNCTION(rb_gsl_vector,graph), -1);
3138
- rb_define_method(GSL_TYPE(cgsl_vector), "graph_step",
3139
- FUNCTION(rb_gsl_vector,graph_step), -1);
3140
- rb_define_method(GSL_TYPE(cgsl_vector), "plot",
3141
- FUNCTION(rb_gsl_vector,plot), -1);
3126
+ rb_define_method(GSL_TYPE(cgsl_vector), "graph",
3127
+ FUNCTION(rb_gsl_vector,graph), -1);
3128
+ rb_define_method(GSL_TYPE(cgsl_vector), "graph_step",
3129
+ FUNCTION(rb_gsl_vector,graph_step), -1);
3130
+ rb_define_method(GSL_TYPE(cgsl_vector), "plot",
3131
+ FUNCTION(rb_gsl_vector,plot), -1);
3142
3132
 
3143
3133
  rb_define_method(GSL_TYPE(cgsl_vector), "print",
3144
- FUNCTION(rb_gsl_vector,print), 0);
3145
- rb_define_method(GSL_TYPE(cgsl_vector), "inspect",
3146
- FUNCTION(rb_gsl_vector,inspect), 0);
3147
- rb_define_method(GSL_TYPE(cgsl_vector), "to_s",
3148
- FUNCTION(rb_gsl_vector,to_s), 0);
3134
+ FUNCTION(rb_gsl_vector,print), 0);
3135
+ rb_define_method(GSL_TYPE(cgsl_vector), "inspect",
3136
+ FUNCTION(rb_gsl_vector,inspect), 0);
3137
+ rb_define_method(GSL_TYPE(cgsl_vector), "to_s",
3138
+ FUNCTION(rb_gsl_vector,to_s), 0);
3149
3139
 
3150
3140
  /*****/
3151
3141
  rb_define_method(GSL_TYPE(cgsl_vector), "subvector",
3152
- FUNCTION(rb_gsl_vector,subvector), -1);
3142
+ FUNCTION(rb_gsl_vector,subvector), -1);
3153
3143
  rb_define_alias(GSL_TYPE(cgsl_vector), "view", "subvector");
3154
- rb_define_method(GSL_TYPE(cgsl_vector), "subvector_with_stride",
3155
- FUNCTION(rb_gsl_vector,subvector_with_stride), -1);
3144
+ rb_define_method(GSL_TYPE(cgsl_vector), "subvector_with_stride",
3145
+ FUNCTION(rb_gsl_vector,subvector_with_stride), -1);
3156
3146
  rb_define_alias(GSL_TYPE(cgsl_vector), "view_with_stride", "subvector_with_stride");
3157
3147
 
3158
- rb_define_method(GSL_TYPE(cgsl_vector), "matrix_view",
3159
- FUNCTION(rb_gsl_vector,matrix_view), -1);
3160
- rb_define_method(GSL_TYPE(cgsl_vector), "matrix_view_with_tda",
3161
- FUNCTION(rb_gsl_vector,matrix_view_with_tda), 3);
3148
+ rb_define_method(GSL_TYPE(cgsl_vector), "matrix_view",
3149
+ FUNCTION(rb_gsl_vector,matrix_view), -1);
3150
+ rb_define_method(GSL_TYPE(cgsl_vector), "matrix_view_with_tda",
3151
+ FUNCTION(rb_gsl_vector,matrix_view_with_tda), 3);
3162
3152
 
3163
3153
  #ifdef BASE_DOUBLE
3164
3154
  rb_undef_method(cgsl_vector_view_ro, "set");
@@ -3172,106 +3162,106 @@ void FUNCTION(Init_gsl_vector,init)(VALUE module)
3172
3162
  rb_undef_method(cgsl_vector_int_col_view_ro, "[]=");
3173
3163
  #endif
3174
3164
 
3175
- rb_define_method(GSL_TYPE(cgsl_vector), "scale",
3176
- FUNCTION(rb_gsl_vector,scale), 1);
3177
- rb_define_method(GSL_TYPE(cgsl_vector), "scale!",
3178
- FUNCTION(rb_gsl_vector,scale_bang), 1);
3179
- rb_define_method(GSL_TYPE(cgsl_vector), "add_constant",
3180
- FUNCTION(rb_gsl_vector,add_constant), 1);
3165
+ rb_define_method(GSL_TYPE(cgsl_vector), "scale",
3166
+ FUNCTION(rb_gsl_vector,scale), 1);
3167
+ rb_define_method(GSL_TYPE(cgsl_vector), "scale!",
3168
+ FUNCTION(rb_gsl_vector,scale_bang), 1);
3169
+ rb_define_method(GSL_TYPE(cgsl_vector), "add_constant",
3170
+ FUNCTION(rb_gsl_vector,add_constant), 1);
3181
3171
  rb_define_alias(GSL_TYPE(cgsl_vector), "add_const", "add_constant");
3182
- rb_define_method(GSL_TYPE(cgsl_vector), "add_constant!",
3183
- FUNCTION(rb_gsl_vector,add_constant_bang), 1);
3172
+ rb_define_method(GSL_TYPE(cgsl_vector), "add_constant!",
3173
+ FUNCTION(rb_gsl_vector,add_constant_bang), 1);
3184
3174
  rb_define_alias(GSL_TYPE(cgsl_vector), "add_const!", "add_constant!");
3185
3175
 
3186
3176
  #ifdef HAVE_TENSOR_TENSOR_H
3187
- rb_define_method(GSL_TYPE(cgsl_vector), "to_tensor",
3188
- FUNCTION(rb_gsl_vector,to_tensor), -1);
3177
+ rb_define_method(GSL_TYPE(cgsl_vector), "to_tensor",
3178
+ FUNCTION(rb_gsl_vector,to_tensor), -1);
3189
3179
  #endif
3190
3180
 
3191
- rb_define_singleton_method(GSL_TYPE(cgsl_vector), "to_gplot",
3192
- FUNCTION(rb_gsl_vector,to_gplot), -1);
3193
- rb_define_singleton_method(GSL_TYPE(cgsl_vector), "to_gsplot",
3194
- FUNCTION(rb_gsl_vector,to_gplot), -1);
3195
- rb_define_method(GSL_TYPE(cgsl_vector), "to_gplot",
3196
- FUNCTION(rb_gsl_vector,to_gplot), -1);
3181
+ rb_define_singleton_method(GSL_TYPE(cgsl_vector), "to_gplot",
3182
+ FUNCTION(rb_gsl_vector,to_gplot), -1);
3183
+ rb_define_singleton_method(GSL_TYPE(cgsl_vector), "to_gsplot",
3184
+ FUNCTION(rb_gsl_vector,to_gplot), -1);
3185
+ rb_define_method(GSL_TYPE(cgsl_vector), "to_gplot",
3186
+ FUNCTION(rb_gsl_vector,to_gplot), -1);
3197
3187