rb-gsl 1.16.0.4 → 1.16.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (307) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +12 -0
  3. data/.travis.yml +24 -0
  4. data/AUTHORS +6 -0
  5. data/COPYING +341 -339
  6. data/ChangeLog +608 -587
  7. data/Gemfile +4 -0
  8. data/README.md +77 -0
  9. data/Rakefile +14 -33
  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/{gsl → gsl_native}/alf.c +9 -9
  89. data/ext/{gsl → gsl_native}/array.c +64 -151
  90. data/ext/{gsl → gsl_native}/array_complex.c +61 -63
  91. data/ext/{gsl → gsl_native}/blas.c +0 -0
  92. data/ext/{gsl → gsl_native}/blas1.c +32 -32
  93. data/ext/{gsl → gsl_native}/blas2.c +54 -58
  94. data/ext/{gsl → gsl_native}/blas3.c +54 -54
  95. data/ext/{gsl → gsl_native}/block.c +3 -6
  96. data/ext/{gsl/block_source.c → gsl_native/block_source.h} +109 -111
  97. data/ext/gsl_native/bspline.c +122 -0
  98. data/ext/{gsl → gsl_native}/bundle.c +0 -0
  99. data/ext/{gsl → gsl_native}/cdf.c +76 -88
  100. data/ext/{gsl → gsl_native}/cheb.c +74 -85
  101. data/ext/{gsl → gsl_native}/combination.c +9 -16
  102. data/ext/{gsl → gsl_native}/common.c +7 -37
  103. data/ext/{gsl → gsl_native}/complex.c +113 -115
  104. data/ext/gsl_native/const.c +331 -0
  105. data/ext/{gsl → gsl_native}/const_additional.c +12 -33
  106. data/ext/gsl_native/cqp.c +283 -0
  107. data/ext/{gsl → gsl_native}/deriv.c +22 -30
  108. data/ext/{gsl → gsl_native}/dht.c +20 -28
  109. data/ext/{gsl → gsl_native}/diff.c +23 -25
  110. data/ext/{gsl → gsl_native}/dirac.c +44 -45
  111. data/ext/{gsl → gsl_native}/eigen.c +1031 -1082
  112. data/ext/{gsl → gsl_native}/error.c +13 -13
  113. data/ext/{gsl → gsl_native}/extconf.rb +5 -13
  114. data/ext/{gsl → gsl_native}/fft.c +192 -198
  115. data/ext/{gsl → gsl_native}/fit.c +16 -16
  116. data/ext/gsl_native/fresnel.c +312 -0
  117. data/ext/{gsl → gsl_native}/function.c +29 -35
  118. data/ext/{gsl → gsl_native}/geometry.c +15 -15
  119. data/ext/{gsl → gsl_native}/graph.c +37 -87
  120. data/ext/{gsl → gsl_native}/gsl.c +10 -23
  121. data/ext/{gsl → gsl_native}/gsl_narray.c +15 -24
  122. data/ext/{gsl → gsl_native}/histogram.c +123 -150
  123. data/ext/{gsl → gsl_native}/histogram2d.c +71 -96
  124. data/ext/{gsl → gsl_native}/histogram3d.c +72 -72
  125. data/ext/{gsl → gsl_native}/histogram3d_source.c +195 -196
  126. data/ext/{gsl → gsl_native}/histogram_find.c +31 -33
  127. data/ext/{gsl → gsl_native}/histogram_oper.c +43 -52
  128. data/ext/{gsl → gsl_native}/ieee.c +7 -15
  129. data/ext/{gsl → gsl_native}/include/rb_gsl.h +0 -7
  130. data/ext/{gsl → gsl_native}/include/rb_gsl_array.h +15 -25
  131. data/ext/{gsl → gsl_native}/include/rb_gsl_cheb.h +0 -0
  132. data/ext/{gsl → gsl_native}/include/rb_gsl_common.h +44 -52
  133. data/ext/{gsl → gsl_native}/include/rb_gsl_complex.h +0 -0
  134. data/ext/{gsl → gsl_native}/include/rb_gsl_const.h +0 -5
  135. data/ext/{gsl → gsl_native}/include/rb_gsl_dirac.h +0 -0
  136. data/ext/{gsl → gsl_native}/include/rb_gsl_eigen.h +0 -0
  137. data/ext/{gsl → gsl_native}/include/rb_gsl_fft.h +0 -3
  138. data/ext/{gsl → gsl_native}/include/rb_gsl_fit.h +0 -0
  139. data/ext/{gsl → gsl_native}/include/rb_gsl_function.h +0 -0
  140. data/ext/{gsl → gsl_native}/include/rb_gsl_graph.h +2 -2
  141. data/ext/{gsl → gsl_native}/include/rb_gsl_histogram.h +8 -8
  142. data/ext/{gsl → gsl_native}/include/rb_gsl_histogram3d.h +50 -50
  143. data/ext/{gsl → gsl_native}/include/rb_gsl_integration.h +0 -0
  144. data/ext/{gsl → gsl_native}/include/rb_gsl_interp.h +0 -0
  145. data/ext/{gsl → gsl_native}/include/rb_gsl_linalg.h +0 -1
  146. data/ext/{gsl → gsl_native}/include/rb_gsl_math.h +0 -4
  147. data/ext/{gsl → gsl_native}/include/rb_gsl_odeiv.h +0 -0
  148. data/ext/{gsl → gsl_native}/include/rb_gsl_poly.h +3 -3
  149. data/ext/{gsl → gsl_native}/include/rb_gsl_rational.h +1 -1
  150. data/ext/{gsl → gsl_native}/include/rb_gsl_rng.h +0 -0
  151. data/ext/{gsl → gsl_native}/include/rb_gsl_root.h +0 -0
  152. data/ext/{gsl → gsl_native}/include/rb_gsl_sf.h +39 -43
  153. data/ext/{gsl → gsl_native}/include/rb_gsl_statistics.h +0 -0
  154. data/ext/{gsl → gsl_native}/include/rb_gsl_tensor.h +0 -0
  155. data/ext/{gsl → gsl_native}/include/rb_gsl_with_narray.h +0 -0
  156. data/ext/{gsl → gsl_native}/include/templates_off.h +0 -0
  157. data/ext/{gsl → gsl_native}/include/templates_on.h +1 -1
  158. data/ext/{gsl → gsl_native}/integration.c +160 -183
  159. data/ext/{gsl → gsl_native}/interp.c +23 -31
  160. data/ext/gsl_native/jacobi.c +733 -0
  161. data/ext/{gsl → gsl_native}/linalg.c +448 -576
  162. data/ext/{gsl → gsl_native}/linalg_complex.c +84 -98
  163. data/ext/{gsl → gsl_native}/math.c +45 -63
  164. data/ext/{gsl → gsl_native}/matrix.c +4 -6
  165. data/ext/{gsl → gsl_native}/matrix_complex.c +111 -114
  166. data/ext/{gsl → gsl_native}/matrix_double.c +74 -77
  167. data/ext/{gsl → gsl_native}/matrix_int.c +49 -50
  168. data/ext/{gsl/matrix_source.c → gsl_native/matrix_source.h} +280 -302
  169. data/ext/{gsl → gsl_native}/min.c +43 -74
  170. data/ext/{gsl → gsl_native}/monte.c +45 -59
  171. data/ext/{gsl → gsl_native}/multifit.c +138 -147
  172. data/ext/{gsl → gsl_native}/multimin.c +55 -83
  173. data/ext/{gsl → gsl_native}/multimin_fsdf.c +15 -15
  174. data/ext/{gsl → gsl_native}/multiroots.c +61 -64
  175. data/ext/{gsl → gsl_native}/multiset.c +3 -7
  176. data/ext/{gsl → gsl_native}/ndlinear.c +320 -321
  177. data/ext/{gsl → gsl_native}/nmf.c +11 -11
  178. data/ext/{gsl → gsl_native}/nmf_wrap.c +1 -1
  179. data/ext/{gsl → gsl_native}/ntuple.c +13 -13
  180. data/ext/{gsl → gsl_native}/odeiv.c +95 -106
  181. data/ext/gsl_native/ool.c +879 -0
  182. data/ext/{gsl → gsl_native}/permutation.c +36 -34
  183. data/ext/{gsl → gsl_native}/poly.c +2 -5
  184. data/ext/{gsl → gsl_native}/poly2.c +6 -6
  185. data/ext/{gsl/poly_source.c → gsl_native/poly_source.h} +232 -275
  186. data/ext/{gsl → gsl_native}/qrng.c +6 -17
  187. data/ext/{gsl → gsl_native}/randist.c +218 -243
  188. data/ext/{gsl → gsl_native}/rational.c +9 -9
  189. data/ext/{gsl → gsl_native}/rng.c +29 -45
  190. data/ext/{gsl → gsl_native}/root.c +43 -43
  191. data/ext/{gsl → gsl_native}/sf.c +163 -197
  192. data/ext/{gsl → gsl_native}/sf_airy.c +0 -0
  193. data/ext/{gsl → gsl_native}/sf_bessel.c +6 -6
  194. data/ext/{gsl → gsl_native}/sf_clausen.c +0 -0
  195. data/ext/{gsl → gsl_native}/sf_coulomb.c +39 -39
  196. data/ext/{gsl → gsl_native}/sf_coupling.c +29 -29
  197. data/ext/{gsl → gsl_native}/sf_dawson.c +0 -0
  198. data/ext/{gsl → gsl_native}/sf_debye.c +0 -9
  199. data/ext/{gsl → gsl_native}/sf_dilog.c +0 -0
  200. data/ext/{gsl → gsl_native}/sf_elementary.c +2 -2
  201. data/ext/{gsl → gsl_native}/sf_ellint.c +42 -42
  202. data/ext/{gsl → gsl_native}/sf_elljac.c +2 -2
  203. data/ext/{gsl → gsl_native}/sf_erfc.c +0 -4
  204. data/ext/{gsl → gsl_native}/sf_exp.c +2 -2
  205. data/ext/{gsl → gsl_native}/sf_expint.c +1 -11
  206. data/ext/{gsl → gsl_native}/sf_fermi_dirac.c +0 -0
  207. data/ext/{gsl → gsl_native}/sf_gamma.c +1 -5
  208. data/ext/{gsl → gsl_native}/sf_gegenbauer.c +0 -0
  209. data/ext/{gsl → gsl_native}/sf_hyperg.c +0 -0
  210. data/ext/{gsl → gsl_native}/sf_laguerre.c +3 -3
  211. data/ext/{gsl → gsl_native}/sf_lambert.c +0 -0
  212. data/ext/{gsl → gsl_native}/sf_legendre.c +0 -0
  213. data/ext/{gsl → gsl_native}/sf_log.c +3 -3
  214. data/ext/gsl_native/sf_mathieu.c +235 -0
  215. data/ext/{gsl → gsl_native}/sf_power.c +0 -0
  216. data/ext/{gsl → gsl_native}/sf_psi.c +2 -11
  217. data/ext/{gsl → gsl_native}/sf_synchrotron.c +0 -0
  218. data/ext/{gsl → gsl_native}/sf_transport.c +0 -0
  219. data/ext/{gsl → gsl_native}/sf_trigonometric.c +3 -3
  220. data/ext/{gsl → gsl_native}/sf_zeta.c +0 -4
  221. data/ext/{gsl → gsl_native}/signal.c +60 -64
  222. data/ext/{gsl → gsl_native}/siman.c +36 -40
  223. data/ext/{gsl → gsl_native}/sort.c +3 -4
  224. data/ext/{gsl → gsl_native}/spline.c +25 -43
  225. data/ext/{gsl → gsl_native}/stats.c +102 -115
  226. data/ext/{gsl → gsl_native}/sum.c +32 -32
  227. data/ext/{gsl → gsl_native}/tamu_anova.c +0 -0
  228. data/ext/{gsl → gsl_native}/tensor.c +2 -4
  229. data/ext/{gsl/tensor_source.c → gsl_native/tensor_source.h} +144 -144
  230. data/ext/{gsl → gsl_native}/vector.c +2 -4
  231. data/ext/{gsl → gsl_native}/vector_complex.c +165 -171
  232. data/ext/{gsl → gsl_native}/vector_double.c +167 -174
  233. data/ext/{gsl → gsl_native}/vector_int.c +23 -25
  234. data/ext/{gsl/vector_source.c → gsl_native/vector_source.h} +400 -414
  235. data/ext/{gsl → gsl_native}/wavelet.c +215 -236
  236. data/lib/gsl.rb +1 -7
  237. data/lib/gsl/gnuplot.rb +2 -2
  238. data/lib/gsl/version.rb +1 -3
  239. data/rb-gsl.gemspec +29 -0
  240. data/rdoc/blas.rdoc +3 -3
  241. data/rdoc/bspline.rdoc +7 -7
  242. data/rdoc/cheb.rdoc +8 -8
  243. data/rdoc/cholesky_complex.rdoc +1 -1
  244. data/rdoc/combi.rdoc +9 -9
  245. data/rdoc/complex.rdoc +11 -11
  246. data/rdoc/const.rdoc +20 -20
  247. data/rdoc/dht.rdoc +6 -6
  248. data/rdoc/diff.rdoc +6 -6
  249. data/rdoc/ehandling.rdoc +3 -3
  250. data/rdoc/eigen.rdoc +11 -11
  251. data/rdoc/fft.rdoc +26 -26
  252. data/rdoc/fit.rdoc +18 -18
  253. data/rdoc/graph.rdoc +2 -2
  254. data/rdoc/hist.rdoc +16 -16
  255. data/rdoc/hist2d.rdoc +4 -4
  256. data/rdoc/hist3d.rdoc +3 -3
  257. data/rdoc/integration.rdoc +16 -16
  258. data/rdoc/interp.rdoc +11 -11
  259. data/rdoc/intro.rdoc +3 -3
  260. data/rdoc/linalg.rdoc +20 -20
  261. data/rdoc/linalg_complex.rdoc +1 -1
  262. data/rdoc/math.rdoc +13 -13
  263. data/rdoc/matrix.rdoc +22 -22
  264. data/rdoc/min.rdoc +9 -9
  265. data/rdoc/monte.rdoc +3 -3
  266. data/rdoc/multimin.rdoc +12 -12
  267. data/rdoc/multiroot.rdoc +12 -12
  268. data/rdoc/narray.rdoc +9 -9
  269. data/rdoc/ndlinear.rdoc +4 -4
  270. data/rdoc/nonlinearfit.rdoc +17 -17
  271. data/rdoc/ntuple.rdoc +5 -5
  272. data/rdoc/odeiv.rdoc +12 -12
  273. data/rdoc/perm.rdoc +11 -11
  274. data/rdoc/poly.rdoc +17 -17
  275. data/rdoc/qrng.rdoc +9 -9
  276. data/rdoc/randist.rdoc +10 -10
  277. data/rdoc/ref.rdoc +49 -49
  278. data/rdoc/rng.rdoc +9 -9
  279. data/rdoc/roots.rdoc +12 -12
  280. data/rdoc/sf.rdoc +35 -35
  281. data/rdoc/siman.rdoc +3 -3
  282. data/rdoc/sort.rdoc +6 -6
  283. data/rdoc/start.rdoc +2 -2
  284. data/rdoc/stats.rdoc +13 -13
  285. data/rdoc/sum.rdoc +4 -4
  286. data/rdoc/tensor.rdoc +3 -3
  287. data/rdoc/tut.rdoc +1 -1
  288. data/rdoc/use.rdoc +3 -3
  289. data/rdoc/vector.rdoc +28 -28
  290. data/rdoc/vector_complex.rdoc +6 -6
  291. data/rdoc/wavelet.rdoc +8 -8
  292. data/test/gsl/blas_test.rb +1 -1
  293. data/test/gsl/index_test.rb +61 -0
  294. data/test/gsl/matrix_test.rb +21 -0
  295. data/uncrustify.cfg +1693 -0
  296. metadata +212 -243
  297. data/README +0 -28
  298. data/ext/gsl/bspline.c +0 -130
  299. data/ext/gsl/const.c +0 -672
  300. data/ext/gsl/cqp.c +0 -283
  301. data/ext/gsl/fcmp.c +0 -64
  302. data/ext/gsl/fresnel.c +0 -312
  303. data/ext/gsl/jacobi.c +0 -739
  304. data/ext/gsl/ool.c +0 -879
  305. data/ext/gsl/oper_complex_source.c +0 -251
  306. data/ext/gsl/sf_mathieu.c +0 -238
  307. data/rdoc/index.rdoc +0 -50
