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
@@ -12,9 +12,7 @@
12
12
 
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
  VALUE rb_gsl_vector_int_inner_product(int argc, VALUE *argv, VALUE obj);
20
18
  VALUE rb_gsl_vector_int_do_something(VALUE obj, void (*func)(gsl_vector_int*));
@@ -31,7 +29,7 @@ VALUE rb_gsl_vector_int_to_f(VALUE obj)
31
29
  size_t i;
32
30
  Data_Get_Struct(obj, gsl_vector_int, v);
33
31
  vnew = gsl_vector_alloc(v->size);
34
- for (i = 0; i < v->size; i++)
32
+ for (i = 0; i < v->size; i++)
35
33
  gsl_vector_set(vnew, i, (double) gsl_vector_int_get(v, i));
36
34
  if (VECTOR_INT_COL_P(obj))
37
35
  return Data_Wrap_Struct(cgsl_vector_col, 0, gsl_vector_free, vnew);
@@ -92,17 +90,17 @@ static VALUE rb_gsl_vector_int_add(VALUE obj, VALUE b)
92
90
  return rb_gsl_vector_add_constant(rb_gsl_vector_int_to_f(obj), b);
93
91
  break;
94
92
  default:
95
- if (rb_obj_is_kind_of(b, cgsl_vector_int)) {
96
- Data_Get_Struct(obj, gsl_vector_int, v);
97
- Data_Get_Struct(b, gsl_vector_int, vb);
98
- vnew = gsl_vector_int_alloc(v->size);
99
- gsl_vector_int_memcpy(vnew, v);
100
- gsl_vector_int_add(vnew, vb);
101
- return Data_Wrap_Struct(VECTOR_INT_ROW_COL(obj), 0, gsl_vector_int_free, vnew);
102
- } else {
103
- return rb_gsl_vector_add(rb_gsl_vector_int_to_f(obj), b);
104
- }
105
- break;
93
+ if (rb_obj_is_kind_of(b, cgsl_vector_int)) {
94
+ Data_Get_Struct(obj, gsl_vector_int, v);
95
+ Data_Get_Struct(b, gsl_vector_int, vb);
96
+ vnew = gsl_vector_int_alloc(v->size);
97
+ gsl_vector_int_memcpy(vnew, v);
98
+ gsl_vector_int_add(vnew, vb);
99
+ return Data_Wrap_Struct(VECTOR_INT_ROW_COL(obj), 0, gsl_vector_int_free, vnew);
100
+ } else {
101
+ return rb_gsl_vector_add(rb_gsl_vector_int_to_f(obj), b);
102
+ }
103
+ break;
106
104
  }
107
105
  }
108
106
 
@@ -119,12 +117,12 @@ static VALUE rb_gsl_vector_int_sub(VALUE obj, VALUE b)
119
117
  break;
120
118
  default:
121
119
  if (rb_obj_is_kind_of(b, cgsl_vector_int)) {
122
- Data_Get_Struct(obj, gsl_vector_int, v);
123
- Data_Get_Struct(b, gsl_vector_int, vb);
124
- vnew = gsl_vector_int_alloc(v->size);
125
- gsl_vector_int_memcpy(vnew, v);
126
- gsl_vector_int_sub(vnew, vb);
127
- return Data_Wrap_Struct(VECTOR_INT_ROW_COL(obj), 0, gsl_vector_int_free, vnew);
120
+ Data_Get_Struct(obj, gsl_vector_int, v);
121
+ Data_Get_Struct(b, gsl_vector_int, vb);
122
+ vnew = gsl_vector_int_alloc(v->size);
123
+ gsl_vector_int_memcpy(vnew, v);
124
+ gsl_vector_int_sub(vnew, vb);
125
+ return Data_Wrap_Struct(VECTOR_INT_ROW_COL(obj), 0, gsl_vector_int_free, vnew);
128
126
  } else {
129
127
  return rb_gsl_vector_sub(rb_gsl_vector_int_to_f(obj), b);
130
128
  }
@@ -151,7 +149,7 @@ static VALUE rb_gsl_vector_int_mul(VALUE obj, VALUE b)
151
149
  argv[0] = obj;
152
150
  argv[1] = b;
153
151
  return rb_gsl_vector_int_inner_product(2, argv, CLASS_OF(obj));
154
- } else if (VECTOR_INT_ROW_P(obj) && MATRIX_INT_P(b)) {
152
+ } else if (VECTOR_INT_ROW_P(obj) && MATRIX_INT_P(b)) {
155
153
  Data_Get_Struct(obj, gsl_vector_int, v);
156
154
  Data_Get_Struct(b, gsl_matrix_int, m);
157
155
  vnew = mygsl_vector_int_mul_matrix(v, m);
@@ -162,10 +160,10 @@ static VALUE rb_gsl_vector_int_mul(VALUE obj, VALUE b)
162
160
  if (v->size != v2->size) rb_raise(rb_eIndexError, "Vector sizes does not match.");
163
161
  m = gsl_matrix_int_alloc(v->size, v2->size);
164
162
  for (i = 0; i < v->size; i++) {
165
- for (j = 0; j < v2->size; j++) {
166
- val = gsl_vector_int_get(v, i)*gsl_vector_int_get(v2, j);
167
- gsl_matrix_int_set(m, i, j, val);
168
- }
163
+ for (j = 0; j < v2->size; j++) {
164
+ val = gsl_vector_int_get(v, i)*gsl_vector_int_get(v2, j);
165
+ gsl_matrix_int_set(m, i, j, val);
166
+ }
169
167
  }
170
168
  return Data_Wrap_Struct(cgsl_matrix_int, 0, gsl_matrix_int_free, m);
171
169
  } else {
@@ -39,10 +39,10 @@
39
39
  void FUNCTION(get_range,beg_en_n)(VALUE range, BASE *beg, BASE *en, size_t *n, int *step);
40
40
 
41
41
  void get_range_beg_en_n_for_size(VALUE range,
42
- int *beg, int *en, size_t *n, int *step, size_t size);
42
+ int *beg, int *en, size_t *n, int *step, size_t size);
43
43
 
44
44
  void parse_subvector_args(int argc, VALUE *argv, size_t size,
45
- size_t *offset, size_t *stride, size_t *n);
45
+ size_t *offset, size_t *stride, size_t *n);
46
46
 
47
47
  void FUNCTION(get_range,beg_en_n)(VALUE range, BASE *beg, BASE *en, size_t *n, int *step)
48
48
  {
@@ -66,7 +66,7 @@ void get_range_beg_en_n_for_size(VALUE range, int *beg, int *en, size_t *n, int
66
66
  }
67
67
 
68
68
  void parse_subvector_args(int argc, VALUE *argv, size_t size,
69
- size_t *offset, size_t *stride, size_t *n)
69
+ size_t *offset, size_t *stride, size_t *n)
70
70
  {
71
71
  int begin = 0, end, step, length;
72
72
  *stride = 1;
@@ -83,13 +83,13 @@ void parse_subvector_args(int argc, VALUE *argv, size_t size,
83
83
  // want to let Ruby crash if GSL does not have bounds checking enabled.
84
84
  if(begin < 0 || (size_t)begin >= size) {
85
85
  rb_raise(rb_eRangeError,
86
- "begin value %d is out of range for Vector of length %d",
87
- begin, (int) size);
86
+ "begin value %d is out of range for Vector of length %d",
87
+ begin, (int) size);
88
88
  }
89
89
  if(end < 0 || (size_t)end >= size) {
90
90
  rb_raise(rb_eRangeError,
91
- "end value %d is out of range for Vector of length %d",
92
- end, (int) size);
91
+ "end value %d is out of range for Vector of length %d",
92
+ end, (int) size);
93
93
  }
94
94
  *stride = (size_t)step;
95
95
  } else {
@@ -97,8 +97,8 @@ void parse_subvector_args(int argc, VALUE *argv, size_t size,
97
97
  length = FIX2INT(argv[0]);
98
98
  if((length < 0 && -length > (int) size) || (length > 0 && length > (int) size)) {
99
99
  rb_raise(rb_eRangeError,
100
- "length %d is out of range for Vector of length %d",
101
- length, (int) size);
100
+ "length %d is out of range for Vector of length %d",
101
+ length, (int) size);
102
102
  } else if(length < 0) {
103
103
  begin = length;
104
104
  *n = (size_t)(-length);
@@ -113,13 +113,13 @@ void parse_subvector_args(int argc, VALUE *argv, size_t size,
113
113
  get_range_beg_en_n_for_size(argv[0], &begin, &end, n, &step, size);
114
114
  if(begin < 0 || (size_t)begin >= size) {
115
115
  rb_raise(rb_eRangeError,
116
- "begin value %d is out of range for Vector of length %d",
117
- (int) begin, (int) size);
116
+ "begin value %d is out of range for Vector of length %d",
117
+ (int) begin, (int) size);
118
118
  }
119
119
  if(end < 0 || (size_t)end >= size) {
120
120
  rb_raise(rb_eRangeError,
121
- "end value %d is out of range for Vector of length %d",
122
- (int) end, (int) size);
121
+ "end value %d is out of range for Vector of length %d",
122
+ (int) end, (int) size);
123
123
  }
124
124
  CHECK_FIXNUM(argv[1]);
125
125
  step = FIX2INT(argv[1]);
@@ -210,13 +210,11 @@ VALUE FUNCTION(rb_gsl_vector,new)(int argc, VALUE *argv, VALUE klass)
210
210
  size_t n, i;
211
211
  BASE beg, en;
212
212
  int step;
213
- #ifdef HAVE_NARRAY_H
214
- VALUE ary2;
215
- #endif
216
213
  switch (argc) {
217
214
  case 1:
218
215
  #ifdef HAVE_NARRAY_H
219
216
  if (NA_IsNArray(argv[0])) {
217
+ VALUE ary2;
220
218
  n = NA_TOTAL(argv[0]);
221
219
  v = FUNCTION(gsl_vector,alloc)(n);
222
220
  if (v == NULL) rb_raise(rb_eNoMemError, "gsl_vector_alloc failed");
@@ -230,7 +228,7 @@ VALUE FUNCTION(rb_gsl_vector,new)(int argc, VALUE *argv, VALUE klass)
230
228
  }
231
229
  #endif
232
230
  switch (TYPE(argv[0])) {
233
- case T_FIXNUM:
231
+ case T_FIXNUM:
234
232
  /*! if an integer n is given, create an empty vector of length n */
235
233
  CHECK_FIXNUM(argv[0]);
236
234
  n = FIX2INT(argv[0]);
@@ -243,35 +241,35 @@ VALUE FUNCTION(rb_gsl_vector,new)(int argc, VALUE *argv, VALUE klass)
243
241
  case T_FLOAT:
244
242
  v = FUNCTION(gsl_vector,alloc)(1);
245
243
  switch(TYPE(argv[0])) {
246
- case T_FIXNUM: case T_BIGNUM: case T_FLOAT:
247
- xnative = NUMCONV2(argv[0]);
248
- break;
249
- default:
250
- xnative = (BASE)0;
244
+ case T_FIXNUM: case T_BIGNUM: case T_FLOAT:
245
+ xnative = NUMCONV2(argv[0]);
246
+ break;
247
+ default:
248
+ xnative = (BASE)0;
251
249
  }
252
250
  FUNCTION(gsl_vector,set)(v, 0, xnative);
253
251
  break;
254
252
  #ifdef BASE_DOUBLE
255
- case T_ARRAY:
253
+ case T_ARRAY:
256
254
  v = make_cvector_from_rarrays(argv[0]);
257
255
  break;
258
256
  #endif
259
257
  default:
260
258
  if (CLASS_OF(argv[0]) == rb_cRange) {
261
- FUNCTION(get_range,beg_en_n)(argv[0], &beg, &en, &n, &step);
262
- v = FUNCTION(gsl_vector,alloc)(n);
263
- FUNCTION(set_ptr_data,by_range)(v->data, v->size, argv[0]);
264
- return Data_Wrap_Struct(klass, 0, FUNCTION(gsl_vector,free), v);
259
+ FUNCTION(get_range,beg_en_n)(argv[0], &beg, &en, &n, &step);
260
+ v = FUNCTION(gsl_vector,alloc)(n);
261
+ FUNCTION(set_ptr_data,by_range)(v->data, v->size, argv[0]);
262
+ return Data_Wrap_Struct(klass, 0, FUNCTION(gsl_vector,free), v);
265
263
  } else if (VEC_P(argv[0])) {
266
- /*! Create a new vector with the same elements of the vector given */
267
- Data_Get_Struct(argv[0], GSL_TYPE(gsl_vector), vtmp);
268
- v = FUNCTION(gsl_vector,alloc)(vtmp->size);
269
- for (i = 0; i < vtmp->size; i++)
270
- FUNCTION(gsl_vector,set)(v, i, FUNCTION(gsl_vector,get)(vtmp, i));
271
- return Data_Wrap_Struct(VEC_ROW_COL(argv[0]), 0, FUNCTION(gsl_vector,free), v);
264
+ /*! Create a new vector with the same elements of the vector given */
265
+ Data_Get_Struct(argv[0], GSL_TYPE(gsl_vector), vtmp);
266
+ v = FUNCTION(gsl_vector,alloc)(vtmp->size);
267
+ for (i = 0; i < vtmp->size; i++)
268
+ FUNCTION(gsl_vector,set)(v, i, FUNCTION(gsl_vector,get)(vtmp, i));
269
+ return Data_Wrap_Struct(VEC_ROW_COL(argv[0]), 0, FUNCTION(gsl_vector,free), v);
272
270
  } else {
273
- rb_raise(rb_eTypeError,
274
- "wrong argument type %s", rb_class2name(CLASS_OF(argv[0])));
271
+ rb_raise(rb_eTypeError,
272
+ "wrong argument type %s", rb_class2name(CLASS_OF(argv[0])));
275
273
  }
276
274
  break;
277
275
  }
@@ -281,11 +279,11 @@ VALUE FUNCTION(rb_gsl_vector,new)(int argc, VALUE *argv, VALUE klass)
281
279
  if (v == NULL) rb_raise(rb_eNoMemError, "gsl_vector_alloc failed");
282
280
  for (i = 0; (int) i < argc; i++) {
283
281
  switch(TYPE(argv[i])) {
284
- case T_FIXNUM: case T_BIGNUM: case T_FLOAT:
285
- xnative = NUMCONV2(argv[i]);
286
- break;
287
- default:
288
- xnative = (BASE)0;
282
+ case T_FIXNUM: case T_BIGNUM: case T_FLOAT:
283
+ xnative = NUMCONV2(argv[i]);
284
+ break;
285
+ default:
286
+ xnative = (BASE)0;
289
287
  }
290
288
  FUNCTION(gsl_vector,set)(v, i, xnative);
291
289
  }
@@ -322,7 +320,7 @@ static VALUE FUNCTION(rb_gsl_vector,get)(int argc, VALUE *argv, VALUE obj)
322
320
  switch (TYPE(argv[0])) {
323
321
  case T_FIXNUM:
324
322
  i = FIX2INT(argv[0]);
325
- if (i < 0)
323
+ if (i < 0)
326
324
  retval = C_TO_VALUE2(FUNCTION(gsl_vector,get)(v, (size_t) (v->size + i)));
327
325
  else
328
326
  retval = C_TO_VALUE2(FUNCTION(gsl_vector,get)(v, (size_t) (i)));
@@ -332,7 +330,7 @@ static VALUE FUNCTION(rb_gsl_vector,get)(int argc, VALUE *argv, VALUE obj)
332
330
  for (j = 0; j < vnew->size; j++) {
333
331
  i = NUMCONV(rb_ary_entry(argv[0], j));
334
332
  if (i < 0) k = v->size + i;
335
- // else k = j;
333
+ // else k = j;
336
334
  else k = i;
337
335
  FUNCTION(gsl_vector,set)(vnew, j, FUNCTION(gsl_vector,get)(v, k));
338
336
  }
@@ -437,7 +435,6 @@ static VALUE FUNCTION(rb_gsl_vector,set)(int argc, VALUE *argv, VALUE obj)
437
435
  if(argc < 1 || argc > 4) {
438
436
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 1-4)", argc);
439
437
  }
440
-
441
438
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
442
439
  other = argv[argc-1];
443
440
 
@@ -458,7 +455,6 @@ static VALUE FUNCTION(rb_gsl_vector,set)(int argc, VALUE *argv, VALUE obj)
458
455
  // assignment to v.subvector(...)
459
456
  FUNCTION(rb_gsl_vector,set_subvector)(argc-1, argv, v, other);
460
457
  }
461
-
462
458
  return obj;
463
459
  }
