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
@@ -18,9 +18,7 @@ EXTERN VALUE mgsl_linalg;
18
18
  EXTERN VALUE cgsl_complex;
19
19
 
20
20
  static VALUE cgsl_matrix_complex_LU;
21
- #ifdef GSL_1_10_LATER
22
21
  static VALUE cgsl_matrix_complex_C;
23
- #endif
24
22
 
25
23
  VALUE rb_gsl_linalg_complex_LU_decomp(int argc, VALUE *argv, VALUE obj)
26
24
  {
@@ -35,7 +33,7 @@ VALUE rb_gsl_linalg_complex_LU_decomp(int argc, VALUE *argv, VALUE obj)
35
33
  case T_CLASS:
36
34
  case T_OBJECT:
37
35
  if (argc != 1) rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)",
38
- argc);
36
+ argc);
39
37
  CHECK_MATRIX_COMPLEX(argv[0]);
40
38
  Data_Get_Struct(argv[0], gsl_matrix_complex, m);
41
39
  itmp = 1;
@@ -81,7 +79,7 @@ VALUE rb_gsl_linalg_complex_LU_decomp2(int argc, VALUE *argv, VALUE obj)
81
79
  case T_CLASS:
82
80
  case T_OBJECT:
83
81
  if (argc != 1) rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)",
84
- argc);
82
+ argc);
85
83
  CHECK_MATRIX_COMPLEX(argv[0]);
86
84
  Data_Get_Struct(argv[0], gsl_matrix_complex, m);
87
85
  itmp = 1;
@@ -100,13 +98,13 @@ VALUE rb_gsl_linalg_complex_LU_decomp2(int argc, VALUE *argv, VALUE obj)
100
98
  p = gsl_permutation_alloc(size);
101
99
  gsl_linalg_complex_LU_decomp(mnew, p, &signum);
102
100
  obj2 = Data_Wrap_Struct(cgsl_permutation, 0, gsl_permutation_free, p);
103
- return rb_ary_new3(3, objm ,obj2, INT2FIX(signum));
101
+ return rb_ary_new3(3, objm,obj2, INT2FIX(signum));
104
102
  break;
105
103
  case 1: /* when a permutation object is given */
106
104
  CHECK_PERMUTATION(argv[itmp]);
107
105
  Data_Get_Struct(argv[itmp], gsl_permutation, p);
108
106
  gsl_linalg_complex_LU_decomp(m, p, &signum);
109
- return rb_ary_new3(3, objm , argv[itmp], INT2FIX(signum));
107
+ return rb_ary_new3(3, objm, argv[itmp], INT2FIX(signum));
110
108
  break;
111
109
  default:
112
110
  rb_raise(rb_eArgError, "Usage: LU_decomp!() or LU_decomp!(permutation)");
@@ -119,14 +117,13 @@ static VALUE rb_gsl_linalg_complex_LU_solve(int argc, VALUE *argv, VALUE obj)
119
117
  gsl_permutation *p = NULL;
120
118
  gsl_vector_complex *b = NULL, *x = NULL;
121
119
  int flagm = 0, flagx = 0, itmp, signum;
122
-
120
+
123
121
  switch (TYPE(obj)) {
124
122
  case T_MODULE:
125
123
  case T_CLASS:
126
124
  case T_OBJECT:
127
- if (argc < 2 || argc > 4)
125
+ if (argc < 2 || argc > 4)
128
126
  rb_raise(rb_eArgError, "Usage: solve(m, b), solve(m, b, x), solve(lu, p, b), solve(lu, p, b, x)");
129
-
130
127
  CHECK_MATRIX(argv[0]);
131
128
  Data_Get_Struct(argv[0], gsl_matrix_complex, m);
132
129
  if (CLASS_OF(argv[0]) != cgsl_matrix_complex_LU) {
@@ -139,7 +136,7 @@ static VALUE rb_gsl_linalg_complex_LU_solve(int argc, VALUE *argv, VALUE obj)
139
136
  itmp = 1;
140
137
  break;
141
138
  default:
142
- if (argc < 1 || argc > 3)
139
+ if (argc < 1 || argc > 3)
143
140
  rb_raise(rb_eArgError, "Usage: LU_solve(b), LU_solve(p, b), LU_solve(b, x), solve(p, b, x)");
144
141
  Data_Get_Struct(obj, gsl_matrix_complex, m);
145
142
  if (CLASS_OF(obj) != cgsl_matrix_complex_LU) {
@@ -185,7 +182,7 @@ static VALUE rb_gsl_linalg_complex_LU_svx(int argc, VALUE *argv, VALUE obj)
185
182
  gsl_permutation *p = NULL;
186
183
  gsl_vector_complex *x = NULL;
187
184
  int flagm = 0, itmp, signum;
188
-
185
+
189
186
  switch (TYPE(obj)) {
190
187
  case T_MODULE:
191
188
  case T_CLASS:
@@ -232,8 +229,8 @@ static VALUE rb_gsl_linalg_complex_LU_svx(int argc, VALUE *argv, VALUE obj)
232
229
  }
233
230
 
234
231
  static VALUE rb_gsl_linalg_complex_LU_refine(VALUE obj, VALUE vm,
235
- VALUE lu, VALUE pp, VALUE bb,
236
- VALUE xx)
232
+ VALUE lu, VALUE pp, VALUE bb,
233
+ VALUE xx)
237
234
  {
238
235
  gsl_matrix_complex *m = NULL, *mlu = NULL;
239
236
  gsl_permutation *p = NULL;
@@ -306,7 +303,6 @@ static VALUE rb_gsl_linalg_complex_LU_invert(int argc, VALUE *argv, VALUE obj)
306
303
  }
307
304
  return Data_Wrap_Struct(cgsl_matrix_complex, 0, gsl_matrix_complex_free, inverse);
308
305
  }
309
- #ifdef GSL_1_1_1_LATER
310
306
  static VALUE rb_gsl_linalg_complex_LU_det(int argc, VALUE *argv, VALUE obj)
311
307
  {
312
308
  gsl_matrix_complex *m = NULL, *mtmp = NULL;
@@ -389,7 +385,7 @@ static VALUE rb_gsl_linalg_complex_LU_lndet(int argc, VALUE *argv, VALUE obj)
389
385
  if (flagm == 1) {
390
386
  p = gsl_permutation_alloc(m->size1);
391
387
  gsl_linalg_complex_LU_decomp(mtmp, p, &signum);
392
- }
388
+ }
393
389
  lndet = gsl_linalg_complex_LU_lndet(mtmp);
394
390
  if (flagm == 1) {
395
391
  gsl_matrix_complex_free(mtmp);
@@ -446,9 +442,6 @@ static VALUE rb_gsl_linalg_complex_LU_sgndet(int argc, VALUE *argv, VALUE obj)
446
442
  }
447
443
  return vz;
448
444
  }