@@ -98,16 +98,14 @@ void Init_gsl_native()
98
98
  Init_gsl_eigen(mgsl);
99
99
 
100
100
  Init_gsl_fft(mgsl);
101
- Init_gsl_signal(mgsl);
101
+ Init_gsl_signal(mgsl);
102
102
  Init_gsl_function(mgsl);
103
103
  Init_gsl_integration(mgsl);
104
104
 
105
105
  Init_gsl_rng(mgsl);
106
106
  Init_gsl_qrng(mgsl);
107
107
  Init_gsl_ran(mgsl);
108
- #ifdef GSL_1_4_LATER
109
108
  Init_gsl_cdf(mgsl);
110
- #endif
111
109
  Init_gsl_stats(mgsl);
112
110
 
113
111
  Init_gsl_histogram(mgsl);
@@ -121,9 +119,7 @@ void Init_gsl_native()
121
119
  Init_gsl_interp(mgsl);
122
120
  Init_gsl_spline(mgsl);
123
121
  Init_gsl_diff(mgsl);
124
- #ifdef GSL_1_4_9_LATER
125
122
  Init_gsl_deriv(mgsl);
126
- #endif
127
123
 
128
124
  Init_gsl_cheb(mgsl);
129
125
  Init_gsl_sum(mgsl);
