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
@@ -34,5 +34,5 @@ x1 = GSL::Vector.linspace(0, 20, N/DECIMATE1)
34
34
  x2 = GSL::Vector.linspace(0, 20, N/DECIMATE2)
35
35
 
36
36
  # y1 and y2 are shifted vertically for visual purpose
37
- GSL::graph([x0, y0], [x1, y1-1], [x2, y2-2])
37
+ GSL::graph([x0, y0], [x1, y1-1], [x2, y2-2])
38
38
  END
@@ -9,28 +9,28 @@ require 'gsl/gnuplot';
9
9
  # Plot using gnuplot
10
10
  Gnuplot.open do |gp|
11
11
  Gnuplot::Plot.new( gp ) do |plot|
12
-
12
+
13
13
  plot.xrange "[0:10]"
14
14
  plot.yrange "[-1.5:1.5]"
15
15
  plot.title "Sin Wave Example"
16
16
  plot.xlabel "x"
17
17
  plot.ylabel "sin(x)"
18
18
  plot.pointsize 3
19
- plot.grid
19
+ plot.grid
20
20
 
21
21
  x = GSL::Vector[0..10]
22
22
  y = GSL::Sf::sin(x)
23
23
 
24
24
  plot.data = [
25
25
  Gnuplot::DataSet.new( "sin(x)" ) { |ds|
26
- ds.with = "lines"
27
- ds.title = "String function"
28
- ds.linewidth = 4
26
+ ds.with = "lines"
27
+ ds.title = "String function"
28
+ ds.linewidth = 4
29
29
  },
30
-
30
+
31
31
  Gnuplot::DataSet.new( [x, y] ) { |ds|
32
- ds.with = "linespoints"
33
- ds.title = "Array data"
32
+ ds.with = "linespoints"
33
+ ds.title = "Array data"
34
34
  }
35
35
  ]
36
36
 
@@ -78,8 +78,8 @@ __END__
78
78
 
79
79
  v = GSL::Vector::alloc(10)
80
80
  for i in 1...10 do
81
- v.set(i, i.to_f)
82
- end
81
+ v.set(i, i.to_f)
82
+ end
83
83
  v.print
84
84
 
85
85
  v.swap_elements(3, 5)
@@ -31,7 +31,7 @@ perm = data2.abs.sort_index
31
31
  i = 0
32
32
  while (i + nc) < n
33
33
  data2[perm[i]] = 0.0
34
- i += 1
34
+ i += 1
35
35
  end
36
36
 
37
37
  # Choose as you like...
@@ -19,7 +19,7 @@ static VALUE rb_alf_params(VALUE obj, VALUE csphase, VALUE cnorm, VALUE norm)
19
19
  int ret;
20
20
  Data_Get_Struct(obj, alf_workspace, w);
21
21
  ret = alf_params(FIX2INT(csphase), FIX2INT(cnorm), (alf_norm_t) FIX2INT(norm), w);
22
- return INT2FIX(ret);
22
+ return INT2FIX(ret);
23
23
  }
24
24
 
25
25
  static void define_constants(VALUE klass)
@@ -60,11 +60,11 @@ static VALUE rb_alf_Plm_array(int argc, VALUE *argv, VALUE obj)
60
60
  Data_Get_Struct(argv[1], gsl_vector, res);
61
61
  lmax = w->lmax;
62
62
  if (res->size < alf_array_size(lmax)) {
63
- rb_raise(rb_eRuntimeError, "Vector length is too small. (%d for >= %d\n", (int) res->size,
64
- (int) alf_array_size(lmax));
63
+ rb_raise(rb_eRuntimeError, "Vector length is too small. (%d for >= %d\n", (int) res->size,
64
+ (int) alf_array_size(lmax));
65
65
  }
