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
@@ -38,34 +38,29 @@ static const gsl_qrng_type* get_gsl_qrng_type(VALUE t)
38
38
  strcpy(name, STR2CSTR(t));
39
39
  if (strstr(name, "niederreiter_2")) return T = gsl_qrng_niederreiter_2;
40
40
  #ifdef HAVE_QRNGEXTRA_QRNGEXTRA_H
41
- else if (strstr(name, "hdsobol")) return T = qrngextra_hdsobol;
41
+ else if (strstr(name, "hdsobol")) return T = qrngextra_hdsobol;
42
42
  #endif
43
43
  else if (strstr(name, "sobol")) return T = gsl_qrng_sobol;
44
- #ifdef GSL_1_11_LATER
45
44
  else if (strstr(name, "reversehalton")) return T = gsl_qrng_reversehalton;
46
45
  else if (strstr(name, "halton")) return T = gsl_qrng_halton;
47
-
48
- #endif
49
46
  else rb_raise(rb_eArgError, "unknown type");
50
47
  break;
51
48
  case T_FIXNUM:
52
49
  switch (FIX2INT(t)) {
53
50
  case GSL_QRNG_NIEDERREITER_2: T = gsl_qrng_niederreiter_2; break;
54
51
  case GSL_QRNG_SOBOL: T = gsl_qrng_sobol; break;
55
- #ifdef GSL_1_11_LATER
56
52
  case GSL_QRNG_HALTON: T = gsl_qrng_halton; break;
57
53
  case GSL_QRNG_REVERSEHALTON: T = gsl_qrng_reversehalton; break;
58
- #endif
59
54
  #ifdef HAVE_QRNGEXTRA_QRNGEXTRA_H
60
- case GSL_QRNG_HDSOBOL: T = qrngextra_hdsobol; break;
55
+ case GSL_QRNG_HDSOBOL: T = qrngextra_hdsobol; break;
61
56
  #endif
62
- default:
57
+ default:
63
58
  rb_raise(rb_eArgError, "unknown type");
64
59
  }
65
60
  break;
66
- default:
61
+ default:
67
62
  rb_raise(rb_eTypeError, "wrong argument type %s (String or Fixnum expected)",
68
- rb_class2name(CLASS_OF(t)));
63
+ rb_class2name(CLASS_OF(t)));
69
64
  }
70
65
  return T;
71
66
  }
@@ -81,7 +76,6 @@ static VALUE rb_gsl_qrng_new(VALUE klass, VALUE t, VALUE dd)
81
76
  return Data_Wrap_Struct(klass, 0, gsl_qrng_free, q);
82
77
  }
83
78
 
84
- #ifdef GSL_1_2_LATER
85
79
  static VALUE rb_gsl_qrng_init(VALUE obj)
86
80
  {
87
81
  gsl_qrng *q = NULL;
@@ -89,7 +83,6 @@ static VALUE rb_gsl_qrng_init(VALUE obj)
89
83
  gsl_qrng_init(q);
90
84
  return obj;
91
85
  }
92
- #endif
93
86
 
94
87
  static VALUE rb_gsl_qrng_name(VALUE obj)
95
88
  {
@@ -148,9 +141,7 @@ void Init_gsl_qrng(VALUE module)
148
141
 
149
142
  rb_define_singleton_method(cgsl_qrng, "new", rb_gsl_qrng_new, 2);
150
143
  rb_define_singleton_method(cgsl_qrng, "alloc", rb_gsl_qrng_new, 2);
151
- #ifdef GSL_1_2_LATER
152
144
  rb_define_method(cgsl_qrng, "init", rb_gsl_qrng_init, 0);
153
- #endif
154
145
  rb_define_method(cgsl_qrng, "name", rb_gsl_qrng_name, 0);
155
146
  rb_define_method(cgsl_qrng, "size", rb_gsl_qrng_size, 0);
156
147
  rb_define_method(cgsl_qrng, "clone", rb_gsl_qrng_clone, 0);
@@ -161,11 +152,9 @@ void Init_gsl_qrng(VALUE module)
161
152
 
162
153
  rb_define_const(cgsl_qrng, "NIEDERREITER_2", INT2FIX(GSL_QRNG_NIEDERREITER_2));
163
154
  rb_define_const(cgsl_qrng, "SOBOL", INT2FIX(GSL_QRNG_SOBOL));
164
- #ifdef GSL_1_11_LATER
165
155
  rb_define_const(cgsl_qrng, "HALTON", INT2FIX(GSL_QRNG_HALTON));
166
156
  rb_define_const(cgsl_qrng, "REVERSEHALTON", INT2FIX(GSL_QRNG_REVERSEHALTON));
167
- #endif
168
157
  #ifdef HAVE_QRNGEXTRA_QRNGEXTRA_H
169
- rb_define_const(cgsl_qrng, "HDSOBOL", INT2FIX(GSL_QRNG_HDSOBOL));
158
+ rb_define_const(cgsl_qrng, "HDSOBOL", INT2FIX(GSL_QRNG_HDSOBOL));
170
159
  #endif
171
160
  }
@@ -16,13 +16,13 @@
16
16
 
17
17
  VALUE rb_gsl_eval_pdf_cdf(VALUE xx, double (*f)(double));
18
18
  VALUE rb_gsl_eval_pdf_cdf2(VALUE xx, VALUE aa, double (*f)(double, double));
19
- VALUE rb_gsl_eval_pdf_cdf3(VALUE xx, VALUE aa, VALUE bb,
20
- double (*f)(double, double, double));
21
- VALUE rb_gsl_eval_pdf_cdf2_uint(VALUE xx, VALUE aa,
22
- double (*f)(unsigned int, double));
19
+ VALUE rb_gsl_eval_pdf_cdf3(VALUE xx, VALUE aa, VALUE bb,
20
+ double (*f)(double, double, double));
21
+ VALUE rb_gsl_eval_pdf_cdf2_uint(VALUE xx, VALUE aa,
22
+ double (*f)(unsigned int, double));
23
23
 
24
24
  static VALUE rb_gsl_ran_eval0(int argc, VALUE *argv, VALUE obj,
25
- double (*f)(const gsl_rng*))
25
+ double (*f)(const gsl_rng*))
26
26
  {
27
27
  gsl_rng *r;
28
28
  switch (TYPE(obj)) {
@@ -30,7 +30,7 @@ static VALUE rb_gsl_ran_eval0(int argc, VALUE *argv, VALUE obj,
30
30
  switch (argc) {
31
31
  case 1:
32
32
  CHECK_RNG(argv[0]);
33
- Data_Get_Struct(argv[0], gsl_rng, r);
33
+ Data_Get_Struct(argv[0], gsl_rng, r);
34
34
  break;
35
35
  default:
36
36
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)", argc);
@@ -45,14 +45,14 @@ static VALUE rb_gsl_ran_eval0(int argc, VALUE *argv, VALUE obj,
45
45
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 0)", argc);
46
46
  break;
47
47
  }
48
- Data_Get_Struct(obj, gsl_rng, r);
48
+ Data_Get_Struct(obj, gsl_rng, r);
49
49
  break;
50
50
  }
51
51
  return rb_float_new((*f)(r));
52
52
  }
53
53
 
54
54
  static VALUE rb_gsl_ran_eval1(int argc, VALUE *argv, VALUE obj,
55
- double (*f)(const gsl_rng*, double))
55
+ double (*f)(const gsl_rng*, double))
56
56
  {
57
57
  gsl_rng *r;
58
58
  gsl_vector *v;
@@ -65,15 +65,15 @@ static VALUE rb_gsl_ran_eval1(int argc, VALUE *argv, VALUE obj,
65
65
  n = NUM2INT(argv[2]);
66
66
  a = NUM2DBL(argv[1]);
67
67
  CHECK_RNG(argv[0]);
68
- Data_Get_Struct(argv[0], gsl_rng, r);
68
+ Data_Get_Struct(argv[0], gsl_rng, r);
69
69
  v = gsl_vector_alloc(n);
70
- for (i = 0; i < n; i++)
71
- gsl_vector_set(v, i, (*f)(r, a));
70
+ for (i = 0; i < n; i++)
71
+ gsl_vector_set(v, i, (*f)(r, a));
72
72
  return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, v);
73
73
  break;
74
74
  case 2:
75
75
  CHECK_RNG(argv[0]);
76
- Data_Get_Struct(argv[0], gsl_rng, r);
76
+ Data_Get_Struct(argv[0], gsl_rng, r);
77
77
  a = NUM2DBL(argv[1]);
78
78
  break;
79
79
  default:
@@ -86,10 +86,10 @@ static VALUE rb_gsl_ran_eval1(int argc, VALUE *argv, VALUE obj,
86
86
  case 2:
87
87
  n = NUM2INT(argv[1]);
88
88
  a = NUM2DBL(argv[0]);
89
- Data_Get_Struct(obj, gsl_rng, r);
89
+ Data_Get_Struct(obj, gsl_rng, r);
90
90
  v = gsl_vector_alloc(n);
91
- for (i = 0; i < n; i++)
92
- gsl_vector_set(v, i, (*f)(r, a));
91
+ for (i = 0; i < n; i++)
92
+ gsl_vector_set(v, i, (*f)(r, a));
93
93
  return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, v);
94
94
  break;
95
95
  case 1:
@@ -99,14 +99,14 @@ static VALUE rb_gsl_ran_eval1(int argc, VALUE *argv, VALUE obj,
99
99
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)", argc);
100
100
  break;
101
101
  }
102
- Data_Get_Struct(obj, gsl_rng, r);
102
+ Data_Get_Struct(obj, gsl_rng, r);
103
103
  break;
104
104
  }
105
105
  return rb_float_new((*f)(r, a));
106
106
  }
107
107
 