@@ -161,32 +157,28 @@ void Init_gsl_native()
161
157
  #endif
162
158
 
163
159
  #ifdef HAVE_OOL_OOL_VERSION_H
164
- Init_ool(mgsl);
160
+ Init_ool(mgsl);
165
161
  #endif
166
162
 
167
163
  #ifdef HAVE_JACOBI_H
168
- Init_jacobi(mgsl);
164
+ Init_jacobi(mgsl);
169
165
  #endif
170
166
 
171
167
  #ifdef HAVE_GSL_GSL_CQP_H
172
- Init_cqp(mgsl);
168
+ Init_cqp(mgsl);
173
169
  #endif
174
170
 
175
- Init_fresnel(mgsl);
176
-
177
- #ifdef GSL_1_9_LATER
178
- Init_bspline(mgsl);
179
- #endif
171
+ Init_fresnel(mgsl);
172
+
173
+ Init_bspline(mgsl);
180
174
 
181
175
  #ifdef HAVE_ALF_ALF_H
182
- Init_alf(mgsl);
176
+ Init_alf(mgsl);
183
177
  #endif
184
178
 
185
- Init_geometry(mgsl);
179
+ Init_geometry(mgsl);
186
180
 
187
- #ifdef GSL_1_14_LATER
188
- Init_multiset(mgsl);
189
- #endif
181
+ Init_multiset(mgsl);
190
182
 
191
183
  rb_gsl_define_methods(mgsl);
192
184
  }
@@ -209,10 +201,8 @@ static void rb_gsl_define_const(VALUE module)
209
201
  rb_define_const(module, "PREC_DOUBLE", INT2FIX(GSL_PREC_DOUBLE));
210
202
  rb_define_const(module, "PREC_SINGLE", INT2FIX(GSL_PREC_SINGLE));
211
203
  rb_define_const(module, "PREC_APPROX", INT2FIX(GSL_PREC_APPROX));
212
- #ifdef GSL_VERSION
213
204
  rb_define_const(module, "VERSION", rb_str_new2(GSL_VERSION));
214
205
  rb_define_const(module, "GSL_VERSION", rb_str_new2(GSL_VERSION));
215
- #endif
216
206
 
217
207
  rb_define_const(module, "DBL_EPSILON", rb_float_new(GSL_DBL_EPSILON));
218
208
  rb_define_const(module, "FLT_EPSILON", rb_float_new(GSL_FLT_EPSILON));
@@ -240,11 +230,8 @@ static void rb_gsl_define_const(VALUE module)
240
230
  rb_define_const(module, "ROOT6_DBL_MIN", rb_float_new(GSL_ROOT6_DBL_MIN));
241
231
  rb_define_const(module, "LOG_DBL_MIN", rb_float_new(GSL_LOG_DBL_MIN));
242
232
 
243
- #ifdef GSL_1_14_LATER
244
233
  rb_define_const(module, "MAJOR_VERSION", INT2FIX(GSL_MAJOR_VERSION));
245
234
  rb_define_const(module, "MINOR_VERSION", INT2FIX(GSL_MINOR_VERSION));
246
- #endif
247
-
248
235
  }
249
236
 
250
237
  static VALUE rb_gsl_have_tensor(VALUE module)
@@ -7,7 +7,6 @@
7
7
 
8
8
  #ifdef HAVE_NARRAY_H
9
9
  #include "include/rb_gsl_array.h"
10
- #include "narray.h"
11
10
  #include "include/rb_gsl_with_narray.h"
12
11
 
13
12
  static VALUE rb_gsl_na_to_gsl_matrix_method(VALUE nna);
@@ -30,7 +29,7 @@ static VALUE rb_gsl_vector_to_narray(VALUE obj, VALUE klass)
30
29
  memcpy(NA_PTR_TYPE(nary,double*), v->data, shape[0]*sizeof(double));
31
30
  } else {
32
31
  int i;
33
- for(i=0; i < (int) v->size; i++) {
32
+ for(i = 0; i < (int) v->size; i++) {
34
33
  (NA_PTR_TYPE(nary,double*))[i] = gsl_vector_get(v, i);
35
34
  }
36
35
  }
@@ -49,7 +48,7 @@ static VALUE rb_gsl_vector_complex_to_narray(VALUE obj, VALUE klass)
49
48
  memcpy(NA_PTR_TYPE(nary,double*), v->data, shape[0]*2*sizeof(double));
50
49
  } else {
51
50
  int i;
52
- for(i=0; i < (int) (2*v->size); i++) {
51
+ for(i = 0; i < (int) (2*v->size); i++) {
53
52
  (NA_PTR_TYPE(nary,gsl_complex*))[i] = gsl_vector_complex_get(v, i);
54
53
  }
55
54
  }
@@ -66,8 +65,7 @@ static VALUE rb_gsl_vector_to_na(VALUE obj)
66
65
  na = rb_gsl_vector_complex_to_narray(obj, cNArray);
67
66
  else
68
67
  rb_raise(rb_eRuntimeError, "unexpected type '%s'",
69
- rb_obj_classname(obj));
70
-
68
+ rb_obj_classname(obj));
71
69
  return na;
72
70
  }
73
71
 
@@ -141,7 +139,7 @@ static VALUE rb_gsl_vector_to_narray_ref(VALUE obj, VALUE klass)
141
139
  na->ptr = (char *) vc->data;
142
140
  } else {
143
141
  rb_raise(rb_eRuntimeError, "cannot convert %s to NArray reference object",
144
- rb_obj_classname(obj));
142
+ rb_obj_classname(obj));
145
143
  }
146
144
  nary = Data_Wrap_Struct(klass, 0, rb_gsl_na_view_free, na);
147
145
  return nary;
@@ -169,7 +167,7 @@ static VALUE rb_gsl_vector_int_to_narray(VALUE obj, VALUE klass)
169
167
  memcpy(NA_PTR_TYPE(nary,int*), v->data, shape[0]*sizeof(int));
170
168
  } else {
171
169
  int i;
172
- for(i=0; i < (int) v->size; i++) {
170
+ for(i = 0; i < (int) v->size; i++) {
173
171
  (NA_PTR_TYPE(nary,int*))[i] = gsl_vector_int_get(v, i);
174
172
  }
175
173
  }
@@ -229,11 +227,10 @@ static VALUE rb_gsl_na_to_gsl_vector_method(VALUE na)
229
227
 
230
228
  if(NA_TYPE(na) == NA_SCOMPLEX || NA_TYPE(na) == NA_DCOMPLEX)
231
229
  v = Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free,
232
- na_to_gv_complex(na));
230
+ na_to_gv_complex(na));
233
231
  else
234
232
  v = Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free,
235
- na_to_gv(na));
236
-
233
+ na_to_gv(na));
237
234
  return v;
238
235
  }
239
236
 
@@ -243,11 +240,10 @@ VALUE rb_gsl_na_to_gsl_vector_view_method(VALUE na)
243
240
 
244
241
  if(NA_TYPE(na) == NA_SCOMPLEX || NA_TYPE(na) == NA_DCOMPLEX)
245
242
  v = Data_Wrap_Struct(cgsl_vector_complex_view, 0, gsl_vector_complex_view_free,
246
- na_to_gv_complex_view(na));
243
+ na_to_gv_complex_view(na));
247
244
  else
248
245
  v = Data_Wrap_Struct(cgsl_vector_view, 0, gsl_vector_view_free,
249
- na_to_gv_view(na));
250
-
246
+ na_to_gv_view(na));
251
247
  return v;
252
248
  }
253
249
 
@@ -282,7 +278,6 @@ gsl_vector_view* na_to_gv_view(VALUE na)
282
278
  // Raise exception if na's type is not NA_DFLOAT.