464
460
 
@@ -471,7 +467,7 @@ static VALUE FUNCTION(rb_gsl_vector,set_all)(VALUE obj, VALUE xx)
471
467
  return obj;
472
468
  }
473
469
 
474
- VALUE FUNCTION(rb_gsl_vector,do_something)(VALUE obj, void (*func)(GSL_TYPE(gsl_vector)*))
470
+ VALUE FUNCTION(rb_gsl_vector,do_something)(VALUE obj, void (*func)(GSL_TYPE (gsl_vector)*))
475
471
  {
476
472
  GSL_TYPE(gsl_vector) *v = NULL;
477
473
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
@@ -659,9 +655,9 @@ static VALUE FUNCTION(rb_gsl_vector,trans)(VALUE obj)
659
655
  return Data_Wrap_Struct(cgsl_vector_int_col, 0, gsl_vector_int_free, vnew);
660
656
  else if (VECTOR_INT_COL_P(obj))
661
657
  return Data_Wrap_Struct(cgsl_vector_int, 0, gsl_vector_int_free, vnew);
662
- else rb_raise(rb_eTypeError,
663
- "wrong type %s (Vector::Int or Vector::Int::Col expected)",
664
- rb_class2name(CLASS_OF(obj)));
658
+ else rb_raise(rb_eTypeError,
659
+ "wrong type %s (Vector::Int or Vector::Int::Col expected)",
660
+ rb_class2name(CLASS_OF(obj)));
665
661
  #endif
666
662
  return Qnil;
667
663
  }
@@ -673,14 +669,14 @@ static VALUE FUNCTION(rb_gsl_vector,trans_bang)(VALUE obj)
673
669
  else if (CLASS_OF(obj) == cgsl_vector_col) RBGSL_SET_CLASS(obj, cgsl_vector);
674
670
  else {
675
671
  rb_raise(rb_eRuntimeError, "method trans! for %s is not permitted.",
676
- rb_class2name(CLASS_OF(obj)));
677
- }
672
+ rb_class2name(CLASS_OF(obj)));
673
+ }
678
674
  #elif defined(BASE_INT)
679
675
  if (CLASS_OF(obj) == cgsl_vector_int) RBGSL_SET_CLASS(obj, cgsl_vector_int_col);
680
676
  else if (CLASS_OF(obj) == cgsl_vector_int_col) RBGSL_SET_CLASS(obj, cgsl_vector_int);
681
677
  else {
682
678
  rb_raise(rb_eRuntimeError, "method trans! for %s is not permitted.",
683
- rb_class2name(CLASS_OF(obj)));
679
+ rb_class2name(CLASS_OF(obj)));
684
680
  }
685
681
  #endif
686
682
  return obj;
@@ -704,7 +700,7 @@ VALUE FUNCTION(rb_gsl_vector,uminus)(VALUE obj)
704
700
  }
705
701
  if (CLASS_OF(obj) == GSL_TYPE(cgsl_poly))
706
702
  return Data_Wrap_Struct(GSL_TYPE(cgsl_poly), 0, FUNCTION(gsl_vector,free), vnew);
707
- else
703
+ else
708
704
  return Data_Wrap_Struct(VEC_ROW_COL(obj), 0, FUNCTION(gsl_vector,free), vnew);
709
705
  }
710
706
 
@@ -810,7 +806,7 @@ static VALUE FUNCTION(rb_gsl_vector,sgn)(VALUE obj)
810
806
  x = FUNCTION(gsl_vector,get)(v, i);
811
807
  FUNCTION(gsl_vector,set)(vnew, i, (BASE)(x>0 ? 1 : (x<0 ? -1 : 0)));
812
808
  }
813
- return Data_Wrap_Struct(VEC_ROW_COL(obj), 0, FUNCTION(gsl_vector,free), vnew);
809
+ return Data_Wrap_Struct(VEC_ROW_COL(obj), 0, FUNCTION(gsl_vector,free), vnew);
814
810
  }
815
811
 
816
812
  static VALUE FUNCTION(rb_gsl_vector,abs)(VALUE obj)
@@ -822,7 +818,7 @@ static VALUE FUNCTION(rb_gsl_vector,abs)(VALUE obj)
822
818
  for (i = 0; i < v->size; i++) {
823
819
  FUNCTION(gsl_vector,set)(vnew, i, (BASE) fabs(FUNCTION(gsl_vector,get)(v, i)));
824
820
  }
825
- return Data_Wrap_Struct(VEC_ROW_COL(obj), 0, FUNCTION(gsl_vector,free), vnew);
821
+ return Data_Wrap_Struct(VEC_ROW_COL(obj), 0, FUNCTION(gsl_vector,free), vnew);
826
822
  }
827
823
 
828
824
  static VALUE FUNCTION(rb_gsl_vector,square)(VALUE obj)
@@ -834,7 +830,7 @@ static VALUE FUNCTION(rb_gsl_vector,square)(VALUE obj)
834
830
  for (i = 0; i < v->size; i++) {
835
831
  FUNCTION(gsl_vector,set)(vnew, i, gsl_pow_2(FUNCTION(gsl_vector,get)(v, i)));
836
832
  }
837
- return Data_Wrap_Struct(VEC_ROW_COL(obj), 0, FUNCTION(gsl_vector,free), vnew);
833
+ return Data_Wrap_Struct(VEC_ROW_COL(obj), 0, FUNCTION(gsl_vector,free), vnew);
838
834
  }
839
835
 
840
836
  static VALUE FUNCTION(rb_gsl_vector,sqrt)(VALUE obj)
@@ -846,7 +842,7 @@ static VALUE FUNCTION(rb_gsl_vector,sqrt)(VALUE obj)
846
842
  for (i = 0; i < v->size; i++) {
847
843
  FUNCTION(gsl_vector,set)(vnew, i, sqrt(FUNCTION(gsl_vector,get)(v, i)));
848
844
  }
849
- return Data_Wrap_Struct(VEC_ROW_COL(obj), 0, FUNCTION(gsl_vector,free), vnew);
845
+ return Data_Wrap_Struct(VEC_ROW_COL(obj), 0, FUNCTION(gsl_vector,free), vnew);
850
846
  }
851
847
 
852
848
  static VALUE FUNCTION(rb_gsl_vector,memcpy)(VALUE obj, VALUE dest, VALUE src)
@@ -867,7 +863,7 @@ static VALUE FUNCTION(rb_gsl_vector,clone)(VALUE obj)
867
863
  FUNCTION(gsl_vector,memcpy)(vnew, v);
868
864
  if (!VEC_VIEW_P(obj))
869
865
  return Data_Wrap_Struct(CLASS_OF(obj), 0, FUNCTION(gsl_vector,free), vnew);
870
- else
866
+ else
871
867
  return Data_Wrap_Struct(VEC_ROW_COL(obj), 0, FUNCTION(gsl_vector,free), vnew);
872
868
  }
873
869
 
@@ -919,7 +915,7 @@ static VALUE FUNCTION(rb_gsl_vector,fprintf)(int argc, VALUE *argv, VALUE obj)
919
915
  GSL_TYPE(gsl_vector) *h = NULL;
920
916
  FILE *fp = NULL;
921
917
  int status, flag = 0;
922
- if (argc != 1 && argc != 2)
918
+ if (argc != 1 && argc != 2)
923
919
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 1 or 2)", argc);
924
920
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), h);
925
921
  fp = rb_gsl_open_writefile(argv[0], &flag);
@@ -941,7 +937,7 @@ static VALUE FUNCTION(rb_gsl_vector,printf)(int argc, VALUE *argv, VALUE obj)
941
937
  int status;
942
938
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), h);
943
939
  if (argc == 1) {
944
- if (TYPE(argv[0]) != T_STRING)
940
+ if (TYPE(argv[0]) != T_STRING)
945
941
  rb_raise(rb_eTypeError, "String expected");
946
942
  else
947
943
  status = FUNCTION(gsl_vector,fprintf)(stdout, h, STR2CSTR(argv[0]));
@@ -974,7 +970,7 @@ VALUE FUNCTION(rb_gsl_vector,inner_product)(int argc, VALUE *argv, VALUE obj)
974
970
  switch (TYPE(obj)) {
975
971
  case T_MODULE: case T_CLASS: case T_OBJECT:
976
972
  if (argc != 2) rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)",
977
- argc);
973
+ argc);
978
974
  CHECK_VEC(argv[0]);
979
975
  CHECK_VEC(argv[1]);
980
976
  Data_Get_Struct(argv[0], GSL_TYPE(gsl_vector), v);
@@ -982,7 +978,7 @@ VALUE FUNCTION(rb_gsl_vector,inner_product)(int argc, VALUE *argv, VALUE obj)
982
978
  break;
983
979
  default:
984
980
  if (argc != 1) rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)",
985
- argc);
981
+ argc);
986
982
  CHECK_VEC(argv[0]);
987
983
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
988
984
  Data_Get_Struct(argv[0], GSL_TYPE(gsl_vector), v2);
@@ -1052,7 +1048,7 @@ static VALUE FUNCTION(rb_gsl_vector,equal)(int argc, VALUE *argv, VALUE obj)
1052
1048
  case T_FLOAT:
1053
1049
  x = NUM2DBL(other);
1054
1050
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v1);
1055
- for (i = 0; i < v1->size; i++)
1051
+ for (i = 0; i < v1->size; i++)
1056
1052
  if (fabs(x-FUNCTION(gsl_vector,get)(v1, i)) > eps) return Qfalse;
1057
1053
  return Qtrue;
1058
1054
  break;
@@ -1108,14 +1104,14 @@ static VALUE FUNCTION(rb_gsl_vector,graph)(int argc, VALUE *argv, VALUE obj)
1108
1104
  if (TYPE(argv[1]) == T_STRING) {
1109
1105
  make_graphcommand(command, argv[1]);
1110
1106
  if (VEC_P(argv[0])) {
1111
- Data_Get_Struct(argv[0], GSL_TYPE(gsl_vector), x);
1107
+ Data_Get_Struct(argv[0], GSL_TYPE(gsl_vector), x);
1112
1108
  } else {
1113
- rb_raise(rb_eTypeError, "argv[0] wrong type %s (String or Vector expected)",
1114
- rb_class2name(CLASS_OF(argv[0])));
1109
+ rb_raise(rb_eTypeError, "argv[0] wrong type %s (String or Vector expected)",
1110
+ rb_class2name(CLASS_OF(argv[0])));
1115
1111
  }
1116
1112
  } else {
1117
- rb_raise(rb_eTypeError, "argv[1] wrong type %s (String or Vector expected)",
1118
- rb_class2name(CLASS_OF(argv[1])));
1113
+ rb_raise(rb_eTypeError, "argv[1] wrong type %s (String or Vector expected)",
1114
+ rb_class2name(CLASS_OF(argv[1])));
1119
1115
  }
1120
1116
  break;
1121
1117
  default:
@@ -1125,7 +1121,7 @@ static VALUE FUNCTION(rb_gsl_vector,graph)(int argc, VALUE *argv, VALUE obj)
1125
1121
  if (y == NULL) rb_raise(rb_eRuntimeError, "ydata not given");
1126
1122
  fp = popen(command, "w");