449
- #endif
450
-
451
- #ifdef GSL_1_10_LATER
452
445
 
453
446
  static VALUE rb_gsl_linalg_cholesky_decomp(int argc, VALUE *argv, VALUE obj)
454
447
  {
@@ -456,7 +449,7 @@ static VALUE rb_gsl_linalg_cholesky_decomp(int argc, VALUE *argv, VALUE obj)
456
449
  switch(TYPE(obj)) {
457
450
  case T_MODULE: case T_CLASS: case T_OBJECT:
458
451
  if (argc != 1) rb_raise(rb_eArgError, "wrong number of argument (%d for 1)",
459
- argc);
452
+ argc);
460
453
  CHECK_MATRIX_COMPLEX(argv[0]);
461
454
  Data_Get_Struct(argv[0], gsl_matrix_complex, Atmp);
462
455
  break;
@@ -479,13 +472,13 @@ static VALUE rb_gsl_linalg_cholesky_solve(int argc, VALUE *argv, VALUE obj)
479
472
  switch(TYPE(obj)) {
480
473
  case T_MODULE: case T_CLASS: case T_OBJECT:
481
474
  if (argc != 2) rb_raise(rb_eArgError, "wrong number of argument (%d for 2)",
482
- argc);
475
+ argc);
483
476
  vA = argv[0];
484
477
  vb = argv[1];
485
478
  break;
486
479
  default:
487
480
  if (argc != 1) rb_raise(rb_eArgError, "wrong number of argument (%d for 1)",
488
- argc);
481
+ argc);
489
482
  vA = obj;
490
483
  vb = argv[0];
491
484
  break;
@@ -519,13 +512,13 @@ static VALUE rb_gsl_linalg_cholesky_svx(int argc, VALUE *argv, VALUE obj)
519
512
  switch(TYPE(obj)) {
520
513
  case T_MODULE: case T_CLASS: case T_OBJECT:
521
514
  if (argc != 2) rb_raise(rb_eArgError, "wrong number of argument (%d for 2)",
522
- argc);
515
+ argc);
523
516
  vA = argv[0];
524
517
  vb = argv[1];
525
518
  break;
526
519
  default:
527
520
  if (argc != 1) rb_raise(rb_eArgError, "wrong number of argument (%d for 1)",
528
- argc);
521
+ argc);
529
522
  vA = obj;
530
523
  vb = argv[0];
531
524
  break;