283
279
  if(NA_TYPE(na) != NA_DFLOAT)
284
280
  rb_raise(rb_eTypeError, "GSL::Vector::View requires NArray be DFLOAT");
285
-
286
281
  v = gsl_vector_view_alloc();
287
282
  v->vector.data = NA_PTR_TYPE(na,double*);
288
283
  v->vector.size = NA_TOTAL(na);
@@ -310,7 +305,6 @@ gsl_vector_complex_view* na_to_gv_complex_view(VALUE na)
310
305
  // Raise exception if na's type is not NA_DCOMPLEX
311
306
  if(NA_TYPE(na) != NA_DCOMPLEX)
312
307
  rb_raise(rb_eTypeError, "GSL::Vector::Complex::View requires NArray be DCOMPLEX");
313
-
314
308
  v = gsl_vector_complex_view_alloc();
315
309
  v->vector.data = NA_PTR_TYPE(na,double*);
316
310
  v->vector.size = NA_TOTAL(na);
@@ -357,7 +351,7 @@ static VALUE rb_gsl_matrix_to_narray(VALUE obj, VALUE klass)
357
351
  shape[1] = m->size1;
358
352
  nary = na_make_object(NA_DFLOAT, 2, shape, klass);
359
353
  for (i = 0; (int) i < shape[1]; i++) {
360
- memcpy(NA_PTR_TYPE(nary,double*)+(i*shape[0]), m->data+(i*m->tda),
354
+ memcpy(NA_PTR_TYPE(nary,double*)+(i*shape[0]), m->data+(i*m->tda),
361
355
  shape[0]*sizeof(double));
362
356
  }
363
357
  return nary;
@@ -384,7 +378,7 @@ static VALUE rb_gsl_matrix_int_to_narray(VALUE obj, VALUE klass)
384
378
  shape[1] = m->size1;
385
379
  nary = na_make_object(NA_LINT, 2, shape, klass);
386
380
  for (i = 0; (int) i < shape[1]; i++) {
387
- memcpy(NA_PTR_TYPE(nary,int*)+(i*shape[0]), m->data+(i*m->tda),
381
+ memcpy(NA_PTR_TYPE(nary,int*)+(i*shape[0]), m->data+(i*m->tda),
388
382
  shape[0]*sizeof(int));
389
383
  }
390
384
  return nary;
@@ -538,7 +532,7 @@ gsl_matrix_view* na_to_gm_view(VALUE nna)
538
532
  m->matrix.data = NA_PTR_TYPE(ary2,double*);
539
533
  m->matrix.size1 = na->shape[1];
540
534
  m->matrix.size2 = na->shape[0];
541
- m->matrix.tda = m->matrix.size2;
535
+ m->matrix.tda = m->matrix.size2;
542
536
  m->matrix.owner = 0;
543
537
  return m;
544
538
  }
@@ -570,13 +564,11 @@ gsl_matrix_int_view* na_to_gm_int_view(VALUE nna)
570
564
  m->matrix.data = NA_PTR_TYPE(ary2,int*);
571
565
  m->matrix.size1 = na->shape[1];
572
566
  m->matrix.size2 = na->shape[0];
573
- m->matrix.tda = m->matrix.size2;
567
+ m->matrix.tda = m->matrix.size2;
574
568
  m->matrix.owner = 0;
575
569
  return m;
576
570
  }
577
571
 
578
- #ifdef HAVE_NARRAY_H
579
- #include "narray.h"
580
572
  #include <gsl/gsl_histogram.h>
581
573
  EXTERN VALUE cgsl_histogram;
582
574
  static VALUE rb_gsl_narray_histogram(int argc, VALUE *argv, VALUE obj)
@@ -593,7 +585,7 @@ static VALUE rb_gsl_narray_histogram(int argc, VALUE *argv, VALUE obj)
593
585
  v.vector.size = stride;
594
586
  switch (argc) {
595
587
  case 1:
596
- if (rb_obj_is_kind_of(argv[0], rb_cRange))
588
+ if (rb_obj_is_kind_of(argv[0], rb_cRange))
597
589
  argv[0] = rb_gsl_range2ary(argv[0]);
598
590
  switch (TYPE(argv[0])) {
599
591
  case T_FIXNUM:
@@ -652,7 +644,6 @@ static VALUE rb_gsl_narray_histogram(int argc, VALUE *argv, VALUE obj)
652
644
  gsl_histogram_increment(h, ptr[i*stride]);
653
645
  return Data_Wrap_Struct(cgsl_histogram, 0, gsl_histogram_free, h);
654
646
  }
655
- #endif
656
647
 
657
648
  /*void rb_gsl_with_narray_define_methods()*/
658
649
  void Init_gsl_narray(VALUE module)
@@ -765,7 +756,7 @@ void Init_gsl_narray(VALUE module)
765
756
  rb_define_method(cNArray, "to_gslm", rb_gsl_na_to_gsl_matrix_method, 0);
766
757
  rb_define_alias(cNArray, "to_gm", "to_gslm");
767
758
  rb_define_method(cNArray, "to_gslm_view", rb_gsl_na_to_gsl_matrix_view_method, 0);
768
- rb_define_alias(cNArray, "to_gm_view", "to_gslm_view");
759
+ rb_define_alias(cNArray, "to_gm_view", "to_gslm_view");
769
760
 
770
761
  /*****/
771
762
  // TODO Complex matrix
@@ -21,7 +21,6 @@ VALUE cgsl_histogram_bin;
21
21
  static VALUE cgsl_histogram_integ;
22
22
 
23
23
  static VALUE rb_gsl_histogram_alloc_from_file(VALUE klass, VALUE name);
24
- #ifdef GSL_0_9_4_LATER
25
24
  static VALUE rb_gsl_histogram_alloc(int argc, VALUE *argv, VALUE klass)
26
25
  {
27
26
  gsl_histogram *h = NULL;
@@ -68,8 +67,8 @@ static VALUE rb_gsl_histogram_alloc(int argc, VALUE *argv, VALUE klass)
68
67
  case T_FIXNUM:
69
68
  CHECK_FIXNUM(argv[0]);
70
69
  if (TYPE(argv[1]) != T_ARRAY) {
71
- rb_raise(rb_eTypeError, "wrong argument type %s (Array expected)",
72
- rb_class2name(CLASS_OF(argv[1])));
70
+ rb_raise(rb_eTypeError, "wrong argument type %s (Array expected)",
71
+ rb_class2name(CLASS_OF(argv[1])));
73
72
  }
74
73
  n = FIX2INT(argv[0]);
75
74
  min = NUM2DBL(rb_ary_entry(argv[1], 0));
@@ -133,7 +132,7 @@ static VALUE rb_gsl_histogram_alloc_from_file(VALUE klass, VALUE name)
133
132
  h->range[n] = upper;
134
133
  fclose(fp);
135
134
  return Data_Wrap_Struct(klass, 0, gsl_histogram_free, h);
136
-
135
+
137
136
  }
138
137
 
139
138
  /* initialization + set uniform ranges (equal spacing from min to max) */
@@ -172,8 +171,8 @@ static VALUE rb_gsl_histogram_alloc_uniform(int argc, VALUE *argv, VALUE klass)
172
171
  }
173
172
 
174
173
  /* initialization + set ranges with a given spacing from min to max */