1127
1123
  for (i = 0; i < y->size; i++) {
1128
- if (x == NULL)
1124
+ if (x == NULL)
1129
1125
  fprintf(fp, "%d %e\n", (int) i, (double) FUNCTION(gsl_vector,get)(y, i));
1130
1126
  else
1131
1127
  fprintf(fp, "%e %e\n", (double) FUNCTION(gsl_vector,get)(x, i), (double) FUNCTION(gsl_vector,get)(y, i));
@@ -1165,14 +1161,14 @@ static VALUE FUNCTION(rb_gsl_vector,graph_step)(int argc, VALUE *argv, VALUE obj
1165
1161
  if (TYPE(argv[1]) == T_STRING) {
1166
1162
  make_graphcommand(command, argv[1]);
1167
1163
  if (VEC_P(argv[0])) {
1168
- Data_Get_Struct(argv[0], GSL_TYPE(gsl_vector), x);
1164
+ Data_Get_Struct(argv[0], GSL_TYPE(gsl_vector), x);
1169
1165
  } else {
1170
- rb_raise(rb_eTypeError, "argv[0] wrong type %s (String or Vector expected)",
1171
- rb_class2name(CLASS_OF(argv[0])));
1166
+ rb_raise(rb_eTypeError, "argv[0] wrong type %s (String or Vector expected)",
1167
+ rb_class2name(CLASS_OF(argv[0])));
1172
1168
  }
1173
1169
  } else {
1174
- rb_raise(rb_eTypeError, "argv[1] wrong type %s (String or Vector expected)",
1175
- rb_class2name(CLASS_OF(argv[1])));
1170
+ rb_raise(rb_eTypeError, "argv[1] wrong type %s (String or Vector expected)",
1171
+ rb_class2name(CLASS_OF(argv[1])));
1176
1172
  }
1177
1173
  break;
1178
1174
  default:
@@ -1184,19 +1180,19 @@ static VALUE FUNCTION(rb_gsl_vector,graph_step)(int argc, VALUE *argv, VALUE obj
1184
1180
  for (i = 0; i < y->size; i++) {
1185
1181
  if (x == NULL) {
1186
1182
  fprintf(fp, "%d %e\n%d %e\n", (int) i, (double) FUNCTION(gsl_vector,get)(y, i),
1187
- (int) (i+1), (double) FUNCTION(gsl_vector,get)(y, i));
1183
+ (int) (i+1), (double) FUNCTION(gsl_vector,get)(y, i));
1188
1184
  } else {
1189
- if (i != y->size-1)
1190
- fprintf(fp, "%e %e\n%e %e\n", (double) FUNCTION(gsl_vector,get)(x, i),
1191
- (double) FUNCTION(gsl_vector,get)(y, i),
1192
- (double) FUNCTION(gsl_vector,get)(x, i+1),
1193
- (double) FUNCTION(gsl_vector,get)(y, i));
1185
+ if (i != y->size-1)
1186
+ fprintf(fp, "%e %e\n%e %e\n", (double) FUNCTION(gsl_vector,get)(x, i),
1187
+ (double) FUNCTION(gsl_vector,get)(y, i),
1188
+ (double) FUNCTION(gsl_vector,get)(x, i+1),
1189
+ (double) FUNCTION(gsl_vector,get)(y, i));
1194
1190
  else
1195
- fprintf(fp, "%e %e\n%e %e",
1196
- (double) FUNCTION(gsl_vector,get)(x, i),
1197
- (double) FUNCTION(gsl_vector,get)(y, i),
1198
- 2.0*FUNCTION(gsl_vector,get)(x, i)-FUNCTION(gsl_vector,get)(x, i-1),
1199
- (double) FUNCTION(gsl_vector,get)(y, i));
1191
+ fprintf(fp, "%e %e\n%e %e",
1192
+ (double) FUNCTION(gsl_vector,get)(x, i),
1193
+ (double) FUNCTION(gsl_vector,get)(y, i),
1194
+ 2.0*FUNCTION(gsl_vector,get)(x, i)-FUNCTION(gsl_vector,get)(x, i-1),
1195
+ (double) FUNCTION(gsl_vector,get)(y, i));
1200
1196
  }
1201
1197
  }
1202
1198
  fflush(fp);
@@ -1228,7 +1224,7 @@ static VALUE FUNCTION(rb_gsl_vector,plot)(int argc, VALUE *argv, VALUE obj)
1228
1224
  Data_Get_Struct(argv[0], GSL_TYPE(gsl_vector), x);
1229
1225
  } else {
1230
1226
  rb_raise(rb_eTypeError, "wrong argument type %s (String or Vector expected)",
1231
- rb_class2name(CLASS_OF(argv[0])));
1227
+ rb_class2name(CLASS_OF(argv[0])));
1232
1228
  }
1233
1229
  break;
1234
1230
  case 2:
@@ -1243,11 +1239,11 @@ static VALUE FUNCTION(rb_gsl_vector,plot)(int argc, VALUE *argv, VALUE obj)
1243
1239
  }
1244
1240
  if (y == NULL) rb_raise(rb_eRuntimeError, "ydata not given");
1245
1241
  for (i = 0; i < y->size; i++) {
1246
- if (x == NULL)
1242
+ if (x == NULL)
1247
1243
  fprintf(fp, "%d %e\n", (int) i, (double) FUNCTION(gsl_vector,get)(y, i));
1248
1244
  else
1249
- fprintf(fp, "%e %e\n", (double) FUNCTION(gsl_vector,get)(x, i),
1250
- (double) FUNCTION(gsl_vector,get)(y, i));
1245
+ fprintf(fp, "%e %e\n", (double) FUNCTION(gsl_vector,get)(x, i),
1246
+ (double) FUNCTION(gsl_vector,get)(y, i));
1251
1247
  }
1252
1248
  fprintf(fp, "e\n");
1253
1249
  fflush(fp);
@@ -1261,11 +1257,11 @@ void FUNCTION(gsl_vector,print)(const GSL_TYPE(gsl_vector) *v, VALUE klass)
1261
1257
  size_t i;
1262
1258
  printf("[ ");
1263
1259
  if (klass == cgsl_vector_col || klass == cgsl_vector_col_view
1264
- || klass == cgsl_vector_col_view_ro
1265
- || klass == cgsl_vector_int_col || klass == cgsl_vector_int_col_view
1266
- || klass == cgsl_vector_int_col_view_ro) {
1260
+ || klass == cgsl_vector_col_view_ro
1261
+ || klass == cgsl_vector_int_col || klass == cgsl_vector_int_col_view
1262
+ || klass == cgsl_vector_int_col_view_ro) {
1267
1263
  printf(PRINTF_FORMAT, FUNCTION(gsl_vector,get)(v, 0));
1268
- for (i = 1; i < v->size; i++) {
1264
+ for (i = 1; i < v->size; i++) {
1269
1265
  printf(PRINTF_FORMAT, FUNCTION(gsl_vector,get)(v, i));
1270
1266
  if (i != v->size-1) printf("\n");
1271
1267
  }
@@ -1317,16 +1313,16 @@ VALUE FUNCTION(rb_gsl_vector,to_s)(VALUE obj)
1317
1313
  strcpy(format2, format);
1318
1314
  #else
1319
1315
  strcpy(format, PRINTF_FORMAT);
1320
- strcpy(format2, " "PRINTF_FORMAT);
1316
+ strcpy(format2, " " PRINTF_FORMAT);
1321
1317
  #endif
1322
1318
  for (i = 0; i < v->size; i++) {
1323
1319
  if (i != 0) {
1324
- strcpy(buf, " ");
1325
- rb_str_cat(str, buf, strlen(buf));
1320
+ strcpy(buf, " ");
1321
+ rb_str_cat(str, buf, strlen(buf));
1326
1322
  }
1327
1323
  x = FUNCTION(gsl_vector,get)(v, i);
1328
- if (x < 0) sprintf(buf, format, x);
1329
- else sprintf(buf, format2, x);
1324
+ if (x < 0) sprintf(buf, format, x);
1325
+ else sprintf(buf, format2, x);
1330
1326
  if (i != v->size-1) strcat(buf, "\n");
1331
1327
  rb_str_cat(str, buf, strlen(buf));
1332
1328
  if (i >= 20 && i != v->size-1) {
@@ -1459,8 +1455,8 @@ static VALUE FUNCTION(rb_gsl_vector,matrix_view)(int argc, VALUE *argv, VALUE ob
1459
1455
  break;
1460
1456
  case 3:
1461
1457
  mv = ALLOC(QUALIFIED_VIEW(gsl_matrix,view));
1462
- *mv = FUNCTION(gsl_matrix,view_vector_with_tda)(v, FIX2INT(argv[0]), FIX2INT(argv[1]),
1463
- FIX2INT(argv[2]));
1458
+ *mv = FUNCTION(gsl_matrix,view_vector_with_tda)(v, FIX2INT(argv[0]), FIX2INT(argv[1]),
1459
+ FIX2INT(argv[2]));
1464
1460
  break;
1465
1461
  default:
1466
1462
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 2 or 3)", argc);
@@ -1470,7 +1466,7 @@ static VALUE FUNCTION(rb_gsl_vector,matrix_view)(int argc, VALUE *argv, VALUE ob
1470
1466
  }
1471
1467
 
1472
1468
  static VALUE FUNCTION(rb_gsl_vector,matrix_view_with_tda)(VALUE obj, VALUE nn1, VALUE nn2,
1473
- VALUE tda)
1469
+ VALUE tda)
1474
1470
  {
1475
1471
  GSL_TYPE(gsl_vector) *v = NULL;
1476
1472
  QUALIFIED_VIEW(gsl_matrix,view) *mv = NULL;
@@ -1514,16 +1510,16 @@ VALUE FUNCTION(rb_gsl_vector,scale)(VALUE obj, VALUE x)
1514
1510
  GSL_TYPE(gsl_vector) *v, *vnew;
1515
1511
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
1516
1512
  vnew = FUNCTION(make_vector,clone)(v);
1517
- FUNCTION(gsl_vector,scale)(vnew, NUMCONV(x));
1513
+ FUNCTION(gsl_vector,scale)(vnew, NUMCONV2(x));
1518
1514
  // return Data_Wrap_Struct(GSL_TYPE(cgsl_vector), 0, FUNCTION(gsl_vector,free), vnew);
1519
- return Data_Wrap_Struct(VEC_ROW_COL(obj), 0, FUNCTION(gsl_vector,free), vnew);
1515
+ return Data_Wrap_Struct(VEC_ROW_COL(obj), 0, FUNCTION(gsl_vector,free), vnew);
1520
1516
  }
1521
1517
 
1522
1518
  VALUE FUNCTION(rb_gsl_vector,scale_bang)(VALUE obj, VALUE x)
1523
1519
  {
1524
1520
  GSL_TYPE(gsl_vector) *v = NULL;
1525
1521
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
1526
- FUNCTION(gsl_vector,scale)(v, NUMCONV(x));
1522
+ FUNCTION(gsl_vector,scale)(v, NUMCONV2(x));
1527
1523
  return obj;
1528
1524
  }
1529
1525
 
@@ -1532,7 +1528,7 @@ VALUE FUNCTION(rb_gsl_vector,add_constant)(VALUE obj, VALUE x)
1532
1528
  GSL_TYPE(gsl_vector) *v, *vnew;
1533
1529
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
1534
1530
  vnew = FUNCTION(make_vector,clone)(v);
1535
- FUNCTION(gsl_vector,add_constant)(vnew, NUMCONV(x));
1531
+ FUNCTION(gsl_vector,add_constant)(vnew, NUMCONV2(x));
1536
1532
  // return Data_Wrap_Struct(GSL_TYPE(cgsl_vector), 0, FUNCTION(gsl_vector,free), vnew);
1537
1533
  return Data_Wrap_Struct(VEC_ROW_COL(obj), 0, FUNCTION(gsl_vector,free), vnew);
1538
1534
  }
@@ -1541,7 +1537,7 @@ VALUE FUNCTION(rb_gsl_vector,add_constant_bang)(VALUE obj, VALUE x)
1541
1537
  {
1542
1538
  GSL_TYPE(gsl_vector) *v = NULL;
1543
1539
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
1544
- FUNCTION(gsl_vector,add_constant)(v, NUMCONV(x));
1540
+ FUNCTION(gsl_vector,add_constant)(v, NUMCONV2(x));
1545
1541
  return obj;
1546
1542
  }
1547
1543
 
@@ -1600,7 +1596,7 @@ static VALUE FUNCTION(rb_gsl_vector,to_gplot)(int argc, VALUE *argv, VALUE obj)
1600
1596
  if (argc < 1) rb_raise(rb_eArgError, "no vectors given");
1601
1597
  if (TYPE(argv[0]) == T_ARRAY) nv = RARRAY_LEN(argv[0]);
1602
1598
  else nv = argc;
1603
- vp = (GSL_TYPE(gsl_vector)**) ALLOC_N(GSL_TYPE(gsl_vector)*, nv);
1599
+ vp = (GSL_TYPE(gsl_vector)**)ALLOC_N(GSL_TYPE(gsl_vector)*, nv);
1604
1600
  istart = 0;
1605
1601
  break;
1606
1602
  default:
@@ -1608,7 +1604,7 @@ static VALUE FUNCTION(rb_gsl_vector,to_gplot)(int argc, VALUE *argv, VALUE obj)
1608
1604
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
1609
1605
  if (argc >= 1 && TYPE(argv[0]) == T_ARRAY) nv = 1 + RARRAY_LEN(argv[0]);
1610
1606
  else nv = argc + 1;
1611
- vp = (GSL_TYPE(gsl_vector)**) ALLOC_N(GSL_TYPE(gsl_vector)*, nv);
1607
+ vp = (GSL_TYPE(gsl_vector)**)ALLOC_N(GSL_TYPE(gsl_vector)*, nv);
1612
1608
  vp[0] = v; len = v->size;
1613
1609
  istart = 1;
1614
1610
  break;
@@ -1619,7 +1615,7 @@ static VALUE FUNCTION(rb_gsl_vector,to_gplot)(int argc, VALUE *argv, VALUE obj)
1619
1615
  CHECK_VEC(tmp);
1620
1616
  Data_Get_Struct(tmp, GSL_TYPE(gsl_vector), v);
1621
1617
  if (len == 0) len = v->size;
1622
- if (len != v->size)
1618
+ if (len != v->size)
1623
1619
  rb_raise(rb_eRuntimeError, "vectors must have equal lengths");
1624
1620
  vp[i+istart] = v;
1625
1621
  }
@@ -1675,7 +1671,7 @@ static VALUE FUNCTION(rb_gsl_vector,collect_bang)(VALUE obj)
1675
1671
 
1676
1672
  /* Modified 2006/Sep/26 */
1677
1673
  GSL_TYPE(gsl_vector)* FUNCTION(mygsl_vector,mul_matrix)(GSL_TYPE(gsl_vector) *v,
1678
- GSL_TYPE(gsl_matrix) *m)
1674
+ GSL_TYPE(gsl_matrix) *m)
1679
1675
  {
1680
1676
  GSL_TYPE(gsl_vector) *vnew;
1681
1677
  size_t i, j;
@@ -1715,7 +1711,7 @@ static VALUE FUNCTION(rb_gsl_vector,to_m_circulant)(VALUE obj)
1715
1711
  }
1716
1712
 