@@ -572,7 +565,7 @@ static VALUE rb_gsl_linalg_complex_householder_hm(VALUE obj, VALUE t, VALUE vv,
572
565
  gsl_vector_complex *v = NULL;
573
566
  gsl_complex *tau;
574
567
  gsl_matrix_complex *A = NULL;
575
- CHECK_COMPLEX(t);
568
+ CHECK_COMPLEX(t);
576
569
  CHECK_VECTOR_COMPLEX(vv);
577
570
  CHECK_MATRIX_COMPLEX(aa);
578
571
  Data_Get_Struct(t, gsl_complex, tau);
@@ -587,7 +580,7 @@ static VALUE rb_gsl_linalg_complex_householder_mh(VALUE obj, VALUE t, VALUE vv,
587
580
  gsl_vector_complex *v = NULL;
588
581
  gsl_complex *tau;
589
582
  gsl_matrix_complex *A = NULL;
590
- CHECK_COMPLEX(t);
583
+ CHECK_COMPLEX(t);
591
584
  CHECK_VECTOR_COMPLEX(vv);
592
585
  CHECK_MATRIX_COMPLEX(aa);
593
586
  Data_Get_Struct(t, gsl_complex, tau);
@@ -601,7 +594,7 @@ static VALUE rb_gsl_linalg_complex_householder_hv(VALUE obj, VALUE t, VALUE vv,
601
594
  {
602
595
  gsl_vector_complex *v = NULL, *w = NULL;
603
596
  gsl_complex *tau;
604
- CHECK_COMPLEX(t);
597
+ CHECK_COMPLEX(t);
605
598
  CHECK_VECTOR_COMPLEX(vv);
606
599
  CHECK_VECTOR_COMPLEX(ww);
607
600
  Data_Get_Struct(t, gsl_complex, tau);
@@ -610,103 +603,97 @@ static VALUE rb_gsl_linalg_complex_householder_hv(VALUE obj, VALUE t, VALUE vv,
610
603
  gsl_linalg_complex_householder_hv(*tau, v, w);
611
604
  return ww;
612
605
  }
613
- #endif
614
606
 
615
607
  void Init_gsl_linalg_complex(VALUE module)
616
608
  {
617
609
  VALUE mgsl_linalg_complex;
618
610
  VALUE mgsl_linalg_complex_LU;
619
- #ifdef GSL_1_10_LATER
620
611
  VALUE mgsl_linalg_complex_chol, mgsl_linalg_complex_Householder;
621
- #endif
622
612
 
623
613
  mgsl_linalg_complex = rb_define_module_under(module, "Complex");
624
614
  mgsl_linalg_complex_LU = rb_define_module_under(mgsl_linalg_complex, "LU");
625
615
 
626
616
  cgsl_matrix_complex_LU = rb_define_class_under(mgsl_linalg_complex_LU,
627
- "LUMatrix", cgsl_matrix_complex);
617
+ "LUMatrix", cgsl_matrix_complex);
628
618
 
629
619
  rb_define_singleton_method(mgsl_linalg_complex, "LU_decomp!",
630
- rb_gsl_linalg_complex_LU_decomp, -1);
620
+ rb_gsl_linalg_complex_LU_decomp, -1);
631
621
  rb_define_singleton_method(mgsl_linalg_complex_LU, "decomp!",
632
- rb_gsl_linalg_complex_LU_decomp, -1);
633
- rb_define_method(cgsl_matrix_complex, "LU_decomp!",
634
- rb_gsl_linalg_complex_LU_decomp, -1);
622
+ rb_gsl_linalg_complex_LU_decomp, -1);
623
+ rb_define_method(cgsl_matrix_complex, "LU_decomp!",
624
+ rb_gsl_linalg_complex_LU_decomp, -1);
635
625
  rb_define_alias(cgsl_matrix_complex, "decomp!", "LU_decomp!");
636
626
 
637
627
  rb_define_singleton_method(mgsl_linalg_complex, "LU_decomp",
638
- rb_gsl_linalg_complex_LU_decomp2, -1);
628
+ rb_gsl_linalg_complex_LU_decomp2, -1);
639
629
  rb_define_singleton_method(mgsl_linalg_complex_LU, "decomp",
640
- rb_gsl_linalg_complex_LU_decomp2, -1);
641
- rb_define_method(cgsl_matrix_complex, "LU_decomp",
642
- rb_gsl_linalg_complex_LU_decomp2, -1);
630
+ rb_gsl_linalg_complex_LU_decomp2, -1);
631
+ rb_define_method(cgsl_matrix_complex, "LU_decomp",
632
+ rb_gsl_linalg_complex_LU_decomp2, -1);
643
633
  rb_define_alias(cgsl_matrix_complex, "decomp", "LU_decomp");
644
634
 
645
635
  rb_define_singleton_method(mgsl_linalg_complex, "LU_solve",
646
- rb_gsl_linalg_complex_LU_solve, -1);
636
+ rb_gsl_linalg_complex_LU_solve, -1);
647
637
  rb_define_singleton_method(mgsl_linalg_complex_LU, "solve",
648
- rb_gsl_linalg_complex_LU_solve, -1);
649
- rb_define_method(cgsl_matrix_complex, "LU_solve",
650
- rb_gsl_linalg_complex_LU_solve, -1);
651
- rb_define_method(cgsl_matrix_complex_LU, "solve",
652
- rb_gsl_linalg_complex_LU_solve, -1);
638
+ rb_gsl_linalg_complex_LU_solve, -1);
639
+ rb_define_method(cgsl_matrix_complex, "LU_solve",
640
+ rb_gsl_linalg_complex_LU_solve, -1);
641
+ rb_define_method(cgsl_matrix_complex_LU, "solve",
642
+ rb_gsl_linalg_complex_LU_solve, -1);
653
643
 
654
644
  rb_define_singleton_method(mgsl_linalg_complex, "LU_svx",
655
- rb_gsl_linalg_complex_LU_svx, -1);
645
+ rb_gsl_linalg_complex_LU_svx, -1);
656
646
  rb_define_singleton_method(mgsl_linalg_complex_LU, "svx",
657
- rb_gsl_linalg_complex_LU_svx, -1);
658
- rb_define_method(cgsl_matrix_complex, "LU_svx",
659
- rb_gsl_linalg_complex_LU_svx, -1);
660
- rb_define_method(cgsl_matrix_complex_LU, "svx",
661
- rb_gsl_linalg_complex_LU_svx, -1);
647
+ rb_gsl_linalg_complex_LU_svx, -1);
648
+ rb_define_method(cgsl_matrix_complex, "LU_svx",
649
+ rb_gsl_linalg_complex_LU_svx, -1);
650
+ rb_define_method(cgsl_matrix_complex_LU, "svx",
651
+ rb_gsl_linalg_complex_LU_svx, -1);
662
652
 
663
653
  rb_define_singleton_method(mgsl_linalg_complex, "LU_refine",
664
- rb_gsl_linalg_complex_LU_refine, 5);
654
+ rb_gsl_linalg_complex_LU_refine, 5);
665
655
  rb_define_singleton_method(mgsl_linalg_complex_LU, "refine",
666
- rb_gsl_linalg_complex_LU_refine, 5);
656
+ rb_gsl_linalg_complex_LU_refine, 5);
667
657
 
668
658
  rb_define_singleton_method(mgsl_linalg_complex, "LU_invert",
669
- rb_gsl_linalg_complex_LU_invert, -1);
659
+ rb_gsl_linalg_complex_LU_invert, -1);
670
660
  rb_define_singleton_method(mgsl_linalg_complex_LU, "invert",
671
- rb_gsl_linalg_complex_LU_invert, -1);
672
- rb_define_method(cgsl_matrix_complex, "LU_invert",
673
- rb_gsl_linalg_complex_LU_invert, -1);
661
+ rb_gsl_linalg_complex_LU_invert, -1);
662
+ rb_define_method(cgsl_matrix_complex, "LU_invert",
663
+ rb_gsl_linalg_complex_LU_invert, -1);
674
664
  rb_define_alias(cgsl_matrix_complex, "invert", "LU_invert");