108
108
  static VALUE rb_gsl_ran_eval1_uint(int argc, VALUE *argv, VALUE obj,
109
- unsigned int (*f)(const gsl_rng*, double))
109
+ unsigned int (*f)(const gsl_rng*, double))
110
110
  {
111
111
  gsl_rng *r;
112
112
  gsl_vector_int *v;
@@ -119,15 +119,15 @@ static VALUE rb_gsl_ran_eval1_uint(int argc, VALUE *argv, VALUE obj,
119
119
  n = NUM2INT(argv[2]);
120
120
  a = NUM2DBL(argv[1]);
121
121
  CHECK_RNG(argv[0]);
122
- Data_Get_Struct(argv[0], gsl_rng, r);
122
+ Data_Get_Struct(argv[0], gsl_rng, r);
123
123
  v = gsl_vector_int_alloc(n);
124
- for (i = 0; i < n; i++)
125
- gsl_vector_int_set(v, i, (int) (*f)(r, a));
124
+ for (i = 0; i < n; i++)
125
+ gsl_vector_int_set(v, i, (int) (*f)(r, a));
126
126
  return Data_Wrap_Struct(cgsl_vector_int, 0, gsl_vector_int_free, v);
127
127
  break;
128
128
  case 2:
129
129
  CHECK_RNG(argv[0]);
130
- Data_Get_Struct(argv[0], gsl_rng, r);
130
+ Data_Get_Struct(argv[0], gsl_rng, r);
131
131
  a = NUM2DBL(argv[1]);
132
132
  break;
133
133
  default:
@@ -140,10 +140,10 @@ static VALUE rb_gsl_ran_eval1_uint(int argc, VALUE *argv, VALUE obj,
140
140
  case 2:
141
141
  n = NUM2INT(argv[1]);
142
142
  a = NUM2DBL(argv[0]);
143
- Data_Get_Struct(obj, gsl_rng, r);
143
+ Data_Get_Struct(obj, gsl_rng, r);
144
144
  v = gsl_vector_int_alloc(n);
145
- for (i = 0; i < n; i++)
146
- gsl_vector_int_set(v, i, (*f)(r, a));
145
+ for (i = 0; i < n; i++)
146
+ gsl_vector_int_set(v, i, (*f)(r, a));
147
147
  return Data_Wrap_Struct(cgsl_vector_int, 0, gsl_vector_int_free, v);
148
148
  break;
149
149
  case 1:
@@ -153,14 +153,14 @@ static VALUE rb_gsl_ran_eval1_uint(int argc, VALUE *argv, VALUE obj,
153
153
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)", argc);
154
154
  break;
155
155
  }
156
- Data_Get_Struct(obj, gsl_rng, r);
156
+ Data_Get_Struct(obj, gsl_rng, r);
157
157
  break;
158
158
  }
159
159
  return INT2FIX((*f)(r, a));
160
160
  }
161
161
 