66
- ret = argv[1];
67
- } else {
66
+ ret = argv[1];
67
+ } else {
68
68
  lmax = FIX2INT(argv[0]);
69
69
  x = NUM2DBL(argv[1]);
70
70
  res = gsl_vector_alloc(alf_array_size(lmax));
@@ -85,8 +85,8 @@ static VALUE rb_alf_Plm_array(int argc, VALUE *argv, VALUE obj)
85
85
  CHECK_VECTOR(argv[2]);
86
86
  Data_Get_Struct(argv[2], gsl_vector, res);
87
87
  if (res->size < alf_array_size(lmax)) {
88
- rb_raise(rb_eRuntimeError, "Vector length is too small. (%d for >= %d\n", (int) res->size,
89
- (int) alf_array_size(lmax));
88
+ rb_raise(rb_eRuntimeError, "Vector length is too small. (%d for >= %d\n", (int) res->size,
89
+ (int) alf_array_size(lmax));
90
90
  }
91
91
  ret = argv[2];
92
92
  }
@@ -155,11 +155,11 @@ static VALUE rb_alf_Plm_deriv_array(int argc, VALUE *argv, VALUE obj)
155
155
  Data_Get_Struct(argv[3], gsl_vector, deriv);
156
156
  if (res->size < alf_array_size(lmax)) {
157
157
  rb_raise(rb_eRuntimeError, "Vector length is too small. (%d for >= %d\n", (int) res->size,
158
- (int) alf_array_size(lmax));
158
+ (int) alf_array_size(lmax));
159
159
  }
160
160
  if (deriv->size < alf_array_size(lmax)) {
161
161
  rb_raise(rb_eRuntimeError, "Vector length is too small. (%d for >= %d\n", (int) res->size,
162
- (int) alf_array_size(lmax));
162
+ (int) alf_array_size(lmax));
163
163
  }
164
164
  ret1 = argv[2];
165
165
  ret2 = argv[3];
@@ -12,9 +12,7 @@
12
12
  #include "include/rb_gsl_common.h"
13
13
  #include "include/rb_gsl_array.h"
14
14
  #include "include/rb_gsl_complex.h"
15
- #ifdef HAVE_NARRAY_H
16
15
  #include "include/rb_gsl_with_narray.h"
17
- #endif
18
16
 
19
17
  /* global variables */
20
18
  VALUE cgsl_block, cgsl_block_int;
@@ -47,9 +45,6 @@ double* get_vector_ptr(VALUE ary, size_t *stride, size_t *n)
47
45
  gsl_vector *v = NULL;
48
46
  gsl_vector_complex *vc = NULL;
49
47
  gsl_matrix *m;
50
- #ifdef HAVE_NARRAY_H
51
- VALUE ary2;
52
- #endif
53
48
  if (VECTOR_P(ary)) {
54
49
  Data_Get_Struct(ary, gsl_vector, v);
55
50
  *stride = v->stride;
@@ -67,6 +62,7 @@ double* get_vector_ptr(VALUE ary, size_t *stride, size_t *n)
67
62
  return m->data;
68
63
  #ifdef HAVE_NARRAY_H
69
64
  } else if (NA_IsNArray(ary)) {
65
+ VALUE ary2;
70
66
  *n = NA_TOTAL(ary);
71
67
  *stride = 1;
72
68
  ary2 = na_change_type(ary, NA_DFLOAT);
@@ -74,7 +70,7 @@ double* get_vector_ptr(VALUE ary, size_t *stride, size_t *n)
74
70
  #endif
75
71
  } else {
76
72
  rb_raise(rb_eTypeError,
77
- "wrong argument type %s", rb_class2name(CLASS_OF(ary)));
73
+ "wrong argument type %s", rb_class2name(CLASS_OF(ary)));
78
74
  }
79
75
  }
80
76
 
@@ -91,7 +87,7 @@ gsl_vector* get_cvector(VALUE obj)
91
87
  rb_raise(rb_eTypeError,
92
88
  "wrong argument type %s", rb_class2name(CLASS_OF(obj)));
93
89
  }
94
- return v;
90
+ return v;
95
91
  }