675
665
  rb_define_alias(cgsl_matrix_complex, "inv", "LU_invert");
676
- rb_define_method(cgsl_matrix_complex_LU, "invert",
677
- rb_gsl_linalg_complex_LU_invert, -1);
678
-
679
- #ifdef GSL_1_1_1_LATER
680
- rb_define_singleton_method(mgsl_linalg_complex, "LU_det",
681
- rb_gsl_linalg_complex_LU_det, -1);
682
- rb_define_singleton_method(mgsl_linalg_complex_LU, "det",
683
- rb_gsl_linalg_complex_LU_det, -1);
666
+ rb_define_method(cgsl_matrix_complex_LU, "invert",
667
+ rb_gsl_linalg_complex_LU_invert, -1);
668
+
669
+ rb_define_singleton_method(mgsl_linalg_complex, "LU_det",
670
+ rb_gsl_linalg_complex_LU_det, -1);
671
+ rb_define_singleton_method(mgsl_linalg_complex_LU, "det",
672
+ rb_gsl_linalg_complex_LU_det, -1);
684
673
  rb_define_method(cgsl_matrix_complex, "LU_det", rb_gsl_linalg_complex_LU_det, -1);
685
674
  rb_define_alias(cgsl_matrix_complex, "det", "LU_det");
686
675
  rb_define_method(cgsl_matrix_complex_LU, "det", rb_gsl_linalg_complex_LU_det, -1);
687
676
 
688
- rb_define_singleton_method(mgsl_linalg_complex, "LU_lndet",
689
- rb_gsl_linalg_complex_LU_lndet, -1);
690
- rb_define_singleton_method(mgsl_linalg_complex_LU, "lndet",
691
- rb_gsl_linalg_complex_LU_lndet, -1);
677
+ rb_define_singleton_method(mgsl_linalg_complex, "LU_lndet",
678
+ rb_gsl_linalg_complex_LU_lndet, -1);
679
+ rb_define_singleton_method(mgsl_linalg_complex_LU, "lndet",
680
+ rb_gsl_linalg_complex_LU_lndet, -1);
692
681
  rb_define_method(cgsl_matrix_complex, "LU_lndet", rb_gsl_linalg_complex_LU_lndet, -1);
693
682
  rb_define_alias(cgsl_matrix_complex, "lndet", "LU_lndet");
694
683
  rb_define_method(cgsl_matrix_complex_LU, "LU_lndet", rb_gsl_linalg_complex_LU_lndet, -1);
695
684
 
696
- rb_define_singleton_method(mgsl_linalg_complex, "LU_sgndet",
697
- rb_gsl_linalg_complex_LU_sgndet, -1);
698
- rb_define_singleton_method(mgsl_linalg_complex_LU, "sgndet",
699
- rb_gsl_linalg_complex_LU_sgndet, -1);
685
+ rb_define_singleton_method(mgsl_linalg_complex, "LU_sgndet",
686
+ rb_gsl_linalg_complex_LU_sgndet, -1);
687
+ rb_define_singleton_method(mgsl_linalg_complex_LU, "sgndet",
688
+ rb_gsl_linalg_complex_LU_sgndet, -1);
700
689
  rb_define_method(cgsl_matrix_complex, "LU_sgndet", rb_gsl_linalg_complex_LU_sgndet, -1);
701
690
  rb_define_alias(cgsl_matrix_complex, "sgndet", "LU_sgndet");
702
691
  rb_define_method(cgsl_matrix_complex_LU, "LU_sgndet", rb_gsl_linalg_complex_LU_sgndet, -1);
703
- #endif
704
692
 
705
- #ifdef GSL_1_10_LATER
706
693
  mgsl_linalg_complex_chol = rb_define_module_under(mgsl_linalg_complex, "Cholesky");
707
- cgsl_matrix_complex_C = rb_define_class_under(mgsl_linalg_complex_chol, "CholeskyMatrix", cgsl_matrix_complex);
694
+ cgsl_matrix_complex_C = rb_define_class_under(mgsl_linalg_complex_chol, "CholeskyMatrix", cgsl_matrix_complex);
708
695
  rb_define_singleton_method(mgsl_linalg_complex_chol, "decomp", rb_gsl_linalg_cholesky_decomp, -1);
709
- rb_define_method(cgsl_matrix_complex, "cholesky_decomp", rb_gsl_linalg_cholesky_decomp, -1);
696
+ rb_define_method(cgsl_matrix_complex, "cholesky_decomp", rb_gsl_linalg_cholesky_decomp, -1);
710
697
  rb_define_singleton_method(mgsl_linalg_complex_chol, "solve", rb_gsl_linalg_cholesky_solve, -1);
711
698
  rb_define_method(cgsl_matrix_complex, "cholesky_solve", rb_gsl_linalg_cholesky_solve, -1);
712
699
  rb_define_method(cgsl_matrix_complex_C, "solve", rb_gsl_linalg_cholesky_solve, -1);
@@ -715,26 +702,25 @@ void Init_gsl_linalg_complex(VALUE module)
715
702
  rb_define_method(cgsl_matrix_complex_C, "svx", rb_gsl_linalg_cholesky_svx, -1);
716
703
 
717
704
  mgsl_linalg_complex_Householder = rb_define_module_under(mgsl_linalg_complex, "Householder");
