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
@@ -1,20 +1,20 @@
1
1
  #include "include/rb_gsl.h"
2
2
 
3
3
  /*!
4
- Counter-clockwise rotation around the X-axis
4
+ Counter-clockwise rotation around the X-axis
5
5
 
6
6
  / x' \ / 1 0 0 \ / x \
7
7
  | y' | = | 0 cos_th -sin_th | | y |
8
8
  \ z' / \ 0 sin_th cos_th / \ z /
9
9
 
10
10
  */
11
- void vector3_rotateX(const double x[3] /*!< Input */,
12
- double theta /*!< Rotation angle */,
13
- double xout[3] /*!< Output */)
11
+ void vector3_rotateX(const double x[3] /*!< Input */,
12
+ double theta /*!< Rotation angle */,
13
+ double xout[3] /*!< Output */)
14
14
  {
15
15
  double a, b, c;
16
16
  double costheta, sintheta;
17
-
17
+
18
18
  costheta = cos(theta);
19
19
  sintheta = sin(theta);
20
20
 
@@ -28,7 +28,7 @@ void vector3_rotateX(const double x[3] /*!< Input */,
28
28
  }
29
29
 
30
30
  /*!
31
- Counter-clockwise rotation around the Y-axis
31
+ Counter-clockwise rotation around the Y-axis
32
32
  (Note the sign of the matrix element.)
33
33
 
34
34
  / x' \ / cos_th 0 sin_th \ / x \
@@ -36,9 +36,9 @@ void vector3_rotateX(const double x[3] /*!< Input */,
36
36
  \ z' / \ -sin_th 0 cos_th / \ z /
37
37
 
38
38
  */
39
- void vector3_rotateY(const double x[3] /*!< Input */,
40
- double theta /*!< Rotation angle */,
41
- double xout[3] /*!< Output */)
39
+ void vector3_rotateY(const double x[3] /*!< Input */,
40
+ double theta /*!< Rotation angle */,
41
+ double xout[3] /*!< Output */)
42
42
  {
43
43
  double a, b, c;
44
44
  double costheta, sintheta;
@@ -56,16 +56,16 @@ void vector3_rotateY(const double x[3] /*!< Input */,
56
56
  }
57
57
 
58
58
  /*!
59
- Counter-clockwise rotation around the Z-axis
59
+ Counter-clockwise rotation around the Z-axis
60
60
 
61
61
  / x' \ / cos_th -sin_th 0 \ / x \
62
62
  | y' | = | sin_th cos_th 0 | | y |
63
63
  \ z' / \ 0 0 1 / \ z /
64
64
 
65
65
  */
66
- void vector3_rotateZ(const double x[3] /*!< Input */,
67
- double theta /*!< Rotation angle */,
68
- double xout[3] /*!< Output */)
66
+ void vector3_rotateZ(const double x[3] /*!< Input */,
67
+ double theta /*!< Rotation angle */,
68
+ double xout[3] /*!< Output */)
69
69
  {
70
70
  double a, b, c;
71
71
  double costheta, sintheta;
@@ -85,7 +85,7 @@ void vector3_rotateZ(const double x[3] /*!< Input */,
85
85
  /*!
86
86
  Rotate a 3-vector.
87
87
 
88
- If flag != 1, cos/sin values stored in the static variables are used
88
+ If flag != 1, cos/sin values stored in the static variables are used
89
89
  for efficiency.
90
90
  The input and the output vectors (x, xout) can be the same pointer.
91
91
 
@@ -95,7 +95,7 @@ void vector3_rotateZ(const double x[3] /*!< Input */,
95
95
 
96
96
  */
97
97
  void vector3_rotate(const double x[3], double theta, double phi,
98
- double xout[3])
98
+ double xout[3])
99
99
  {
100
100
  vector3_rotateY(x, theta,xout);
101
101
  vector3_rotateZ(xout, phi, xout);
@@ -18,25 +18,21 @@ void make_graphcommand(char *command, VALUE hash)
18
18
  sprintf(command, "graph -T X -g 3 %s", STR2CSTR(hash));
19
19
  return;
20
20
  }
21
-
22
21
  strcpy(command, "graph");
23
- if (TYPE(hash) != T_HASH) rb_raise(rb_eTypeError,
24
- "wrong argument type %s (Hash expected)",
25
- rb_class2name(CLASS_OF(hash)));
22
+ if (TYPE(hash) != T_HASH) rb_raise(rb_eTypeError,
23
+ "wrong argument type %s (Hash expected)",
24
+ rb_class2name(CLASS_OF(hash)));
26
25
  if ((val = rb_hash_aref(hash, rb_str_new2("T"))) != Qnil)
27
26
  sprintf(command, "%s -T %s", command, STR2CSTR(val));
28
27
  else
29
28
  sprintf(command, "%s -T X", command);
30
-
31
29
  val = rb_hash_aref(hash, rb_str_new2("C"));
32
30
  if (val == Qtrue)
33
31
  sprintf(command, "%s -C", command);
34
-
35
32
  if ((val = rb_hash_aref(hash, rb_str_new2("g"))) != Qnil)
36
33
  sprintf(command, "%s -g %d", command, (int) FIX2INT(val));
37
34
  else
38
35
  sprintf(command, "%s -g 3", command);
39
-
40
36
  if ((val = rb_hash_aref(hash, rb_str_new2("B"))) == Qtrue)
41
37
  sprintf(command, "%s -B", command);
42
38
  if ((val = rb_hash_aref(hash, rb_str_new2("E"))) != Qnil)
@@ -45,7 +41,6 @@ void make_graphcommand(char *command, VALUE hash)
45
41
  sprintf(command, "%s -f %f", command, NUM2DBL(val));
46
42
  if ((val = rb_hash_aref(hash, rb_str_new2("F"))) != Qnil)
47
43
  sprintf(command, "%s -F %s", command, STR2CSTR(val));
48
-
49
44
  if ((val = rb_hash_aref(hash, rb_str_new2("h"))) != Qnil)
50
45
  sprintf(command, "%s -h %f", command, NUM2DBL(val));
51
46
  if ((val = rb_hash_aref(hash, rb_str_new2("k"))) != Qnil)
@@ -58,7 +53,6 @@ void make_graphcommand(char *command, VALUE hash)
58
53
  else
59
54
  sprintf(command, "%s -l %s", command, STR2CSTR(val));
60
55
  }
61
-
62
56
  if ((val = rb_hash_aref(hash, rb_str_new2("L"))) != Qnil)
63
57
  sprintf(command, "%s -L \"%s\"", command, STR2CSTR(val));
64
58
  if ((val = rb_hash_aref(hash, rb_str_new2("N"))) != Qnil)
@@ -103,10 +97,8 @@ void make_graphcommand(char *command, VALUE hash)
103
97
  sprintf(command, "%s --title-font-name %s", command, STR2CSTR(val));
104
98
  if ((val = rb_hash_aref(hash, rb_str_new2("title-font-size"))) != Qnil)
105
99
  sprintf(command, "%s --title-font-size %f", command, NUM2DBL(val));
106
-
107
100
  if ((val = rb_hash_aref(hash, rb_str_new2("toggle-rotate-y-label"))) == Qtrue)
108
101
  sprintf(command, "%s --toggle-rotate-y-label", command);
109
-
110
102
  if ((val = rb_hash_aref(hash, rb_str_new2("m"))) != Qnil)
111
103
  sprintf(command, "%s -m %d", command, (int) FIX2INT(val));
112
104
  if ((val = rb_hash_aref(hash, rb_str_new2("S"))) != Qnil)
@@ -115,15 +107,12 @@ void make_graphcommand(char *command, VALUE hash)
115
107
  sprintf(command, "%s -W %f", command, NUM2DBL(val));
116
108
  if ((val = rb_hash_aref(hash, rb_str_new2("q"))) != Qnil)
117
109
  sprintf(command, "%s -q %f", command, NUM2DBL(val));
118
-
119
110
  if ((val = rb_hash_aref(hash, rb_str_new2("symbol-font-name"))) != Qnil)
120
111
  sprintf(command, "%s --symbol-font-name %s", command, STR2CSTR(val));
121
-
122
112
  if ((val = rb_hash_aref(hash, rb_str_new2("reposition"))) != Qnil)
123
113
  sprintf(command, "%s --reposition %s", command, STR2CSTR(val));
124
114
  if ((val = rb_hash_aref(hash, rb_str_new2("blankout"))) != Qnil)
125
115
  sprintf(command, "%s --blankout %s", command, STR2CSTR(val));
126
-
127
116
  if ((val = rb_hash_aref(hash, rb_str_new2("O"))) == Qtrue)
128
117
  sprintf(command, "%s -O", command);
129
118
  }
@@ -982,7 +971,6 @@ static void gsl_graph_set_command(gsl_graph *g, char *command)
982
971
  sprintf(command, "%s -T X", command);
983
972
  else
984
973
  sprintf(command, "%s -T %s", command, STR2CSTR(g->T));
985
-
986
974
  if (TYPE(g->E) == T_STRING) {
987
975
  strcpy(str, STR2CSTR(g->E));
988
976
  if (strcmp(str, "x") == 0)
@@ -991,28 +979,21 @@ static void gsl_graph_set_command(gsl_graph *g, char *command)
991
979
  sprintf(command, "%s -E y", command);
992
980
  else if (strcmp(str, "xy")*strcmp(str, "x/y") == 0)
993
981
  sprintf(command, "%s -E x -E y", command);
994
- else
982
+ else
995
983
  rb_raise(rb_eRuntimeError, "unrecognized -E option %s", str);
996
984
  }
997
-
998
985
  if (g->f != Qnil)
999
986
  sprintf(command, "%s -f %f", command, NUM2DBL(g->f));
1000
-
1001
987
  if (TYPE(g->F) == T_STRING)
1002
988
  sprintf(command, "%s -F %s", command, STR2CSTR(g->F));
1003
-
1004
989
  if (TYPE(g->g) == T_FIXNUM)
1005
990
  sprintf(command, "%s -g %d", command, (int) FIX2INT(g->g));
1006
-
1007
991
  if (g->h != Qnil)
1008
992
  sprintf(command, "%s -h %f", command, NUM2DBL(g->h));
1009
-
1010
993
  if (g->k != Qnil)
1011
994
  sprintf(command, "%s -k %f", command, NUM2DBL(g->k));
1012
-
1013
995
  if (TYPE(g->K) == T_FIXNUM)
1014
996
  sprintf(command, "%s -K %d", command, (int) FIX2INT(g->K));
1015
-
1016
997
  if (TYPE(g->l) == T_STRING) {
1017
998
  strcpy(str, STR2CSTR(g->l));
1018
999
  if (strcmp(str, "x") == 0)
@@ -1021,13 +1002,11 @@ static void gsl_graph_set_command(gsl_graph *g, char *command)
1021
1002
  sprintf(command, "%s -l y", command);
1022
1003
  else if (strcmp(str, "xy")*strcmp(str, "x/y") == 0)
1023
1004
  sprintf(command, "%s -l x -l y", command);
1024
- else
1005
+ else
1025
1006
  rb_raise(rb_eRuntimeError, "unrecognized -l option %s", str);
1026
1007
  }
1027
-
1028
1008
  if (TYPE(g->L) == T_STRING)
1029
1009
  sprintf(command, "%s -L \"%s\"", command, STR2CSTR(g->L));
1030
-
1031
1010
  if (TYPE(g->N) == T_STRING) {
1032
1011
  strcpy(str, STR2CSTR(g->N));
1033
1012
  if (strcmp(str, "x") == 0)
@@ -1036,13 +1015,11 @@ static void gsl_graph_set_command(gsl_graph *g, char *command)
1036
1015
  sprintf(command, "%s -N y", command);
1037
1016
  else if (strcmp(str, "xy")*strcmp(str, "x/y") == 0)
1038
1017
  sprintf(command, "%s -N x -N y", command);
1039
- else
1018
+ else
1040
1019
  rb_raise(rb_eRuntimeError, "unrecognized -N option %s", str);
1041
1020
  }
1042
-
1043
1021
  if (g->r != Qnil)
1044
1022
  sprintf(command, "%s -r %f", command, NUM2DBL(g->r));
1045
-
1046
1023
  if (TYPE(g->R) == T_STRING) {
1047
1024
  strcpy(str, STR2CSTR(g->R));
1048
1025
  if (strcmp(str, "x") == 0)
@@ -1051,16 +1028,13 @@ static void gsl_graph_set_command(gsl_graph *g, char *command)
1051
1028
  sprintf(command, "%s -R y", command);
1052
1029
  else if (strcmp(str, "xy")*strcmp(str, "x/y") == 0)
1053
1030
  sprintf(command, "%s -R x -R y", command);
1054
- else
1031
+ else
1055
1032
  rb_raise(rb_eRuntimeError, "unrecognized -R option %s", str);
1056
1033
  }
1057
-
1058
1034
  if (g->u != Qnil)
1059
1035
  sprintf(command, "%s -u %f", command, NUM2DBL(g->u));
1060
-
1061
1036
  if (g->w != Qnil)
1062
1037
  sprintf(command, "%s -w %f", command, NUM2DBL(g->w));
1063
-
1064
1038
  switch (TYPE(g->x)) {
1065
1039
  case T_STRING:
1066
1040
  sprintf(command, "%s -x %s", command, STR2CSTR(g->x));
@@ -1103,61 +1077,47 @@ static void gsl_graph_set_command(gsl_graph *g, char *command)
1103
1077
  sprintf(command, "%s -X \"%s\"", command, STR2CSTR(g->X));
1104
1078
  if (g->Y != Qnil)
1105
1079
  sprintf(command, "%s -Y \"%s\"", command, STR2CSTR(g->Y));
1106
-
1107
1080
  if (TYPE(g->bg) == T_STRING)
1108
1081
  sprintf(command, "%s --bg-color %s", command, STR2CSTR(g->bg));
1109
-
1110
1082
  if (TYPE(g->bitmap_size) == T_STRING)
1111
1083
  sprintf(command, "%s --bitmap-size %s", command, STR2CSTR(g->bitmap_size));
1112
-
1113
1084
  if (TYPE(g->frame) == T_STRING)
1114
1085
  sprintf(command, "%s --frame-color %s", command, STR2CSTR(g->frame));
1115
-
1116
1086
  if (g->frame_line_width != Qnil)
1117
1087
  sprintf(command, "%s --frame-line-width %f", command, NUM2DBL(g->frame_line_width));
1118
-
1119
- if (g->max_line_length != Qnil)
1120
- sprintf(command, "%s --max_line_length %d", command,
1121
- (int) FIX2INT(g->max_line_length));
1122
-
1088
+ if (g->max_line_length != Qnil)
1089
+ sprintf(command, "%s --max_line_length %d", command,
1090
+ (int) FIX2INT(g->max_line_length));
1123
1091
  if (g->page_size != Qnil)
1124
1092
  sprintf(command, "%s --page-size %s", command, STR2CSTR(g->page_size));
1125
-
1126
1093
  if (g->pen_colors != Qnil)
1127
1094
  sprintf(command, "%s --pen-colors %s", command, STR2CSTR(g->pen_colors));
1128
-
1129
1095
  if (g->rotation != Qnil)
1130
1096
  sprintf(command, "%s --rotation %d", command, (int) FIX2INT(g->rotation));
1131
-
1132
1097
  if (g->title_font_name != Qnil)
1133
1098
  sprintf(command, "%s --title-font-name %s", command, STR2CSTR(g->title_font_name)); if (g->title_font_size != Qnil)
1134
1099
  sprintf(command, "%s --title-font-size %f", command, NUM2DBL(g->title_font_size));
1135
-
1136
1100
  if (g->rotate_y_label == Qtrue)
1137
1101
  sprintf(command, "%s --toggle-rotate-y-label", command);
1138
-
1139
1102
  if (g->I != Qnil)
1140
1103
  sprintf(command, "%s -I %s", command, STR2CSTR(g->I));
1141
-
1142
1104
  if (g->s == Qtrue)
1143
1105
  sprintf(command, "%s -s", command);
1144
1106
  if (g->t == Qtrue)
1145
1107
  sprintf(command, "%s -t", command);
1146
1108
  if (g->B == Qtrue)
1147
1109
  sprintf(command, "%s -B", command);
1148
-
1149
1110
  if (g->m != Qnil)
1150
1111
  sprintf(command, "%s -m %d", command, (int) FIX2INT(g->m));
1151
-
1152
1112
  switch (TYPE(g->S)) {
1153
1113
  case T_STRING:
1154
1114
  sprintf(command, "%s -S %s", command, STR2CSTR(g->S));
1155
1115
  break;
1156
1116
  case T_ARRAY:
1157
- // if (RARRAY(g->S)->len == 2)
1158
- if (RARRAY_LEN(g->S) == 2)
1117
+ // if (RARRAY(g->S)->len == 2)
1118
+ if (RARRAY_LEN(g->S) == 2)
1159
1119
  sprintf(command, "%s -S %d %f", command, (int) FIX2INT(rb_ary_entry(g->S, 0)),
1160
- NUM2DBL(rb_ary_entry(g->S, 1)));
1120
+ NUM2DBL(rb_ary_entry(g->S, 1)));
1161
1121
  break;
1162
1122
  default:
1163
1123
  /* do nothing */
@@ -1166,16 +1126,12 @@ static void gsl_graph_set_command(gsl_graph *g, char *command)
1166
1126
 
1167
1127
  if (g->W != Qnil)
1168
1128
  sprintf(command, "%s -W %f", command, NUM2DBL(g->W));
1169
-
1170
1129
  if (g->q != Qnil)
1171
1130
  sprintf(command, "%s -q %f", command, NUM2DBL(g->q));
1172
-
1173
1131
  if (g->C == Qtrue)
1174
1132
  sprintf(command, "%s -C", command);
1175
-
1176
1133
  if (g->symbol_font_name != Qnil)
1177
1134
  sprintf(command, "%s --symbol_font_name %s", command, STR2CSTR(g->symbol_font_name));
1178
-
1179
1135
  switch (TYPE(g->reposition)) {
1180
1136
  case T_STRING:
1181
1137
  sprintf(command, "%s --reposition %s", command, STR2CSTR(g->reposition));
@@ -1197,7 +1153,6 @@ static void gsl_graph_set_command(gsl_graph *g, char *command)
1197
1153
 
1198
1154
  if (g->blankout != Qnil)
1199
1155
  sprintf(command, "%s --blankout %f", command, NUM2DBL(g->blankout));
1200
-
1201
1156
  if (g->O == Qtrue)
1202
1157
  sprintf(command, "%s -O", command);
1203
1158
  }
@@ -1219,7 +1174,7 @@ static VALUE rb_gsl_graph_graph(int argc, VALUE *argv, VALUE obj)
1219
1174
  case 3:
1220
1175
  Check_Type(argv[2], T_STRING);
1221
1176
  sprintf(command, "%s %s", command, STR2CSTR(argv[2]));
1222
- /* no break */
1177
+ /* no break */
1223
1178
  case 2:
1224
1179
  if (TYPE(argv[1]) == T_STRING) {
1225
1180
  sprintf(command, "%s %s", command, STR2CSTR(argv[1]));
@@ -1227,19 +1182,19 @@ static VALUE rb_gsl_graph_graph(int argc, VALUE *argv, VALUE obj)
1227
1182
  g->ydata = argv[1];
1228
1183
  } else {
1229
1184
  rb_raise(rb_eTypeError, "wrong argument type %s (Vector or String expected)",
1230
- rb_class2name(CLASS_OF(argv[1])));
1185
+ rb_class2name(CLASS_OF(argv[1])));
1231
1186
  }
1232
- /* no break */
1187
+ /* no break */
1233
1188
  case 1:
1234
1189
  if (TYPE(argv[0]) == T_STRING) {
1235
1190
  sprintf(command, "%s %s", command, STR2CSTR(argv[0]));
1236
1191
  } else if (VECTOR_P(argv[0])) {
1237
- g->xdata = argv[0];
1192
+ g->xdata = argv[0];
1238
1193
  } else if (HISTOGRAM_P(argv[0])) {
1239
1194
  Data_Get_Struct(argv[0], gsl_histogram, h);
1240
1195
  } else {
1241
1196
  rb_raise(rb_eTypeError, "wrong argument type %s (Vector or String expected)",
1242
- rb_class2name(CLASS_OF(argv[0])));
1197
+ rb_class2name(CLASS_OF(argv[0])));
1243
1198
  }