175
- static VALUE rb_gsl_histogram_alloc_with_min_max_step(VALUE klass, VALUE vmin,
176
- VALUE vmax, VALUE ss)
174
+ static VALUE rb_gsl_histogram_alloc_with_min_max_step(VALUE klass, VALUE vmin,
175
+ VALUE vmax, VALUE ss)
177
176
  {
178
177
  gsl_histogram *h = NULL;
179
178
  gsl_vector *v = NULL;
@@ -196,7 +195,6 @@ static VALUE rb_gsl_histogram_alloc_with_min_max_step(VALUE klass, VALUE vmin,
196
195
  gsl_vector_free(v);
197
196
  return Data_Wrap_Struct(klass, 0, gsl_histogram_free, h);
198
197
  }
199
- #endif
200
198
 
201
199
  static VALUE rb_gsl_histogram_calloc(VALUE klass, VALUE nn)
202
200
  {
@@ -244,7 +242,7 @@ static VALUE rb_gsl_histogram_set_ranges(int argc, VALUE *argv, VALUE obj)
244
242
  gsl_vector *v = NULL;
245
243
  size_t size;
246
244
  Data_Get_Struct(obj, gsl_histogram, h);
247
- if (argc != 1 && argc != 2)
245
+ if (argc != 1 && argc != 2)
248
246
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 1 or 2)", argc);
249
247
  if (TYPE(argv[0]) == T_ARRAY) {
250
248
  v = make_cvector_from_rarray(argv[0]);
@@ -336,10 +334,6 @@ static VALUE rb_gsl_histogram_accumulate(int argc, VALUE *argv, VALUE obj)
336
334
  gsl_vector_int *vi;
337
335
  size_t i;
338
336
  double weight = 1;
339
- #ifdef HAVE_NARRAY_H
340
- double *ptr;
341
- size_t size, stride;
342
- #endif
343
337
  switch (argc) {
344
338
  case 2:
345
339
  Need_Float(argv[1]);
@@ -367,8 +361,10 @@ static VALUE rb_gsl_histogram_accumulate(int argc, VALUE *argv, VALUE obj)
367
361
  gsl_histogram_accumulate(h, (double)gsl_vector_int_get(vi, i), weight);
368
362
  #ifdef HAVE_NARRAY_H
369
363
  } else if (NA_IsNArray(argv[0])) {
364
+ double *ptr;
365
+ size_t size, stride;
370
366
  ptr = get_vector_ptr(argv[0], &stride, &size);
371
- for (i = 0; i < size; i++)
367
+ for (i = 0; i < size; i++)
372
368
  gsl_histogram_accumulate(h, ptr[i], weight);
373
369
  #endif
374
370
  } else {
@@ -386,7 +382,7 @@ static VALUE rb_gsl_histogram_accumulate2(int argc, VALUE *argv, VALUE obj)
386
382
  case 2:
387
383
  Need_Float(argv[1]);
388
384
  weight = NUM2DBL(argv[1]);
389
- /* no break; */
385
+ /* no break; */
390
386
  case 1:
391
387
  Need_Float(argv[0]);
392
388
  x = NUM2DBL(argv[0]);
@@ -494,17 +490,6 @@ static VALUE rb_gsl_histogram_sigma(VALUE obj)
494
490
  return rb_float_new(gsl_histogram_sigma(h));
495
491
  }
496
492
 
497
- #ifndef GSL_1_1_LATER
498
- double gsl_histogram_sum(const gsl_histogram * h)
499
- {
500
- double sum=0;
501
- size_t i=0, n;
502
- n=h->n;
503
- while(i < n) sum += h->bin[i++];
504
- return sum;
505
- }
506
- #endif
507
-
508
493
  static VALUE rb_gsl_histogram_sum(VALUE obj)
509
494
  {
510
495
  gsl_histogram *h = NULL;
@@ -573,7 +558,7 @@ static VALUE rb_gsl_histogram_equal_bins_p(int argc, VALUE *argv, VALUE obj)
573
558
  case T_CLASS:
574
559
  case T_OBJECT:
575
560
  if (argc != 2) rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)",
576
- argc);
561
+ argc);
577
562
  CHECK_HISTOGRAM(argv[0]);
578
563
  CHECK_HISTOGRAM(argv[1]);
579
564
  Data_Get_Struct(argv[0], gsl_histogram, h1);
@@ -581,7 +566,7 @@ static VALUE rb_gsl_histogram_equal_bins_p(int argc, VALUE *argv, VALUE obj)
581
566
  break;
582
567
  default:
583
568
  if (argc != 1) rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)",
584
- argc);
569
+ argc);
585
570
  Data_Get_Struct(obj, gsl_histogram, h1);
586
571
  CHECK_HISTOGRAM(argv[0]);
587
572
  Data_Get_Struct(argv[0], gsl_histogram, h2);
@@ -598,7 +583,7 @@ static VALUE rb_gsl_histogram_equal_bins_p2(int argc, VALUE *argv, VALUE obj)
598
583
  case T_CLASS:
599
584
  case T_OBJECT:
600
585
  if (argc != 2) rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)",
601
- argc);
586
+ argc);
602
587
  CHECK_HISTOGRAM(argv[0]);
603
588
  CHECK_HISTOGRAM(argv[1]);
604
589
  Data_Get_Struct(argv[0], gsl_histogram, h1);
@@ -606,7 +591,7 @@ static VALUE rb_gsl_histogram_equal_bins_p2(int argc, VALUE *argv, VALUE obj)
606
591
  break;
607
592
  default:
608
593
  if (argc != 1) rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)",
609
- argc);
594
+ argc);
610
595
  Data_Get_Struct(obj, gsl_histogram, h1);
611
596
  CHECK_HISTOGRAM(argv[0]);
612
597
  Data_Get_Struct(argv[0], gsl_histogram, h2);
@@ -884,24 +869,17 @@ static VALUE rb_gsl_histogram_pdf_alloc(VALUE klass, VALUE nn)
884
869
  {
885
870
  gsl_histogram_pdf *h = NULL;
886
871
  gsl_histogram *h0 = NULL;
887
- #ifdef GSL_0_9_4_LATER
888
- if (rb_obj_is_kind_of(nn, cgsl_histogram)) {
889
- Data_Get_Struct(nn, gsl_histogram, h0);
890
- h = gsl_histogram_pdf_alloc(h0->n);
891
- gsl_histogram_pdf_init(h, h0);
892
- } else {
893
- CHECK_FIXNUM(nn);
872
+ if (rb_obj_is_kind_of(nn, cgsl_histogram)) {
873
+ Data_Get_Struct(nn, gsl_histogram, h0);
874
+ h = gsl_histogram_pdf_alloc(h0->n);
875
+ gsl_histogram_pdf_init(h, h0);
876
+ } else {
877
+ CHECK_FIXNUM(nn);
894
878
  h = gsl_histogram_pdf_alloc(FIX2INT(nn));
895
879
  }
896
- #else
897
- gsl_histogram *hh = NULL;
898
- Data_Get_Struct(nn, gsl_histogram, hh);
899
- h = gsl_histogram_pdf_alloc(hh);
900
- #endif
901
880
  return Data_Wrap_Struct(klass, 0, gsl_histogram_pdf_free, h);
902
881
  }
903
882
 
904
- #ifdef GSL_0_9_4_LATER
905
883
  static VALUE rb_gsl_histogram_pdf_init(VALUE obj, VALUE hh)
906
884
  {
907
885
  gsl_histogram_pdf *p = NULL;
@@ -912,7 +890,6 @@ static VALUE rb_gsl_histogram_pdf_init(VALUE obj, VALUE hh)
912
890
  gsl_histogram_pdf_init(p, h);
913
891
  return obj;
914
892
  }
915
- #endif
916
893
 
917
894
  static VALUE rb_gsl_histogram_pdf_sample(VALUE obj, VALUE r)
918
895
  {
@@ -971,7 +948,7 @@ static VALUE rb_gsl_histogram_graph(int argc, VALUE *argv, VALUE obj)
971
948
  fprintf(fp, "%e %e\n%e %e\n", v->range[i], v->bin[i], v->range[i+1], v->bin[i]);
972
949
  }
973
950
  fflush(fp);
974
- pclose(fp);
951
+ pclose(fp);
975
952
  fp = NULL;
976
953
  return Qtrue;
977
954
  #else
@@ -996,8 +973,8 @@ static VALUE rb_gsl_histogram_plot(int argc, VALUE *argv, VALUE obj)
996
973
  case 1:
997
974
  fp = popen("gnuplot -persist", "w");
998
975
  if (fp == NULL) rb_raise(rb_eIOError, "GNU graph not found.");
999
- if (TYPE(argv[0]) == T_STRING)
1000
- fprintf(fp, "plot '-' %s\n", STR2CSTR(argv[0]));
976
+ if (TYPE(argv[0]) == T_STRING)
977
+ fprintf(fp, "plot '-' %s\n", STR2CSTR(argv[0]));
1001
978
  else
1002
979
  fprintf(fp, "plot '-' with fsteps\n");
1003
980
  break;
@@ -1048,7 +1025,7 @@ static VALUE rb_gsl_histogram_fit_exponential(int argc, VALUE *argv, VALUE obj)
1048
1025
  }
1049
1026
  n = binend - binstart + 1;
1050
1027
  dof = n - p;
1051
-
1028
+
1052
1029
  x = gsl_vector_alloc(n);
1053
1030
  w = gsl_vector_alloc(n);
1054
1031
  lny = gsl_vector_alloc(n);
@@ -1059,15 +1036,15 @@ static VALUE rb_gsl_histogram_fit_exponential(int argc, VALUE *argv, VALUE obj)
1059
1036
  gsl_vector_set(lny, i, log(h->bin[i+binstart]));