96
92
 
97
93
  VALUE make_rarray_from_cvector(const gsl_vector *v)
@@ -142,7 +138,7 @@ gsl_vector* get_vector(VALUE ary)
142
138
  return v;
143
139
  } else {
144
140
  rb_raise(rb_eTypeError,
145
- "wrong argument type %s", rb_class2name(CLASS_OF(ary)));
141
+ "wrong argument type %s", rb_class2name(CLASS_OF(ary)));
146
142
  }
147
143
  }
148
144
 
@@ -157,7 +153,7 @@ gsl_vector* make_cvector_from_rarrays(VALUE ary)
157
153
  #endif
158
154
  } else {
159
155
  rb_raise(rb_eTypeError,
160
- "wrong argument type %s", rb_class2name(CLASS_OF(ary)));
156
+ "wrong argument type %s", rb_class2name(CLASS_OF(ary)));
161
157
  }
162
158
  }
163
159
 
@@ -184,7 +180,7 @@ void carray_set_from_rarrays(double *a, VALUE ary)
184
180
  #endif
185
181
  } else {
186
182
  rb_raise(rb_eTypeError,
187
- "wrong argument type %s", rb_class2name(CLASS_OF(ary)));
183
+ "wrong argument type %s", rb_class2name(CLASS_OF(ary)));
188
184
  }
189
185
  }
190
186
 
@@ -274,7 +270,7 @@ VALUE make_matrix_clone2(VALUE vm)
274
270
  mnew = gsl_matrix_alloc(m->size1, m->size2);
275
271
  if (mnew == NULL) rb_raise(rb_eNoMemError, "gsl_matrix_alloc failed");
276
272
  gsl_matrix_memcpy(mnew, m);
277
- return Data_Wrap_Struct(cgsl_matrix, 0, gsl_matrix_free, mnew);;
273
+ return Data_Wrap_Struct(cgsl_matrix, 0, gsl_matrix_free, mnew);
278
274
  }
279
275
 
280
276
  gsl_matrix_complex* make_matrix_complex_clone(const gsl_matrix_complex *m)
@@ -316,8 +312,8 @@ gsl_matrix_complex* matrix_to_complex(const gsl_matrix *m)
316
312
  return cm;
317
313
  }
318
314
 
319
- void gsl_matrix_complex_mul(gsl_matrix_complex *mnew, const gsl_matrix_complex *m,
320
- const gsl_matrix_complex *mb)
315
+ void gsl_matrix_complex_mul(gsl_matrix_complex *mnew, const gsl_matrix_complex *m,
316
+ const gsl_matrix_complex *mb)
321
317
  {
322
318
  gsl_complex a, b, c, sum;
323
319
  size_t i, j, k;
@@ -325,45 +321,45 @@ void gsl_matrix_complex_mul(gsl_matrix_complex *mnew, const gsl_matrix_complex *
325
321
  for (j = 0; j < m->size2; j++) {
326
322
  sum = gsl_complex_rect(0.0, 0.0);
327
323
  for (k = 0; k < m->size2; k++) {
328
- a = gsl_matrix_complex_get(m, j, k);
329
- b = gsl_matrix_complex_get(mb, k, i);
330
- c = gsl_complex_mul(a, b);
331
- sum = gsl_complex_add(sum, c);
324
+ a = gsl_matrix_complex_get(m, j, k);
325
+ b = gsl_matrix_complex_get(mb, k, i);
326
+ c = gsl_complex_mul(a, b);
327
+ sum = gsl_complex_add(sum, c);
332
328
  }
333
329
  gsl_matrix_complex_set(mnew, j, i, sum);
334
330
  }
335
331
  }
336
332
  }
337
333
 