1244
1199
  break;
1245
1200
  default:
@@ -1248,19 +1203,16 @@ static VALUE rb_gsl_graph_graph(int argc, VALUE *argv, VALUE obj)
1248
1203
  }
1249
1204
  if (VECTOR_P(g->xdata)) Data_Get_Struct(g->xdata, gsl_vector, x);
1250
1205
  if (VECTOR_P(g->ydata)) Data_Get_Struct(g->ydata, gsl_vector, y);
1251
-
1252
1206
  if (x == NULL && h == NULL)
1253
1207
  rb_raise(rb_eRuntimeError, "data is not given");
1254
-
1255
1208
  if (h) size = h->n;
1256
1209
  else size = x->size;
1257
-
1258
1210
  fp = popen(command, "w");
1259
1211
  if (fp == NULL) rb_raise(rb_eIOError, "GNU graph not found.");
1260
1212
  for (i = 0; i < size; i++) {
1261
- if (h)
1213
+ if (h)
1262
1214
  fprintf(fp, "%g %g\n%g %g\n", h->range[i], h->bin[i], h->range[i+1], h->bin[i]);
1263
- else if (y == NULL)
1215
+ else if (y == NULL)
1264
1216
  fprintf(fp, "%d %g\n", (int) i, gsl_vector_get(x, i));
1265
1217
  else
1266
1218
  fprintf(fp, "%g %g\n", gsl_vector_get(x, i), gsl_vector_get(y, i));
@@ -1290,7 +1242,7 @@ static VALUE rb_gsl_graph_step(int argc, VALUE *argv, VALUE obj)
1290
1242
  case 3:
1291
1243
  Check_Type(argv[2], T_STRING);
1292
1244
  sprintf(command, "%s %s", command, STR2CSTR(argv[2]));
1293
- /* no break */
1245
+ /* no break */
1294
1246
  case 2:
1295
1247
  if (TYPE(argv[1]) == T_STRING) {
1296
1248
  sprintf(command, "%s %s", command, STR2CSTR(argv[1]));
@@ -1298,17 +1250,17 @@ static VALUE rb_gsl_graph_step(int argc, VALUE *argv, VALUE obj)
1298
1250
  g->ydata = argv[1];
1299
1251
  } else {
1300
1252
  rb_raise(rb_eTypeError, "wrong argument type %s (Vector or String expected)",
1301
- rb_class2name(CLASS_OF(argv[1])));
1253
+ rb_class2name(CLASS_OF(argv[1])));
1302
1254
  }