1060
1037
  gsl_vector_set(w, i, h->bin[i+binstart]);
1061
1038
  }
1062
- gsl_fit_wlinear(x->data, 1, w->data, 1, lny->data, 1, n,
1063
- &c0, &c1, &cov00, &cov01, &cov11, &sumsq);
1039
+ gsl_fit_wlinear(x->data, 1, w->data, 1, lny->data, 1, n,
1040
+ &c0, &c1, &cov00, &cov01, &cov11, &sumsq);
1064
1041
  gsl_vector_free(lny);
1065
1042
  gsl_vector_free(w);
1066
1043
  gsl_vector_free(x);
1067
1044
  c0 = exp(c0);
1068
- return rb_ary_new3(6, rb_float_new(c0), rb_float_new(c1),
1069
- rb_float_new(c0*sqrt(cov00)), rb_float_new(sqrt(cov11)),
1070
- rb_float_new(sumsq), INT2FIX(dof));
1045
+ return rb_ary_new3(6, rb_float_new(c0), rb_float_new(c1),
1046
+ rb_float_new(c0*sqrt(cov00)), rb_float_new(sqrt(cov11)),
1047
+ rb_float_new(sumsq), INT2FIX(dof));
1071
1048
  }
1072
1049
 
1073
1050
  static VALUE rb_gsl_histogram_fit_power(int argc, VALUE *argv, VALUE obj)
@@ -1094,7 +1071,7 @@ static VALUE rb_gsl_histogram_fit_power(int argc, VALUE *argv, VALUE obj)
1094
1071
  }
1095
1072
  n = binend - binstart + 1;
1096
1073
  dof = n - p;
1097
-
1074
+
1098
1075
  lnx = gsl_vector_alloc(n);
1099
1076
  w = gsl_vector_alloc(n);
1100
1077
  lny = gsl_vector_alloc(n);
@@ -1105,15 +1082,15 @@ static VALUE rb_gsl_histogram_fit_power(int argc, VALUE *argv, VALUE obj)
1105
1082
  gsl_vector_set(lny, i, log(h->bin[i+binstart]));
1106
1083
  gsl_vector_set(w, i, h->bin[i+binstart]);
1107
1084
  }
1108
- gsl_fit_wlinear(lnx->data, 1, w->data, 1, lny->data, 1, n,
1109
- &c0, &c1, &cov00, &cov01, &cov11, &sumsq);
1085
+ gsl_fit_wlinear(lnx->data, 1, w->data, 1, lny->data, 1, n,
1086
+ &c0, &c1, &cov00, &cov01, &cov11, &sumsq);
1110
1087
  gsl_vector_free(lny);
1111
1088
  gsl_vector_free(w);
1112
1089
  gsl_vector_free(lnx);
1113
1090
  c0 = exp(c0);
1114
- return rb_ary_new3(6, rb_float_new(c0), rb_float_new(c1),
1115
- rb_float_new(c0*sqrt(cov00)), rb_float_new(sqrt(cov11)),
1116
- rb_float_new(sumsq), INT2FIX(dof));
1091
+ return rb_ary_new3(6, rb_float_new(c0), rb_float_new(c1),
1092
+ rb_float_new(c0*sqrt(cov00)), rb_float_new(sqrt(cov11)),
1093
+ rb_float_new(sumsq), INT2FIX(dof));
1117
1094
  }
1118
1095
 
1119
1096
  static int Gaussian_f(const gsl_vector *v, void *params, gsl_vector *f);
@@ -1173,8 +1150,8 @@ static int Gaussian_df(const gsl_vector *v, void *params, gsl_matrix *J)
1173
1150
  return GSL_SUCCESS;
1174
1151
  }
1175
1152
 
1176
- static int Gaussian_fdf(const gsl_vector *v, void *params, gsl_vector *f,
1177
- gsl_matrix *J)
1153
+ static int Gaussian_fdf(const gsl_vector *v, void *params, gsl_vector *f,
1154
+ gsl_matrix *J)
1178
1155
  {
1179
1156
  Gaussian_f(v, params, f);
1180
1157
  Gaussian_df(v, params, J);
@@ -1253,9 +1230,9 @@ static VALUE rb_gsl_histogram_fit_gaussian(int argc, VALUE *argv, VALUE obj)
1253
1230
  gsl_vector_free(x);
1254
1231
  gsl_matrix_free(covar);
1255
1232
  return rb_ary_new3(8, rb_float_new(sigma), rb_float_new(mean),
1256
- rb_float_new(height), rb_float_new(errs),
1257
- rb_float_new(errm), rb_float_new(errh),
1258
- rb_float_new(chi2), INT2FIX(dof));
1233
+ rb_float_new(height), rb_float_new(errs),
1234
+ rb_float_new(errm), rb_float_new(errh),
1235
+ rb_float_new(chi2), INT2FIX(dof));
1259
1236
  }
1260
1237
 
1261
1238
  static int Rayleigh_f(const gsl_vector *v, void *params, gsl_vector *f);
@@ -1308,8 +1285,8 @@ static int Rayleigh_df(const gsl_vector *v, void *params, gsl_matrix *J)
1308
1285
  return GSL_SUCCESS;
1309
1286
  }
1310
1287
 
1311
- static int Rayleigh_fdf(const gsl_vector *v, void *params, gsl_vector *f,
1312
- gsl_matrix *J)
1288
+ static int Rayleigh_fdf(const gsl_vector *v, void *params, gsl_vector *f,
1289
+ gsl_matrix *J)
1313
1290
  {
1314
1291
  Rayleigh_f(v, params, f);
1315
1292
  Rayleigh_df(v, params, J);
@@ -1349,7 +1326,7 @@ static VALUE rb_gsl_histogram_fit_rayleigh(int argc, VALUE *argv, VALUE obj)
1349
1326
  }
1350
1327
  x = gsl_vector_alloc(p);
1351
1328
  gsl_vector_set(x, 0, gsl_pow_2(gsl_histogram_sigma(h))); /* initial values, var = 1 */
1352
- gsl_vector_set(x, 1, gsl_histogram_max_val(h));
1329
+ gsl_vector_set(x, 1, gsl_histogram_max_val(h));
1353
1330
  hh.h = h;
1354
1331
  hh.binstart = binstart;
1355
1332
  hh.binend = binend;
@@ -1385,10 +1362,10 @@ static VALUE rb_gsl_histogram_fit_rayleigh(int argc, VALUE *argv, VALUE obj)
1385
1362
  gsl_multifit_fdfsolver_free(s);
1386
1363
  gsl_vector_free(x);
1387
1364
  gsl_matrix_free(covar);
1388
- return rb_ary_new3(6, rb_float_new(sigma),
1389
- rb_float_new(height), rb_float_new(errs),
1390
- rb_float_new(errh),
1391
- rb_float_new(chi2), INT2FIX(dof));
1365
+ return rb_ary_new3(6, rb_float_new(sigma),
1366
+ rb_float_new(height), rb_float_new(errs),
1367
+ rb_float_new(errh),
1368
+ rb_float_new(chi2), INT2FIX(dof));
1392
1369
  }
1393
1370
 
1394
1371
  /*
@@ -1444,8 +1421,8 @@ static int xExponential_df(const gsl_vector *v, void *params, gsl_matrix *J)
1444
1421
  return GSL_SUCCESS;
1445
1422
  }
1446
1423
 
1447
- static int xExponential_fdf(const gsl_vector *v, void *params, gsl_vector *f,
1448
- gsl_matrix *J)
1424
+ static int xExponential_fdf(const gsl_vector *v, void *params, gsl_vector *f,
1425
+ gsl_matrix *J)
1449
1426
  {
1450
1427
  xExponential_f(v, params, f);
1451
1428
  xExponential_df(v, params, J);
@@ -1485,7 +1462,7 @@ static VALUE rb_gsl_histogram_fit_xexponential(int argc, VALUE *argv, VALUE obj)
1485
1462
  }
1486
1463
  x = gsl_vector_alloc(p);
1487
1464
  gsl_vector_set(x, 0, gsl_histogram_sigma(h)); /* initial values, var = 1 */
1488
- gsl_vector_set(x, 1, gsl_histogram_max_val(h));
1465
+ gsl_vector_set(x, 1, gsl_histogram_max_val(h));
1489
1466
  hh.h = h;
1490
1467
  hh.binstart = binstart;
1491
1468
  hh.binend = binend;
@@ -1521,10 +1498,10 @@ static VALUE rb_gsl_histogram_fit_xexponential(int argc, VALUE *argv, VALUE obj)
1521
1498
  gsl_multifit_fdfsolver_free(s);