718
- rb_define_singleton_method(mgsl_linalg_complex, "householder_transform",
719
- rb_gsl_linalg_complex_householder_transform, -1);
720
- rb_define_singleton_method(mgsl_linalg_complex_Householder, "transform",
721
- rb_gsl_linalg_complex_householder_transform, -1);
722
- rb_define_method(cgsl_vector_complex, "householder_transform",
723
- rb_gsl_linalg_complex_householder_transform, -1);
724
-
725
- rb_define_singleton_method(mgsl_linalg_complex, "householder_hm",
726
- rb_gsl_linalg_complex_householder_hm, 3);
727
- rb_define_singleton_method(mgsl_linalg_complex_Householder, "hm",
728
- rb_gsl_linalg_complex_householder_hm, 3);
729
-
730
- rb_define_singleton_method(mgsl_linalg_complex, "householder_mh",
731
- rb_gsl_linalg_complex_householder_mh, 3);
732
- rb_define_singleton_method(mgsl_linalg_complex_Householder, "mh",
733
- rb_gsl_linalg_complex_householder_mh, 3);
734
-
735
- rb_define_singleton_method(mgsl_linalg_complex, "householder_hv",
736
- rb_gsl_linalg_complex_householder_hv, 3);
737
- rb_define_singleton_method(mgsl_linalg_complex_Householder, "hv",
738
- rb_gsl_linalg_complex_householder_hv, 3);
739
- #endif
705
+ rb_define_singleton_method(mgsl_linalg_complex, "householder_transform",
706
+ rb_gsl_linalg_complex_householder_transform, -1);
707
+ rb_define_singleton_method(mgsl_linalg_complex_Householder, "transform",
708
+ rb_gsl_linalg_complex_householder_transform, -1);
709
+ rb_define_method(cgsl_vector_complex, "householder_transform",
710
+ rb_gsl_linalg_complex_householder_transform, -1);
711
+
712
+ rb_define_singleton_method(mgsl_linalg_complex, "householder_hm",
713
+ rb_gsl_linalg_complex_householder_hm, 3);
714
+ rb_define_singleton_method(mgsl_linalg_complex_Householder, "hm",
715
+ rb_gsl_linalg_complex_householder_hm, 3);
716
+
717
+ rb_define_singleton_method(mgsl_linalg_complex, "householder_mh",
718
+ rb_gsl_linalg_complex_householder_mh, 3);
719
+ rb_define_singleton_method(mgsl_linalg_complex_Householder, "mh",
720
+ rb_gsl_linalg_complex_householder_mh, 3);
721
+
722
+ rb_define_singleton_method(mgsl_linalg_complex, "householder_hv",
723
+ rb_gsl_linalg_complex_householder_hv, 3);
724
+ rb_define_singleton_method(mgsl_linalg_complex_Householder, "hv",
725
+ rb_gsl_linalg_complex_householder_hv, 3);
740
726
  }
@@ -12,9 +12,6 @@
12
12
 
13
13
  #include "include/rb_gsl_math.h"
14
14
  #include "include/rb_gsl_complex.h"
15
- #ifdef HAVE_NARRAY_H
16
- #include "narray.h"
17
- #endif
18
15
 
19
16
  static void rb_gsl_define_const(VALUE module);
20
17
 
@@ -124,15 +121,15 @@ VALUE rb_gsl_math_complex_eval(gsl_complex (*func)(gsl_complex), VALUE obj)
124
121
  mnew = gsl_matrix_complex_alloc(m->size1, m->size2);
125
122
  for (i = 0; i < m->size1; i++) {
126
123
  for (j = 0; j < m->size2; j++) {
127
- gsl_matrix_complex_set(mnew, i, j, (*func)(gsl_matrix_complex_get(m, i, j)));
124
+ gsl_matrix_complex_set(mnew, i, j, (*func)(gsl_matrix_complex_get(m, i, j)));
128
125
  }
129
126
  }
130
127
  return Data_Wrap_Struct(cgsl_matrix_complex, 0, gsl_matrix_complex_free, mnew);
131
128
  } else {
132
- rb_raise(rb_eTypeError,
133
- "wrong argument type %s "
134
- " (GSL::Complex or GSL::Vector::Complex expected)",
135
- rb_class2name(CLASS_OF(obj)));
129
+ rb_raise(rb_eTypeError,
130
+ "wrong argument type %s "
131
+ " (GSL::Complex or GSL::Vector::Complex expected)",
132
+ rb_class2name(CLASS_OF(obj)));
136
133
  }
137
134
  }
138
135
 