338
- void gsl_matrix_mul_vector(gsl_vector *vnew,
339
- const gsl_matrix *m, const gsl_vector *v)
334
+ void gsl_matrix_mul_vector(gsl_vector *vnew,
335
+ const gsl_matrix *m, const gsl_vector *v)
340
336
  {
341
337
  size_t i, j;
342
338
  double val;
343
339
  for (i = 0; i < m->size1; i++) {
344
340
  val = 0;
345
- for (j = 0; j < m->size2; j++)
341
+ for (j = 0; j < m->size2; j++)
346
342
  val += gsl_matrix_get(m, i, j)*gsl_vector_get(v, j);
347
343
  gsl_vector_set(vnew, i, val);
348
344
  }
349
345
  }
350
346
 
351
- void gsl_matrix_int_mul_vector(gsl_vector_int *vnew,
352
- const gsl_matrix_int *m, const gsl_vector_int *v)
347
+ void gsl_matrix_int_mul_vector(gsl_vector_int *vnew,
348
+ const gsl_matrix_int *m, const gsl_vector_int *v)
353
349
  {
354
350
  size_t i, j;
355
351
  int val;
356
352
  for (i = 0; i < m->size1; i++) {
357
353
  val = 0;
358
- for (j = 0; j < m->size2; j++)
354
+ for (j = 0; j < m->size2; j++)
359
355
  val += gsl_matrix_int_get(m, i, j)*gsl_vector_int_get(v, j);
360
356
  gsl_vector_int_set(vnew, i, val);
361
357
  }
362
358
  }
363
359
 
364
- void gsl_matrix_complex_mul_vector(gsl_vector_complex *vnew,
365
- const gsl_matrix_complex *m,
366
- const gsl_vector_complex *v)
360
+ void gsl_matrix_complex_mul_vector(gsl_vector_complex *vnew,
361
+ const gsl_matrix_complex *m,
362
+ const gsl_vector_complex *v)
367
363
  {
368
364
  gsl_complex a, b, c, sum;
369
365
  size_t i, j;
@@ -377,98 +373,17 @@ void gsl_matrix_complex_mul_vector(gsl_vector_complex *vnew,
377
373
  }
378
374
  gsl_vector_complex_set(vnew, i, sum);
379
375
  }
380
-
381
- }
382
-
383
- /*****/
384
- #ifndef GSL_1_12_LATER
385
- int gsl_vector_complex_add(gsl_vector_complex *cv, const gsl_vector_complex *cv2)
386
- {
387
- size_t i;
388
- gsl_complex a, b, c;
389
- for (i = 0; i < cv->size; i++) {
390
- a = gsl_vector_complex_get(cv, i);
391
- b = gsl_vector_complex_get(cv2, i);
392
- c = gsl_complex_add(a, b);
393
- gsl_vector_complex_set(cv, i, c);
394
- }
395
- return 0;
396
376
  }
397
377
 