1522
1499
  gsl_vector_free(x);
1523
1500
  gsl_matrix_free(covar);
1524
- return rb_ary_new3(6, rb_float_new(b),
1525
- rb_float_new(height), rb_float_new(errs),
1526
- rb_float_new(errh),
1527
- rb_float_new(chi2), INT2FIX(dof));
1501
+ return rb_ary_new3(6, rb_float_new(b),
1502
+ rb_float_new(height), rb_float_new(errs),
1503
+ rb_float_new(errh),
1504
+ rb_float_new(chi2), INT2FIX(dof));
1528
1505
  }
1529
1506
 
1530
1507
  static VALUE rb_gsl_histogram_fit(int argc, VALUE *argv, VALUE obj)
@@ -1539,20 +1516,20 @@ static VALUE rb_gsl_histogram_fit(int argc, VALUE *argv, VALUE obj)
1539
1516
  return rb_gsl_histogram_fit_power(argc-1, argv+1, obj);
1540
1517
  } else if (str_head_grep(fittype, "gaus") == 0) {
1541
1518
  return rb_gsl_histogram_fit_gaussian(argc-1, argv+1, obj);
1542
- } else if (str_head_grep(fittype, "rayleigh") == 0) {
1519
+ } else if (str_head_grep(fittype, "rayleigh") == 0) {
1543
1520
  return rb_gsl_histogram_fit_rayleigh(argc-1, argv+1, obj);
1544
1521
  } else if (str_head_grep(fittype, "xexp") == 0) {
1545
1522
  return rb_gsl_histogram_fit_xexponential(argc-1, argv+1, obj);
1546
1523
  } else {
1547
- rb_raise(rb_eRuntimeError,
1548
- "unknown fitting type %s (exp, power, gaus expected)", fittype);
1524
+ rb_raise(rb_eRuntimeError,
1525
+ "unknown fitting type %s (exp, power, gaus expected)", fittype);
1549
1526
  }
1550
1527
  return Qnil;
1551
1528
  }
1552
1529
 
1553
1530
  /* Integrate histogram: the two histograms must have the same range and bins. */
1554
1531
  void mygsl_histogram_integrate(const gsl_histogram *h, gsl_histogram *hi,
1555
- size_t istart, size_t iend)
1532
+ size_t istart, size_t iend)
1556
1533
  {
1557
1534
  size_t i;
1558
1535
  if (iend >= istart) {
@@ -1580,7 +1557,7 @@ void mygsl_histogram_differentiate(const gsl_histogram *hi, gsl_histogram *h)
1580
1557
 
1581
1558
  /* Create a histogram integrating the given histogram h */
1582
1559
  gsl_histogram* mygsl_histogram_calloc_integrate(const gsl_histogram *h,
1583
- size_t istart, size_t iend)
1560
+ size_t istart, size_t iend)
1584
1561
  {
1585
1562
  gsl_histogram *hi = NULL;
1586
1563
  hi = gsl_histogram_calloc_range(h->n, h->range);
@@ -1616,16 +1593,16 @@ static VALUE rb_gsl_histogram_integrate(int argc, VALUE *argv, VALUE obj)
1616
1593
  case T_FIXNUM:
1617
1594
  itmp = FIX2INT(argv[0]);
1618
1595
  if (itmp == -1) {
1619
- istart = h->n - 1;
1620
- iend = 0;
1596
+ istart = h->n - 1;
1597
+ iend = 0;
1621
1598
  } else {
1622
- istart = 0;
1623
- iend = h->n - 1;
1599
+ istart = 0;
1600
+ iend = h->n - 1;
1624
1601
  }
1625
1602
  break;
1626
1603
  default:
1627
1604
  rb_raise(rb_eArgError, "wrong argument type %s (Arran or Fixnum expected)",
1628
- rb_class2name(CLASS_OF(argv[0])));
1605
+ rb_class2name(CLASS_OF(argv[0])));
1629
1606
  break;
1630
1607
  }
1631
1608
  break;
@@ -1692,27 +1669,27 @@ static VALUE rb_gsl_histogram_rebin(int argc, VALUE *argv, VALUE obj)
1692
1669
  }
1693
1670
 
1694
1671
  static int mygsl_histogram_fread2(FILE * stream, gsl_histogram * h)