1303
- /* no break */
1255
+ /* no break */
1304
1256
  case 1:
1305
1257
  if (TYPE(argv[0]) == T_STRING) {
1306
1258
  sprintf(command, "%s %s", command, STR2CSTR(argv[0]));
1307
1259
  } else if (VECTOR_P(argv[0])) {
1308
- g->xdata = argv[0];
1260
+ g->xdata = argv[0];
1309
1261
  } else {
1310
1262
  rb_raise(rb_eTypeError, "wrong argument type %s (Vector or String expected)",
1311
- rb_class2name(CLASS_OF(argv[0])));
1263
+ rb_class2name(CLASS_OF(argv[0])));
1312
1264
  }
1313
1265
  break;
1314
1266
  default:
@@ -1317,10 +1269,8 @@ static VALUE rb_gsl_graph_step(int argc, VALUE *argv, VALUE obj)
1317
1269
  }
1318
1270
  if (VECTOR_P(g->xdata)) Data_Get_Struct(g->xdata, gsl_vector, x);
1319
1271
  if (VECTOR_P(g->ydata)) Data_Get_Struct(g->ydata, gsl_vector, y);
1320
-
1321
1272
  if (x == NULL)
1322
1273
  rb_raise(rb_eRuntimeError, "data is not given");
1323
-
1324
1274
  size = x->size;