398
- int gsl_vector_complex_add_constant(gsl_vector_complex *cv, gsl_complex b)
399
- {
400
- size_t i;
401
- gsl_complex a, c;
402
- for (i = 0; i < cv->size; i++) {
403
- a = gsl_vector_complex_get(cv, i);
404
- c = gsl_complex_add(a, b);
405
- gsl_vector_complex_set(cv, i, c);
406
- }
407
- return 0;
408
- }
409
-
410
- int gsl_vector_complex_scale(gsl_vector_complex *cv, gsl_complex b)
411
- {
412
- size_t i;
413
- gsl_complex a, c;
414
- for (i = 0; i < cv->size; i++) {
415
- a = gsl_vector_complex_get(cv, i);
416
- c = gsl_complex_mul(a, b);
417
- gsl_vector_complex_set(cv, i, c);
418
- }
419
- return 0;
420
- }
421
-
422
-
423
- int gsl_vector_complex_sub(gsl_vector_complex *cv, const gsl_vector_complex *cv2)
424
- {
425
- size_t i;
426
- gsl_complex a, b, c;
427
- for (i = 0; i < cv->size; i++) {
428
- a = gsl_vector_complex_get(cv, i);
429
- b = gsl_vector_complex_get(cv2, i);
430
- c = gsl_complex_sub(a, b);
431
- gsl_vector_complex_set(cv, i, c);
432
- }
433
- return 0;
434
- }
435
-
436
- int gsl_vector_complex_mul(gsl_vector_complex *cv, const gsl_vector_complex *cv2)
437
- {
438
- size_t i;
439
- gsl_complex a, b, c;
440
- for (i = 0; i < cv->size; i++) {
441
- a = gsl_vector_complex_get(cv, i);
442
- b = gsl_vector_complex_get(cv2, i);
443
- c = gsl_complex_mul(a, b);
444
- gsl_vector_complex_set(cv, i, c);
445
- }
446
- return 0;
447
- }
448
-
449
- int gsl_vector_complex_div(gsl_vector_complex *cv, const gsl_vector_complex *cv2)
450
- {
451
- size_t i;
452
- gsl_complex a, b, c;
453
- for (i = 0; i < cv->size; i++) {
454
- a = gsl_vector_complex_get(cv, i);
455
- b = gsl_vector_complex_get(cv2, i);
456
- c = gsl_complex_div(a, b);
457
- gsl_vector_complex_set(cv, i, c);
458
- }
459
- return 0;
460
- }
461
- #endif
462
-
463
378
  VALUE rb_gsl_range2ary(VALUE obj)
464
379
  {
465
380
  // double beg, en;
466
381
  // size_t n;
467
382
  // int step;
468
383
  VALUE ary;
469
- if (CLASS_OF(obj) != rb_cRange)
384
+ if (CLASS_OF(obj) != rb_cRange)
470
385
  rb_raise(rb_eTypeError, "wrong argument type %s (Range expected)",
471
- rb_class2name(CLASS_OF(obj)));
386
+ rb_class2name(CLASS_OF(obj)));
472
387
  ary = rb_funcall(obj, rb_gsl_id_to_a, 0);
473
388
  return ary;
474
389
  }
@@ -480,9 +395,9 @@ VALUE rb_gsl_range2vector(VALUE obj)
480
395
  size_t n;
481
396
  int i, step;
482
397
  gsl_vector *v;
483
- if (CLASS_OF(obj) != rb_cRange)
398
+ if (CLASS_OF(obj) != rb_cRange)
484
399
  rb_raise(rb_eTypeError, "wrong argument type %s (Range expected)",
485
- rb_class2name(CLASS_OF(obj)));
400
+ rb_class2name(CLASS_OF(obj)));
486
401
  get_range_beg_en_n(obj, &beg, &en, &n, &step);
487
402
  v = gsl_vector_alloc(n);
488
403
  for (i = 0; i < (int) n; i++) gsl_vector_set(v, i, (double) (beg+i));
@@ -495,9 +410,9 @@ VALUE rb_gsl_range2vector_int(VALUE obj)
495
410
  int beg, en, i, step;
496
411
  size_t n;
497
412
  gsl_vector_int *v;
498
- if (CLASS_OF(obj) != rb_cRange)
413
+ if (CLASS_OF(obj) != rb_cRange)
499
414
  rb_raise(rb_eTypeError, "wrong argument type %s (Range expected)",
500
- rb_class2name(CLASS_OF(obj)));
415
+ rb_class2name(CLASS_OF(obj)));
501
416
  get_range_int_beg_en_n(obj, &beg, &en, &n, &step);
502
417
  v = gsl_vector_int_alloc(n);
503
418
  for (i = 0; i < (int) n; i++) gsl_vector_int_set(v, i, beg+i);
@@ -547,71 +462,71 @@ void rb_gsl_matrix_int_view_free(gsl_matrix_int_view * mv)
547
462
 
548
463
  void Init_gsl_array(VALUE module)