1695
- {
1672
+ {
1696
1673
  double min, max;
1697
1674
  int status;
1698
1675
  status = gsl_block_raw_fread(stream, &min, 1, 1);
1699
- if (status) return status;
1676
+ if (status) return status;
1700
1677
  status = gsl_block_raw_fread(stream, &max, 1, 1);
1701
- if (status) return status;
1678
+ if (status) return status;
1702
1679
  gsl_histogram_set_ranges_uniform(h, min, max);
1703
- status = gsl_block_raw_fread (stream, h->bin, h->n, 1);
1704
- if (status) return status;
1680
+ status = gsl_block_raw_fread (stream, h->bin, h->n, 1);
1681
+ if (status) return status;
1705
1682
  return status;
1706
1683
  }
1707
1684
 
1708
1685
  static int mygsl_histogram_fwrite2(FILE * stream, const gsl_histogram * h)
1709
- {
1686
+ {
1710
1687
  int status;
1711
1688
  status = gsl_block_raw_fwrite (stream, h->range, 1, 1);
1712
- if (status) return status;
1689
+ if (status) return status;
1713
1690
  status = gsl_block_raw_fwrite (stream, h->range+h->n, 1, 1);
1714
- if (status) return status;
1715
- status = gsl_block_raw_fwrite (stream, h->bin, h->n, 1);
1691
+ if (status) return status;
1692
+ status = gsl_block_raw_fwrite (stream, h->bin, h->n, 1);
1716
1693
  return status;
1717
1694
  }
1718
1695
 
@@ -1833,33 +1810,31 @@ void Init_gsl_histogram(VALUE module)
1833
1810
  VALUE cgsl_histogram_pdf;
1834
1811
 
1835
1812
  cgsl_histogram = rb_define_class_under(module, "Histogram", cGSL_Object);
1836
- cgsl_histogram_range = rb_define_class_under(cgsl_histogram, "Range",
1837
- cgsl_vector_view_ro);
1838
- cgsl_histogram_bin = rb_define_class_under(cgsl_histogram, "Bin",
1839
- cgsl_vector_view);
1840
- cgsl_histogram_integ = rb_define_class_under(cgsl_histogram, "Integral",
1841
- cgsl_histogram);
1842
-
1843
- #ifdef GSL_0_9_4_LATER
1813
+ cgsl_histogram_range = rb_define_class_under(cgsl_histogram, "Range",
1814
+ cgsl_vector_view_ro);
1815
+ cgsl_histogram_bin = rb_define_class_under(cgsl_histogram, "Bin",
1816
+ cgsl_vector_view);
1817
+ cgsl_histogram_integ = rb_define_class_under(cgsl_histogram, "Integral",
1818
+ cgsl_histogram);
1819
+
1844
1820
  rb_define_singleton_method(cgsl_histogram, "alloc", rb_gsl_histogram_alloc, -1);
1845
1821
  /* rb_define_singleton_method(cgsl_histogram, "new", rb_gsl_histogram_alloc, -1);*/
1846
1822
  rb_define_singleton_method(cgsl_histogram, "[]", rb_gsl_histogram_alloc, -1);
1847
1823
 
1848
- rb_define_singleton_method(cgsl_histogram, "alloc_uniform",
1849
- rb_gsl_histogram_alloc_uniform, -1);
1850
- rb_define_singleton_method(cgsl_histogram, "new_uniform",
1851
- rb_gsl_histogram_alloc_uniform, -1);
1824
+ rb_define_singleton_method(cgsl_histogram, "alloc_uniform",
1825
+ rb_gsl_histogram_alloc_uniform, -1);
1826
+ rb_define_singleton_method(cgsl_histogram, "new_uniform",
1827
+ rb_gsl_histogram_alloc_uniform, -1);
1852
1828
 
1853
- rb_define_singleton_method(cgsl_histogram, "alloc_with_min_max_step",
1854
- rb_gsl_histogram_alloc_with_min_max_step, 3);
1855
- rb_define_singleton_method(cgsl_histogram, "new_with_min_max_step",
1856
- rb_gsl_histogram_alloc_with_min_max_step, 3);
1857
- #endif
1829
+ rb_define_singleton_method(cgsl_histogram, "alloc_with_min_max_step",
1830
+ rb_gsl_histogram_alloc_with_min_max_step, 3);
1831
+ rb_define_singleton_method(cgsl_histogram, "new_with_min_max_step",
1832
+ rb_gsl_histogram_alloc_with_min_max_step, 3);
1858
1833
 
1859
- rb_define_singleton_method(cgsl_histogram, "calloc",
1860
- rb_gsl_histogram_calloc, 1);
1861
- rb_define_singleton_method(cgsl_histogram, "calloc_range",
1862
- rb_gsl_histogram_calloc_range, -1);
1834
+ rb_define_singleton_method(cgsl_histogram, "calloc",
1835
+ rb_gsl_histogram_calloc, 1);
1836
+ rb_define_singleton_method(cgsl_histogram, "calloc_range",
1837
+ rb_gsl_histogram_calloc_range, -1);
1863
1838
 
1864
1839
  rb_define_method(cgsl_histogram, "bins", rb_gsl_histogram_bins, 0);
1865
1840
  rb_define_alias(cgsl_histogram, "n", "bins");
@@ -1867,8 +1842,8 @@ void Init_gsl_histogram(VALUE module)
1867
1842
  rb_define_method(cgsl_histogram, "set_ranges", rb_gsl_histogram_set_ranges, -1);
1868
1843
  rb_define_method(cgsl_histogram, "range", rb_gsl_histogram_range, 0);
1869
1844
  rb_define_method(cgsl_histogram, "bin", rb_gsl_histogram_bin, 0);
1870
- rb_define_method(cgsl_histogram, "set_ranges_uniform",
1871
- rb_gsl_histogram_set_ranges_uniform, -1);
1845
+ rb_define_method(cgsl_histogram, "set_ranges_uniform",
1846
+ rb_gsl_histogram_set_ranges_uniform, -1);
1872
1847
  rb_define_singleton_method(cgsl_histogram, "memcpy", rb_gsl_histogram_memcpy, 2);
1873
1848
  rb_define_method(cgsl_histogram, "clone", rb_gsl_histogram_clone, 0);
1874
1849
  rb_define_alias(cgsl_histogram, "duplicate", "clone");
@@ -1896,20 +1871,20 @@ void Init_gsl_histogram(VALUE module)
1896
1871
  rb_define_method(cgsl_histogram, "sum", rb_gsl_histogram_integral, -1);
1897
1872
  rb_define_alias(cgsl_histogram, "integral", "sum");
1898
1873
 
1899
- rb_define_method(cgsl_histogram, "equal_bins_p",
1900
- rb_gsl_histogram_equal_bins_p, -1);
1874
+ rb_define_method(cgsl_histogram, "equal_bins_p",
1875
+ rb_gsl_histogram_equal_bins_p, -1);
1901
1876
  rb_define_alias(cgsl_histogram, "equal_bins", "equal_bins_p");
1902
- rb_define_singleton_method(cgsl_histogram, "equal_bins_p",
1903
- rb_gsl_histogram_equal_bins_p, -1);
1904
- rb_define_singleton_method(cgsl_histogram, "equal_bins",
1905
- rb_gsl_histogram_equal_bins_p, -1);
1906
- rb_define_method(cgsl_histogram, "equal_bins_p?",
1907
- rb_gsl_histogram_equal_bins_p2, -1);
1877
+ rb_define_singleton_method(cgsl_histogram, "equal_bins_p",
1878
+ rb_gsl_histogram_equal_bins_p, -1);
1879
+ rb_define_singleton_method(cgsl_histogram, "equal_bins",
1880
+ rb_gsl_histogram_equal_bins_p, -1);
1881
+ rb_define_method(cgsl_histogram, "equal_bins_p?",
1882
+ rb_gsl_histogram_equal_bins_p2, -1);
1908
1883
  rb_define_alias(cgsl_histogram, "equal_bins?", "equal_bins_p?");
1909
- rb_define_singleton_method(cgsl_histogram, "equal_bins_p?",
1910
- rb_gsl_histogram_equal_bins_p2, -1);
1911
- rb_define_singleton_method(cgsl_histogram, "equal_bins?",
1912
- rb_gsl_histogram_equal_bins_p2, -1);
1884
+ rb_define_singleton_method(cgsl_histogram, "equal_bins_p?",
1885
+ rb_gsl_histogram_equal_bins_p2, -1);
1886
+ rb_define_singleton_method(cgsl_histogram, "equal_bins?",
1887
+ rb_gsl_histogram_equal_bins_p2, -1);
1913
1888
 
1914
1889
  rb_define_method(cgsl_histogram, "add", rb_gsl_histogram_add, 1);
1915
1890
  rb_define_alias(cgsl_histogram, "+", "add");
@@ -1940,13 +1915,11 @@ void Init_gsl_histogram(VALUE module)
1940
1915
  rb_define_method(cgsl_histogram, "print", rb_gsl_histogram_print, 0);
1941
1916
 
1942
1917
  cgsl_histogram_pdf = rb_define_class_under(cgsl_histogram, "Pdf", cGSL_Object);
1943
- rb_define_singleton_method(cgsl_histogram_pdf, "alloc",
1944
- rb_gsl_histogram_pdf_alloc, 1);
1945
- /* rb_define_singleton_method(cgsl_histogram_pdf, "new",
1918
+ rb_define_singleton_method(cgsl_histogram_pdf, "alloc",
1919
+ rb_gsl_histogram_pdf_alloc, 1);
1920
+ /* rb_define_singleton_method(cgsl_histogram_pdf, "new",
1946
1921
  rb_gsl_histogram_pdf_alloc, 1);*/
1947
- #ifdef GSL_0_9_4_LATER
1948
1922
  rb_define_method(cgsl_histogram_pdf, "init", rb_gsl_histogram_pdf_init, 1);
1949
- #endif
1950
1923
  rb_define_method(cgsl_histogram_pdf, "sample", rb_gsl_histogram_pdf_sample, 1);
1951
1924
 
1952
1925
  rb_define_method(cgsl_histogram_pdf, "range", rb_gsl_histogram_pdf_range, 0);
@@ -1958,23 +1931,23 @@ void Init_gsl_histogram(VALUE module)
1958
1931
 
1959
1932
  rb_define_method(cgsl_histogram, "plot", rb_gsl_histogram_plot, -1);
1960
1933
 
1961
- rb_define_method(cgsl_histogram, "fit_gaussian",
1962
- rb_gsl_histogram_fit_gaussian, -1);
1963
- rb_define_method(cgsl_histogram, "fit_exponential",
1964
- rb_gsl_histogram_fit_exponential, -1);
1965
- rb_define_method(cgsl_histogram, "fit_xexponential",
1966
- rb_gsl_histogram_fit_xexponential, -1);
1967
- rb_define_method(cgsl_histogram, "fit_power",
1968
- rb_gsl_histogram_fit_power, -1);
1969
- rb_define_method(cgsl_histogram, "fit_rayleigh",
1970
- rb_gsl_histogram_fit_rayleigh, -1);
1971
- rb_define_method(cgsl_histogram, "fit",
1972
- rb_gsl_histogram_fit, -1);
1934
+ rb_define_method(cgsl_histogram, "fit_gaussian",
1935
+ rb_gsl_histogram_fit_gaussian, -1);
1936
+ rb_define_method(cgsl_histogram, "fit_exponential",
1937
+ rb_gsl_histogram_fit_exponential, -1);
1938
+ rb_define_method(cgsl_histogram, "fit_xexponential",
1939
+ rb_gsl_histogram_fit_xexponential, -1);
1940
+ rb_define_method(cgsl_histogram, "fit_power",
1941
+ rb_gsl_histogram_fit_power, -1);
1942
+ rb_define_method(cgsl_histogram, "fit_rayleigh",
1943
+ rb_gsl_histogram_fit_rayleigh, -1);
1944
+ rb_define_method(cgsl_histogram, "fit",
1945
+ rb_gsl_histogram_fit, -1);
1973
1946
 
1974
1947
  rb_define_method(cgsl_histogram, "integrate", rb_gsl_histogram_integrate, -1);
1975
1948
  rb_undef_method(cgsl_histogram_integ, "integrate");
1976
- rb_define_method(cgsl_histogram_integ, "differentiate",
1977
- rb_gsl_histogram_differentiate, 0);
1949
+ rb_define_method(cgsl_histogram_integ, "differentiate",
1950
+ rb_gsl_histogram_differentiate, 0);
1978
1951
  rb_define_alias(cgsl_histogram_integ, "diff", "differentiate");
1979
1952
 
1980
1953
  rb_define_method(cgsl_histogram, "normalize", rb_gsl_histogram_normalize, 0);