1325
1275
 
1326
1276
  fp = popen(command, "w");
@@ -1328,14 +1278,14 @@ static VALUE rb_gsl_graph_step(int argc, VALUE *argv, VALUE obj)
1328
1278
  for (i = 0; i < size; i++) {
1329
1279
  if (y == NULL) {
1330
1280
  fprintf(fp, "%d %g\n%d %g\n", (int) i, gsl_vector_get(x, i),
1331
- (int) (i+1), gsl_vector_get(x, i));
1281
+ (int) (i+1), gsl_vector_get(x, i));
1332
1282
  } else {
1333
1283
  if (i != size-1)
1334
- fprintf(fp, "%g %g\n%g %g\n", gsl_vector_get(x, i), gsl_vector_get(y, i),
1335
- gsl_vector_get(x, i+1), gsl_vector_get(y, i));
1336
- else
1337
- fprintf(fp, "%g %g\n%g %g", gsl_vector_get(x, i), gsl_vector_get(y, i),
1338
- 2.0*gsl_vector_get(x, i)-gsl_vector_get(x, i-1), gsl_vector_get(y, i));
1284
+ fprintf(fp, "%g %g\n%g %g\n", gsl_vector_get(x, i), gsl_vector_get(y, i),
1285
+ gsl_vector_get(x, i+1), gsl_vector_get(y, i));
1286
+ else
1287
+ fprintf(fp, "%g %g\n%g %g", gsl_vector_get(x, i), gsl_vector_get(y, i),
1288
+ 2.0*gsl_vector_get(x, i)-gsl_vector_get(x, i-1), gsl_vector_get(y, i));
1339
1289
  }