162
162
  static VALUE rb_gsl_ran_eval2(int argc, VALUE *argv, VALUE obj,
163
- double (*f)(const gsl_rng*, double, double))
163
+ double (*f)(const gsl_rng*, double, double))
164
164
  {
165
165
  gsl_rng *r;
166
166
  gsl_vector *v;
@@ -171,7 +171,7 @@ static VALUE rb_gsl_ran_eval2(int argc, VALUE *argv, VALUE obj,
171
171
  switch (argc) {
172
172
  case 4:
173
173
  CHECK_RNG(argv[0]);
174
- Data_Get_Struct(argv[0], gsl_rng, r);
174
+ Data_Get_Struct(argv[0], gsl_rng, r);
175
175
  a = NUM2DBL(argv[1]); b = NUM2DBL(argv[2]);
176
176
  n = NUM2INT(argv[3]);
177
177
  v = gsl_vector_alloc(n);
@@ -180,7 +180,7 @@ static VALUE rb_gsl_ran_eval2(int argc, VALUE *argv, VALUE obj,
180
180
  break;
181
181
  case 3:
182
182
  CHECK_RNG(argv[0]);
183
- Data_Get_Struct(argv[0], gsl_rng, r);
183
+ Data_Get_Struct(argv[0], gsl_rng, r);
184
184
  a = NUM2DBL(argv[1]); b = NUM2DBL(argv[2]);
185
185
  break;
186
186
  default:
@@ -191,7 +191,7 @@ static VALUE rb_gsl_ran_eval2(int argc, VALUE *argv, VALUE obj,
191
191
  default:
192
192
  switch (argc) {
193
193
  case 3:
194
- Data_Get_Struct(obj, gsl_rng, r);
194
+ Data_Get_Struct(obj, gsl_rng, r);
195
195
  a = NUM2DBL(argv[0]); b = NUM2DBL(argv[1]);
196
196
  n = NUM2INT(argv[2]);
197
197
  v = gsl_vector_alloc(n);
@@ -205,14 +205,14 @@ static VALUE rb_gsl_ran_eval2(int argc, VALUE *argv, VALUE obj,
205
205
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)", argc);
206
206
  break;
207
207
  }
208
- Data_Get_Struct(obj, gsl_rng, r);
208
+ Data_Get_Struct(obj, gsl_rng, r);
209
209
  break;
210
210
  }
211
211
  return rb_float_new((*f)(r, a, b));
212
212
  }
213
213
 
214
214
  static VALUE rb_gsl_ran_eval3(int argc, VALUE *argv, VALUE obj,
215
- double (*f)(const gsl_rng*, double, double, double))
215
+ double (*f)(const gsl_rng*, double, double, double))
216
216
  {
217
217
  gsl_rng *r;
218
218
  gsl_vector *v;
@@ -223,7 +223,7 @@ static VALUE rb_gsl_ran_eval3(int argc, VALUE *argv, VALUE obj,
223
223
  switch (argc) {
224
224
  case 5:
225
225
  CHECK_RNG(argv[0]);
226
- Data_Get_Struct(argv[0], gsl_rng, r);
226
+ Data_Get_Struct(argv[0], gsl_rng, r);
227
227
  a = NUM2DBL(argv[1]); b = NUM2DBL(argv[2]); c = NUM2DBL(argv[3]);
228
228
  n = NUM2INT(argv[4]);
229
229
  v = gsl_vector_alloc(n);
@@ -232,7 +232,7 @@ static VALUE rb_gsl_ran_eval3(int argc, VALUE *argv, VALUE obj,
232
232
  break;
233
233
  case 4:
234
234
  CHECK_RNG(argv[0]);
235
- Data_Get_Struct(argv[0], gsl_rng, r);
235
+ Data_Get_Struct(argv[0], gsl_rng, r);
236
236
  a = NUM2DBL(argv[1]); b = NUM2DBL(argv[2]); c = NUM2DBL(argv[3]);
237
237
  break;
238
238
  default:
@@ -243,7 +243,7 @@ static VALUE rb_gsl_ran_eval3(int argc, VALUE *argv, VALUE obj,
243
243
  default:
244
244
  switch (argc) {
245
245
  case 4:
246
- Data_Get_Struct(obj, gsl_rng, r);
246
+ Data_Get_Struct(obj, gsl_rng, r);
247
247
  a = NUM2DBL(argv[0]); b = NUM2DBL(argv[1]); c = NUM2DBL(argv[2]);
248
248
  n = NUM2INT(argv[3]);
249
249
  v = gsl_vector_alloc(n);
@@ -257,7 +257,7 @@ static VALUE rb_gsl_ran_eval3(int argc, VALUE *argv, VALUE obj,
257
257
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 3)", argc);
258
258
  break;
259
259
  }
260
- Data_Get_Struct(obj, gsl_rng, r);
260
+ Data_Get_Struct(obj, gsl_rng, r);
261
261
  break;
262
262
  }
263
263
  return rb_float_new((*f)(r, a, b, c));
@@ -265,7 +265,7 @@ static VALUE rb_gsl_ran_eval3(int argc, VALUE *argv, VALUE obj,
265
265
 
266
266
  static VALUE rb_gsl_ran_gaussian(int argc, VALUE *argv, VALUE obj)
267
267
  {
268
- gsl_rng *r = NULL;
268
+ gsl_rng *r = NULL;
269
269
  gsl_vector *v;
270
270
  size_t n, i;
271
271
  double sigma = 1.0;
@@ -276,18 +276,18 @@ static VALUE rb_gsl_ran_gaussian(int argc, VALUE *argv, VALUE obj)
276
276
  n = NUM2INT(argv[2]);
277
277
  sigma = NUM2DBL(argv[1]);
278
278
  CHECK_RNG(argv[0]);
279
- Data_Get_Struct(argv[0], gsl_rng, r);
279
+ Data_Get_Struct(argv[0], gsl_rng, r);
280
280
  v = gsl_vector_alloc(n);
281
- for (i = 0; i < n; i++)
282
- gsl_vector_set(v, i, gsl_ran_gaussian(r, sigma));
281
+ for (i = 0; i < n; i++)
282
+ gsl_vector_set(v, i, gsl_ran_gaussian(r, sigma));
283
283
  return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, v);
284
284
  break;
285
285
  case 2:
286
286
  sigma = NUM2DBL(argv[1]);
287
- /* no break */
287
+ /* no break */
288
288
  case 1:
289
289
  CHECK_RNG(argv[0]);
290
- Data_Get_Struct(argv[0], gsl_rng, r);
290
+ Data_Get_Struct(argv[0], gsl_rng, r);
291
291
  return rb_float_new(gsl_ran_gaussian(r, sigma));
292
292
  break;
293
293
  default:
@@ -297,19 +297,19 @@ static VALUE rb_gsl_ran_gaussian(int argc, VALUE *argv, VALUE obj)
297
297
  }
298
298
  break;
299
299
  default:
300
- Data_Get_Struct(obj, gsl_rng, r);
300
+ Data_Get_Struct(obj, gsl_rng, r);
301
301
  switch (argc) {
302
302
  case 2:
303
303
  n = NUM2INT(argv[1]);
304
304
  sigma = NUM2DBL(argv[0]);
305
305
  v = gsl_vector_alloc(n);
306
- for (i = 0; i < n; i++)
307
- gsl_vector_set(v, i, gsl_ran_gaussian(r, sigma));
306
+ for (i = 0; i < n; i++)
307
+ gsl_vector_set(v, i, gsl_ran_gaussian(r, sigma));
308
308
  return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, v);
309
309
  break;
310
310
  case 1:
311
311
  sigma = NUM2DBL(argv[0]);
312
- /* no break */
312
+ /* no break */
313
313
  case 0:
314
314
  return rb_float_new(gsl_ran_gaussian(r, sigma));
315
315
  break;
@@ -325,17 +325,17 @@ static VALUE rb_gsl_ran_gaussian(int argc, VALUE *argv, VALUE obj)
325
325
 
326
326
  static VALUE rb_gsl_ran_gaussian_ratio_method(int argc, VALUE *argv, VALUE obj)
327
327
  {
328
- gsl_rng *r = NULL;
328
+ gsl_rng *r = NULL;
329
329
  double sigma = 1.0;
330
330
  switch (TYPE(obj)) {
331
331
  case T_MODULE: case T_CLASS: case T_OBJECT:
332
332
  switch (argc) {
333
333
  case 2:
334
334
  sigma = NUM2DBL(argv[1]);
335
- /* no break */
335
+ /* no break */
336
336
  case 1:
337
337
  CHECK_RNG(argv[0]);
338
- Data_Get_Struct(argv[0], gsl_rng, r);
338
+ Data_Get_Struct(argv[0], gsl_rng, r);
339
339
  return rb_float_new(gsl_ran_gaussian_ratio_method(r, sigma));
340
340
  break;
341
341
  default:
@@ -344,11 +344,11 @@ static VALUE rb_gsl_ran_gaussian_ratio_method(int argc, VALUE *argv, VALUE obj)
344
344
  }
345
345
  break;
346
346
  default:
347
- Data_Get_Struct(obj, gsl_rng, r);
347
+ Data_Get_Struct(obj, gsl_rng, r);
348
348
  switch (argc) {
349
349
  case 1:
350
350
  sigma = NUM2DBL(argv[0]);
351
- /* no break */
351
+ /* no break */
352
352
  case 0:
353
353
  return rb_float_new(gsl_ran_gaussian_ratio_method(r, sigma));
354
354
  break;
@@ -374,7 +374,7 @@ static VALUE rb_gsl_ran_gaussian_pdf(int argc, VALUE *argv, VALUE obj)
374
374
 
375
375
  static VALUE rb_gsl_ran_gaussian_tail(int argc, VALUE *argv, VALUE obj)
376
376
  {
377
- gsl_rng *r = NULL;
377
+ gsl_rng *r = NULL;
378
378
  gsl_vector *v;
379
379
  size_t n, i;
380
380
  double a, sigma = 1.0;
@@ -386,18 +386,18 @@ static VALUE rb_gsl_ran_gaussian_tail(int argc, VALUE *argv, VALUE obj)
386
386
  sigma = NUM2DBL(argv[2]);
387
387
  a = NUM2DBL(argv[1]);
388
388
  CHECK_RNG(argv[0]);
389
- Data_Get_Struct(argv[0], gsl_rng, r);
389
+ Data_Get_Struct(argv[0], gsl_rng, r);
390
390
  v = gsl_vector_alloc(n);
391
- for (i = 0; i < n; i++)
392
- gsl_vector_set(v, i, gsl_ran_gaussian_tail(r, a, sigma));
391
+ for (i = 0; i < n; i++)
392
+ gsl_vector_set(v, i, gsl_ran_gaussian_tail(r, a, sigma));
393
393
  return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, v);
394
394
  break;
395
395
  case 3:
396
396
  sigma = NUM2DBL(argv[2]);
397
- /* no break */
397
+ /* no break */
398
398
  case 2:
399
399
  CHECK_RNG(argv[0]);
400
- Data_Get_Struct(argv[0], gsl_rng, r);
400
+ Data_Get_Struct(argv[0], gsl_rng, r);
401
401
  a = NUM2DBL(argv[1]);
402
402
  return rb_float_new(gsl_ran_gaussian_tail(r, a, sigma));
403
403
  break;
@@ -407,20 +407,20 @@ static VALUE rb_gsl_ran_gaussian_tail(int argc, VALUE *argv, VALUE obj)
407
407
  }
408
408
  break;
409
409
  default:
410
- Data_Get_Struct(obj, gsl_rng, r);
410
+ Data_Get_Struct(obj, gsl_rng, r);
411
411
  switch (argc) {
412
412
  case 3:
413
413
  n = NUM2INT(argv[2]);
414
414
  sigma = NUM2DBL(argv[1]);
415
415
  a = NUM2DBL(argv[0]);
416
416
  v = gsl_vector_alloc(n);
417
- for (i = 0; i < n; i++)
418
- gsl_vector_set(v, i, gsl_ran_gaussian_tail(r, a, sigma));
417
+ for (i = 0; i < n; i++)
418
+ gsl_vector_set(v, i, gsl_ran_gaussian_tail(r, a, sigma));
419
419
  return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, v);
420
420
  break;
421
421
  case 2:
422
422
  sigma = NUM2DBL(argv[1]);
423
- /* no break */
423
+ /* no break */
424
424
  case 1:
425
425
  a = NUM2DBL(argv[0]);
426
426
  return rb_float_new(gsl_ran_gaussian_tail(r, a, sigma));
@@ -450,14 +450,14 @@ static VALUE rb_gsl_ran_gaussian_tail_pdf(int argc, VALUE *argv, VALUE obj)
450
450
 
451
451
  static VALUE rb_gsl_ran_bivariate_gaussian(int argc, VALUE *argv, VALUE obj)
452
452
  {
453
- gsl_rng *r = NULL;
453
+ gsl_rng *r = NULL;
454
454
  double sigmax, sigmay, x, y, rho;
455
455
  switch (TYPE(obj)) {
456
456
  case T_MODULE: case T_CLASS: case T_OBJECT:
457
457
  switch (argc) {
458
458
  case 4:
459
459
  CHECK_RNG(argv[0]);
460
- Data_Get_Struct(argv[0], gsl_rng, r);
460
+ Data_Get_Struct(argv[0], gsl_rng, r);
461
461
  sigmax = NUM2DBL(argv[1]); sigmay = NUM2DBL(argv[2]);
462
462
  rho = NUM2DBL(argv[3]);
463
463
  break;
@@ -469,7 +469,7 @@ static VALUE rb_gsl_ran_bivariate_gaussian(int argc, VALUE *argv, VALUE obj)
469
469
  default:
470
470
  switch (argc) {
471
471
  case 3:
472
- Data_Get_Struct(obj, gsl_rng, r);
472
+ Data_Get_Struct(obj, gsl_rng, r);
473
473
  sigmax = NUM2DBL(argv[0]); sigmay = NUM2DBL(argv[1]);
474
474
  rho = NUM2DBL(argv[2]);
475
475
  break;
@@ -720,7 +720,7 @@ static VALUE rb_gsl_ran_binomial(int argc, VALUE *argv, VALUE obj)
720
720
  switch (argc) {
721
721
  case 3:
722
722
  CHECK_RNG(argv[0]);
723
- Data_Get_Struct(argv[0], gsl_rng, r);
723
+ Data_Get_Struct(argv[0], gsl_rng, r);
724
724
  p = NUM2DBL(argv[1]);
725
725
  n = FIX2UINT(argv[2]);
726
726
  break;
@@ -739,16 +739,15 @@ static VALUE rb_gsl_ran_binomial(int argc, VALUE *argv, VALUE obj)
739
739
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)", argc);
740
740
  break;
741
741
  }
742
- Data_Get_Struct(obj, gsl_rng, r);
742
+ Data_Get_Struct(obj, gsl_rng, r);
743
743
  break;
744
744
  }
745
745
  return UINT2NUM(gsl_ran_binomial(r, p, n));
746
746
  }
747
747
 
748
- #ifdef GSL_1_4_LATER
749
748
  static VALUE rb_gsl_ran_binomial_tpe(int argc, VALUE *argv, VALUE obj)
750
749
  {
751
- gsl_rng *r = NULL;
750
+ gsl_rng *r = NULL;
752
751
  double p;
753
752
  unsigned int n;
754
753
  switch (TYPE(obj)) {
@@ -756,7 +755,7 @@ static VALUE rb_gsl_ran_binomial_tpe(int argc, VALUE *argv, VALUE obj)
756
755
  switch (argc) {
757
756
  case 3:
758
757
  CHECK_RNG(argv[0]);
759
- Data_Get_Struct(argv[0], gsl_rng, r);
758
+ Data_Get_Struct(argv[0], gsl_rng, r);
760
759
  p = NUM2DBL(argv[1]);
761
760
  n = FIX2UINT(argv[2]);
762
761
  break;
@@ -775,12 +774,11 @@ static VALUE rb_gsl_ran_binomial_tpe(int argc, VALUE *argv, VALUE obj)
775
774
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)", argc);
776
775
  break;
777
776
  }
778
- Data_Get_Struct(obj, gsl_rng, r);
777
+ Data_Get_Struct(obj, gsl_rng, r);
779
778
  break;
780
779
  }
781
780
  return UINT2NUM(gsl_ran_binomial_tpe(r, p, n));
782
781
  }
783
- #endif
784
782
 
785
783
  static VALUE rb_gsl_ran_binomial_pdf(VALUE obj, VALUE x, VALUE p, VALUE n)
786
784
  {
@@ -797,7 +795,7 @@ static VALUE rb_gsl_ran_negative_binomial(int argc, VALUE *argv, VALUE obj)
797
795
  switch (argc) {
798
796
  case 3:
799
797
  CHECK_RNG(argv[0]);
800
- Data_Get_Struct(argv[0], gsl_rng, r);
798
+ Data_Get_Struct(argv[0], gsl_rng, r);
801
799
  p = NUM2DBL(argv[1]);
802
800
  n = FIX2UINT(argv[2]);
803
801
  break;
@@ -816,7 +814,7 @@ static VALUE rb_gsl_ran_negative_binomial(int argc, VALUE *argv, VALUE obj)
816
814
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)", argc);
817
815
  break;
818
816
  }
819
- Data_Get_Struct(obj, gsl_rng, r);
817
+ Data_Get_Struct(obj, gsl_rng, r);
820
818
  break;
821
819
  }
822
820
  return UINT2NUM(gsl_ran_negative_binomial(r, p, n));
@@ -829,7 +827,7 @@ static VALUE rb_gsl_ran_negative_binomial_pdf(VALUE obj, VALUE x, VALUE p, VALUE
829
827
 
830
828
  static VALUE rb_gsl_ran_pascal(int argc, VALUE *argv, VALUE obj)
831
829
  {
832
- gsl_rng *r = NULL;
830
+ gsl_rng *r = NULL;
833
831
  double p;
834
832
  unsigned int n;
835
833
  switch (TYPE(obj)) {
@@ -837,7 +835,7 @@ static VALUE rb_gsl_ran_pascal(int argc, VALUE *argv, VALUE obj)
837
835
  switch (argc) {
838
836
  case 3:
839
837
  CHECK_RNG(argv[0]);
840
- Data_Get_Struct(argv[0], gsl_rng, r);
838
+ Data_Get_Struct(argv[0], gsl_rng, r);
841
839
  p = NUM2DBL(argv[1]);
842
840
  n = FIX2UINT(argv[2]);
843
841
  break;
@@ -856,7 +854,7 @@ static VALUE rb_gsl_ran_pascal(int argc, VALUE *argv, VALUE obj)
856
854
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)", argc);
857
855
  break;
858
856
  }
859
- Data_Get_Struct(obj, gsl_rng, r);
857
+ Data_Get_Struct(obj, gsl_rng, r);
860
858
  break;
861
859
  }
862
860
  return UINT2NUM(gsl_ran_pascal(r, p, n));
@@ -886,7 +884,7 @@ static VALUE rb_gsl_ran_hypergeometric(int argc, VALUE *argv, VALUE obj)
886
884
  switch (argc) {
887
885
  case 4:
888
886
  CHECK_RNG(argv[0]);
889
- Data_Get_Struct(argv[0], gsl_rng, r);
887
+ Data_Get_Struct(argv[0], gsl_rng, r);
890
888
  n1 = FIX2UINT(argv[1]);
891
889
  n2 = FIX2UINT(argv[2]);
892
890
  t = FIX2UINT(argv[3]);
@@ -907,7 +905,7 @@ static VALUE rb_gsl_ran_hypergeometric(int argc, VALUE *argv, VALUE obj)
907
905
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 3)", argc);
908
906
  break;
909
907
  }
910
- Data_Get_Struct(obj, gsl_rng, r);
908
+ Data_Get_Struct(obj, gsl_rng, r);
911
909
  break;
912
910
  }
913
911
  return UINT2NUM(gsl_ran_hypergeometric(r, n1, n2, t));
@@ -930,14 +928,14 @@ static VALUE rb_gsl_ran_logarithmic_pdf(VALUE obj, VALUE x, VALUE mu)
930
928
 
931
929
  static VALUE rb_gsl_ran_dir_2d(int argc, VALUE *argv, VALUE obj)
932
930
  {
933
- gsl_rng *r = NULL;
931
+ gsl_rng *r = NULL;
934
932
  double x, y;
935
933
  switch (TYPE(obj)) {
936
934
  case T_MODULE: case T_CLASS: case T_OBJECT:
937
935
  switch (argc) {
938
936
  case 1:
939
937
  CHECK_RNG(argv[0]);
940
- Data_Get_Struct(argv[0], gsl_rng, r);
938
+ Data_Get_Struct(argv[0], gsl_rng, r);
941
939
  break;
942
940
  default:
943
941
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)", argc);
@@ -947,7 +945,7 @@ static VALUE rb_gsl_ran_dir_2d(int argc, VALUE *argv, VALUE obj)
947
945
  default:
948
946
  switch (argc) {
949
947
  case 0:
950
- Data_Get_Struct(obj, gsl_rng, r);
948
+ Data_Get_Struct(obj, gsl_rng, r);
951
949
  break;
952
950
  default:
953
951
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 0)", argc);
@@ -960,14 +958,14 @@ static VALUE rb_gsl_ran_dir_2d(int argc, VALUE *argv, VALUE obj)
960
958
 
961
959
  static VALUE rb_gsl_ran_dir_2d_trig_method(int argc, VALUE *argv, VALUE obj)
962
960
  {
963
- gsl_rng *r = NULL;
961
+ gsl_rng *r = NULL;
964
962
  double x, y;
965
963
  switch (TYPE(obj)) {
966
964
  case T_MODULE: case T_CLASS: case T_OBJECT:
967
965
  switch (argc) {
968
966
  case 1:
969
967
  CHECK_RNG(argv[0]);
970
- Data_Get_Struct(argv[0], gsl_rng, r);
968
+ Data_Get_Struct(argv[0], gsl_rng, r);
971
969
  break;
972
970
  default:
973
971
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)", argc);
@@ -977,7 +975,7 @@ static VALUE rb_gsl_ran_dir_2d_trig_method(int argc, VALUE *argv, VALUE obj)
977
975
  default:
978
976
  switch (argc) {
979
977
  case 0:
980
- Data_Get_Struct(obj, gsl_rng, r);
978
+ Data_Get_Struct(obj, gsl_rng, r);
981
979
  break;
982
980
  default:
983
981
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 0)", argc);
@@ -990,14 +988,14 @@ static VALUE rb_gsl_ran_dir_2d_trig_method(int argc, VALUE *argv, VALUE obj)
990
988
 
991
989
  static VALUE rb_gsl_ran_dir_3d(int argc, VALUE *argv, VALUE obj)
992
990
  {
993
- gsl_rng *r = NULL;
991
+ gsl_rng *r = NULL;
994
992
  double x, y, z;
995
993
  switch (TYPE(obj)) {
996
994
  case T_MODULE: case T_CLASS: case T_OBJECT:
997
995
  switch (argc) {
998
996
  case 1:
999
997
  CHECK_RNG(argv[0]);
1000
- Data_Get_Struct(argv[0], gsl_rng, r);
998
+ Data_Get_Struct(argv[0], gsl_rng, r);
1001
999
  break;
1002
1000
  default:
1003
1001
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)", argc);
@@ -1007,7 +1005,7 @@ static VALUE rb_gsl_ran_dir_3d(int argc, VALUE *argv, VALUE obj)
1007
1005
  default:
1008
1006
  switch (argc) {
1009
1007
  case 0:
1010
- Data_Get_Struct(obj, gsl_rng, r);
1008
+ Data_Get_Struct(obj, gsl_rng, r);
1011
1009
  break;
1012
1010
  default:
1013
1011
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 0)", argc);
@@ -1020,7 +1018,7 @@ static VALUE rb_gsl_ran_dir_3d(int argc, VALUE *argv, VALUE obj)
1020
1018
 
1021
1019
  static VALUE rb_gsl_ran_dir_nd(int argc, VALUE *argv, VALUE obj)
1022
1020
  {
1023
- gsl_rng *r = NULL;
1021
+ gsl_rng *r = NULL;
1024
1022
  size_t n;
1025
1023
  gsl_vector *v;
1026
1024
  switch (TYPE(obj)) {
@@ -1028,7 +1026,7 @@ static VALUE rb_gsl_ran_dir_nd(int argc, VALUE *argv, VALUE obj)
1028
1026
  switch (argc) {
1029
1027
  case 2:
1030
1028
  CHECK_RNG(argv[0]); CHECK_FIXNUM(argv[1]);
1031
- Data_Get_Struct(argv[0], gsl_rng, r);
1029
+ Data_Get_Struct(argv[0], gsl_rng, r);
1032
1030
  n = FIX2INT(argv[1]);
1033
1031
  break;
1034
1032
  default:
@@ -1041,7 +1039,7 @@ static VALUE rb_gsl_ran_dir_nd(int argc, VALUE *argv, VALUE obj)
1041
1039
  case 1:
1042
1040
  CHECK_FIXNUM(argv[0]);
1043
1041
  n = FIX2INT(argv[0]);
1044
- Data_Get_Struct(obj, gsl_rng, r);
1042
+ Data_Get_Struct(obj, gsl_rng, r);
1045
1043
  break;
1046
1044
  default:
1047
1045
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 0)", argc);
@@ -1055,7 +1053,7 @@ static VALUE rb_gsl_ran_dir_nd(int argc, VALUE *argv, VALUE obj)
1055
1053
 
1056
1054
  static VALUE rb_gsl_ran_shuffle(int argc, VALUE *argv, VALUE obj)
1057
1055
  {
1058
- gsl_rng *r = NULL;
1056
+ gsl_rng *r = NULL;
1059
1057
  gsl_vector *v = NULL;
1060
1058
  gsl_permutation *p = NULL;
1061
1059
  switch (TYPE(obj)) {
@@ -1067,13 +1065,13 @@ static VALUE rb_gsl_ran_shuffle(int argc, VALUE *argv, VALUE obj)
1067
1065
  CHECK_RNG(argv[0]);
1068
1066
  Data_Get_Struct(argv[0], gsl_rng, r);
1069
1067
  if (VECTOR_P(argv[1])) {
1070
- Data_Get_Struct(argv[1], gsl_vector, v);
1071
- gsl_ran_shuffle(r, v->data, v->size, sizeof(double));
1068
+ Data_Get_Struct(argv[1], gsl_vector, v);
1069
+ gsl_ran_shuffle(r, v->data, v->size, sizeof(double));
1072
1070
  } else if (PERMUTATION_P(argv[1])) {
1073
- Data_Get_Struct(argv[1], gsl_permutation, p);
1074
- gsl_ran_shuffle(r, p->data, p->size, sizeof(size_t));
1071
+ Data_Get_Struct(argv[1], gsl_permutation, p);
1072
+ gsl_ran_shuffle(r, p->data, p->size, sizeof(size_t));
1075
1073
  } else {
1076
- rb_raise(rb_eTypeError, "wrong argument type %s (Vector or Permutation expected)", rb_class2name(CLASS_OF(argv[1])));
1074
+ rb_raise(rb_eTypeError, "wrong argument type %s (Vector or Permutation expected)", rb_class2name(CLASS_OF(argv[1])));
1077
1075
  }
1078
1076
  break;
1079
1077
  case 3:
@@ -1081,15 +1079,15 @@ static VALUE rb_gsl_ran_shuffle(int argc, VALUE *argv, VALUE obj)
1081
1079
  CHECK_FIXNUM(argv[2]);
1082
1080
  Data_Get_Struct(argv[0], gsl_rng, r);
1083
1081
  if (VECTOR_P(argv[1])) {
1084
- Data_Get_Struct(argv[1], gsl_vector, v);
1085
- gsl_ran_shuffle(r, v->data, FIX2INT(argv[2]), sizeof(double));
1082
+ Data_Get_Struct(argv[1], gsl_vector, v);
1083
+ gsl_ran_shuffle(r, v->data, FIX2INT(argv[2]), sizeof(double));
1086
1084
  } else if (PERMUTATION_P(argv[1])) {
1087
- Data_Get_Struct(argv[1], gsl_permutation, p);
1088
- gsl_ran_shuffle(r, p->data, FIX2INT(argv[2]), sizeof(size_t));
1085
+ Data_Get_Struct(argv[1], gsl_permutation, p);
1086
+ gsl_ran_shuffle(r, p->data, FIX2INT(argv[2]), sizeof(size_t));
1089
1087
  } else {
1090
- rb_raise(rb_eTypeError,
1091
- "wrong argument type %s (Vector or Permutation expected)",
1092
- rb_class2name(CLASS_OF(argv[1])));
1088
+ rb_raise(rb_eTypeError,
1089
+ "wrong argument type %s (Vector or Permutation expected)",
1090
+ rb_class2name(CLASS_OF(argv[1])));
1093
1091
  }
1094
1092
  break;
1095
1093
  default:
@@ -1098,31 +1096,31 @@ static VALUE rb_gsl_ran_shuffle(int argc, VALUE *argv, VALUE obj)
1098
1096
  }
1099
1097
  break;
1100
1098
  default:
1101
- Data_Get_Struct(obj, gsl_rng, r);
1099
+ Data_Get_Struct(obj, gsl_rng, r);
1102
1100
  switch (argc) {
1103
1101
  case 1:
1104
1102
  if (VECTOR_P(argv[0])) {
1105
- Data_Get_Struct(argv[0], gsl_vector, v);
1106
- gsl_ran_shuffle(r, v->data, v->size, sizeof(double));
1103
+ Data_Get_Struct(argv[0], gsl_vector, v);
1104
+ gsl_ran_shuffle(r, v->data, v->size, sizeof(double));
1107
1105
  } else if (PERMUTATION_P(argv[0])) {
1108
- Data_Get_Struct(argv[0], gsl_permutation, p);
1109
- gsl_ran_shuffle(r, p->data, p->size, sizeof(size_t));
1106
+ Data_Get_Struct(argv[0], gsl_permutation, p);
1107
+ gsl_ran_shuffle(r, p->data, p->size, sizeof(size_t));
1110
1108
  } else {
1111
- rb_raise(rb_eTypeError, "wrong argument type %s (Vector or Permutation expected)", rb_class2name(CLASS_OF(argv[0])));
1109
+ rb_raise(rb_eTypeError, "wrong argument type %s (Vector or Permutation expected)", rb_class2name(CLASS_OF(argv[0])));
1112
1110
  }
1113
1111
  break;
1114
1112
  case 2:
1115
1113
  CHECK_FIXNUM(argv[1]);
1116
1114
  if (VECTOR_P(argv[0])) {
1117
- Data_Get_Struct(argv[0], gsl_vector, v);
1118
- gsl_ran_shuffle(r, v->data, FIX2INT(argv[1]), sizeof(double));
1115
+ Data_Get_Struct(argv[0], gsl_vector, v);
1116
+ gsl_ran_shuffle(r, v->data, FIX2INT(argv[1]), sizeof(double));
1119
1117
  } else if (PERMUTATION_P(argv[0])) {
1120
- Data_Get_Struct(argv[0], gsl_permutation, p);
1121
- gsl_ran_shuffle(r, p->data, FIX2INT(argv[1]), sizeof(size_t));
1118
+ Data_Get_Struct(argv[0], gsl_permutation, p);
1119
+ gsl_ran_shuffle(r, p->data, FIX2INT(argv[1]), sizeof(size_t));
1122
1120
  } else {
1123
- rb_raise(rb_eTypeError,
1124
- "wrong argument type %s (Vector or Permutation expected)",
1125
- rb_class2name(CLASS_OF(argv[0])));
1121
+ rb_raise(rb_eTypeError,
1122
+ "wrong argument type %s (Vector or Permutation expected)",
1123
+ rb_class2name(CLASS_OF(argv[0])));
1126
1124
  }
1127
1125
  default:
1128
1126
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 2 or 3)", argc);
@@ -1135,31 +1133,31 @@ static VALUE rb_gsl_ran_shuffle(int argc, VALUE *argv, VALUE obj)
1135
1133
 
1136
1134
  static VALUE rb_gsl_ran_choose(int argc, VALUE *argv, VALUE obj)
1137
1135
  {
1138
- gsl_rng *r = NULL;
1136
+ gsl_rng *r = NULL;
1139
1137
  gsl_vector *v = NULL, *v2 = NULL;
1140
1138
  size_t k, n;
1141
- Data_Get_Struct(obj, gsl_rng, r);
1139
+ Data_Get_Struct(obj, gsl_rng, r);
1142
1140
  switch (argc) {
1143
1141
  case 2:
1144
1142
  CHECK_VECTOR(argv[0]);
1145
1143
  CHECK_FIXNUM(argv[1]);
1146
- Data_Get_Struct(argv[0], gsl_vector, v);
1144
+ Data_Get_Struct(argv[0], gsl_vector, v);
1147
1145
  n = v->size;
1148
1146
  k = FIX2INT(argv[1]);
1149
1147
  if (k > n) rb_raise(rb_eArgError, "the argument 1 must be less than or equal to the size of the vector.");
1150
1148
  v2 = gsl_vector_alloc(k);
1151
1149
  gsl_ran_choose(r, v2->data, k, v->data, n, sizeof(double));
1152
- return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, v2);;
1150
+ return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, v2);
1153
1151
  break;
1154
1152
  case 1:
1155
1153
  CHECK_VECTOR(argv[0]);
1156
- Data_Get_Struct(argv[0], gsl_vector, v);
1154
+ Data_Get_Struct(argv[0], gsl_vector, v);
1157
1155
  n = v->size;
1158
1156
  k = v->size;
1159
1157
  if (k > n) rb_raise(rb_eArgError, "the argument 1 must be less than or equal to the size of the vector.");
1160
1158
  v2 = gsl_vector_alloc(k);
1161
1159
  gsl_ran_choose(r, v2->data, k, v->data, n, sizeof(double));
1162
- return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, v2);;
1160
+ return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, v2);
1163
1161
  break;
1164
1162
  default:
1165
1163
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 1 or 2)", argc);
@@ -1169,7 +1167,7 @@ static VALUE rb_gsl_ran_choose(int argc, VALUE *argv, VALUE obj)
1169
1167
 
1170
1168
  static VALUE rb_gsl_ran_choose_singleton(int argc, VALUE *argv, VALUE obj)
1171
1169
  {
1172
- gsl_rng *r = NULL;
1170
+ gsl_rng *r = NULL;
1173
1171
  gsl_vector *v = NULL, *v2 = NULL;
1174
1172
  size_t k, n;
1175
1173
  switch (argc) {
@@ -1177,26 +1175,26 @@ static VALUE rb_gsl_ran_choose_singleton(int argc, VALUE *argv, VALUE obj)
1177
1175
  CHECK_RNG(argv[0]);
1178
1176
  CHECK_VECTOR(argv[1]);
1179
1177
  CHECK_FIXNUM(argv[2]);
1180
- Data_Get_Struct(argv[0], gsl_rng, r);
1181
- Data_Get_Struct(argv[1], gsl_vector, v);
1178
+ Data_Get_Struct(argv[0], gsl_rng, r);
1179
+ Data_Get_Struct(argv[1], gsl_vector, v);
1182
1180
  n = v->size;
1183
1181
  k = FIX2INT(argv[2]);
1184
1182
  if (k > n) rb_raise(rb_eArgError, "the argument 1 must be less than or equal to the size of the vector.");
1185
1183
  v2 = gsl_vector_alloc(k);
1186
1184
  gsl_ran_choose(r, v2->data, k, v->data, n, sizeof(double));
1187
- return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, v2);;
1185
+ return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, v2);
1188
1186
  break;
1189
1187
  case 2:
1190
1188
  CHECK_RNG(argv[0]);
1191
1189
  CHECK_VECTOR(argv[1]);
1192
- Data_Get_Struct(argv[0], gsl_rng, r);
1193
- Data_Get_Struct(argv[1], gsl_vector, v);
1190
+ Data_Get_Struct(argv[0], gsl_rng, r);
1191
+ Data_Get_Struct(argv[1], gsl_vector, v);
1194
1192
  n = v->size;
1195
1193
  k = v->size;
1196
1194
  if (k > n) rb_raise(rb_eArgError, "the argument 1 must be less than or equal to the size of the vector.");
1197
1195
  v2 = gsl_vector_alloc(k);
1198
1196
  gsl_ran_choose(r, v2->data, k, v->data, n, sizeof(double));
1199
- return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, v2);;
1197
+ return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, v2);
1200
1198
  break;
1201
1199
  default:
1202
1200
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 2 or 3)", argc);
@@ -1206,32 +1204,31 @@ static VALUE rb_gsl_ran_choose_singleton(int argc, VALUE *argv, VALUE obj)
1206
1204
 
1207
1205
  static VALUE rb_gsl_ran_sample(VALUE obj, VALUE vv, VALUE kk)
1208
1206
  {
1209
- gsl_rng *r = NULL;
1207
+ gsl_rng *r = NULL;
1210
1208
  gsl_vector *v = NULL, *v2 = NULL;
1211
1209
  size_t k, n;
1212
- Data_Get_Struct(obj, gsl_rng, r);
1213
- Data_Get_Struct(vv, gsl_vector, v);
1210
+ Data_Get_Struct(obj, gsl_rng, r);
1211
+ Data_Get_Struct(vv, gsl_vector, v);
1214
1212
  n = v->size;
1215
1213
  k = FIX2INT(kk);
1216
1214
  v2 = gsl_vector_alloc(k);
1217
1215
  gsl_ran_sample(r, v2->data, k, v->data, n, sizeof(double));
1218
- return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, v2);;
1216
+ return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, v2);
1219
1217
  }
1220
1218
 
1221
- #ifdef GSL_1_3_LATER
1222
1219
  static VALUE rb_gsl_ran_dirichlet(int argc, VALUE *argv, VALUE obj)
1223
1220
  {
1224
- gsl_rng *r = NULL;
1221
+ gsl_rng *r = NULL;
1225
1222
  gsl_vector *v = NULL, *v2 = NULL;
1226
- Data_Get_Struct(obj, gsl_rng, r);
1223
+ Data_Get_Struct(obj, gsl_rng, r);
1227
1224
  if (argc == 1) {
1228
- Data_Get_Struct(argv[0], gsl_vector, v);
1225
+ Data_Get_Struct(argv[0], gsl_vector, v);
1229
1226
  v2 = gsl_vector_alloc(v->size);
1230
1227
  gsl_ran_dirichlet(r, v->size, v->data, v2->data);
1231
1228
  return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, v2);
1232
1229
  } else if (argc == 2) {
1233
- Data_Get_Struct(argv[0], gsl_vector, v);
1234
- Data_Get_Struct(argv[1], gsl_vector, v2);
1230
+ Data_Get_Struct(argv[0], gsl_vector, v);
1231
+ Data_Get_Struct(argv[1], gsl_vector, v2);
1235
1232
  gsl_ran_dirichlet(r, v->size, v->data, v2->data);
1236
1233
  return obj;
1237
1234
  } else {
@@ -1242,18 +1239,17 @@ static VALUE rb_gsl_ran_dirichlet(int argc, VALUE *argv, VALUE obj)
1242
1239
  static VALUE rb_gsl_ran_dirichlet_pdf(VALUE obj, VALUE a, VALUE t)
1243
1240
  {
1244
1241
  gsl_vector *alpha = NULL, *theta = NULL;
1245
- Data_Get_Struct(a, gsl_vector, alpha);
1246
- Data_Get_Struct(t, gsl_vector, theta);
1242
+ Data_Get_Struct(a, gsl_vector, alpha);
1243
+ Data_Get_Struct(t, gsl_vector, theta);
1247
1244
  return rb_float_new(gsl_ran_dirichlet_pdf(alpha->size, alpha->data, theta->data));
1248
1245
  }
1249
1246
  static VALUE rb_gsl_ran_dirichlet_lnpdf(VALUE obj, VALUE a, VALUE t)
1250
1247
  {
1251
1248
  gsl_vector *alpha = NULL, *theta = NULL;
1252
- Data_Get_Struct(a, gsl_vector, alpha);
1253
- Data_Get_Struct(t, gsl_vector, theta);
1249
+ Data_Get_Struct(a, gsl_vector, alpha);
1250
+ Data_Get_Struct(t, gsl_vector, theta);
1254
1251
  return rb_float_new(gsl_ran_dirichlet_lnpdf(alpha->size, alpha->data, theta->data));
1255
1252
  }
1256
- #endif
1257
1253
 
1258
1254
  static VALUE rb_gsl_ran_discrete_new(VALUE klass, VALUE vv)
1259
1255
  {
@@ -1280,21 +1276,13 @@ static VALUE rb_gsl_ran_discrete_pdf(VALUE obj, VALUE k, VALUE gg)
1280
1276
  return rb_float_new(gsl_ran_discrete_pdf(FIX2INT(k), g));
1281
1277
  }
1282
1278
 
1283
- #ifdef HAVE_NARRAY_H
1284
- #include "narray.h"
1285
- #endif
1286
-
1287
1279
  /*****/
1288
1280
  VALUE rb_gsl_eval_pdf_cdf(VALUE xx, double (*f)(double))
1289
1281
  {
1290
1282
  VALUE x, ary;
1291
1283
  gsl_vector *v = NULL, *vnew = NULL;
1292
1284
  gsl_matrix *m = NULL, *mnew = NULL;
1293
- size_t i, j, n;
1294
- #ifdef HAVE_NARRAY_H
1295
- struct NARRAY *na;
1296
- double *ptr1, *ptr2;
1297
- #endif
1285
+ size_t i, j, n;
1298
1286
  if (CLASS_OF(xx) == rb_cRange) xx = rb_gsl_range2ary(xx);
1299
1287
  switch(TYPE(xx)) {
1300
1288
  case T_FIXNUM:
@@ -1316,6 +1304,8 @@ VALUE rb_gsl_eval_pdf_cdf(VALUE xx, double (*f)(double))
1316
1304
  default:
1317
1305
  #ifdef HAVE_NARRAY_H
1318
1306
  if (NA_IsNArray(xx)) {
1307
+ struct NARRAY *na;
1308
+ double *ptr1, *ptr2;
1319
1309
  xx = na_change_type(xx, NA_DFLOAT);
1320
1310
  GetNArray(xx, na);
1321
1311
  ptr1 = (double *) na->ptr;
@@ -1330,16 +1320,16 @@ VALUE rb_gsl_eval_pdf_cdf(VALUE xx, double (*f)(double))
1330
1320
  Data_Get_Struct(xx, gsl_vector, v);
1331
1321
  vnew = gsl_vector_alloc(v->size);
1332
1322
  for (i = 0; i < v->size; i++) {
1333
- gsl_vector_set(vnew, i, (*f)(gsl_vector_get(v, i)));
1323
+ gsl_vector_set(vnew, i, (*f)(gsl_vector_get(v, i)));
1334
1324
  }
1335
1325
  return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, vnew);
1336
1326
  } else if (MATRIX_P(xx)) {
1337
1327
  Data_Get_Struct(xx, gsl_matrix, m);
1338
1328
  mnew = gsl_matrix_alloc(m->size1, m->size2);
1339
1329
  for (i = 0; i < m->size1; i++) {
1340
- for (j = 0; j < m->size2; j++) {
1341
- gsl_matrix_set(mnew, i, j, (*f)(gsl_matrix_get(m, i, j)));
1342
- }
1330
+ for (j = 0; j < m->size2; j++) {
1331
+ gsl_matrix_set(mnew, i, j, (*f)(gsl_matrix_get(m, i, j)));
1332
+ }
1343
1333
  }
1344
1334
  return Data_Wrap_Struct(cgsl_matrix, 0, gsl_matrix_free, mnew);
1345
1335
  } else {
@@ -1351,18 +1341,14 @@ VALUE rb_gsl_eval_pdf_cdf(VALUE xx, double (*f)(double))
1351
1341
  return Qnil;
1352
1342
  }
1353
1343
 
1354
- VALUE rb_gsl_eval_pdf_cdf2(VALUE xx, VALUE aa,
1355
- double (*f)(double, double))
1344
+ VALUE rb_gsl_eval_pdf_cdf2(VALUE xx, VALUE aa,
1345
+ double (*f)(double, double))
1356
1346
  {
1357
1347
  VALUE x, ary;
1358
1348
  double a;
1359
1349
  gsl_vector *v = NULL, *vnew = NULL;
1360
1350
  gsl_matrix *m = NULL, *mnew = NULL;
1361
1351
  size_t i, j, n;
1362
- #ifdef HAVE_NARRAY_H
1363
- struct NARRAY *na;
1364
- double *ptr1, *ptr2;
1365
- #endif
1366
1352
  Need_Float(aa);
1367
1353
  a = NUM2DBL(aa);
1368
1354
  if (CLASS_OF(xx) == rb_cRange) xx = rb_gsl_range2ary(xx);
@@ -1386,6 +1372,8 @@ VALUE rb_gsl_eval_pdf_cdf2(VALUE xx, VALUE aa,
1386
1372
  default:
1387
1373
  #ifdef HAVE_NARRAY_H
1388
1374
  if (NA_IsNArray(xx)) {
1375
+ struct NARRAY *na;
1376
+ double *ptr1, *ptr2;
1389
1377
  xx = na_change_type(xx, NA_DFLOAT);
1390
1378
  GetNArray(xx, na);
1391
1379
  ptr1 = (double *) na->ptr;
@@ -1400,16 +1388,16 @@ VALUE rb_gsl_eval_pdf_cdf2(VALUE xx, VALUE aa,
1400
1388
  Data_Get_Struct(xx, gsl_vector, v);
1401
1389
  vnew = gsl_vector_alloc(v->size);
1402
1390
  for (i = 0; i < v->size; i++) {
1403
- gsl_vector_set(vnew, i, (*f)(gsl_vector_get(v, i), a));
1391
+ gsl_vector_set(vnew, i, (*f)(gsl_vector_get(v, i), a));
1404
1392
  }
1405
1393
  return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, vnew);
1406
1394
  } else if (MATRIX_P(xx)) {
1407
1395
  Data_Get_Struct(xx, gsl_matrix, m);
1408
1396
  mnew = gsl_matrix_alloc(m->size1, m->size2);
1409
1397
  for (i = 0; i < m->size1; i++) {
1410
- for (j = 0; j < m->size2; j++) {
1411
- gsl_matrix_set(mnew, i, j, (*f)(gsl_matrix_get(m, i, j), a));
1412
- }
1398
+ for (j = 0; j < m->size2; j++) {
1399
+ gsl_matrix_set(mnew, i, j, (*f)(gsl_matrix_get(m, i, j), a));
1400
+ }
1413
1401
  }
1414
1402
  return Data_Wrap_Struct(cgsl_matrix, 0, gsl_matrix_free, mnew);
1415
1403
  } else {
@@ -1421,18 +1409,14 @@ VALUE rb_gsl_eval_pdf_cdf2(VALUE xx, VALUE aa,
1421
1409
  return Qnil;
1422
1410
  }
1423
1411
 
1424
- VALUE rb_gsl_eval_pdf_cdf3(VALUE xx, VALUE aa, VALUE bb,
1425
- double (*f)(double, double, double))
1412
+ VALUE rb_gsl_eval_pdf_cdf3(VALUE xx, VALUE aa, VALUE bb,
1413
+ double (*f)(double, double, double))
1426
1414
  {
1427
1415
  VALUE x, ary;
1428
1416
  double a, b;
1429
1417
  gsl_vector *v = NULL, *vnew = NULL;
1430
1418
  gsl_matrix *m = NULL, *mnew = NULL;
1431
1419
  size_t i, j, n;
1432
- #ifdef HAVE_NARRAY_H
1433
- struct NARRAY *na;
1434
- double *ptr1, *ptr2;
1435
- #endif
1436
1420
  Need_Float(aa); Need_Float(bb);
1437
1421
  a = NUM2DBL(aa); b = NUM2DBL(bb);
1438
1422
  if (CLASS_OF(xx) == rb_cRange) xx = rb_gsl_range2ary(xx);
@@ -1456,6 +1440,8 @@ VALUE rb_gsl_eval_pdf_cdf3(VALUE xx, VALUE aa, VALUE bb,
1456
1440
  default:
1457
1441
  #ifdef HAVE_NARRAY_H
1458
1442
  if (NA_IsNArray(xx)) {
1443
+ struct NARRAY *na;
1444
+ double *ptr1, *ptr2;
1459
1445
  xx = na_change_type(xx, NA_DFLOAT);
1460
1446
  GetNArray(xx, na);
1461
1447
  ptr1 = (double *) na->ptr;
@@ -1470,16 +1456,16 @@ VALUE rb_gsl_eval_pdf_cdf3(VALUE xx, VALUE aa, VALUE bb,
1470
1456
  Data_Get_Struct(xx, gsl_vector, v);
1471
1457
  vnew = gsl_vector_alloc(v->size);
1472
1458
  for (i = 0; i < v->size; i++) {
1473
- gsl_vector_set(vnew, i, (*f)(gsl_vector_get(v, i), a, b));
1459
+ gsl_vector_set(vnew, i, (*f)(gsl_vector_get(v, i), a, b));
1474
1460
  }
1475
1461
  return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, vnew);
1476
1462
  } else if (MATRIX_P(xx)) {
1477
1463
  Data_Get_Struct(xx, gsl_matrix, m);
1478
1464
  mnew = gsl_matrix_alloc(m->size1, m->size2);
1479
1465
  for (i = 0; i < m->size1; i++) {
1480
- for (j = 0; j < m->size2; j++) {
1481
- gsl_matrix_set(mnew, i, j, (*f)(gsl_matrix_get(m, i, j), a, b));
1482
- }
1466
+ for (j = 0; j < m->size2; j++) {
1467
+ gsl_matrix_set(mnew, i, j, (*f)(gsl_matrix_get(m, i, j), a, b));
1468
+ }
1483
1469
  }
1484
1470
  return Data_Wrap_Struct(cgsl_matrix, 0, gsl_matrix_free, mnew);
1485
1471
  } else {
@@ -1491,8 +1477,8 @@ VALUE rb_gsl_eval_pdf_cdf3(VALUE xx, VALUE aa, VALUE bb,
1491
1477
  return Qnil;
1492
1478
  }
1493
1479
 
1494
- VALUE rb_gsl_eval_pdf_cdf2_uint(VALUE xx, VALUE aa,
1495
- double (*f)(unsigned int, double))
1480
+ VALUE rb_gsl_eval_pdf_cdf2_uint(VALUE xx, VALUE aa,
1481
+ double (*f)(unsigned int, double))
1496
1482
  {
1497
1483
  VALUE x, ary;
1498
1484
  double a;
@@ -1501,10 +1487,6 @@ VALUE rb_gsl_eval_pdf_cdf2_uint(VALUE xx, VALUE aa,
1501
1487
  gsl_matrix *m = NULL, *mnew = NULL;
1502
1488
  gsl_matrix_int *mi = NULL;
1503
1489
  size_t i, j, n;
1504
- #ifdef HAVE_NARRAY_H
1505
- struct NARRAY *na;
1506
- char *ptr1, *ptr2;
1507
- #endif
1508
1490
  Need_Float(aa);
1509
1491
  a = NUM2DBL(aa);
1510
1492
  if (CLASS_OF(xx) == rb_cRange) xx = rb_gsl_range2ary(xx);
@@ -1527,6 +1509,8 @@ VALUE rb_gsl_eval_pdf_cdf2_uint(VALUE xx, VALUE aa,
1527
1509
  default:
1528
1510
  #ifdef HAVE_NARRAY_H
1529
1511
  if (NA_IsNArray(xx)) {
1512
+ struct NARRAY *na;
1513
+ char *ptr1, *ptr2;
1530
1514
  GetNArray(xx, na);
1531
1515
  n = na->total;
1532
1516
  ary = na_make_object(na->type, na->rank, na->shape, CLASS_OF(xx));
@@ -1534,13 +1518,13 @@ VALUE rb_gsl_eval_pdf_cdf2_uint(VALUE xx, VALUE aa,
1534
1518
  ptr2 = (char *)NA_STRUCT(ary)->ptr;
1535
1519
  switch (na->type) {
1536
1520
  case NA_LINT:
1537
- for (i = 0; i < n; i++)
1538
- ((int*)ptr2)[i] = (*f)((unsigned int) ((int*)ptr1)[i], a);
1539
- break;
1521
+ for (i = 0; i < n; i++)
1522
+ ((int*)ptr2)[i] = (*f)((unsigned int) ((int*)ptr1)[i], a);
1523
+ break;
1540
1524
  default:
1541
- for (i = 0; i < n; i++)
1542
- ((double*)ptr2)[i] = (*f)((unsigned int) ((double*)ptr1)[i], a);
1543
- break;
1525
+ for (i = 0; i < n; i++)
1526
+ ((double*)ptr2)[i] = (*f)((unsigned int) ((double*)ptr1)[i], a);
1527
+ break;
1544
1528
  }
1545
1529
  return ary;
1546
1530
  }
@@ -1549,32 +1533,32 @@ VALUE rb_gsl_eval_pdf_cdf2_uint(VALUE xx, VALUE aa,
1549
1533
  Data_Get_Struct(xx, gsl_vector, v);
1550
1534
  vnew = gsl_vector_alloc(v->size);
1551
1535
  for (i = 0; i < v->size; i++) {
1552
- gsl_vector_set(vnew, i, (*f)((unsigned int) gsl_vector_get(v, i), a));
1536
+ gsl_vector_set(vnew, i, (*f)((unsigned int) gsl_vector_get(v, i), a));
1553
1537
  }
1554
1538
  return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, vnew);
1555
1539
  } else if (VECTOR_INT_P(xx)) {
1556
1540
  Data_Get_Struct(xx, gsl_vector_int, vi);
1557
1541
  vnew = gsl_vector_alloc(vi->size);
1558
1542
  for (i = 0; i < vi->size; i++) {
1559
- gsl_vector_set(vnew, i, (*f)((unsigned int) gsl_vector_int_get(vi, i), a));
1543
+ gsl_vector_set(vnew, i, (*f)((unsigned int) gsl_vector_int_get(vi, i), a));
1560
1544
  }
1561
1545
  return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, vnew);
1562
1546
  } else if (MATRIX_P(xx)) {
1563
1547
  Data_Get_Struct(xx, gsl_matrix, m);
1564
1548
  mnew = gsl_matrix_alloc(m->size1, m->size2);
1565
1549
  for (i = 0; i < m->size1; i++) {
1566
- for (j = 0; j < m->size2; j++) {
1567
- gsl_matrix_set(mnew, i, j, (*f)((unsigned int) gsl_matrix_get(m, i, j), a));
1568
- }
1550
+ for (j = 0; j < m->size2; j++) {
1551
+ gsl_matrix_set(mnew, i, j, (*f)((unsigned int) gsl_matrix_get(m, i, j), a));
1552
+ }
1569
1553
  }
1570
1554
  return Data_Wrap_Struct(cgsl_matrix, 0, gsl_matrix_free, mnew);
1571
1555
  } else if (MATRIX_INT_P(xx)) {
1572
1556
  Data_Get_Struct(xx, gsl_matrix_int, mi);
1573
1557
  mnew = gsl_matrix_alloc(mi->size1, mi->size2);
1574
1558
  for (i = 0; i < mi->size1; i++) {
1575
- for (j = 0; j < mi->size2; j++) {
1576
- gsl_matrix_set(mnew, i, j, (*f)((unsigned int) gsl_matrix_int_get(mi, i, j), a));
1577
- }
1559
+ for (j = 0; j < mi->size2; j++) {
1560
+ gsl_matrix_set(mnew, i, j, (*f)((unsigned int) gsl_matrix_int_get(mi, i, j), a));
1561
+ }
1578
1562
  }
1579
1563
  return Data_Wrap_Struct(cgsl_matrix, 0, gsl_matrix_free, mnew);
1580
1564
  } else {
@@ -1600,11 +1584,10 @@ static VALUE rb_gsl_ran_erlang_pdf(VALUE obj, VALUE x, VALUE a, VALUE n)
1600
1584
  }
1601
1585
  */
1602
1586
 
1603
- #ifdef GSL_1_8_LATER
1604
1587
 
1605
1588
  static VALUE rb_gsl_ran_gaussian_ziggurat(int argc, VALUE *argv, VALUE obj)
1606
1589
  {
1607
- gsl_rng *r = NULL;
1590
+ gsl_rng *r = NULL;
1608
1591
  gsl_vector *v;
1609
1592
  size_t n, i;
1610
1593
  double sigma = 1.0;
@@ -1615,18 +1598,18 @@ static VALUE rb_gsl_ran_gaussian_ziggurat(int argc, VALUE *argv, VALUE obj)
1615
1598
  n = NUM2INT(argv[2]);
1616
1599
  sigma = NUM2DBL(argv[1]);
1617
1600
  CHECK_RNG(argv[0]);
1618
- Data_Get_Struct(argv[0], gsl_rng, r);
1601
+ Data_Get_Struct(argv[0], gsl_rng, r);
1619
1602
  v = gsl_vector_alloc(n);
1620
- for (i = 0; i < n; i++)
1621
- gsl_vector_set(v, i, gsl_ran_gaussian_ziggurat(r, sigma));
1603
+ for (i = 0; i < n; i++)
1604
+ gsl_vector_set(v, i, gsl_ran_gaussian_ziggurat(r, sigma));
1622
1605
  return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, v);
1623
1606
  break;
1624
1607
  case 2:
1625
1608
  sigma = NUM2DBL(argv[1]);
1626
- /* no break */
1609
+ /* no break */
1627
1610
  case 1:
1628
1611
  CHECK_RNG(argv[0]);
1629
- Data_Get_Struct(argv[0], gsl_rng, r);
1612
+ Data_Get_Struct(argv[0], gsl_rng, r);
1630
1613
  return rb_float_new(gsl_ran_gaussian_ziggurat(r, sigma));
1631
1614
  break;
1632
1615
  default:
@@ -1636,19 +1619,19 @@ static VALUE rb_gsl_ran_gaussian_ziggurat(int argc, VALUE *argv, VALUE obj)
1636
1619
  }
1637
1620
  break;
1638
1621
  default:
1639
- Data_Get_Struct(obj, gsl_rng, r);
1622
+ Data_Get_Struct(obj, gsl_rng, r);
1640
1623
  switch (argc) {
1641
1624
  case 2:
1642
1625
  n = NUM2INT(argv[1]);
1643
1626
  sigma = NUM2DBL(argv[0]);
1644
1627
  v = gsl_vector_alloc(n);
1645
- for (i = 0; i < n; i++)
1646
- gsl_vector_set(v, i, gsl_ran_gaussian_ziggurat(r, sigma));
1628
+ for (i = 0; i < n; i++)
1629
+ gsl_vector_set(v, i, gsl_ran_gaussian_ziggurat(r, sigma));
1647
1630
  return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, v);
1648
1631
  break;
1649
1632
  case 1:
1650
1633
  sigma = NUM2DBL(argv[0]);
1651
- /* no break */
1634
+ /* no break */
1652
1635
  case 0:
1653
1636
  return rb_float_new(gsl_ran_gaussian_ziggurat(r, sigma));
1654
1637
  break;
@@ -1666,7 +1649,6 @@ static VALUE rb_gsl_ran_gamma_mt(int argc, VALUE *argv, VALUE obj)
1666
1649
  {
1667
1650
  return rb_gsl_ran_eval2(argc, argv, obj, gsl_ran_gamma_mt);
1668
1651
  }
1669
- #endif
1670
1652
 
1671
1653
  void Init_gsl_ran(VALUE module)
1672
1654
  {
@@ -1674,18 +1656,18 @@ void Init_gsl_ran(VALUE module)
1674
1656
  VALUE cgsl_ran_discrete;
1675
1657
 
1676
1658
  mgsl_ran = rb_define_module_under(module, "Ran");
1677
-
1659
+
1678
1660
  rb_define_module_function(mgsl_ran, "gaussian", rb_gsl_ran_gaussian, -1);
1679
1661
  rb_define_module_function(mgsl_ran, "ugaussian", rb_gsl_ran_gaussian, -1);
1680
1662
  rb_define_method(cgsl_rng, "gaussian", rb_gsl_ran_gaussian, -1);
1681
1663
  rb_define_alias(cgsl_rng, "ugaussian", "gaussian");
1682
1664
 
1683
- rb_define_module_function(mgsl_ran, "gaussian_ratio_method",
1684
- rb_gsl_ran_gaussian_ratio_method, -1);
1665
+ rb_define_module_function(mgsl_ran, "gaussian_ratio_method",
1666
+ rb_gsl_ran_gaussian_ratio_method, -1);
1685
1667
  rb_define_module_function(mgsl_ran, "ugaussian_ratio_method",
1686
- rb_gsl_ran_gaussian_ratio_method, -1);
1687
- rb_define_method(cgsl_rng, "gaussian_ratio_method",
1688
- rb_gsl_ran_gaussian_ratio_method, -1);
1668
+ rb_gsl_ran_gaussian_ratio_method, -1);
1669
+ rb_define_method(cgsl_rng, "gaussian_ratio_method",
1670
+ rb_gsl_ran_gaussian_ratio_method, -1);
1689
1671
  rb_define_alias(cgsl_rng, "ugaussian_ratio_method", "gaussian_ratio_method");
1690
1672
  rb_define_module_function(mgsl_ran, "gaussian_pdf", rb_gsl_ran_gaussian_pdf, -1);
1691
1673
  rb_define_module_function(mgsl_ran, "ugaussian_pdf", rb_gsl_ran_gaussian_pdf, -1);
@@ -1694,22 +1676,22 @@ void Init_gsl_ran(VALUE module)
1694
1676
  rb_define_module_function(mgsl_ran, "ugaussian_tail", rb_gsl_ran_gaussian_tail, -1);
1695
1677
  rb_define_method(cgsl_rng, "gaussian_tail", rb_gsl_ran_gaussian_tail, -1);
1696
1678
  rb_define_alias(cgsl_rng, "ugaussian_tail", "gaussian_tail");
1697
- rb_define_module_function(mgsl_ran, "gaussian_tail_pdf",
1698
- rb_gsl_ran_gaussian_tail_pdf, -1);
1699
- rb_define_module_function(mgsl_ran, "ugaussian_tail_pdf",
1700
- rb_gsl_ran_gaussian_tail_pdf, -1);
1701
-
1702
- rb_define_module_function(mgsl_ran, "bivariate_gaussian",
1703
- rb_gsl_ran_bivariate_gaussian, -1);
1704
- rb_define_method(cgsl_rng, "bivariate_gaussian",
1705
- rb_gsl_ran_bivariate_gaussian, -1);
1706
- rb_define_module_function(mgsl_ran, "bivariate_gaussian_pdf",
1707
- rb_gsl_ran_bivariate_gaussian_pdf, 5);
1679
+ rb_define_module_function(mgsl_ran, "gaussian_tail_pdf",
1680
+ rb_gsl_ran_gaussian_tail_pdf, -1);
1681
+ rb_define_module_function(mgsl_ran, "ugaussian_tail_pdf",
1682
+ rb_gsl_ran_gaussian_tail_pdf, -1);
1683
+
1684
+ rb_define_module_function(mgsl_ran, "bivariate_gaussian",
1685
+ rb_gsl_ran_bivariate_gaussian, -1);
1686
+ rb_define_method(cgsl_rng, "bivariate_gaussian",
1687
+ rb_gsl_ran_bivariate_gaussian, -1);
1688
+ rb_define_module_function(mgsl_ran, "bivariate_gaussian_pdf",
1689
+ rb_gsl_ran_bivariate_gaussian_pdf, 5);
1708
1690
 
1709
1691
  rb_define_module_function(mgsl_ran, "exponential", rb_gsl_ran_exponential, -1);
1710
1692
  rb_define_method(cgsl_rng, "exponential", rb_gsl_ran_exponential, -1);
1711
- rb_define_module_function(mgsl_ran, "exponential_pdf",
1712
- rb_gsl_ran_exponential_pdf, 2);
1693
+ rb_define_module_function(mgsl_ran, "exponential_pdf",
1694
+ rb_gsl_ran_exponential_pdf, 2);
1713
1695
 
1714
1696
  rb_define_module_function(mgsl_ran, "laplace", rb_gsl_ran_laplace, -1);
1715
1697
  rb_define_method(cgsl_rng, "laplace", rb_gsl_ran_laplace, -1);
@@ -1729,8 +1711,8 @@ void Init_gsl_ran(VALUE module)
1729
1711
 
1730
1712
  rb_define_module_function(mgsl_ran, "rayleigh_tail", rb_gsl_ran_rayleigh_tail, -1);
1731
1713
  rb_define_method(cgsl_rng, "rayleigh_tail", rb_gsl_ran_rayleigh_tail, -1);
1732
- rb_define_module_function(mgsl_ran, "rayleigh_tail_pdf",
1733
- rb_gsl_ran_rayleigh_tail_pdf, 3);
1714
+ rb_define_module_function(mgsl_ran, "rayleigh_tail_pdf",
1715
+ rb_gsl_ran_rayleigh_tail_pdf, 3);
1734
1716
 
1735
1717
  rb_define_module_function(mgsl_ran, "landau", rb_gsl_ran_landau, -1);
1736
1718
  rb_define_method(cgsl_rng, "landau", rb_gsl_ran_landau, -1);
@@ -1799,14 +1781,12 @@ void Init_gsl_ran(VALUE module)
1799
1781
 
1800
1782
  rb_define_module_function(mgsl_ran, "binomial", rb_gsl_ran_binomial, -1);
1801
1783
  rb_define_method(cgsl_rng, "binomial", rb_gsl_ran_binomial, -1);
1802
- #ifdef GSL_1_4_LATER
1803
1784
  rb_define_module_function(mgsl_ran, "binomial_tpe", rb_gsl_ran_binomial_tpe, -1);
1804
1785
  rb_define_method(cgsl_rng, "binomial_tpe", rb_gsl_ran_binomial_tpe, -1);
1805
- #endif
1806
1786
  rb_define_module_function(mgsl_ran, "binomial_pdf", rb_gsl_ran_binomial_pdf, 3);
1807
1787
 
1808
- rb_define_module_function(mgsl_ran, "negative_binomial",
1809
- rb_gsl_ran_negative_binomial, -1);
1788
+ rb_define_module_function(mgsl_ran, "negative_binomial",
1789
+ rb_gsl_ran_negative_binomial, -1);
1810
1790
  rb_define_method(cgsl_rng, "negative_binomial", rb_gsl_ran_negative_binomial, -1);
1811
1791
  rb_define_module_function(mgsl_ran, "negative_binomial_pdf", rb_gsl_ran_negative_binomial_pdf, 3);
1812
1792
 
@@ -1820,17 +1800,17 @@ void Init_gsl_ran(VALUE module)
1820
1800
 
1821
1801
  rb_define_module_function(mgsl_ran, "hypergeometric", rb_gsl_ran_hypergeometric, -1);
1822
1802
  rb_define_method(cgsl_rng, "hypergeometric", rb_gsl_ran_hypergeometric, -1);
1823
- rb_define_module_function(mgsl_ran, "hypergeometric_pdf",
1824
- rb_gsl_ran_hypergeometric_pdf, 4);
1803
+ rb_define_module_function(mgsl_ran, "hypergeometric_pdf",
1804
+ rb_gsl_ran_hypergeometric_pdf, 4);
1825
1805
 
1826
1806
  rb_define_module_function(mgsl_ran, "logarithmic", rb_gsl_ran_logarithmic, -1);
1827
1807
  rb_define_method(cgsl_rng, "logarithmic", rb_gsl_ran_logarithmic, -1);
1828
1808
  rb_define_module_function(mgsl_ran, "logarithmic_pdf",
1829
- rb_gsl_ran_logarithmic_pdf, 2);
1809
+ rb_gsl_ran_logarithmic_pdf, 2);
1830
1810
 
1831
1811
  rb_define_module_function(mgsl_ran, "dir_2d", rb_gsl_ran_dir_2d, -1);
1832
- rb_define_module_function(mgsl_ran, "dir_2d_trig_method",
1833
- rb_gsl_ran_dir_2d_trig_method, -1);
1812
+ rb_define_module_function(mgsl_ran, "dir_2d_trig_method",
1813
+ rb_gsl_ran_dir_2d_trig_method, -1);
1834
1814
  rb_define_module_function(mgsl_ran, "dir_3d", rb_gsl_ran_dir_3d, -1);
1835
1815
  rb_define_module_function(mgsl_ran, "dir_nd", rb_gsl_ran_dir_nd, -1);
1836
1816
 
@@ -1853,21 +1833,16 @@ void Init_gsl_ran(VALUE module)
1853
1833
  rb_define_method(cgsl_rng, "discrete", rb_gsl_ran_discrete, 1);
1854
1834
  rb_define_module_function(mgsl_ran, "discrete_pdf", rb_gsl_ran_discrete_pdf, 2);
1855
1835
 
1856
- #ifdef GSL_1_3_LATER
1857
1836
  rb_define_method(cgsl_rng, "dirichlet", rb_gsl_ran_dirichlet, -1);
1858
1837
  rb_define_module_function(mgsl_ran, "dirichlet_pdf", rb_gsl_ran_dirichlet_pdf, 2);
1859
1838
  rb_define_module_function(mgsl_ran, "dirichlet_lnpdf", rb_gsl_ran_dirichlet_lnpdf, 2);
1860
- #endif
1861
1839
 
1862
1840
  /* rb_define_method(cgsl_rng, "erlang", rb_gsl_ran_erlang, 2);
1863
1841
  rb_define_method(module, "ran_erlang_pdf", rb_gsl_ran_erlang_pdf, 3);
1864
1842
  rb_define_method(mgsl_ran, "erlang_pdf", rb_gsl_ran_erlang_pdf, 3);*/
1865
1843
 
1866
- #ifdef GSL_1_8_LATER
1867
1844
  rb_define_module_function(mgsl_ran, "gaussian_ziggurat", rb_gsl_ran_gaussian_ziggurat, -1);
1868
1845
  rb_define_method(cgsl_rng, "gaussian_ziggurat", rb_gsl_ran_gaussian_ziggurat, -1);
1869
1846
  rb_define_module_function(mgsl_ran, "gamma_mt", rb_gsl_ran_gamma_mt, -1);
1870
1847
  rb_define_method(cgsl_rng, "gamma_mt", rb_gsl_ran_gamma_mt, -1);
1871
- #endif
1872
-
1873
1848
  }