@@ -140,10 +137,6 @@ static VALUE rb_gsl_math_eval(double (*func)(const double), VALUE xx)
140
137
  {
141
138
  VALUE x, ary;
142
139
  size_t i, size;
143
- #ifdef HAVE_NARRAY_H
144
- struct NARRAY *na;
145
- double *ptr1, *ptr2;
146
- #endif
147
140
  if (CLASS_OF(xx) == rb_cRange) xx = rb_gsl_range2ary(xx);
148
141
  switch (TYPE(xx)) {
149
142
  case T_FIXNUM:
@@ -165,6 +158,8 @@ static VALUE rb_gsl_math_eval(double (*func)(const double), VALUE xx)
165
158
  default:
166
159
  #ifdef HAVE_NARRAY_H
167
160
  if (NA_IsNArray(xx)) {
161
+ struct NARRAY *na;
162
+ double *ptr1, *ptr2;
168
163
  GetNArray(xx, na);
169
164
  ptr1 = (double*) na->ptr;
170
165
  size = na->total;
@@ -188,18 +183,14 @@ static VALUE rb_gsl_math_eval(double (*func)(const double), VALUE xx)
188
183
  }
189
184
 
190
185
  static VALUE rb_gsl_math_eval2(double (*func)(const double, const double), VALUE xx,
191
- VALUE yy);
186
+ VALUE yy);
192
187
  static VALUE rb_gsl_math_eval2(double (*func)(const double, const double), VALUE xx,
193
- VALUE yy)
188
+ VALUE yy)
194
189
  {
195
190
  VALUE x, y, ary;
196
191
  size_t i, j, size;
197
192
  gsl_vector *v = NULL, *v2 = NULL, *vnew = NULL;
198
193
  gsl_matrix *m = NULL, *m2 = NULL, *mnew = NULL;
199
- #ifdef HAVE_NARRAY_H
200
- struct NARRAY *nax, *nay;
201
- double *ptr1, *ptr2, *ptr3;
202
- #endif
203
194
  if (CLASS_OF(xx) == rb_cRange) xx = rb_gsl_range2ary(xx);
204
195
  switch (TYPE(xx)) {
205
196
  case T_FIXNUM:
@@ -226,6 +217,8 @@ static VALUE rb_gsl_math_eval2(double (*func)(const double, const double), VALUE
226
217
  default:
227
218
  #ifdef HAVE_NARRAY_H
228
219
  if (NA_IsNArray(xx)) {
220
+ struct NARRAY *nax, *nay;
221
+ double *ptr1, *ptr2, *ptr3;
229
222
  GetNArray(xx, nax);
230
223
  GetNArray(yy, nay);
231
224
  ptr1 = (double*) nax->ptr;
@@ -243,7 +236,7 @@ static VALUE rb_gsl_math_eval2(double (*func)(const double, const double), VALUE
243
236
  Data_Get_Struct(yy, gsl_vector, v2);
244
237
  vnew = gsl_vector_alloc(v->size);
245
238
  for (i = 0; i < v->size; i++) {
246
- gsl_vector_set(vnew, i, (*func)(gsl_vector_get(v, i), gsl_vector_get(v2, i)));
239
+ gsl_vector_set(vnew, i, (*func)(gsl_vector_get(v, i), gsl_vector_get(v2, i)));
247
240
  }
248
241
  return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, vnew);
249
242
  } else if (MATRIX_P(xx)) {
@@ -252,15 +245,15 @@ static VALUE rb_gsl_math_eval2(double (*func)(const double, const double), VALUE
252
245
  Data_Get_Struct(yy, gsl_matrix, m2);
253
246
  mnew = gsl_matrix_alloc(m->size1, m->size2);
254
247
  for (i = 0; i < m->size1; i++) {
255
- for (j = 0; j < m->size2; j++) {
256
- gsl_matrix_set(mnew, i, j, (*func)(gsl_matrix_get(m, i, j), gsl_matrix_get(m2, i, j)));
257
- }
248
+ for (j = 0; j < m->size2; j++) {
249
+ gsl_matrix_set(mnew, i, j, (*func)(gsl_matrix_get(m, i, j), gsl_matrix_get(m2, i, j)));
250
+ }
258
251
  }
259
252
  return Data_Wrap_Struct(cgsl_matrix, 0, gsl_matrix_free, mnew);
260
253
  } else {
261
- rb_raise(rb_eTypeError,
262
- "wrong argument type %s "
263
- "(Array or Vector or Matrix expected)", rb_class2name(CLASS_OF(xx)));
254
+ rb_raise(rb_eTypeError,
255
+ "wrong argument type %s "
256
+ "(Array or Vector or Matrix expected)", rb_class2name(CLASS_OF(xx)));
264
257
  }
265
258
  break;
266
259
  }
@@ -287,32 +280,32 @@ static VALUE rb_gsl_hypot(VALUE obj, VALUE x, VALUE y)
287
280
  {
288
281
  return rb_gsl_math_eval2(gsl_hypot, x, y);
289
282
  }
290
- #ifdef GSL_1_10_LATER
283
+
291
284
  static VALUE rb_gsl_hypot3(VALUE obj, VALUE x, VALUE y, VALUE z)
292
285
  {
293
286
  Need_Float(x);
294
287
  Need_Float(y);
295
- Need_Float(z);
288
+ Need_Float(z);
296
289
  return rb_float_new(gsl_hypot3(NUM2DBL(x), NUM2DBL(y), NUM2DBL(z)));
297
290
  }
298
- #endif
291
+
299
292
  static VALUE rb_gsl_acosh(VALUE obj, VALUE x)
300
293
  {
301
- if (COMPLEX_P(x) || VECTOR_COMPLEX_P(x) || MATRIX_COMPLEX_P(x))
294
+ if (COMPLEX_P(x) || VECTOR_COMPLEX_P(x) || MATRIX_COMPLEX_P(x))
302
295
  return rb_gsl_math_complex_eval(gsl_complex_arccosh, x);
303
296
  return rb_gsl_math_eval(gsl_acosh, x);
304
297
  }
305
298
 
306
299
  static VALUE rb_gsl_asinh(VALUE obj, VALUE x)
307
300
  {
308
- if (COMPLEX_P(x) || VECTOR_COMPLEX_P(x) || MATRIX_COMPLEX_P(x))
301
+ if (COMPLEX_P(x) || VECTOR_COMPLEX_P(x) || MATRIX_COMPLEX_P(x))
309
302
  return rb_gsl_math_complex_eval(gsl_complex_arcsinh, x);
310
303
  return rb_gsl_math_eval(gsl_asinh, x);
311
304
  }
312
305
 
313
306
  static VALUE rb_gsl_atanh(VALUE obj, VALUE x)
314
307
  {
315
- if (COMPLEX_P(x) || VECTOR_COMPLEX_P(x) || MATRIX_COMPLEX_P(x))
308
+ if (COMPLEX_P(x) || VECTOR_COMPLEX_P(x) || MATRIX_COMPLEX_P(x))
316
309
  return rb_gsl_math_complex_eval(gsl_complex_arctanh, x);
317
310
  return rb_gsl_math_eval(gsl_atanh, x);
318
311
  }
@@ -328,10 +321,6 @@ VALUE rb_gsl_pow(VALUE obj, VALUE xx, VALUE nn)
328
321
  double n;
329
322
  gsl_vector *v = NULL, *vnew = NULL;
330
323
  gsl_matrix *m = NULL, *mnew = NULL;
331
- #ifdef HAVE_NARRAY_H
332
- struct NARRAY *na;
333
- double *ptr1, *ptr2;
334
- #endif
335
324
  if (CLASS_OF(xx) == rb_cRange) xx = rb_gsl_range2ary(xx);
336
325
  switch (TYPE(xx)) {
337
326
  case T_FIXNUM:
@@ -353,6 +342,8 @@ VALUE rb_gsl_pow(VALUE obj, VALUE xx, VALUE nn)
353
342
  default:
354
343
  #ifdef HAVE_NARRAY_H
355
344
  if (NA_IsNArray(xx)) {
345
+ struct NARRAY *na;
346
+ double *ptr1, *ptr2;
356
347
  n = NUM2DBL(nn);
357
348
  GetNArray(xx, na);
358
349
  ptr1 = (double*) na->ptr;
@@ -368,21 +359,21 @@ VALUE rb_gsl_pow(VALUE obj, VALUE xx, VALUE nn)
368
359
  Data_Get_Struct(xx, gsl_vector, v);
369
360
  vnew = gsl_vector_alloc(v->size);
370
361
  for (i = 0; i < v->size; i++) {
371
- gsl_vector_set(vnew, i, pow(gsl_vector_get(v, i), n));
362
+ gsl_vector_set(vnew, i, pow(gsl_vector_get(v, i), n));
372
363
  }
373
364
  return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, vnew);
374
- }
365
+ }
375
366
  if (MATRIX_P(xx)) {
376
367
  n = NUM2DBL(nn);
377
368
  Data_Get_Struct(xx, gsl_matrix, m);
378
369
  mnew = gsl_matrix_alloc(m->size1, m->size2);
379
370
  for (i = 0; i < m->size1; i++) {
380
- for (j = 0; j < m->size2; j++) {
381
- gsl_matrix_set(mnew, i, j, pow(gsl_matrix_get(m, i, j), n));
382
- }
371
+ for (j = 0; j < m->size2; j++) {
372
+ gsl_matrix_set(mnew, i, j, pow(gsl_matrix_get(m, i, j), n));
373
+ }
383
374
  }
384
375
  return Data_Wrap_Struct(cgsl_matrix, 0, gsl_matrix_free, mnew);
385
- }
376
+ }
386
377
  if (COMPLEX_P(xx) || VECTOR_COMPLEX_P(xx) || MATRIX_COMPLEX_P(xx)) {
387
378
  argv[0] = xx;
388
379
  argv[1] = nn;
@@ -402,10 +393,6 @@ static VALUE rb_gsl_pow_int(VALUE obj, VALUE xx, VALUE nn)
402
393
  int n;
403
394
  gsl_vector *v = NULL, *vnew = NULL;
404
395
  gsl_matrix *m = NULL, *mnew = NULL;
405
- #ifdef HAVE_NARRAY_H
406
- struct NARRAY *na;
407
- double *ptr1, *ptr2;
408
- #endif
409
396
 
410
397
  if (CLASS_OF(xx) == rb_cRange) xx = rb_gsl_range2ary(xx);
411
398
  switch (TYPE(xx)) {
@@ -430,6 +417,8 @@ static VALUE rb_gsl_pow_int(VALUE obj, VALUE xx, VALUE nn)
430
417
  default:
431
418
  #ifdef HAVE_NARRAY_H
432
419
  if (NA_IsNArray(xx)) {
420
+ struct NARRAY *na;
421
+ double *ptr1, *ptr2;
433
422
  CHECK_FIXNUM(nn);
434
423
  n = FIX2INT(nn);
435
424
  GetNArray(xx, na);
@@ -447,7 +436,7 @@ static VALUE rb_gsl_pow_int(VALUE obj, VALUE xx, VALUE nn)
447
436
  Data_Get_Struct(xx, gsl_vector, v);
448
437
  vnew = gsl_vector_alloc(v->size);
449
438
  for (i = 0; i < v->size; i++) {
450
- gsl_vector_set(vnew, i, gsl_pow_int(gsl_vector_get(v, i), n));
439
+ gsl_vector_set(vnew, i, gsl_pow_int(gsl_vector_get(v, i), n));
451
440
  }
452
441
  return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, vnew);
453
442
  } else if (MATRIX_P(xx)) {
@@ -456,9 +445,9 @@ static VALUE rb_gsl_pow_int(VALUE obj, VALUE xx, VALUE nn)
456
445
  Data_Get_Struct(xx, gsl_matrix, m);
457
446
  mnew = gsl_matrix_alloc(m->size1, m->size2);
458
447
  for (i = 0; i < m->size1; i++) {
459
- for (j = 0; j < m->size2; j++) {
460
- gsl_matrix_set(mnew, i, j, gsl_pow_int(gsl_matrix_get(m, i, j), n));
461
- }
448
+ for (j = 0; j < m->size2; j++) {
449
+ gsl_matrix_set(mnew, i, j, gsl_pow_int(gsl_matrix_get(m, i, j), n));
450
+ }
462
451
  }
463
452
  return Data_Wrap_Struct(cgsl_matrix, 0, gsl_matrix_free, mnew);
464
453
  } else if (COMPLEX_P(xx) || VECTOR_COMPLEX_P(xx) || MATRIX_COMPLEX_P(xx)) {
@@ -556,7 +545,6 @@ static VALUE rb_GSL_MAX(VALUE obj, VALUE aa, VALUE bb)
556
545
  max = GSL_MAX_DBL(a, b);
557
546
  if (gsl_fcmp(max, a, 1.0e-10) == 0) return aa;
558
547
  else return bb;
559
-
560
548
  }
561
549
 
562
550
  static VALUE rb_GSL_MIN(VALUE obj, VALUE aa, VALUE bb)
@@ -587,7 +575,7 @@ static VALUE rb_GSL_MAX_INT(VALUE obj, VALUE aa, VALUE bb)
587
575
  {
588
576
  if (TYPE(aa) != T_FIXNUM || TYPE(bb) != T_FIXNUM)
589
577
  return rb_GSL_MAX(obj, aa, bb);
590
- else
578
+ else
591
579
  return INT2FIX(GSL_MAX_INT(FIX2INT(aa), FIX2INT(bb)));
592
580
  }
593
581
 
@@ -595,11 +583,10 @@ static VALUE rb_GSL_MIN_INT(VALUE obj, VALUE aa, VALUE bb)
595
583
  {
596
584
  if (TYPE(aa) != T_FIXNUM || TYPE(bb) != T_FIXNUM)
597
585
  return rb_GSL_MIN(obj, aa, bb);
598
- return
586
+ return
599
587
  INT2FIX(GSL_MIN_INT(FIX2INT(aa), FIX2INT(bb)));
600
588
  }
601
589
 
602
- #ifdef GSL_1_3_LATER
603
590
  static VALUE rb_gsl_ldexp(VALUE obj, VALUE x, VALUE e)
604
591
  {
605
592
  return rb_float_new(gsl_ldexp(NUM2DBL(x), FIX2INT(e)));
@@ -613,7 +600,6 @@ static VALUE rb_gsl_frexp(VALUE obj, VALUE x)
613
600
  val = gsl_frexp(NUM2DBL(x), &e);
614
601
  return rb_ary_new3(2, rb_float_new(val), INT2FIX(e));
615
602
  }
616
- #endif
617
603
 
618
604
  static VALUE rb_gsl_fcmp(int argc, VALUE *argv, VALUE obj)
619
605
  {
@@ -621,7 +607,7 @@ static VALUE rb_gsl_fcmp(int argc, VALUE *argv, VALUE obj)
621
607
  switch (argc) {
622
608
  case 3:
623
609
  epsilon = NUM2DBL(argv[2]);
624
- /* no break, do next */
610
+ /* no break, do next */
625
611
  case 2:
626
612
  a = NUM2DBL(argv[0]);
627
613
  b = NUM2DBL(argv[1]);
@@ -641,7 +627,7 @@ static VALUE rb_gsl_equal(int argc, VALUE *argv, VALUE obj)
641
627
  switch (argc) {
642
628
  case 3:
643
629
  epsilon = NUM2DBL(argv[2]);
644
- /* no break, do next */
630
+ /* no break, do next */
645
631
  case 2:
646
632
  a = NUM2DBL(argv[0]);
647
633
  b = NUM2DBL(argv[1]);
@@ -668,14 +654,12 @@ void Init_gsl_math(VALUE module)
668
654
  rb_define_module_function(module, "isinf?", rb_gsl_isinf2, 1);
669
655
  rb_define_module_function(module, "finite", rb_gsl_finite, 1);
670
656
  rb_define_module_function(module, "finite?", rb_gsl_finite2, 1);
671
-
657
+
672
658
  rb_define_module_function(module, "sqrt", rb_gsl_sqrt, 1);
673
659
  rb_define_module_function(module, "log1p", rb_gsl_log1p, 1);
674
660
  rb_define_module_function(module, "expm1", rb_gsl_expm1, 1);
675
661
  rb_define_module_function(module, "hypot", rb_gsl_hypot, 2);
676
- #ifdef GSL_1_10_LATER
677
- rb_define_module_function(module, "hypot3", rb_gsl_hypot3, 3);
678
- #endif
662
+ rb_define_module_function(module, "hypot3", rb_gsl_hypot3, 3);
679
663
  rb_define_module_function(module, "acosh", rb_gsl_acosh, 1);
680
664
  rb_define_module_function(module, "asinh", rb_gsl_asinh, 1);
681
665
  rb_define_module_function(module, "atanh", rb_gsl_atanh, 1);
@@ -691,7 +675,7 @@ void Init_gsl_math(VALUE module)
691
675
  rb_define_module_function(module, "pow_9", rb_gsl_pow_9, 1);
692
676
  rb_define_module_function(module, "sign", rb_GSL_SIGN, 1);
693
677
  rb_define_module_function(module, "SIGN", rb_GSL_SIGN, 1);
694
-
678
+
695
679
  rb_define_module_function(module, "is_odd", rb_GSL_IS_ODD, 1);
696
680
  rb_define_module_function(module, "IS_ODD", rb_GSL_IS_ODD, 1);
697
681
  rb_define_module_function(module, "is_odd?", rb_GSL_IS_ODD2, 1);
@@ -717,8 +701,6 @@ void Init_gsl_math(VALUE module)
717
701
 
718
702
  rb_define_module_function(module, "fcmp", rb_gsl_fcmp, -1);
719
703
  rb_define_singleton_method(module, "equal?", rb_gsl_equal, -1);
720
- #ifdef GSL_1_3_LATER
721
704
  rb_define_module_function(module, "ldexp", rb_gsl_ldexp, 2);
722
705
  rb_define_module_function(module, "frexp", rb_gsl_frexp, 1);
723
- #endif
724
706
  }