1340
1290
  }
1341
1291
  fflush(fp);
@@ -1617,18 +1567,18 @@ void Init_gsl_graph(VALUE module)
1617
1567
  rb_define_alias(cgsl_graph, "use_color", "C");
1618
1568
  rb_define_alias(cgsl_graph, "toggle_use_color", "C");
1619
1569
 
1620
- rb_define_method(cgsl_graph, "set_symbol_font_name",
1621
- rb_gsl_graph_set_symbol_font_name, 1);
1570
+ rb_define_method(cgsl_graph, "set_symbol_font_name",
1571
+ rb_gsl_graph_set_symbol_font_name, 1);
1622
1572
  rb_define_alias(cgsl_graph, "symbol_font_name=", "set_symbol_font_name");
1623
1573
  rb_define_method(cgsl_graph, "symbol_font_name", rb_gsl_graph_symbol_font_name, 0);
1624
1574
 
1625
- rb_define_method(cgsl_graph, "set_reposition",
1626
- rb_gsl_graph_set_reposition, 1);
1575
+ rb_define_method(cgsl_graph, "set_reposition",
1576
+ rb_gsl_graph_set_reposition, 1);
1627
1577
  rb_define_alias(cgsl_graph, "reposition=", "set_reposition");
1628
1578
  rb_define_method(cgsl_graph, "reposition", rb_gsl_graph_reposition, 0);
1629
1579
 
1630
- rb_define_method(cgsl_graph, "set_blankout",
1631
- rb_gsl_graph_set_blankout, 1);
1580
+ rb_define_method(cgsl_graph, "set_blankout",
1581
+ rb_gsl_graph_set_blankout, 1);
1632
1582
  rb_define_alias(cgsl_graph, "blankout=", "set_blankout");
1633
1583
  rb_define_method(cgsl_graph, "blankout", rb_gsl_graph_blankout, 0);
1634
1584