1717
1713
  static void FUNCTION(mygsl_vector,indgen)(GSL_TYPE(gsl_vector) *v,
1718
- BASE start, BASE step)
1714
+ BASE start, BASE step)
1719
1715
  {
1720
1716
  size_t k = 0;
1721
1717
  BASE i;
@@ -1734,10 +1730,10 @@ static VALUE FUNCTION(rb_gsl_vector,indgen_singleton)(int argc, VALUE *argv, VAL
1734
1730
  switch (argc) {
1735
1731
  case 3:
1736
1732
  step = NUMCONV2(argv[2]);
1737
- /* no break */
1733
+ /* no break */
1738
1734
  case 2:
1739
1735
  start = NUMCONV2(argv[1]);
1740
- /* no break */
1736
+ /* no break */
1741
1737
  case 1:
1742
1738
  n = NUM2INT(argv[0]);
1743
1739
  break;
@@ -1757,7 +1753,7 @@ static VALUE FUNCTION(rb_gsl_vector,indgen)(int argc, VALUE *argv, VALUE obj)
1757
1753
  switch (argc) {
1758
1754
  case 2:
1759
1755
  step = NUMCONV2(argv[1]);
1760
- /* no break */
1756
+ /* no break */
1761
1757
  case 1:
1762
1758
  start = NUMCONV2(argv[0]);
1763
1759
  break;
@@ -1780,7 +1776,7 @@ static VALUE FUNCTION(rb_gsl_vector,indgen_bang)(int argc, VALUE *argv, VALUE ob
1780
1776
  switch (argc) {
1781
1777
  case 2:
1782
1778
  step = NUMCONV2(argv[1]);
1783
- /* no break */
1779
+ /* no break */
1784
1780
  case 1:
1785
1781
  start = NUMCONV2(argv[0]);
1786
1782
  break;
@@ -1906,7 +1902,7 @@ static VALUE FUNCTION(rb_gsl_vector,histogram)(int argc, VALUE *argv, VALUE obj)
1906
1902
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
1907
1903
  switch (argc) {
1908
1904
  case 1:
1909
- if (rb_obj_is_kind_of(argv[0], rb_cRange))
1905
+ if (rb_obj_is_kind_of(argv[0], rb_cRange))
1910
1906
  argv[0] = rb_gsl_range2ary(argv[0]);
1911
1907
  switch (TYPE(argv[0])) {
1912
1908
  case T_FIXNUM:
@@ -1939,7 +1935,7 @@ static VALUE FUNCTION(rb_gsl_vector,histogram)(int argc, VALUE *argv, VALUE obj)
1939
1935
  break;
1940
1936
  default:
1941
1937
  rb_raise(rb_eTypeError, "wrong argument type %s (Array expected)",
1942
- rb_class2name(CLASS_OF(argv[1])));
1938
+ rb_class2name(CLASS_OF(argv[1])));
1943
1939
  break;
1944
1940
  }
1945
1941
  h = gsl_histogram_alloc(n);
@@ -1986,56 +1982,56 @@ static VALUE FUNCTION(rb_gsl_vector,concat)(VALUE obj, VALUE other)
1986
1982
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
1987
1983
 
1988
1984
  switch(TYPE(other)) {
1989
- case T_FIXNUM:
1990
- case T_BIGNUM:
1991
- case T_FLOAT:
1992
- vnew = FUNCTION(gsl_vector,alloc)(v->size + 1);
1993
- vv = FUNCTION(gsl_vector,subvector)(vnew, 0, v->size);
1994
- FUNCTION(gsl_vector,memcpy)(&vv.vector, v);
1995
- FUNCTION(gsl_vector,set)(vnew, v->size, NUMCONV2(other));
1996
- break;
1985
+ case T_FIXNUM:
1986
+ case T_BIGNUM:
1987
+ case T_FLOAT:
1988
+ vnew = FUNCTION(gsl_vector,alloc)(v->size + 1);
1989
+ vv = FUNCTION(gsl_vector,subvector)(vnew, 0, v->size);
1990
+ FUNCTION(gsl_vector,memcpy)(&vv.vector, v);
1991
+ FUNCTION(gsl_vector,set)(vnew, v->size, NUMCONV2(other));
1992
+ break;
1997
1993
 
1998
- case T_ARRAY:
1999
- size2 = RARRAY_LEN(other);
1994
+ case T_ARRAY:
1995
+ size2 = RARRAY_LEN(other);
1996
+ vnew = FUNCTION(gsl_vector,alloc)(v->size + size2);
1997
+ vv = FUNCTION(gsl_vector,subvector)(vnew, 0, v->size);
1998
+ FUNCTION(gsl_vector,memcpy)(&vv.vector, v);
1999
+ for (i = 0; i < size2; i++) {
2000
+ x = rb_ary_entry(other, i);
2001
+ FUNCTION(gsl_vector,set)(vnew, v->size + i, NUMCONV2(x));
2002
+ }
2003
+ break;
2004
+
2005
+ default:
2006
+ if(rb_obj_is_kind_of(other, rb_cRange)) {
2007
+ FUNCTION(get_range,beg_en_n)(other, &beg, &end, &size2, &step);
2000
2008
  vnew = FUNCTION(gsl_vector,alloc)(v->size + size2);
2001
2009
  vv = FUNCTION(gsl_vector,subvector)(vnew, 0, v->size);
2002
2010
  FUNCTION(gsl_vector,memcpy)(&vv.vector, v);
2003
2011
  for (i = 0; i < size2; i++) {
2004
- x = rb_ary_entry(other, i);
2005
- FUNCTION(gsl_vector,set)(vnew, v->size + i, NUMCONV2(x));
2012
+ FUNCTION(gsl_vector,set)(vnew, v->size + i, beg);
2013
+ beg += step;
2006
2014
  }
2007
- break;
2008
-
2009
- default:
2010
- if(rb_obj_is_kind_of(other, rb_cRange)) {
2011
- FUNCTION(get_range,beg_en_n)(other, &beg, &end, &size2, &step);
2012
- vnew = FUNCTION(gsl_vector,alloc)(v->size + size2);
2013
- vv = FUNCTION(gsl_vector,subvector)(vnew, 0, v->size);
2014
- FUNCTION(gsl_vector,memcpy)(&vv.vector, v);
2015
- for (i = 0; i < size2; i++) {
2016
- FUNCTION(gsl_vector,set)(vnew, v->size + i, beg);
2017
- beg += step;
2018
- }
2019
- } else if (rb_obj_is_kind_of(other, GSL_TYPE(cgsl_vector))) {
2020
- Data_Get_Struct(other, GSL_TYPE(gsl_vector), v2);
2021
- size2 = v2->size;
2022
- vnew = FUNCTION(gsl_vector,alloc)(v->size + size2);
2023
- vv = FUNCTION(gsl_vector,subvector)(vnew, 0, v->size);
2024
- FUNCTION(gsl_vector,memcpy)(&vv.vector, v);
2025
- vv = FUNCTION(gsl_vector,subvector)(vnew, v->size, size2);
2026
- FUNCTION(gsl_vector,memcpy)(&vv.vector, v2);
2027
- } else {
2028
- rb_raise(rb_eTypeError, "wrong argument type %s (Array, Numeric, Range, or %s expected)",
2029
- rb_class2name(CLASS_OF(other)), rb_class2name(GSL_TYPE(cgsl_vector)));
2030
- }
2031
- break;
2015
+ } else if (rb_obj_is_kind_of(other, GSL_TYPE(cgsl_vector))) {
2016
+ Data_Get_Struct(other, GSL_TYPE(gsl_vector), v2);
2017
+ size2 = v2->size;
2018
+ vnew = FUNCTION(gsl_vector,alloc)(v->size + size2);
2019
+ vv = FUNCTION(gsl_vector,subvector)(vnew, 0, v->size);
2020
+ FUNCTION(gsl_vector,memcpy)(&vv.vector, v);
2021
+ vv = FUNCTION(gsl_vector,subvector)(vnew, v->size, size2);
2022
+ FUNCTION(gsl_vector,memcpy)(&vv.vector, v2);
2023
+ } else {
2024
+ rb_raise(rb_eTypeError, "wrong argument type %s (Array, Numeric, Range, or %s expected)",
2025
+ rb_class2name(CLASS_OF(other)), rb_class2name(GSL_TYPE(cgsl_vector)));
2026
+ }
2027
+ break;
2032
2028
  }
2033
2029
 
2034
- return Data_Wrap_Struct(VEC_ROW_COL(obj), 0, FUNCTION(gsl_vector,free), vnew);
2030
+ return Data_Wrap_Struct(VEC_ROW_COL(obj), 0, FUNCTION(gsl_vector,free), vnew);
2035
2031
  }
2036
2032
 
2037
2033
  void FUNCTION(mygsl_vector,diff)(GSL_TYPE(gsl_vector) *vdst,
2038
- GSL_TYPE(gsl_vector) *vsrc, size_t n)
2034
+ GSL_TYPE(gsl_vector) *vsrc, size_t n)
2039
2035
  {
2040
2036
  BASE a, b;
2041
2037
  int coef, fac, nn, ff;
@@ -2086,7 +2082,7 @@ static VALUE FUNCTION(rb_gsl_vector,test)(VALUE obj, int (*f)(const double))
2086
2082
  size_t i;
2087
2083
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
2088
2084
  vi = gsl_vector_int_alloc(v->size);
2089
- for (i = 0; i < v->size; i++)
2085
+ for (i = 0; i < v->size; i++)
2090
2086
  gsl_vector_int_set(vi, i, (*f)(FUNCTION(gsl_vector,get)(v, i)));
2091
2087
  return Data_Wrap_Struct(cgsl_vector_int, 0, gsl_vector_int_free, vi);
2092
2088
  }
@@ -2227,23 +2223,23 @@ static VALUE FUNCTION(rb_gsl_vector,filescan)(VALUE klass, VALUE file)
2227
2223
  Check_Type(file, T_STRING);
2228
2224
  strcpy(filename, STR2CSTR(file));
2229
2225
  sprintf(buf, "sed '/^#/d' %s | wc", filename);
2230
- if ((fp = popen(buf, "r")) == NULL)
2226
+ if ((fp = popen(buf, "r")) == NULL)
2231
2227
  rb_raise(rb_eIOError, "popen failed.");
2232
2228
  if (fgets(buf, 1024, fp) == NULL)
2233
2229
  rb_sys_fail(0);
2234
2230
  pclose(fp);
2235
2231
  sscanf(buf, "%d", &nn);
2236
2232
  lines = (size_t) nn; /* vector length */
2237
- if ((fp = fopen(filename, "r")) == NULL)
2233
+ if ((fp = fopen(filename, "r")) == NULL)
2238
2234
  rb_raise(rb_eIOError, "cannot open file %s.", filename);
2239
2235
  while (1) {
2240
- if (fgets(buf, 1024, fp) == NULL) /* read the first line to count number of columns */
2236
+ if (fgets(buf, 1024, fp) == NULL) /* read the first line to count number of columns */
2241
2237
  rb_sys_fail(0);
2242
- if (buf[0] == '#') continue;
2243
- else break;
2244
- }
2238
+ if (buf[0] == '#') continue;
2239
+ else break;
2240
+ }
2245
2241
  n = count_columns(buf); /* number of vectors to be created */
2246
- x = (GSL_TYPE(gsl_vector)**) xmalloc(sizeof(GSL_TYPE(gsl_vector)*)*n);
2242
+ x = (GSL_TYPE(gsl_vector)**)xmalloc(sizeof(GSL_TYPE(gsl_vector)*)*n);
2247
2243
  ary = rb_ary_new2(n);
2248
2244
  for (j = 0; j < n; j++) {
2249
2245
  x[j] = FUNCTION(gsl_vector,alloc)(lines);
@@ -2251,11 +2247,11 @@ static VALUE FUNCTION(rb_gsl_vector,filescan)(VALUE klass, VALUE file)
2251
2247
  }
2252
2248
  rewind(fp);
2253
2249
  for (i = 0, ii = 0; ii < lines; i++) {
2254
- pos = ftell(fp);
2255
- if (fgets(buf, 1024, fp) == NULL)
2250
+ pos = ftell(fp);
2251
+ if (fgets(buf, 1024, fp) == NULL)
2256
2252
  rb_sys_fail(0);
2257
- if (buf[0] == '#') continue;
2258
- fseek(fp, pos, SEEK_SET);
2253
+ if (buf[0] == '#') continue;
2254
+ fseek(fp, pos, SEEK_SET);
2259
2255
  for (j = 0, jj = 0; jj < n; j++) {
2260
2256
  k = fscanf(fp, FORMAT_TMP, &val);
2261
2257
  if (k != 1) continue;
@@ -2269,9 +2265,9 @@ static VALUE FUNCTION(rb_gsl_vector,filescan)(VALUE klass, VALUE file)
2269
2265
  }
2270
2266
  #undef FORMAT_TMP
2271
2267
 
2272
- static int FUNCTION(gsl_vector,eq)(const GSL_TYPE(gsl_vector) *a,
2273
- const GSL_TYPE(gsl_vector) *b,
2274
- gsl_block_uchar *c)
2268
+ static int FUNCTION(gsl_vector,eq)(const GSL_TYPE(gsl_vector) *a,
2269
+ const GSL_TYPE(gsl_vector) *b,
2270
+ gsl_block_uchar *c)
2275
2271
  {
2276
2272
  size_t i;
2277
2273
  BASE x, y;
@@ -2285,9 +2281,9 @@ static int FUNCTION(gsl_vector,eq)(const GSL_TYPE(gsl_vector) *a,
2285
2281
  return 0;
2286
2282
  }
2287
2283
 
2288
- static int FUNCTION(gsl_vector,ne)(const GSL_TYPE(gsl_vector) *a,
2289
- const GSL_TYPE(gsl_vector) *b,
2290
- gsl_block_uchar *c)
2284
+ static int FUNCTION(gsl_vector,ne)(const GSL_TYPE(gsl_vector) *a,
2285
+ const GSL_TYPE(gsl_vector) *b,
2286
+ gsl_block_uchar *c)
2291
2287
  {
2292
2288
  size_t i;
2293
2289
  BASE x, y;
@@ -2301,9 +2297,9 @@ static int FUNCTION(gsl_vector,ne)(const GSL_TYPE(gsl_vector) *a,
2301
2297
  return 0;
2302
2298
  }
2303
2299
 
2304
- static int FUNCTION(gsl_vector,gt)(const GSL_TYPE(gsl_vector) *a,
2305
- const GSL_TYPE(gsl_vector) *b,
2306
- gsl_block_uchar *c)
2300
+ static int FUNCTION(gsl_vector,gt)(const GSL_TYPE(gsl_vector) *a,
2301
+ const GSL_TYPE(gsl_vector) *b,
2302
+ gsl_block_uchar *c)
2307
2303
  {
2308
2304
  size_t i;
2309
2305
  BASE x, y;
@@ -2317,9 +2313,9 @@ static int FUNCTION(gsl_vector,gt)(const GSL_TYPE(gsl_vector) *a,
2317
2313
  return 0;
2318
2314
  }
2319
2315
 
2320
- static int FUNCTION(gsl_vector,ge)(const GSL_TYPE(gsl_vector) *a,
2321
- const GSL_TYPE(gsl_vector) *b,
2322
- gsl_block_uchar *c)
2316
+ static int FUNCTION(gsl_vector,ge)(const GSL_TYPE(gsl_vector) *a,
2317
+ const GSL_TYPE(gsl_vector) *b,
2318
+ gsl_block_uchar *c)
2323
2319
  {
2324
2320
  size_t i;
2325
2321
  BASE x, y;
@@ -2333,9 +2329,9 @@ static int FUNCTION(gsl_vector,ge)(const GSL_TYPE(gsl_vector) *a,
2333
2329
  return 0;
2334
2330
  }
2335
2331
 
2336
- static int FUNCTION(gsl_vector,lt)(const GSL_TYPE(gsl_vector) *a,
2337
- const GSL_TYPE(gsl_vector) *b,
2338
- gsl_block_uchar *c)
2332
+ static int FUNCTION(gsl_vector,lt)(const GSL_TYPE(gsl_vector) *a,
2333
+ const GSL_TYPE(gsl_vector) *b,
2334
+ gsl_block_uchar *c)
2339
2335
  {
2340
2336
  size_t i;
2341
2337
  BASE x, y;
@@ -2349,9 +2345,9 @@ static int FUNCTION(gsl_vector,lt)(const GSL_TYPE(gsl_vector) *a,
2349
2345
  return 0;
2350
2346
  }
2351
2347
 
2352
- static int FUNCTION(gsl_vector,le)(const GSL_TYPE(gsl_vector) *a,
2353
- const GSL_TYPE(gsl_vector) *b,
2354
- gsl_block_uchar *c)
2348
+ static int FUNCTION(gsl_vector,le)(const GSL_TYPE(gsl_vector) *a,
2349
+ const GSL_TYPE(gsl_vector) *b,
2350
+ gsl_block_uchar *c)
2355
2351
  {
2356
2352
  size_t i;
2357
2353
  BASE x, y;
@@ -2365,9 +2361,9 @@ static int FUNCTION(gsl_vector,le)(const GSL_TYPE(gsl_vector) *a,
2365
2361
  return 0;
2366
2362
  }
2367
2363
 
2368
- static int FUNCTION(gsl_vector,and)(const GSL_TYPE(gsl_vector) *a,
2369
- const GSL_TYPE(gsl_vector) *b,
2370
- gsl_block_uchar *c)
2364
+ static int FUNCTION(gsl_vector,and)(const GSL_TYPE(gsl_vector) *a,
2365
+ const GSL_TYPE(gsl_vector) *b,
2366
+ gsl_block_uchar *c)
2371
2367
  {
2372
2368
  size_t i;
2373
2369
  BASE x, y;
@@ -2381,9 +2377,9 @@ static int FUNCTION(gsl_vector,and)(const GSL_TYPE(gsl_vector) *a,
2381
2377
  return 0;
2382
2378
  }
2383
2379
 
2384
- static int FUNCTION(gsl_vector,or)(const GSL_TYPE(gsl_vector) *a,
2385
- const GSL_TYPE(gsl_vector) *b,
2386
- gsl_block_uchar *c)
2380
+ static int FUNCTION(gsl_vector,or)(const GSL_TYPE(gsl_vector) *a,
2381
+ const GSL_TYPE(gsl_vector) *b,
2382
+ gsl_block_uchar *c)
2387
2383
  {
2388
2384
  size_t i;
2389
2385
  BASE x, y;
@@ -2397,9 +2393,9 @@ static int FUNCTION(gsl_vector,or)(const GSL_TYPE(gsl_vector) *a,
2397
2393
  return 0;
2398
2394
  }
2399
2395
 
2400
- static int FUNCTION(gsl_vector,xor)(const GSL_TYPE(gsl_vector) *a,
2401
- const GSL_TYPE(gsl_vector) *b,
2402
- gsl_block_uchar *c)
2396
+ static int FUNCTION(gsl_vector,xor)(const GSL_TYPE(gsl_vector) *a,
2397
+ const GSL_TYPE(gsl_vector) *b,
2398
+ gsl_block_uchar *c)
2403
2399
  {
2404
2400
  size_t i;
2405
2401
  BASE x, y;
@@ -2413,8 +2409,8 @@ static int FUNCTION(gsl_vector,xor)(const GSL_TYPE(gsl_vector) *a,
2413
2409
  return 0;
2414
2410
  }
2415
2411
 
2416
- static int FUNCTION(gsl_vector,eq2)(const GSL_TYPE(gsl_vector) *a,
2417
- BASE b, gsl_block_uchar *c)
2412
+ static int FUNCTION(gsl_vector,eq2)(const GSL_TYPE(gsl_vector) *a,
2413
+ BASE b, gsl_block_uchar *c)
2418
2414
  {
2419
2415
  size_t i;
2420
2416
  BASE x, y;
@@ -2427,9 +2423,9 @@ static int FUNCTION(gsl_vector,eq2)(const GSL_TYPE(gsl_vector) *a,
2427
2423
  return 0;
2428
2424
  }
2429
2425
 
2430
- static int FUNCTION(gsl_vector,ne2)(const GSL_TYPE(gsl_vector) *a,
2431
- BASE b,
2432
- gsl_block_uchar *c)
2426
+ static int FUNCTION(gsl_vector,ne2)(const GSL_TYPE(gsl_vector) *a,
2427
+ BASE b,
2428
+ gsl_block_uchar *c)
2433
2429
  {
2434
2430
  size_t i;
2435
2431
  BASE x, y;
@@ -2442,9 +2438,9 @@ static int FUNCTION(gsl_vector,ne2)(const GSL_TYPE(gsl_vector) *a,
2442
2438
  return 0;
2443
2439
  }
2444
2440
 
2445
- static int FUNCTION(gsl_vector,gt2)(const GSL_TYPE(gsl_vector) *a,
2446
- BASE b,
2447
- gsl_block_uchar *c)
2441
+ static int FUNCTION(gsl_vector,gt2)(const GSL_TYPE(gsl_vector) *a,
2442
+ BASE b,
2443
+ gsl_block_uchar *c)
2448
2444
  {
2449
2445
  size_t i;
2450
2446
  BASE x, y;
@@ -2457,9 +2453,9 @@ static int FUNCTION(gsl_vector,gt2)(const GSL_TYPE(gsl_vector) *a,
2457
2453
  return 0;
2458
2454
  }
2459
2455
 
2460
- static int FUNCTION(gsl_vector,ge2)(const GSL_TYPE(gsl_vector) *a,
2461
- BASE b,
2462
- gsl_block_uchar *c)
2456
+ static int FUNCTION(gsl_vector,ge2)(const GSL_TYPE(gsl_vector) *a,
2457
+ BASE b,
2458
+ gsl_block_uchar *c)
2463
2459
  {
2464
2460
  size_t i;
2465
2461
  BASE x, y;
@@ -2472,9 +2468,9 @@ static int FUNCTION(gsl_vector,ge2)(const GSL_TYPE(gsl_vector) *a,
2472
2468
  return 0;
2473
2469
  }
2474
2470
 
2475
- static int FUNCTION(gsl_vector,lt2)(const GSL_TYPE(gsl_vector) *a,
2476
- BASE b,
2477
- gsl_block_uchar *c)
2471
+ static int FUNCTION(gsl_vector,lt2)(const GSL_TYPE(gsl_vector) *a,
2472
+ BASE b,
2473
+ gsl_block_uchar *c)
2478
2474
  {
2479
2475
  size_t i;
2480
2476
  BASE x, y;
@@ -2487,9 +2483,9 @@ static int FUNCTION(gsl_vector,lt2)(const GSL_TYPE(gsl_vector) *a,
2487
2483
  return 0;
2488
2484
  }
2489
2485
 
2490
- static int FUNCTION(gsl_vector,le2)(const GSL_TYPE(gsl_vector) *a,
2491
- BASE b,
2492
- gsl_block_uchar *c)
2486
+ static int FUNCTION(gsl_vector,le2)(const GSL_TYPE(gsl_vector) *a,
2487
+ BASE b,
2488
+ gsl_block_uchar *c)
2493
2489
  {
2494
2490
  size_t i;
2495
2491
  BASE x, y;
@@ -2502,9 +2498,9 @@ static int FUNCTION(gsl_vector,le2)(const GSL_TYPE(gsl_vector) *a,
2502
2498
  return 0;
2503
2499
  }
2504
2500
 
2505
- static int FUNCTION(gsl_vector,and2)(const GSL_TYPE(gsl_vector) *a,
2506
- BASE b,
2507
- gsl_block_uchar *c)
2501
+ static int FUNCTION(gsl_vector,and2)(const GSL_TYPE(gsl_vector) *a,
2502
+ BASE b,
2503
+ gsl_block_uchar *c)
2508
2504
  {
2509
2505
  size_t i;
2510
2506
  BASE x, y;
@@ -2517,9 +2513,9 @@ static int FUNCTION(gsl_vector,and2)(const GSL_TYPE(gsl_vector) *a,
2517
2513
  return 0;
2518
2514
  }
2519
2515
 
2520
- static int FUNCTION(gsl_vector,or2)(const GSL_TYPE(gsl_vector) *a,
2521
- BASE b,
2522
- gsl_block_uchar *c)
2516
+ static int FUNCTION(gsl_vector,or2)(const GSL_TYPE(gsl_vector) *a,
2517
+ BASE b,
2518
+ gsl_block_uchar *c)
2523
2519
  {
2524
2520
  size_t i;
2525
2521
  BASE x, y;
@@ -2532,9 +2528,9 @@ static int FUNCTION(gsl_vector,or2)(const GSL_TYPE(gsl_vector) *a,
2532
2528
  return 0;
2533
2529
  }
2534
2530
 
2535
- static int FUNCTION(gsl_vector,xor2)(const GSL_TYPE(gsl_vector) *a,
2536
- BASE b,
2537
- gsl_block_uchar *c)
2531
+ static int FUNCTION(gsl_vector,xor2)(const GSL_TYPE(gsl_vector) *a,
2532
+ BASE b,
2533
+ gsl_block_uchar *c)
2538
2534
  {
2539
2535
  size_t i;
2540
2536
  BASE x, y;
@@ -2549,12 +2545,12 @@ static int FUNCTION(gsl_vector,xor2)(const GSL_TYPE(gsl_vector) *a,
2549
2545
 
2550
2546
 
2551
2547
  static VALUE FUNCTION(rb_gsl_vector,compare)(VALUE aa, VALUE bb,
2552
- int (*cmp)(const GSL_TYPE(gsl_vector)*,
2553
- const GSL_TYPE(gsl_vector)*,
2554
- gsl_block_uchar*),
2555
- int (*cmp2)(const GSL_TYPE(gsl_vector)*,
2556
- BASE,
2557
- gsl_block_uchar*))
2548
+ int (*cmp)(const GSL_TYPE (gsl_vector)*,
2549
+ const GSL_TYPE (gsl_vector)*,
2550
+ gsl_block_uchar*),
2551
+ int (*cmp2)(const GSL_TYPE (gsl_vector)*,
2552
+ BASE,
2553
+ gsl_block_uchar*))
2558
2554
  {
2559
2555
  GSL_TYPE(gsl_vector) *a, *b;
2560
2556
  /* gsl_vector_int *c;*/
@@ -2564,9 +2560,9 @@ static VALUE FUNCTION(rb_gsl_vector,compare)(VALUE aa, VALUE bb,
2564
2560
  c = gsl_block_uchar_alloc(a->size);
2565
2561
  if (VEC_P(bb)) {
2566
2562
  Data_Get_Struct(bb, GSL_TYPE(gsl_vector), b);
2567
- if (a->size != b->size)
2568
- rb_raise(rb_eRuntimeError, "Vector size mismatch, %d and %d", (int) a->size,
2569
- (int) b->size);
2563
+ if (a->size != b->size)
2564
+ rb_raise(rb_eRuntimeError, "Vector size mismatch, %d and %d", (int) a->size,
2565
+ (int) b->size);
2570
2566
  /*status =*/ (*cmp)(a, b, c);
2571
2567
  } else {
2572
2568
  /*status =*/ (*cmp2)(a, NUMCONV(bb), c);
@@ -2577,55 +2573,55 @@ static VALUE FUNCTION(rb_gsl_vector,compare)(VALUE aa, VALUE bb,
2577
2573
  static VALUE FUNCTION(rb_gsl_vector,eq)(VALUE aa, VALUE bb)
2578
2574
  {
2579
2575
  return FUNCTION(rb_gsl_vector,compare)(aa, bb, FUNCTION(gsl_vector,eq),
2580
- FUNCTION(gsl_vector,eq2));
2576
+ FUNCTION(gsl_vector,eq2));
2581
2577
  }
2582
2578
 
2583
2579
  static VALUE FUNCTION(rb_gsl_vector,ne)(VALUE aa, VALUE bb)
2584
2580
  {
2585
2581
  return FUNCTION(rb_gsl_vector,compare)(aa, bb, FUNCTION(gsl_vector,ne),
2586
- FUNCTION(gsl_vector,ne2));
2582
+ FUNCTION(gsl_vector,ne2));
2587
2583
  }
2588
2584
 
2589
2585
  static VALUE FUNCTION(rb_gsl_vector,gt)(VALUE aa, VALUE bb)
2590
2586
  {
2591
2587
  return FUNCTION(rb_gsl_vector,compare)(aa, bb, FUNCTION(gsl_vector,gt),
2592
- FUNCTION(gsl_vector,gt2));
2588
+ FUNCTION(gsl_vector,gt2));
2593
2589
  }
2594
2590
 
2595
2591
  static VALUE FUNCTION(rb_gsl_vector,ge)(VALUE aa, VALUE bb)
2596
2592
  {
2597
2593
  return FUNCTION(rb_gsl_vector,compare)(aa, bb, FUNCTION(gsl_vector,ge),
2598
- FUNCTION(gsl_vector,ge2));
2594
+ FUNCTION(gsl_vector,ge2));
2599
2595
  }
2600
2596
 
2601
2597
  static VALUE FUNCTION(rb_gsl_vector,lt)(VALUE aa, VALUE bb)
2602
2598
  {
2603
2599
  return FUNCTION(rb_gsl_vector,compare)(aa, bb, FUNCTION(gsl_vector,lt),
2604
- FUNCTION(gsl_vector,lt2));
2600
+ FUNCTION(gsl_vector,lt2));
2605
2601
  }
2606
2602
 
2607
2603
  static VALUE FUNCTION(rb_gsl_vector,le)(VALUE aa, VALUE bb)
2608
2604
  {
2609
2605
  return FUNCTION(rb_gsl_vector,compare)(aa, bb, FUNCTION(gsl_vector,le),
2610
- FUNCTION(gsl_vector,le2));
2606
+ FUNCTION(gsl_vector,le2));
2611
2607
  }
2612
2608
 
2613
2609
  static VALUE FUNCTION(rb_gsl_vector,and)(VALUE aa, VALUE bb)
2614
2610
  {
2615
2611
  return FUNCTION(rb_gsl_vector,compare)(aa, bb, FUNCTION(gsl_vector,and),
2616
- FUNCTION(gsl_vector,and2));
2612
+ FUNCTION(gsl_vector,and2));
2617
2613
  }
2618
2614
 
2619
2615
  static VALUE FUNCTION(rb_gsl_vector,or)(VALUE aa, VALUE bb)
2620
2616
  {
2621
2617
  return FUNCTION(rb_gsl_vector,compare)(aa, bb, FUNCTION(gsl_vector,or),
2622
- FUNCTION(gsl_vector,or2));
2618
+ FUNCTION(gsl_vector,or2));
2623
2619
  }
2624
2620
 
2625
2621
  static VALUE FUNCTION(rb_gsl_vector,xor)(VALUE aa, VALUE bb)
2626
2622
  {
2627
2623
  return FUNCTION(rb_gsl_vector,compare)(aa, bb, FUNCTION(gsl_vector,xor),
2628
- FUNCTION(gsl_vector,xor2));
2624
+ FUNCTION(gsl_vector,xor2));
2629
2625
  }
2630
2626
 
2631
2627
  static VALUE FUNCTION(rb_gsl_vector,not)(VALUE obj)
@@ -2663,11 +2659,11 @@ static VALUE FUNCTION(rb_gsl_vector,any2)(VALUE obj)
2663
2659
 
2664
2660
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
2665
2661
  if (rb_block_given_p()) {
2666
- for (i = 0; i < v->size; i++)
2662
+ for (i = 0; i < v->size; i++)
2667
2663
  if (rb_yield(C_TO_VALUE(FUNCTION(gsl_vector,get)(v, i)))) return Qtrue;
2668
2664
  return Qfalse;
2669
2665
  } else {
2670
- for (i = 0; i < v->size; i++)
2666
+ for (i = 0; i < v->size; i++)
2671
2667
  if (v->data[i*v->stride]) return Qtrue;
2672
2668
  return Qfalse;
2673
2669
  }
@@ -2680,11 +2676,11 @@ static VALUE FUNCTION(rb_gsl_vector,none)(VALUE obj)
2680
2676
 
2681
2677
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
2682
2678
  if (rb_block_given_p()) {
2683
- for (i = 0; i < v->size; i++)
2679
+ for (i = 0; i < v->size; i++)
2684
2680
  if (rb_yield(C_TO_VALUE(FUNCTION(gsl_vector,get)(v, i)))) return Qfalse;
2685
2681
  return Qtrue;
2686
2682
  } else {
2687
- for (i = 0; i < v->size; i++)
2683
+ for (i = 0; i < v->size; i++)
2688
2684
  if (v->data[i*v->stride]) return Qfalse;
2689
2685
  return Qtrue;
2690
2686
  }
@@ -2697,11 +2693,11 @@ static VALUE FUNCTION(rb_gsl_vector,all)(VALUE obj)
2697
2693
 
2698
2694
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
2699
2695
  if (rb_block_given_p()) {
2700
- for (i = 0; i < v->size; i++)
2696
+ for (i = 0; i < v->size; i++)
2701
2697
  if (!rb_yield(C_TO_VALUE(FUNCTION(gsl_vector,get)(v, i)))) return Qfalse;
2702
2698
  return Qtrue;
2703
2699
  } else {
2704
- for (i = 0; i < v->size; i++)
2700
+ for (i = 0; i < v->size; i++)
2705
2701
  if (!v->data[i*v->stride]) return Qfalse;
2706
2702
  return Qtrue;
2707
2703
  }
@@ -2719,10 +2715,10 @@ static VALUE FUNCTION(rb_gsl_vector,where)(VALUE obj)
2719
2715
  btmp = gsl_block_uchar_alloc(v->size);
2720
2716
  for (i = 0; i < v->size; i++) {
2721
2717
  if (rb_yield(C_TO_VALUE(FUNCTION(gsl_vector,get)(v, i)))) {
2722
- btmp->data[i] = 1;
2723
- n++;
2718
+ btmp->data[i] = 1;
2719
+ n++;
2724
2720
  } else {
2725
- btmp->data[i] = 0;
2721
+ btmp->data[i] = 0;
2726
2722
  }
2727
2723
  } /* for */
2728
2724
  } else { /* block is not given */
@@ -2754,10 +2750,10 @@ static VALUE FUNCTION(rb_gsl_vector,where2)(VALUE obj)
2754
2750
  btmp = gsl_block_uchar_alloc(v->size);
2755
2751
  for (i = 0; i < v->size; i++) {
2756
2752
  if (rb_yield(C_TO_VALUE(FUNCTION(gsl_vector,get)(v, i)))) {
2757
- btmp->data[i] = 1;
2758
- n++;
2753
+ btmp->data[i] = 1;
2754
+ n++;
2759
2755
  } else {
2760
- btmp->data[i] = 0;
2756
+ btmp->data[i] = 0;
2761
2757
  }
2762
2758
  } /* for */
2763
2759
  } else { /* block is not given */
@@ -2768,11 +2764,11 @@ static VALUE FUNCTION(rb_gsl_vector,where2)(VALUE obj)
2768
2764
  v2 = gsl_permutation_calloc(v->size); /* calloc() initializes v2 */
2769
2765
  vv1 = Qnil;
2770
2766
  vv2 = Data_Wrap_Struct(cgsl_index, 0, gsl_permutation_free, v2);
2771
- } else if (v->size-n == 0) {
2767
+ } else if (v->size-n == 0) {
2772
2768
  v1 = gsl_permutation_calloc(n); /* calloc() initializes v1 */
2773
- vv1 = Data_Wrap_Struct(cgsl_index, 0, gsl_permutation_free, v1);
2769
+ vv1 = Data_Wrap_Struct(cgsl_index, 0, gsl_permutation_free, v1);
2774
2770
  vv2 = Qnil;
2775
- } else {
2771
+ } else {
2776
2772
  /* same case as 'where' */
2777
2773
  v1 = gsl_permutation_alloc(n);
2778
2774
  v2 = gsl_permutation_alloc(v->size-n);
@@ -2787,8 +2783,8 @@ static VALUE FUNCTION(rb_gsl_vector,where2)(VALUE obj)
2787
2783
  return rb_ary_new3(2, vv1, vv2);
2788
2784
  }
2789
2785
 
2790
- static VALUE FUNCTION(rb_gsl_vector,op_inplace)(VALUE vv1, VALUE vv2,
2791
- int (*f)(GSL_TYPE(gsl_vector)*, const GSL_TYPE(gsl_vector)*))
2786
+ static VALUE FUNCTION(rb_gsl_vector,op_inplace)(VALUE vv1, VALUE vv2,
2787
+ int (*f)(GSL_TYPE (gsl_vector)*, const GSL_TYPE (gsl_vector)*))
2792
2788
  {
2793
2789
  GSL_TYPE(gsl_vector) *v1, *v2;
2794
2790
  Data_Get_Struct(vv1, GSL_TYPE(gsl_vector), v1);
@@ -2866,14 +2862,14 @@ static VALUE FUNCTION(rb_gsl_vector,zip)(int argc, VALUE *argv, VALUE obj)
2866
2862
  argv2 = argv;
2867
2863
  } else {
2868
2864
  if (argc < 1) rb_raise(rb_eArgError, "Too few arguments.");
2869
- Data_Get_Struct(argv[0], GSL_TYPE(gsl_vector), v0);
2865
+ Data_Get_Struct(argv[0], GSL_TYPE(gsl_vector), v0);
2870
2866
  argc2 = argc - 1;
2871
2867
  argv2 = argv + 1;
2872
2868
  }
2873
2869
  for (i = 0; (int) i < argc2; i++) {
2874
2870
  CHECK_VEC(argv2[i]);
2875
2871
  }
2876
- vp = (GSL_TYPE(gsl_vector)**) malloc(sizeof(GSL_TYPE(gsl_vector)**));
2872
+ vp = (GSL_TYPE(gsl_vector)**)malloc(sizeof(GSL_TYPE(gsl_vector)**));
2877
2873
  for (i = 0; (int) i < argc2; i++) {
2878
2874
  Data_Get_Struct(argv2[i], GSL_TYPE(gsl_vector), vp[i]);
2879
2875
  }
@@ -2883,15 +2879,14 @@ static VALUE FUNCTION(rb_gsl_vector,zip)(int argc, VALUE *argv, VALUE obj)
2883
2879
  FUNCTION(gsl_vector,set)(vnew, 0, FUNCTION(gsl_vector,get)(v0, i));
2884
2880
  for (j = 0; (int) j < argc2; j++) {
2885
2881
  if (i < vp[j]->size) {
2886
- FUNCTION(gsl_vector,set)(vnew, j+1, FUNCTION(gsl_vector,get)(vp[j], i));
2882
+ FUNCTION(gsl_vector,set)(vnew, j+1, FUNCTION(gsl_vector,get)(vp[j], i));
2887
2883
  } else {
2888
- FUNCTION(gsl_vector,set)(vnew, j+1, 0.0);
2884
+ FUNCTION(gsl_vector,set)(vnew, j+1, 0.0);
2889
2885
  }
2890
2886
  }
2891
2887
  rb_ary_store(ary, i, Data_Wrap_Struct(GSL_TYPE(cgsl_vector), 0, FUNCTION(gsl_vector,free), vnew));
2892
2888
  }
2893
-
2894
- free((GSL_TYPE(gsl_vector)**) vp);
2889
+ free((GSL_TYPE(gsl_vector)**)vp);
2895
2890
  return ary;
2896
2891
  }
2897
2892
 
@@ -2955,17 +2950,16 @@ static VALUE FUNCTION(rb_gsl_vector,cumprod)(VALUE obj)
2955
2950
  return Data_Wrap_Struct(VEC_ROW_COL(obj), 0, FUNCTION(gsl_vector,free), vnew);
2956
2951
  }
2957
2952
 
2958
- #ifdef GSL_1_9_LATER
2959
2953
  static VALUE FUNCTION(rb_gsl_vector,property)(VALUE obj,
2960
- int (*f)(const GSL_TYPE(gsl_vector) *)) {
2954
+ int (*f)(const GSL_TYPE (gsl_vector) *)) {
2961
2955
  GSL_TYPE(gsl_vector) *v;
2962
2956
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
2963
- return INT2FIX((*f)(v));
2957
+ return INT2FIX((*f)(v));
2964
2958
  }
2965
2959
 
2966
2960
  static VALUE FUNCTION(rb_gsl_vector,property2)(VALUE obj,
2967
- int (*f)(const GSL_TYPE(gsl_vector) *)) {
2968
- GSL_TYPE(gsl_vector) *v;
2961
+ int (*f)(const GSL_TYPE (gsl_vector) *)) {
2962
+ GSL_TYPE(gsl_vector) *v;
2969
2963
  Data_Get_Struct(obj, GSL_TYPE(gsl_vector), v);
2970
2964
  if ((*f)(v)) return Qtrue;
2971
2965
  else return Qfalse;
@@ -2977,19 +2971,17 @@ static VALUE FUNCTION(rb_gsl_vector,ispos)(VALUE obj)
2977
2971
  }
2978
2972
  static VALUE FUNCTION(rb_gsl_vector,ispos2)(VALUE obj)
2979
2973
  {
2980
- return FUNCTION(rb_gsl_vector,property2)(obj, FUNCTION(gsl_vector, ispos));
2974
+ return FUNCTION(rb_gsl_vector,property2)(obj, FUNCTION(gsl_vector, ispos));
2981
2975
  }
2982
2976
  static VALUE FUNCTION(rb_gsl_vector,isneg)(VALUE obj)
2983
2977
  {
2984
- return FUNCTION(rb_gsl_vector,property)(obj, FUNCTION(gsl_vector, isneg));
2978
+ return FUNCTION(rb_gsl_vector,property)(obj, FUNCTION(gsl_vector, isneg));
2985
2979
  }
2986
2980
  static VALUE FUNCTION(rb_gsl_vector,isneg2)(VALUE obj)
2987
2981
  {
2988
- return FUNCTION(rb_gsl_vector,property2)(obj, FUNCTION(gsl_vector, isneg));
2982
+ return FUNCTION(rb_gsl_vector,property2)(obj, FUNCTION(gsl_vector, isneg));
2989
2983
  }
2990
- #endif
2991
2984
 
2992
- #ifdef GSL_1_10_LATER
2993
2985
  static VALUE FUNCTION(rb_gsl_vector,isnonneg)(VALUE obj)
2994
2986
  {
2995
2987
  return FUNCTION(rb_gsl_vector,property)(obj, FUNCTION(gsl_vector, isnonneg));
@@ -2997,19 +2989,18 @@ static VALUE FUNCTION(rb_gsl_vector,isnonneg)(VALUE obj)
2997
2989
  static VALUE FUNCTION(rb_gsl_vector,isnonneg2)(VALUE obj)
2998
2990
  {
2999
2991
  return FUNCTION(rb_gsl_vector,property2)(obj, FUNCTION(gsl_vector, isnonneg));
3000
- }
3001
- #endif
2992
+ }
3002
2993
 
3003
2994
  void FUNCTION(Init_gsl_vector,init)(VALUE module)
3004
2995
  {
3005
- /* rb_define_singleton_method(GSL_TYPE(cgsl_vector), "new",
2996
+ /* rb_define_singleton_method(GSL_TYPE(cgsl_vector), "new",
3006
2997
  FUNCTION(rb_gsl_vector,new), -1);*/
3007
- rb_define_singleton_method(GSL_TYPE(cgsl_vector), "[]",
3008
- FUNCTION(rb_gsl_vector,new), -1);
3009
- rb_define_singleton_method(GSL_TYPE(cgsl_vector), "alloc",
3010
- FUNCTION(rb_gsl_vector,new), -1);
3011
- rb_define_singleton_method(GSL_TYPE(cgsl_vector), "calloc",
3012
- FUNCTION(rb_gsl_vector,calloc), 1);
2998
+ rb_define_singleton_method(GSL_TYPE(cgsl_vector), "[]",
2999
+ FUNCTION(rb_gsl_vector,new), -1);
3000
+ rb_define_singleton_method(GSL_TYPE(cgsl_vector), "alloc",
3001
+ FUNCTION(rb_gsl_vector,new), -1);
3002
+ rb_define_singleton_method(GSL_TYPE(cgsl_vector), "calloc",
3003
+ FUNCTION(rb_gsl_vector,calloc), 1);
3013
3004
 
3014
3005
  /*****/
3015
3006
  rb_define_method(GSL_TYPE(cgsl_vector), "get", FUNCTION(rb_gsl_vector,get), -1);
@@ -3078,86 +3069,86 @@ void FUNCTION(Init_gsl_vector,init)(VALUE module)
3078
3069
  rb_define_method(GSL_TYPE(cgsl_vector), "cumsum", FUNCTION(rb_gsl_vector,cumsum), 0);
3079
3070
  rb_define_method(GSL_TYPE(cgsl_vector), "cumprod", FUNCTION(rb_gsl_vector,cumprod), 0);
3080
3071
 
3081
- rb_define_method(GSL_TYPE(cgsl_vector), "connect",
3082
- FUNCTION(rb_gsl_vector,connect), -1);
3083
- rb_define_singleton_method(GSL_TYPE(cgsl_vector), "connect",
3084
- FUNCTION(rb_gsl_vector,connect), -1);
3072
+ rb_define_method(GSL_TYPE(cgsl_vector), "connect",
3073
+ FUNCTION(rb_gsl_vector,connect), -1);
3074
+ rb_define_singleton_method(GSL_TYPE(cgsl_vector), "connect",
3075
+ FUNCTION(rb_gsl_vector,connect), -1);
3085
3076
 
3086
3077
 
3087
3078
  rb_define_method(GSL_TYPE(cgsl_vector), "sgn", FUNCTION(rb_gsl_vector,sgn), 0);
3088
3079
  rb_define_alias(GSL_TYPE(cgsl_vector), "signum", "sgn");
3089
3080
  rb_define_method(GSL_TYPE(cgsl_vector), "abs", FUNCTION(rb_gsl_vector,abs), 0);
3090
3081
  rb_define_alias(GSL_TYPE(cgsl_vector), "fabs", "abs");
3091
- rb_define_method(GSL_TYPE(cgsl_vector), "square",
3092
- FUNCTION(rb_gsl_vector,square), 0);
3082
+ rb_define_method(GSL_TYPE(cgsl_vector), "square",
3083
+ FUNCTION(rb_gsl_vector,square), 0);
3093
3084
  rb_define_alias(GSL_TYPE(cgsl_vector), "abs2", "square");
3094
3085
  rb_define_method(GSL_TYPE(cgsl_vector), "sqrt", FUNCTION(rb_gsl_vector,sqrt), 0);
3095
3086
 
3096
- rb_define_singleton_method(GSL_TYPE(cgsl_vector), "memcpy",
3097
- FUNCTION(rb_gsl_vector,memcpy), 2);
3098
- rb_define_method(GSL_TYPE(cgsl_vector), "clone",
3099
- FUNCTION(rb_gsl_vector,clone), 0);
3087
+ rb_define_singleton_method(GSL_TYPE(cgsl_vector), "memcpy",
3088
+ FUNCTION(rb_gsl_vector,memcpy), 2);
3089
+ rb_define_method(GSL_TYPE(cgsl_vector), "clone",
3090
+ FUNCTION(rb_gsl_vector,clone), 0);
3100
3091
  rb_define_alias(GSL_TYPE(cgsl_vector), "duplicate", "clone");
3101
3092
  rb_define_alias(GSL_TYPE(cgsl_vector), "dup", "clone");
3102
- rb_define_singleton_method(GSL_TYPE(cgsl_vector), "swap",
3103
- FUNCTION(rb_gsl_vector,swap), 2);
3104
- rb_define_method(GSL_TYPE(cgsl_vector), "swap_elements",
3105
- FUNCTION(rb_gsl_vector,swap_elements), 2);
3106
-
3107
- rb_define_method(GSL_TYPE(cgsl_vector), "fwrite",
3108
- FUNCTION(rb_gsl_vector,fwrite), 1);
3109
- rb_define_method(GSL_TYPE(cgsl_vector), "fread",
3110
- FUNCTION(rb_gsl_vector,fread), 1);
3111
- rb_define_method(GSL_TYPE(cgsl_vector), "fprintf",
3112
- FUNCTION(rb_gsl_vector,fprintf), -1);
3113
- rb_define_method(GSL_TYPE(cgsl_vector), "printf",
3114
- FUNCTION(rb_gsl_vector,printf), -1);
3115
- rb_define_method(GSL_TYPE(cgsl_vector), "fscanf",
3116
- FUNCTION(rb_gsl_vector,fscanf), 1);
3093
+ rb_define_singleton_method(GSL_TYPE(cgsl_vector), "swap",
3094
+ FUNCTION(rb_gsl_vector,swap), 2);
3095
+ rb_define_method(GSL_TYPE(cgsl_vector), "swap_elements",
3096
+ FUNCTION(rb_gsl_vector,swap_elements), 2);
3097
+
3098
+ rb_define_method(GSL_TYPE(cgsl_vector), "fwrite",
3099
+ FUNCTION(rb_gsl_vector,fwrite), 1);
3100
+ rb_define_method(GSL_TYPE(cgsl_vector), "fread",
3101
+ FUNCTION(rb_gsl_vector,fread), 1);
3102
+ rb_define_method(GSL_TYPE(cgsl_vector), "fprintf",
3103
+ FUNCTION(rb_gsl_vector,fprintf), -1);
3104
+ rb_define_method(GSL_TYPE(cgsl_vector), "printf",
3105
+ FUNCTION(rb_gsl_vector,printf), -1);
3106
+ rb_define_method(GSL_TYPE(cgsl_vector), "fscanf",
3107
+ FUNCTION(rb_gsl_vector,fscanf), 1);
3117
3108
 
3118
3109
  /* 2.Aug.2004 */
3119
- rb_define_singleton_method(GSL_TYPE(cgsl_vector), "inner_product",
3120
- FUNCTION(rb_gsl_vector,inner_product), -1);
3121
- rb_define_singleton_method(GSL_TYPE(cgsl_vector), "dot",
3122
- FUNCTION(rb_gsl_vector,inner_product), -1);
3110
+ rb_define_singleton_method(GSL_TYPE(cgsl_vector), "inner_product",
3111
+ FUNCTION(rb_gsl_vector,inner_product), -1);
3112
+ rb_define_singleton_method(GSL_TYPE(cgsl_vector), "dot",
3113
+ FUNCTION(rb_gsl_vector,inner_product), -1);
3123
3114
  rb_define_method(GSL_TYPE(cgsl_vector), "inner_product",
3124
- FUNCTION(rb_gsl_vector,inner_product), -1);
3115
+ FUNCTION(rb_gsl_vector,inner_product), -1);
3125
3116
  rb_define_alias(GSL_TYPE(cgsl_vector), "dot", "inner_product");
3126
3117
 
3127
- rb_define_method(GSL_TYPE(cgsl_vector), "equal?",
3128
- FUNCTION(rb_gsl_vector,equal), -1);
3118
+ rb_define_method(GSL_TYPE(cgsl_vector), "equal?",
3119
+ FUNCTION(rb_gsl_vector,equal), -1);
3129
3120
  rb_define_alias(GSL_TYPE(cgsl_vector), "==", "equal?");
3130
3121
 
3131
- rb_define_method(GSL_TYPE(cgsl_vector), "to_poly",
3132
- FUNCTION(rb_gsl_vector,to_poly), 0);
3122
+ rb_define_method(GSL_TYPE(cgsl_vector), "to_poly",
3123
+ FUNCTION(rb_gsl_vector,to_poly), 0);
3133
3124
 
3134
3125
  /*****/
3135
- rb_define_method(GSL_TYPE(cgsl_vector), "graph",
3136
- FUNCTION(rb_gsl_vector,graph), -1);
3137
- rb_define_method(GSL_TYPE(cgsl_vector), "graph_step",
3138
- FUNCTION(rb_gsl_vector,graph_step), -1);
3139
- rb_define_method(GSL_TYPE(cgsl_vector), "plot",
3140
- FUNCTION(rb_gsl_vector,plot), -1);
3126
+ rb_define_method(GSL_TYPE(cgsl_vector), "graph",
3127
+ FUNCTION(rb_gsl_vector,graph), -1);
3128
+ rb_define_method(GSL_TYPE(cgsl_vector), "graph_step",
3129
+ FUNCTION(rb_gsl_vector,graph_step), -1);
3130
+ rb_define_method(GSL_TYPE(cgsl_vector), "plot",
3131
+ FUNCTION(rb_gsl_vector,plot), -1);
3141
3132
 
3142
3133
  rb_define_method(GSL_TYPE(cgsl_vector), "print",
3143
- FUNCTION(rb_gsl_vector,print), 0);
3144
- rb_define_method(GSL_TYPE(cgsl_vector), "inspect",
3145
- FUNCTION(rb_gsl_vector,inspect), 0);
3146
- rb_define_method(GSL_TYPE(cgsl_vector), "to_s",
3147
- FUNCTION(rb_gsl_vector,to_s), 0);
3134
+ FUNCTION(rb_gsl_vector,print), 0);
3135
+ rb_define_method(GSL_TYPE(cgsl_vector), "inspect",
3136
+ FUNCTION(rb_gsl_vector,inspect), 0);
3137
+ rb_define_method(GSL_TYPE(cgsl_vector), "to_s",
3138
+ FUNCTION(rb_gsl_vector,to_s), 0);
3148
3139
 
3149
3140
  /*****/
3150
3141
  rb_define_method(GSL_TYPE(cgsl_vector), "subvector",
3151
- FUNCTION(rb_gsl_vector,subvector), -1);
3142
+ FUNCTION(rb_gsl_vector,subvector), -1);
3152
3143
  rb_define_alias(GSL_TYPE(cgsl_vector), "view", "subvector");
3153
- rb_define_method(GSL_TYPE(cgsl_vector), "subvector_with_stride",
3154
- FUNCTION(rb_gsl_vector,subvector_with_stride), -1);
3144
+ rb_define_method(GSL_TYPE(cgsl_vector), "subvector_with_stride",
3145
+ FUNCTION(rb_gsl_vector,subvector_with_stride), -1);
3155
3146
  rb_define_alias(GSL_TYPE(cgsl_vector), "view_with_stride", "subvector_with_stride");
3156
3147
 
3157
- rb_define_method(GSL_TYPE(cgsl_vector), "matrix_view",
3158
- FUNCTION(rb_gsl_vector,matrix_view), -1);
3159
- rb_define_method(GSL_TYPE(cgsl_vector), "matrix_view_with_tda",
3160
- FUNCTION(rb_gsl_vector,matrix_view_with_tda), 3);
3148
+ rb_define_method(GSL_TYPE(cgsl_vector), "matrix_view",
3149
+ FUNCTION(rb_gsl_vector,matrix_view), -1);
3150
+ rb_define_method(GSL_TYPE(cgsl_vector), "matrix_view_with_tda",
3151
+ FUNCTION(rb_gsl_vector,matrix_view_with_tda), 3);
3161
3152
 
3162
3153
  #ifdef BASE_DOUBLE
3163
3154
  rb_undef_method(cgsl_vector_view_ro, "set");
@@ -3171,106 +3162,106 @@ void FUNCTION(Init_gsl_vector,init)(VALUE module)
3171
3162
  rb_undef_method(cgsl_vector_int_col_view_ro, "[]=");
3172
3163
  #endif
3173
3164
 
3174
- rb_define_method(GSL_TYPE(cgsl_vector), "scale",
3175
- FUNCTION(rb_gsl_vector,scale), 1);
3176
- rb_define_method(GSL_TYPE(cgsl_vector), "scale!",
3177
- FUNCTION(rb_gsl_vector,scale_bang), 1);
3178
- rb_define_method(GSL_TYPE(cgsl_vector), "add_constant",
3179
- FUNCTION(rb_gsl_vector,add_constant), 1);
3165
+ rb_define_method(GSL_TYPE(cgsl_vector), "scale",
3166
+ FUNCTION(rb_gsl_vector,scale), 1);
3167
+ rb_define_method(GSL_TYPE(cgsl_vector), "scale!",
3168
+ FUNCTION(rb_gsl_vector,scale_bang), 1);
3169
+ rb_define_method(GSL_TYPE(cgsl_vector), "add_constant",
3170
+ FUNCTION(rb_gsl_vector,add_constant), 1);
3180
3171
  rb_define_alias(GSL_TYPE(cgsl_vector), "add_const", "add_constant");
3181
- rb_define_method(GSL_TYPE(cgsl_vector), "add_constant!",
3182
- FUNCTION(rb_gsl_vector,add_constant_bang), 1);
3172
+ rb_define_method(GSL_TYPE(cgsl_vector), "add_constant!",
3173
+ FUNCTION(rb_gsl_vector,add_constant_bang), 1);
3183
3174
  rb_define_alias(GSL_TYPE(cgsl_vector), "add_const!", "add_constant!");
3184
3175
 
3185
3176
  #ifdef HAVE_TENSOR_TENSOR_H
3186
- rb_define_method(GSL_TYPE(cgsl_vector), "to_tensor",
3187
- FUNCTION(rb_gsl_vector,to_tensor), -1);
3177
+ rb_define_method(GSL_TYPE(cgsl_vector), "to_tensor",
3178
+ FUNCTION(rb_gsl_vector,to_tensor), -1);
3188
3179
  #endif
3189
3180
 
3190
- rb_define_singleton_method(GSL_TYPE(cgsl_vector), "to_gplot",
3191
- FUNCTION(rb_gsl_vector,to_gplot), -1);
3192
- rb_define_singleton_method(GSL_TYPE(cgsl_vector), "to_gsplot",
3193
- FUNCTION(rb_gsl_vector,to_gplot), -1);
3194
- rb_define_method(GSL_TYPE(cgsl_vector), "to_gplot",
3195
- FUNCTION(rb_gsl_vector,to_gplot), -1);
3181
+ rb_define_singleton_method(GSL_TYPE(cgsl_vector), "to_gplot",
3182
+ FUNCTION(rb_gsl_vector,to_gplot), -1);
3183
+ rb_define_singleton_method(GSL_TYPE(cgsl_vector), "to_gsplot",
3184
+ FUNCTION(rb_gsl_vector,to_gplot), -1);
3185
+ rb_define_method(GSL_TYPE(cgsl_vector), "to_gplot",
3186
+ FUNCTION(rb_gsl_vector,to_gplot), -1);
3196
3187
  rb_define_alias(GSL_TYPE(cgsl_vector), "to_gsplot", "to_gplot");
3197
3188
 
3198
3189
  /*****/
3199
- rb_define_method(GSL_TYPE(cgsl_vector), "collect",
3200
- FUNCTION(rb_gsl_vector,collect), 0);
3201
- rb_define_method(GSL_TYPE(cgsl_vector), "collect!",
3202
- FUNCTION(rb_gsl_vector,collect_bang), 0);
3190
+ rb_define_method(GSL_TYPE(cgsl_vector), "collect",
3191
+ FUNCTION(rb_gsl_vector,collect), 0);
3192
+ rb_define_method(GSL_TYPE(cgsl_vector), "collect!",
3193
+ FUNCTION(rb_gsl_vector,collect_bang), 0);
3203
3194
  rb_define_alias(GSL_TYPE(cgsl_vector), "map", "collect");
3204
3195
  rb_define_alias(GSL_TYPE(cgsl_vector), "map!", "collect!");
3205
3196
 
3206
3197
  rb_define_method(GSL_TYPE(cgsl_vector), "to_m", FUNCTION(rb_gsl_vector,to_m), 2);
3207
3198
  rb_define_alias(GSL_TYPE(cgsl_vector), "to_matrix", "to_m");
3208
3199
  rb_define_alias(GSL_TYPE(cgsl_vector), "reshape", "to_m");
3209
- rb_define_method(GSL_TYPE(cgsl_vector), "to_m_diagonal",
3210
- FUNCTION(rb_gsl_vector,to_m_diagonal), 0);
3211
- rb_define_method(GSL_TYPE(cgsl_vector), "block",
3212
- FUNCTION(rb_gsl_vector,block), 0);
3213
- rb_define_method(GSL_TYPE(cgsl_vector), "to_m_circulant",
3214
- FUNCTION(rb_gsl_vector,to_m_circulant), 0);
3215
- rb_define_singleton_method(GSL_TYPE(cgsl_vector), "indgen",
3216
- FUNCTION(rb_gsl_vector,indgen_singleton), -1);
3217
- rb_define_method(GSL_TYPE(cgsl_vector), "indgen",
3218
- FUNCTION(rb_gsl_vector,indgen), -1);
3219
- rb_define_method(GSL_TYPE(cgsl_vector), "indgen!",
3220
- FUNCTION(rb_gsl_vector,indgen_bang), -1);
3200
+ rb_define_method(GSL_TYPE(cgsl_vector), "to_m_diagonal",
3201
+ FUNCTION(rb_gsl_vector,to_m_diagonal), 0);
3202
+ rb_define_method(GSL_TYPE(cgsl_vector), "block",
3203
+ FUNCTION(rb_gsl_vector,block), 0);
3204
+ rb_define_method(GSL_TYPE(cgsl_vector), "to_m_circulant",
3205
+ FUNCTION(rb_gsl_vector,to_m_circulant), 0);
3206
+ rb_define_singleton_method(GSL_TYPE(cgsl_vector), "indgen",
3207
+ FUNCTION(rb_gsl_vector,indgen_singleton), -1);
3208
+ rb_define_method(GSL_TYPE(cgsl_vector), "indgen",
3209
+ FUNCTION(rb_gsl_vector,indgen), -1);
3210
+ rb_define_method(GSL_TYPE(cgsl_vector), "indgen!",
3211
+ FUNCTION(rb_gsl_vector,indgen_bang), -1);
3221
3212
  /*****/
3222
- rb_define_method(GSL_TYPE(cgsl_vector), "sort!",
3223
- GSL_TYPE(rb_gsl_sort_vector), 0);
3224
- rb_define_method(GSL_TYPE(cgsl_vector), "sort",
3225
- GSL_TYPE(rb_gsl_sort_vector2), 0);
3226
- rb_define_method(GSL_TYPE(cgsl_vector), "sort_index",
3227
- FUNCTION(rb_gsl_sort_vector,index), 0);
3213
+ rb_define_method(GSL_TYPE(cgsl_vector), "sort!",
3214
+ GSL_TYPE(rb_gsl_sort_vector), 0);
3215
+ rb_define_method(GSL_TYPE(cgsl_vector), "sort",
3216
+ GSL_TYPE(rb_gsl_sort_vector2), 0);
3217
+ rb_define_method(GSL_TYPE(cgsl_vector), "sort_index",
3218
+ FUNCTION(rb_gsl_sort_vector,index), 0);
3228
3219
  rb_define_method(GSL_TYPE(cgsl_vector), "sort_smallest",
3229
- FUNCTION(rb_gsl_sort_vector,smallest), 1);
3220
+ FUNCTION(rb_gsl_sort_vector,smallest), 1);
3230
3221
  rb_define_alias(GSL_TYPE(cgsl_vector), "smallest", "sort_smallest");
3231
3222
  rb_define_method(GSL_TYPE(cgsl_vector), "sort_largest",
3232
- FUNCTION(rb_gsl_sort_vector,largest), 1);
3223
+ FUNCTION(rb_gsl_sort_vector,largest), 1);
3233
3224
  rb_define_alias(GSL_TYPE(cgsl_vector), "largest", "sort_largest");
3234
- rb_define_method(GSL_TYPE(cgsl_vector), "sort_smallest_index",
3235
- FUNCTION(rb_gsl_sort_vector,smallest_index), 1);
3225
+ rb_define_method(GSL_TYPE(cgsl_vector), "sort_smallest_index",
3226
+ FUNCTION(rb_gsl_sort_vector,smallest_index), 1);
3236
3227
  rb_define_alias(GSL_TYPE(cgsl_vector), "smallest_index", "sort_smallest_index");
3237
- rb_define_method(GSL_TYPE(cgsl_vector), "sort_largest_index",
3238
- FUNCTION(rb_gsl_sort_vector,largest_index), 1);
3228
+ rb_define_method(GSL_TYPE(cgsl_vector), "sort_largest_index",
3229
+ FUNCTION(rb_gsl_sort_vector,largest_index), 1);
3239
3230
  rb_define_alias(GSL_TYPE(cgsl_vector), "largest_index", "sort_largest_index");
3240
3231
 
3241
3232
  /*****/
3242
3233
  rb_define_method(GSL_TYPE(cgsl_vector), "histogram",
3243
- FUNCTION(rb_gsl_vector,histogram), -1);
3244
-
3245
- rb_define_method(GSL_TYPE(cgsl_vector), "last",
3246
- FUNCTION(rb_gsl_vector,last), 0);
3247
- rb_define_method(GSL_TYPE(cgsl_vector), "first",
3248
- FUNCTION(rb_gsl_vector,first), 0);
3249
- rb_define_method(GSL_TYPE(cgsl_vector), "concat",
3250
- FUNCTION(rb_gsl_vector,concat), 1);
3251
-
3252
- rb_define_method(GSL_TYPE(cgsl_vector), "diff",
3253
- FUNCTION(rb_gsl_vector,diff), -1);
3254
- rb_define_method(GSL_TYPE(cgsl_vector), "isnan",
3255
- FUNCTION(rb_gsl_vector,isnan), 0);
3256
- rb_define_method(GSL_TYPE(cgsl_vector), "isinf",
3257
- FUNCTION(rb_gsl_vector,isinf), 0);
3258
- rb_define_method(GSL_TYPE(cgsl_vector), "finite",
3259
- FUNCTION(rb_gsl_vector,finite), 0);
3260
-
3261
- rb_define_method(GSL_TYPE(cgsl_vector), "isnan?",
3262
- FUNCTION(rb_gsl_vector,isnan2), 0);
3263
- rb_define_method(GSL_TYPE(cgsl_vector), "isinf?",
3264
- FUNCTION(rb_gsl_vector,isinf2), 0);
3265
- rb_define_method(GSL_TYPE(cgsl_vector), "finite?",
3266
- FUNCTION(rb_gsl_vector,finite2), 0);
3267
-
3268
- rb_define_method(GSL_TYPE(cgsl_vector), "delete_at",
3269
- FUNCTION(rb_gsl_vector,delete_at), 1);
3270
- rb_define_method(GSL_TYPE(cgsl_vector), "delete_if",
3271
- FUNCTION(rb_gsl_vector,delete_if), 0);
3272
- rb_define_method(GSL_TYPE(cgsl_vector), "delete",
3273
- FUNCTION(rb_gsl_vector,delete), 1);
3234
+ FUNCTION(rb_gsl_vector,histogram), -1);
3235
+
3236
+ rb_define_method(GSL_TYPE(cgsl_vector), "last",
3237
+ FUNCTION(rb_gsl_vector,last), 0);
3238
+ rb_define_method(GSL_TYPE(cgsl_vector), "first",
3239
+ FUNCTION(rb_gsl_vector,first), 0);
3240
+ rb_define_method(GSL_TYPE(cgsl_vector), "concat",
3241
+ FUNCTION(rb_gsl_vector,concat), 1);
3242
+
3243
+ rb_define_method(GSL_TYPE(cgsl_vector), "diff",
3244
+ FUNCTION(rb_gsl_vector,diff), -1);
3245
+ rb_define_method(GSL_TYPE(cgsl_vector), "isnan",
3246
+ FUNCTION(rb_gsl_vector,isnan), 0);
3247
+ rb_define_method(GSL_TYPE(cgsl_vector), "isinf",
3248
+ FUNCTION(rb_gsl_vector,isinf), 0);
3249
+ rb_define_method(GSL_TYPE(cgsl_vector), "finite",
3250
+ FUNCTION(rb_gsl_vector,finite), 0);
3251
+
3252
+ rb_define_method(GSL_TYPE(cgsl_vector), "isnan?",
3253
+ FUNCTION(rb_gsl_vector,isnan2), 0);
3254
+ rb_define_method(GSL_TYPE(cgsl_vector), "isinf?",
3255
+ FUNCTION(rb_gsl_vector,isinf2), 0);
3256
+ rb_define_method(GSL_TYPE(cgsl_vector), "finite?",
3257
+ FUNCTION(rb_gsl_vector,finite2), 0);
3258
+
3259
+ rb_define_method(GSL_TYPE(cgsl_vector), "delete_at",
3260
+ FUNCTION(rb_gsl_vector,delete_at), 1);
3261
+ rb_define_method(GSL_TYPE(cgsl_vector), "delete_if",
3262
+ FUNCTION(rb_gsl_vector,delete_if), 0);
3263
+ rb_define_method(GSL_TYPE(cgsl_vector), "delete",
3264
+ FUNCTION(rb_gsl_vector,delete), 1);
3274
3265
  /***/
3275
3266
  rb_define_singleton_method(GSL_TYPE(cgsl_vector), "filescan", FUNCTION(rb_gsl_vector,filescan), 1);
3276
3267
 
@@ -3294,9 +3285,9 @@ void FUNCTION(Init_gsl_vector,init)(VALUE module)
3294
3285
  rb_define_method(GSL_TYPE(cgsl_vector), "all?", FUNCTION(rb_gsl_vector,all), 0);
3295
3286
  rb_define_method(GSL_TYPE(cgsl_vector), "none?", FUNCTION(rb_gsl_vector,none), 0);
3296
3287
  rb_define_method(GSL_TYPE(cgsl_vector), "any",
3297
- FUNCTION(rb_gsl_vector,any), 0);
3288
+ FUNCTION(rb_gsl_vector,any), 0);
3298
3289
  rb_define_method(GSL_TYPE(cgsl_vector), "any?",
3299
- FUNCTION(rb_gsl_vector,any2), 0);
3290
+ FUNCTION(rb_gsl_vector,any2), 0);
3300
3291
 
3301
3292
  rb_define_method(GSL_TYPE(cgsl_vector), "where", FUNCTION(rb_gsl_vector,where), 0);
3302
3293
  rb_define_method(GSL_TYPE(cgsl_vector), "where2", FUNCTION(rb_gsl_vector,where2), 0);
@@ -3309,17 +3300,12 @@ void FUNCTION(Init_gsl_vector,init)(VALUE module)
3309
3300
  rb_define_singleton_method(GSL_TYPE(cgsl_vector), "zip", FUNCTION(rb_gsl_vector,zip), -1);
3310
3301
  rb_define_method(GSL_TYPE(cgsl_vector), "zip", FUNCTION(rb_gsl_vector,zip), -1);
3311
3302
  rb_define_method(GSL_TYPE(cgsl_vector), "join", FUNCTION(rb_gsl_vector,join), -1);
3312
- #ifdef GSL_1_9_LATER
3313
3303
  rb_define_method(GSL_TYPE(cgsl_vector), "ispos", FUNCTION(rb_gsl_vector,ispos), 0);
3314
3304
  rb_define_method(GSL_TYPE(cgsl_vector), "ispos?", FUNCTION(rb_gsl_vector,ispos2), 0);
3315
3305
  rb_define_method(GSL_TYPE(cgsl_vector), "isneg", FUNCTION(rb_gsl_vector,isneg), 0);
3316
3306
  rb_define_method(GSL_TYPE(cgsl_vector), "isneg?", FUNCTION(rb_gsl_vector,isneg2), 0);
3317
- #endif
3318
-
3319
- #ifdef GSL_1_10_LATER
3320
3307
  rb_define_method(GSL_TYPE(cgsl_vector), "isnonneg", FUNCTION(rb_gsl_vector,isnonneg), 0);
3321
3308
  rb_define_method(GSL_TYPE(cgsl_vector), "isnonneg?", FUNCTION(rb_gsl_vector,isnonneg2), 0);
3322
- #endif
3323
3309
  }
3324
3310
 
3325
3311
  #undef NUMCONV