549
464
  {
550
- cgsl_block = rb_define_class_under(module, "Block",
551
- cGSL_Object);
552
- cgsl_block_int = rb_define_class_under(cgsl_block, "Int",
553
- cGSL_Object);
554
- cgsl_block_uchar = rb_define_class_under(cgsl_block, "Byte",
555
- cGSL_Object);
465
+ cgsl_block = rb_define_class_under(module, "Block",
466
+ cGSL_Object);
467
+ cgsl_block_int = rb_define_class_under(cgsl_block, "Int",
468
+ cGSL_Object);
469
+ cgsl_block_uchar = rb_define_class_under(cgsl_block, "Byte",
470
+ cGSL_Object);
556
471
 
557
472
  cgsl_block_complex = rb_define_class_under(cgsl_block, "Complex", cgsl_block);
558
- cgsl_vector = rb_define_class_under(module, "Vector",
559
- cGSL_Object);
560
- cgsl_vector_col = rb_define_class_under(cgsl_vector, "Col",
561
- cgsl_vector);
562
- cgsl_vector_complex = rb_define_class_under(cgsl_vector, "Complex",
563
- cGSL_Object);
473
+ cgsl_vector = rb_define_class_under(module, "Vector",
474
+ cGSL_Object);
475
+ cgsl_vector_col = rb_define_class_under(cgsl_vector, "Col",
476
+ cgsl_vector);
477
+ cgsl_vector_complex = rb_define_class_under(cgsl_vector, "Complex",
478
+ cGSL_Object);
564
479
  cgsl_vector_complex_col = rb_define_class_under(cgsl_vector_complex, "Col",
565
- cgsl_vector_complex);
480
+ cgsl_vector_complex);
566
481
  cgsl_matrix = rb_define_class_under(module, "Matrix", cGSL_Object);
567
482
  cgsl_matrix_complex = rb_define_class_under(cgsl_matrix, "Complex", cGSL_Object);
568
483
 
569
484
  cgsl_vector_view = rb_define_class_under(cgsl_vector, "View", cgsl_vector);
570
485
  cgsl_vector_col_view = rb_define_class_under(cgsl_vector_col, "View", cgsl_vector_col);
571
486
 
572
- cgsl_vector_complex_view = rb_define_class_under(cgsl_vector_complex, "View",
573
- cgsl_vector_complex);
574
- cgsl_vector_complex_col_view = rb_define_class_under(cgsl_vector_complex_col, "View",
575
- cgsl_vector_complex_col);
487
+ cgsl_vector_complex_view = rb_define_class_under(cgsl_vector_complex, "View",
488
+ cgsl_vector_complex);
489
+ cgsl_vector_complex_col_view = rb_define_class_under(cgsl_vector_complex_col, "View",
490
+ cgsl_vector_complex_col);
576
491
 
577
492
  cgsl_vector_int = rb_define_class_under(cgsl_vector, "Int", cGSL_Object);
578
- cgsl_vector_int_col = rb_define_class_under(cgsl_vector_int, "Col", cgsl_vector_int);
493
+ cgsl_vector_int_col = rb_define_class_under(cgsl_vector_int, "Col", cgsl_vector_int);
579
494
  cgsl_vector_int_view = rb_define_class_under(cgsl_vector_int, "View", cgsl_vector_int);
580
495
  cgsl_vector_int_col_view = rb_define_class_under(cgsl_vector_int_col, "View", cgsl_vector_int_col);
581
496
 
582
497
 
583
498
  /*****/
584
499
 
585
- cgsl_matrix_view = rb_define_class_under(cgsl_matrix, "View",
586
- cgsl_matrix);
587
- cgsl_matrix_complex_view = rb_define_class_under(cgsl_matrix_complex, "View",
588
- cgsl_matrix_complex);
589
- cgsl_permutation = rb_define_class_under(module, "Permutation", cGSL_Object);
500
+ cgsl_matrix_view = rb_define_class_under(cgsl_matrix, "View",
501
+ cgsl_matrix);
502
+ cgsl_matrix_complex_view = rb_define_class_under(cgsl_matrix_complex, "View",
503
+ cgsl_matrix_complex);
504
+ cgsl_permutation = rb_define_class_under(module, "Permutation", cGSL_Object);
590
505
  cgsl_index = rb_define_class_under(module, "Index", cgsl_permutation);
591
506
 
592
507
  cgsl_vector_view_ro = rb_define_class_under(cgsl_vector_view, "ReadOnly",
593
- cgsl_vector_view);
508
+ cgsl_vector_view);
594
509
  cgsl_vector_col_view_ro = rb_define_class_under(cgsl_vector_col_view, "ReadOnly",
595
- cgsl_vector_col_view);
510
+ cgsl_vector_col_view);
596
511
  cgsl_vector_int_view_ro = rb_define_class_under(cgsl_vector_int_view, "ReadOnly",
597
- cgsl_vector_int_view);
512
+ cgsl_vector_int_view);
598
513
  cgsl_vector_int_col_view_ro = rb_define_class_under(cgsl_vector_int_col_view, "ReadOnly",
599
- cgsl_vector_int_col_view);
514
+ cgsl_vector_int_col_view);
600
515
  cgsl_matrix_view_ro = rb_define_class_under(cgsl_matrix_view, "ReadOnly",
601
- cgsl_matrix_view);
516
+ cgsl_matrix_view);
602
517
 
603
- cgsl_vector_complex_view_ro = rb_define_class_under(cgsl_vector_complex_view,
604
- "ReadOnly",
605
- cgsl_vector_complex_view);
606
- cgsl_matrix_complex_view_ro = rb_define_class_under(cgsl_matrix_complex_view,
607
- "ReadOnly",
608
- cgsl_matrix_complex_view);
518
+ cgsl_vector_complex_view_ro = rb_define_class_under(cgsl_vector_complex_view,
519
+ "ReadOnly",
520
+ cgsl_vector_complex_view);
521
+ cgsl_matrix_complex_view_ro = rb_define_class_under(cgsl_matrix_complex_view,
522
+ "ReadOnly",
523
+ cgsl_matrix_complex_view);
609
524
 
610
525
  /*****/
611
526
  cgsl_matrix_int = rb_define_class_under(cgsl_matrix, "Int", cGSL_Object);
612
527
  cgsl_matrix_int_view = rb_define_class_under(cgsl_matrix_int, "View", cgsl_matrix_int);
613
528
  cgsl_matrix_int_view_ro = rb_define_class_under(cgsl_matrix_int_view, "ReadOnly",
614
- cgsl_matrix_int_view);
529
+ cgsl_matrix_int_view);
615
530
  /*****/
616
531
  Init_gsl_block_init(module);
617
532
  Init_gsl_block_int_init(module);
@@ -624,16 +539,14 @@ void Init_gsl_array(VALUE module)
624
539
  Init_gsl_matrix_int(module);
625
540
  Init_gsl_matrix_complex(module);
626
541
  Init_gsl_permutation(module);
627
- #ifdef GSL_1_1_LATER
628
542
  Init_gsl_combination(module);
629
- #endif
630
543
  Init_gsl_array_complex(module);
631
544
  Init_gsl_matrix_nmf();
632
545
 
633
546
  rb_define_method(cgsl_vector_view_ro, "set", rb_gsl_obj_read_only, -1);
634
547
  rb_define_method(cgsl_matrix_view_ro, "set", rb_gsl_obj_read_only, -1);
635
548
  rb_define_method(cgsl_vector_int_view_ro, "set", rb_gsl_obj_read_only, -1);
636
- rb_define_method(cgsl_matrix_int_view_ro, "set", rb_gsl_obj_read_only, -1);
549
+ rb_define_method(cgsl_matrix_int_view_ro, "set", rb_gsl_obj_read_only, -1);
637
550
  rb_define_method(cgsl_vector_complex_view_ro, "set", rb_gsl_obj_read_only, -1);
638
551
  rb_define_method(cgsl_matrix_complex_view_ro, "set", rb_gsl_obj_read_only, -1);
639
552