gsl 1.15.3 → 1.16.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (446) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.travis.yml +24 -0
  4. data/AUTHORS +10 -2
  5. data/COPYING +341 -339
  6. data/ChangeLog +612 -554
  7. data/Gemfile +4 -0
  8. data/README.md +77 -0
  9. data/Rakefile +14 -93
  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/{alf.c → gsl_native/alf.c} +10 -10
  89. data/ext/{array.c → gsl_native/array.c} +70 -159
  90. data/ext/{array_complex.c → gsl_native/array_complex.c} +63 -66
  91. data/ext/{blas.c → gsl_native/blas.c} +2 -3
  92. data/ext/{blas1.c → gsl_native/blas1.c} +35 -36
  93. data/ext/{blas2.c → gsl_native/blas2.c} +57 -62
  94. data/ext/{blas3.c → gsl_native/blas3.c} +57 -58
  95. data/ext/{block.c → gsl_native/block.c} +14 -18
  96. data/ext/{block_source.c → gsl_native/block_source.h} +110 -112
  97. data/ext/gsl_native/bspline.c +122 -0
  98. data/ext/{bundle.c → gsl_native/bundle.c} +0 -0
  99. data/ext/{cdf.c → gsl_native/cdf.c} +79 -93
  100. data/ext/{cheb.c → gsl_native/cheb.c} +78 -89
  101. data/ext/{combination.c → gsl_native/combination.c} +11 -19
  102. data/ext/{common.c → gsl_native/common.c} +9 -41
  103. data/ext/{complex.c → gsl_native/complex.c} +116 -118
  104. data/ext/gsl_native/const.c +331 -0
  105. data/ext/{const_additional.c → gsl_native/const_additional.c} +13 -34
  106. data/ext/gsl_native/cqp.c +283 -0
  107. data/ext/{deriv.c → gsl_native/deriv.c} +25 -33
  108. data/ext/{dht.c → gsl_native/dht.c} +23 -31
  109. data/ext/{diff.c → gsl_native/diff.c} +26 -28
  110. data/ext/{dirac.c → gsl_native/dirac.c} +45 -46
  111. data/ext/{eigen.c → gsl_native/eigen.c} +1044 -1095
  112. data/ext/{error.c → gsl_native/error.c} +18 -18
  113. data/ext/gsl_native/extconf.rb +118 -0
  114. data/ext/{fft.c → gsl_native/fft.c} +197 -204
  115. data/ext/{fit.c → gsl_native/fit.c} +17 -18
  116. data/ext/gsl_native/fresnel.c +312 -0
  117. data/ext/{function.c → gsl_native/function.c} +37 -43
  118. data/ext/{geometry.c → gsl_native/geometry.c} +16 -16
  119. data/ext/{graph.c → gsl_native/graph.c} +39 -89
  120. data/ext/{gsl.c → gsl_native/gsl.c} +12 -33
  121. data/ext/{gsl_narray.c → gsl_native/gsl_narray.c} +20 -30
  122. data/ext/{histogram.c → gsl_native/histogram.c} +133 -160
  123. data/ext/{histogram2d.c → gsl_native/histogram2d.c} +78 -104
  124. data/ext/{histogram3d.c → gsl_native/histogram3d.c} +76 -76
  125. data/ext/{histogram3d_source.c → gsl_native/histogram3d_source.c} +196 -197
  126. data/ext/{histogram_find.c → gsl_native/histogram_find.c} +32 -34
  127. data/ext/{histogram_oper.c → gsl_native/histogram_oper.c} +43 -52
  128. data/ext/{ieee.c → gsl_native/ieee.c} +9 -21
  129. data/{include → ext/gsl_native/include}/rb_gsl.h +4 -26
  130. data/{include → ext/gsl_native/include}/rb_gsl_array.h +15 -39
  131. data/{include → ext/gsl_native/include}/rb_gsl_cheb.h +0 -2
  132. data/{include → ext/gsl_native/include}/rb_gsl_common.h +61 -61
  133. data/{include → ext/gsl_native/include}/rb_gsl_complex.h +1 -1
  134. data/{include → ext/gsl_native/include}/rb_gsl_const.h +0 -6
  135. data/ext/gsl_native/include/rb_gsl_dirac.h +6 -0
  136. data/{include → ext/gsl_native/include}/rb_gsl_eigen.h +1 -1
  137. data/{include → ext/gsl_native/include}/rb_gsl_fft.h +0 -13
  138. data/{include → ext/gsl_native/include}/rb_gsl_fit.h +0 -2
  139. data/{include → ext/gsl_native/include}/rb_gsl_function.h +0 -4
  140. data/{include → ext/gsl_native/include}/rb_gsl_graph.h +2 -4
  141. data/{include → ext/gsl_native/include}/rb_gsl_histogram.h +8 -8
  142. data/{include → ext/gsl_native/include}/rb_gsl_histogram3d.h +50 -50
  143. data/{include → ext/gsl_native/include}/rb_gsl_integration.h +1 -1
  144. data/{include → ext/gsl_native/include}/rb_gsl_interp.h +0 -5
  145. data/{include → ext/gsl_native/include}/rb_gsl_linalg.h +2 -6
  146. data/{include → ext/gsl_native/include}/rb_gsl_math.h +0 -6
  147. data/{include → ext/gsl_native/include}/rb_gsl_odeiv.h +0 -3
  148. data/{include → ext/gsl_native/include}/rb_gsl_poly.h +3 -7
  149. data/{include → ext/gsl_native/include}/rb_gsl_rational.h +1 -8
  150. data/{include → ext/gsl_native/include}/rb_gsl_rng.h +0 -1
  151. data/{include → ext/gsl_native/include}/rb_gsl_root.h +1 -1
  152. data/{include → ext/gsl_native/include}/rb_gsl_sf.h +39 -48
  153. data/{include → ext/gsl_native/include}/rb_gsl_statistics.h +1 -1
  154. data/{include → ext/gsl_native/include}/rb_gsl_tensor.h +0 -2
  155. data/{include → ext/gsl_native/include}/rb_gsl_with_narray.h +3 -1
  156. data/{include → ext/gsl_native/include}/templates_off.h +0 -0
  157. data/{include → ext/gsl_native/include}/templates_on.h +1 -1
  158. data/ext/{integration.c → gsl_native/integration.c} +164 -189
  159. data/ext/{interp.c → gsl_native/interp.c} +25 -38
  160. data/ext/gsl_native/jacobi.c +733 -0
  161. data/ext/{linalg.c → gsl_native/linalg.c} +462 -589
  162. data/ext/{linalg_complex.c → gsl_native/linalg_complex.c} +93 -106
  163. data/ext/{math.c → gsl_native/math.c} +48 -67
  164. data/ext/{matrix.c → gsl_native/matrix.c} +13 -16
  165. data/ext/{matrix_complex.c → gsl_native/matrix_complex.c} +119 -123
  166. data/ext/{matrix_double.c → gsl_native/matrix_double.c} +79 -82
  167. data/ext/{matrix_int.c → gsl_native/matrix_int.c} +53 -54
  168. data/ext/{matrix_source.c → gsl_native/matrix_source.h} +292 -318
  169. data/ext/{min.c → gsl_native/min.c} +45 -76
  170. data/ext/{monte.c → gsl_native/monte.c} +50 -64
  171. data/ext/{multifit.c → gsl_native/multifit.c} +142 -151
  172. data/ext/{multimin.c → gsl_native/multimin.c} +64 -92
  173. data/ext/{multimin_fsdf.c → gsl_native/multimin_fsdf.c} +16 -16
  174. data/ext/{multiroots.c → gsl_native/multiroots.c} +73 -76
  175. data/ext/{multiset.c → gsl_native/multiset.c} +4 -8
  176. data/ext/{ndlinear.c → gsl_native/ndlinear.c} +320 -321
  177. data/ext/{nmf.c → gsl_native/nmf.c} +11 -11
  178. data/ext/{nmf_wrap.c → gsl_native/nmf_wrap.c} +1 -1
  179. data/ext/{ntuple.c → gsl_native/ntuple.c} +23 -23
  180. data/ext/{odeiv.c → gsl_native/odeiv.c} +101 -116
  181. data/ext/gsl_native/ool.c +879 -0
  182. data/ext/{permutation.c → gsl_native/permutation.c} +39 -37
  183. data/ext/{poly.c → gsl_native/poly.c} +10 -13
  184. data/ext/{poly2.c → gsl_native/poly2.c} +16 -16
  185. data/ext/{poly_source.c → gsl_native/poly_source.h} +249 -293
  186. data/ext/{qrng.c → gsl_native/qrng.c} +9 -20
  187. data/ext/{randist.c → gsl_native/randist.c} +222 -247
  188. data/ext/{rational.c → gsl_native/rational.c} +12 -12
  189. data/ext/{rng.c → gsl_native/rng.c} +30 -47
  190. data/ext/{root.c → gsl_native/root.c} +47 -48
  191. data/ext/{sf.c → gsl_native/sf.c} +196 -244
  192. data/ext/{sf_airy.c → gsl_native/sf_airy.c} +2 -2
  193. data/ext/{sf_bessel.c → gsl_native/sf_bessel.c} +7 -7
  194. data/ext/{sf_clausen.c → gsl_native/sf_clausen.c} +1 -1
  195. data/ext/{sf_coulomb.c → gsl_native/sf_coulomb.c} +40 -40
  196. data/ext/{sf_coupling.c → gsl_native/sf_coupling.c} +30 -30
  197. data/ext/{sf_dawson.c → gsl_native/sf_dawson.c} +1 -1
  198. data/ext/{sf_debye.c → gsl_native/sf_debye.c} +1 -10
  199. data/ext/{sf_dilog.c → gsl_native/sf_dilog.c} +1 -1
  200. data/ext/{sf_elementary.c → gsl_native/sf_elementary.c} +3 -3
  201. data/ext/{sf_ellint.c → gsl_native/sf_ellint.c} +43 -43
  202. data/ext/{sf_elljac.c → gsl_native/sf_elljac.c} +3 -3
  203. data/ext/{sf_erfc.c → gsl_native/sf_erfc.c} +1 -5
  204. data/ext/{sf_exp.c → gsl_native/sf_exp.c} +3 -3
  205. data/ext/{sf_expint.c → gsl_native/sf_expint.c} +2 -12
  206. data/ext/{sf_fermi_dirac.c → gsl_native/sf_fermi_dirac.c} +1 -1
  207. data/ext/{sf_gamma.c → gsl_native/sf_gamma.c} +2 -6
  208. data/ext/{sf_gegenbauer.c → gsl_native/sf_gegenbauer.c} +1 -1
  209. data/ext/{sf_hyperg.c → gsl_native/sf_hyperg.c} +1 -1
  210. data/ext/{sf_laguerre.c → gsl_native/sf_laguerre.c} +4 -4
  211. data/ext/{sf_lambert.c → gsl_native/sf_lambert.c} +1 -1
  212. data/ext/{sf_legendre.c → gsl_native/sf_legendre.c} +1 -1
  213. data/ext/{sf_log.c → gsl_native/sf_log.c} +4 -4
  214. data/ext/gsl_native/sf_mathieu.c +235 -0
  215. data/ext/{sf_power.c → gsl_native/sf_power.c} +1 -1
  216. data/ext/{sf_psi.c → gsl_native/sf_psi.c} +3 -12
  217. data/ext/{sf_synchrotron.c → gsl_native/sf_synchrotron.c} +1 -1
  218. data/ext/{sf_transport.c → gsl_native/sf_transport.c} +1 -1
  219. data/ext/{sf_trigonometric.c → gsl_native/sf_trigonometric.c} +4 -4
  220. data/ext/{sf_zeta.c → gsl_native/sf_zeta.c} +1 -5
  221. data/ext/{signal.c → gsl_native/signal.c} +63 -68
  222. data/ext/{siman.c → gsl_native/siman.c} +45 -49
  223. data/ext/{sort.c → gsl_native/sort.c} +6 -7
  224. data/ext/{spline.c → gsl_native/spline.c} +28 -46
  225. data/ext/{stats.c → gsl_native/stats.c} +105 -118
  226. data/ext/{sum.c → gsl_native/sum.c} +34 -34
  227. data/ext/{tamu_anova.c → gsl_native/tamu_anova.c} +1 -1
  228. data/ext/{tensor.c → gsl_native/tensor.c} +8 -11
  229. data/ext/{tensor_source.c → gsl_native/tensor_source.h} +147 -148
  230. data/ext/{vector.c → gsl_native/vector.c} +11 -14
  231. data/ext/{vector_complex.c → gsl_native/vector_complex.c} +179 -184
  232. data/ext/{vector_double.c → gsl_native/vector_double.c} +178 -183
  233. data/ext/{vector_int.c → gsl_native/vector_int.c} +27 -29
  234. data/ext/{vector_source.c → gsl_native/vector_source.h} +428 -443
  235. data/ext/{wavelet.c → gsl_native/wavelet.c} +224 -246
  236. data/gsl.gemspec +29 -0
  237. data/lib/gsl.rb +8 -3
  238. data/lib/gsl/gnuplot.rb +3 -3
  239. data/lib/gsl/oper.rb +35 -60
  240. data/lib/gsl/version.rb +3 -0
  241. data/lib/rbgsl.rb +1 -3
  242. data/rdoc/alf.rdoc +5 -5
  243. data/rdoc/blas.rdoc +9 -9
  244. data/rdoc/bspline.rdoc +17 -17
  245. data/rdoc/changes.rdoc +4 -9
  246. data/rdoc/cheb.rdoc +25 -25
  247. data/rdoc/cholesky_complex.rdoc +21 -21
  248. data/rdoc/combi.rdoc +37 -37
  249. data/rdoc/complex.rdoc +22 -22
  250. data/rdoc/const.rdoc +47 -47
  251. data/rdoc/dht.rdoc +49 -49
  252. data/rdoc/diff.rdoc +42 -42
  253. data/rdoc/ehandling.rdoc +6 -6
  254. data/rdoc/eigen.rdoc +153 -153
  255. data/rdoc/fft.rdoc +146 -146
  256. data/rdoc/fit.rdoc +109 -109
  257. data/rdoc/function.rdoc +11 -11
  258. data/rdoc/graph.rdoc +17 -17
  259. data/rdoc/hist.rdoc +103 -103
  260. data/rdoc/hist2d.rdoc +42 -42
  261. data/rdoc/hist3d.rdoc +9 -9
  262. data/rdoc/integration.rdoc +110 -110
  263. data/rdoc/interp.rdoc +71 -71
  264. data/rdoc/intro.rdoc +8 -8
  265. data/rdoc/linalg.rdoc +188 -188
  266. data/rdoc/linalg_complex.rdoc +1 -1
  267. data/rdoc/math.rdoc +58 -58
  268. data/rdoc/matrix.rdoc +275 -275
  269. data/rdoc/min.rdoc +57 -57
  270. data/rdoc/monte.rdoc +22 -22
  271. data/rdoc/multimin.rdoc +95 -95
  272. data/rdoc/multiroot.rdoc +80 -80
  273. data/rdoc/narray.rdoc +32 -32
  274. data/rdoc/ndlinear.rdoc +54 -54
  275. data/rdoc/nonlinearfit.rdoc +100 -100
  276. data/rdoc/ntuple.rdoc +31 -31
  277. data/rdoc/odeiv.rdoc +88 -88
  278. data/rdoc/perm.rdoc +90 -90
  279. data/rdoc/poly.rdoc +66 -66
  280. data/rdoc/qrng.rdoc +21 -21
  281. data/rdoc/randist.rdoc +82 -82
  282. data/rdoc/ref.rdoc +57 -57
  283. data/rdoc/rng.rdoc +85 -85
  284. data/rdoc/roots.rdoc +57 -57
  285. data/rdoc/sf.rdoc +428 -428
  286. data/rdoc/siman.rdoc +19 -19
  287. data/rdoc/sort.rdoc +30 -30
  288. data/rdoc/start.rdoc +8 -8
  289. data/rdoc/stats.rdoc +52 -52
  290. data/rdoc/sum.rdoc +12 -12
  291. data/rdoc/tensor.rdoc +31 -31
  292. data/rdoc/tut.rdoc +1 -1
  293. data/rdoc/use.rdoc +39 -39
  294. data/rdoc/vector.rdoc +188 -188
  295. data/rdoc/vector_complex.rdoc +24 -24
  296. data/rdoc/wavelet.rdoc +46 -46
  297. data/test/gsl/blas_test.rb +79 -0
  298. data/test/gsl/bspline_test.rb +63 -0
  299. data/test/gsl/cdf_test.rb +1512 -0
  300. data/test/gsl/cheb_test.rb +80 -0
  301. data/test/gsl/combination_test.rb +100 -0
  302. data/test/gsl/complex_test.rb +20 -0
  303. data/test/gsl/const_test.rb +29 -0
  304. data/test/gsl/deriv_test.rb +62 -0
  305. data/test/gsl/dht_test.rb +79 -0
  306. data/test/gsl/diff_test.rb +53 -0
  307. data/test/gsl/eigen_test.rb +563 -0
  308. data/test/gsl/err_test.rb +23 -0
  309. data/test/gsl/fit_test.rb +101 -0
  310. data/test/gsl/histo_test.rb +14 -0
  311. data/test/gsl/index_test.rb +61 -0
  312. data/test/gsl/integration_test.rb +274 -0
  313. data/test/gsl/interp_test.rb +27 -0
  314. data/test/gsl/linalg_test.rb +463 -0
  315. data/test/gsl/matrix_nmf_test.rb +37 -0
  316. data/test/gsl/matrix_test.rb +98 -0
  317. data/test/gsl/min_test.rb +89 -0
  318. data/test/gsl/monte_test.rb +77 -0
  319. data/test/gsl/multifit_test.rb +753 -0
  320. data/test/gsl/multimin_test.rb +157 -0
  321. data/test/gsl/multiroot_test.rb +135 -0
  322. data/test/gsl/multiset_test.rb +52 -0
  323. data/test/gsl/odeiv_test.rb +275 -0
  324. data/test/gsl/oper_test.rb +98 -0
  325. data/test/gsl/poly_test.rb +338 -0
  326. data/test/gsl/qrng_test.rb +94 -0
  327. data/test/gsl/quartic_test.rb +28 -0
  328. data/test/gsl/randist_test.rb +122 -0
  329. data/test/gsl/rng_test.rb +303 -0
  330. data/test/gsl/roots_test.rb +78 -0
  331. data/test/gsl/sf_test.rb +2079 -0
  332. data/test/gsl/stats_test.rb +122 -0
  333. data/test/gsl/sum_test.rb +69 -0
  334. data/test/gsl/tensor_test.rb +396 -0
  335. data/test/gsl/vector_test.rb +223 -0
  336. data/test/gsl/wavelet_test.rb +130 -0
  337. data/test/gsl_test.rb +321 -0
  338. data/test/test_helper.rb +42 -0
  339. data/uncrustify.cfg +1693 -0
  340. metadata +337 -378
  341. data/README +0 -32
  342. data/VERSION +0 -1
  343. data/ext/bspline.c +0 -130
  344. data/ext/const.c +0 -673
  345. data/ext/cqp.c +0 -283
  346. data/ext/extconf.rb +0 -295
  347. data/ext/fcmp.c +0 -66
  348. data/ext/fresnel.c +0 -312
  349. data/ext/jacobi.c +0 -739
  350. data/ext/ool.c +0 -879
  351. data/ext/oper_complex_source.c +0 -253
  352. data/ext/sf_mathieu.c +0 -238
  353. data/include/rb_gsl_config.h +0 -62
  354. data/include/rb_gsl_dirac.h +0 -13
  355. data/rdoc/index.rdoc +0 -62
  356. data/rdoc/rngextra.rdoc +0 -11
  357. data/rdoc/screenshot.rdoc +0 -40
  358. data/setup.rb +0 -1585
  359. data/tests/blas/amax.rb +0 -14
  360. data/tests/blas/asum.rb +0 -16
  361. data/tests/blas/axpy.rb +0 -25
  362. data/tests/blas/copy.rb +0 -23
  363. data/tests/blas/dot.rb +0 -23
  364. data/tests/bspline.rb +0 -53
  365. data/tests/cdf.rb +0 -1388
  366. data/tests/cheb.rb +0 -112
  367. data/tests/combination.rb +0 -123
  368. data/tests/complex.rb +0 -17
  369. data/tests/const.rb +0 -24
  370. data/tests/deriv.rb +0 -85
  371. data/tests/dht/dht1.rb +0 -17
  372. data/tests/dht/dht2.rb +0 -23
  373. data/tests/dht/dht3.rb +0 -23
  374. data/tests/dht/dht4.rb +0 -23
  375. data/tests/diff.rb +0 -78
  376. data/tests/eigen/eigen.rb +0 -220
  377. data/tests/eigen/gen.rb +0 -105
  378. data/tests/eigen/genherm.rb +0 -66
  379. data/tests/eigen/gensymm.rb +0 -68
  380. data/tests/eigen/nonsymm.rb +0 -53
  381. data/tests/eigen/nonsymmv.rb +0 -53
  382. data/tests/eigen/symm-herm.rb +0 -74
  383. data/tests/err.rb +0 -58
  384. data/tests/fit.rb +0 -124
  385. data/tests/gsl_test.rb +0 -118
  386. data/tests/gsl_test2.rb +0 -110
  387. data/tests/histo.rb +0 -12
  388. data/tests/integration/integration1.rb +0 -72
  389. data/tests/integration/integration2.rb +0 -71
  390. data/tests/integration/integration3.rb +0 -71
  391. data/tests/integration/integration4.rb +0 -71
  392. data/tests/interp.rb +0 -45
  393. data/tests/linalg/HH.rb +0 -64
  394. data/tests/linalg/LU.rb +0 -47
  395. data/tests/linalg/QR.rb +0 -77
  396. data/tests/linalg/SV.rb +0 -24
  397. data/tests/linalg/TDN.rb +0 -116
  398. data/tests/linalg/TDS.rb +0 -122
  399. data/tests/linalg/bidiag.rb +0 -73
  400. data/tests/linalg/cholesky.rb +0 -20
  401. data/tests/linalg/linalg.rb +0 -158
  402. data/tests/matrix/matrix_complex_test.rb +0 -36
  403. data/tests/matrix/matrix_nmf_test.rb +0 -39
  404. data/tests/matrix/matrix_test.rb +0 -48
  405. data/tests/min.rb +0 -99
  406. data/tests/monte/miser.rb +0 -31
  407. data/tests/monte/vegas.rb +0 -45
  408. data/tests/multifit/test_2dgauss.rb +0 -112
  409. data/tests/multifit/test_brown.rb +0 -90
  410. data/tests/multifit/test_enso.rb +0 -246
  411. data/tests/multifit/test_filip.rb +0 -155
  412. data/tests/multifit/test_gauss.rb +0 -97
  413. data/tests/multifit/test_longley.rb +0 -110
  414. data/tests/multifit/test_multifit.rb +0 -52
  415. data/tests/multimin.rb +0 -139
  416. data/tests/multiroot.rb +0 -131
  417. data/tests/multiset.rb +0 -52
  418. data/tests/narray/blas_dnrm2.rb +0 -20
  419. data/tests/odeiv.rb +0 -353
  420. data/tests/poly/poly.rb +0 -290
  421. data/tests/poly/special.rb +0 -65
  422. data/tests/qrng.rb +0 -131
  423. data/tests/quartic.rb +0 -29
  424. data/tests/randist.rb +0 -134
  425. data/tests/rng.rb +0 -305
  426. data/tests/roots.rb +0 -76
  427. data/tests/run-test.sh +0 -17
  428. data/tests/sf/gsl_test_sf.rb +0 -249
  429. data/tests/sf/test_airy.rb +0 -83
  430. data/tests/sf/test_bessel.rb +0 -306
  431. data/tests/sf/test_coulomb.rb +0 -17
  432. data/tests/sf/test_dilog.rb +0 -25
  433. data/tests/sf/test_gamma.rb +0 -209
  434. data/tests/sf/test_hyperg.rb +0 -356
  435. data/tests/sf/test_legendre.rb +0 -227
  436. data/tests/sf/test_mathieu.rb +0 -59
  437. data/tests/sf/test_mode.rb +0 -19
  438. data/tests/sf/test_sf.rb +0 -839
  439. data/tests/stats.rb +0 -174
  440. data/tests/stats_mt.rb +0 -16
  441. data/tests/sum.rb +0 -98
  442. data/tests/sys.rb +0 -323
  443. data/tests/tensor.rb +0 -419
  444. data/tests/vector/vector_complex_test.rb +0 -101
  445. data/tests/vector/vector_test.rb +0 -141
  446. data/tests/wavelet.rb +0 -142
@@ -9,11 +9,11 @@
9
9
  WITHOUT ANY WARRANTY.
10
10
  */
11
11
 
12
- #include "rb_gsl.h"
13
- #include "rb_gsl_array.h"
12
+ #include "include/rb_gsl.h"
13
+ #include "include/rb_gsl_array.h"
14
14
 
15
- #include "rb_gsl_eigen.h"
16
- #include "rb_gsl_complex.h"
15
+ #include "include/rb_gsl_eigen.h"
16
+ #include "include/rb_gsl_complex.h"
17
17
  #include <gsl/gsl_complex.h>
18
18
  #include <gsl/gsl_complex_math.h>
19
19
  #include <gsl/gsl_math.h>
@@ -29,16 +29,13 @@ static VALUE cgsl_eigen_vector;
29
29
  static VALUE cgsl_eigen_vector_complex;
30
30
  static VALUE cgsl_eigen_herm_vectors;
31
31
 
32
- #ifdef HAVE_EIGEN_FRANCIS
32
+ #ifdef HAVE_GSL_EIGEN_FRANCIS
33
33
  static VALUE cgsl_eigen_francis_workspace;
34
34
 
35
35
  #endif
36
- #ifdef GSL_1_9_LATER
37
36
  static VALUE cgsl_eigen_nonsymm_workspace;
38
37
  static VALUE cgsl_eigen_nonsymmv_workspace;
39
- #endif
40
38
 
41
- #ifdef GSL_1_10_LATER
42
39
  static VALUE cgensymm, mgensymm;
43
40
  static VALUE cgensymmv, mgensymmv;
44
41
  static VALUE cgenherm, mgenherm;
@@ -46,15 +43,14 @@ static VALUE cgenhermv, mgenhermv;
46
43
 
47
44
  static VALUE mgen, mgenv;
48
45
  static VALUE cgenw, cgenvw;
49
- #endif
50
46
 
51
47
  static VALUE rb_gsl_eigen_symm_alloc(VALUE klass, VALUE nn)
52
48
  {
53
49
  gsl_eigen_symm_workspace *w = NULL;
54
50
  CHECK_FIXNUM(nn);
55
51
  w = gsl_eigen_symm_alloc(FIX2INT(nn));
56
- return Data_Wrap_Struct(cgsl_eigen_symm_workspace, 0,
57
- gsl_eigen_symm_free, w);
52
+ return Data_Wrap_Struct(cgsl_eigen_symm_workspace, 0,
53
+ gsl_eigen_symm_free, w);
58
54
  }
59
55
 
60
56
  static VALUE rb_gsl_eigen_symmv_alloc(VALUE klass, VALUE nn)
@@ -70,8 +66,8 @@ static VALUE rb_gsl_eigen_herm_alloc(VALUE klass, VALUE nn)
70
66
  gsl_eigen_herm_workspace *w = NULL;
71
67
  CHECK_FIXNUM(nn);
72
68
  w = gsl_eigen_herm_alloc(FIX2INT(nn));
73
- return Data_Wrap_Struct(cgsl_eigen_herm_workspace, 0,
74
- gsl_eigen_herm_free, w);
69
+ return Data_Wrap_Struct(cgsl_eigen_herm_workspace, 0,
70
+ gsl_eigen_herm_free, w);
75
71
  }
76
72
 
77
73
  static VALUE rb_gsl_eigen_hermv_alloc(VALUE klass, VALUE nn)
@@ -79,12 +75,64 @@ static VALUE rb_gsl_eigen_hermv_alloc(VALUE klass, VALUE nn)
79
75
  gsl_eigen_hermv_workspace *w = NULL;
80
76
  CHECK_FIXNUM(nn);
81
77
  w = gsl_eigen_hermv_alloc(FIX2INT(nn));
82
- return Data_Wrap_Struct(cgsl_eigen_hermv_workspace, 0,
83
- gsl_eigen_hermv_free, w);
78
+ return Data_Wrap_Struct(cgsl_eigen_hermv_workspace, 0,
79
+ gsl_eigen_hermv_free, w);
84
80
  }
85
81
 
86
82
  #ifdef HAVE_NARRAY_H
87
- static VALUE rb_gsl_eigen_symm_narray(int argc, VALUE *argv, VALUE obj);
83
+ static VALUE rb_gsl_eigen_symm_narray(int argc, VALUE *argv, VALUE obj)
84
+ {
85
+ struct NARRAY *na;
86
+ VALUE nary;
87
+ gsl_matrix *A = NULL;
88
+ gsl_eigen_symm_workspace *w = NULL;
89
+ gsl_vector_view vv;
90
+ int shape[1];
91
+ int flagw = 0;
92
+ switch (argc) {
93
+ case 2:
94
+ if (!NA_IsNArray(argv[0]))
95
+ rb_raise(rb_eTypeError, "wrong argument type %s (NArray expected)",
96
+ rb_class2name(CLASS_OF(argv[0])));
97
+ GetNArray(argv[0], na);
98
+ if (na->rank < 2) rb_raise(rb_eRuntimeError, "rank >= 2 required");
99
+ if (na->shape[0] != na->shape[1])
100
+ rb_raise(rb_eRuntimeError, "square matrix required");
101
+ A = gsl_matrix_alloc(na->shape[1], na->shape[0]);
102
+ memcpy(A->data, (double*) na->ptr, sizeof(double)*A->size1*A->size2);
103
+ if (CLASS_OF(argv[1]) != cgsl_eigen_symm_workspace)
104
+ rb_raise(rb_eTypeError,
105
+ "argv[1]: wrong argument type %s (Eigen::Symm::Workspace expected",
106
+ rb_class2name(CLASS_OF(argv[1])));
107
+ Data_Get_Struct(argv[1], gsl_eigen_symm_workspace, w);
108
+ flagw = 0;
109
+ break;
110
+ case 1:
111
+ if (!NA_IsNArray(argv[0]))
112
+ rb_raise(rb_eTypeError, "wrong argument type %s (NArray expected)",
113
+ rb_class2name(CLASS_OF(argv[0])));
114
+ GetNArray(argv[0], na);
115
+ if (na->rank < 2) rb_raise(rb_eRuntimeError, "rank >= 2 required");
116
+ if (na->shape[0] != na->shape[1])
117
+ rb_raise(rb_eRuntimeError, "square matrix required");
118
+ A = gsl_matrix_alloc(na->shape[1], na->shape[0]);
119
+ memcpy(A->data, (double*) na->ptr, sizeof(double)*A->size1*A->size2);
120
+ w = gsl_eigen_symm_alloc(A->size1);
121
+ flagw = 1;
122
+ break;
123
+ default:
124
+ rb_raise(rb_eArgError, "matrix not given");
125
+ break;
126
+ }
127
+ shape[0] = A->size1;
128
+ nary = na_make_object(NA_DFLOAT, 1, shape, cNVector);
129
+ vv = gsl_vector_view_array(NA_PTR_TYPE(nary,double*), A->size1);
130
+ gsl_eigen_symm(A, &vv.vector, w);
131
+ /* gsl_sort_vector(v);*/
132
+ gsl_matrix_free(A);
133
+ if (flagw == 1) gsl_eigen_symm_free(w);
134
+ return nary;
135
+ }
88
136
  #endif
89
137
 
90
138
  static VALUE rb_gsl_eigen_symm(int argc, VALUE *argv, VALUE obj)
@@ -100,19 +148,19 @@ static VALUE rb_gsl_eigen_symm(int argc, VALUE *argv, VALUE obj)
100
148
  switch (argc) {
101
149
  case 2:
102
150
  #ifdef HAVE_NARRAY_H
103
- if (NA_IsNArray(argv[0])) return rb_gsl_eigen_symm_narray(argc, argv, obj);
151
+ if (NA_IsNArray(argv[0])) return rb_gsl_eigen_symm_narray(argc, argv, obj);
104
152
  #endif
105
153
  CHECK_MATRIX(argv[0]);
106
154
  Data_Get_Struct(argv[0], gsl_matrix, Atmp);
107
155
  if (CLASS_OF(argv[1]) != cgsl_eigen_symm_workspace)
108
- rb_raise(rb_eTypeError,
109
- "argv[1]: wrong argument type %s (Eigen::Symm::Workspace expected)",
110
- rb_class2name(CLASS_OF(argv[1])));
156
+ rb_raise(rb_eTypeError,
157
+ "argv[1]: wrong argument type %s (Eigen::Symm::Workspace expected)",
158
+ rb_class2name(CLASS_OF(argv[1])));
111
159
  Data_Get_Struct(argv[1], gsl_eigen_symm_workspace, w);
112
160
  break;
113
161
  case 1:
114
162
  #ifdef HAVE_NARRAY_H
115
- if (NA_IsNArray(argv[0])) return rb_gsl_eigen_symm_narray(argc, argv, obj);
163
+ if (NA_IsNArray(argv[0])) return rb_gsl_eigen_symm_narray(argc, argv, obj);
116
164
  #endif
117
165
  CHECK_MATRIX(argv[0]);
118
166
  Data_Get_Struct(argv[0], gsl_matrix, Atmp);
@@ -130,10 +178,9 @@ static VALUE rb_gsl_eigen_symm(int argc, VALUE *argv, VALUE obj)
130
178
  switch (argc) {
131
179
  case 1:
132
180
  if (CLASS_OF(argv[0]) != cgsl_eigen_symm_workspace)
133
- rb_raise(rb_eTypeError,
134
- "argv[0]: wrong argument type %s (Eigen::Symm::Workspace expected",
135
- rb_class2name(CLASS_OF(argv[0])));
136
-
181
+ rb_raise(rb_eTypeError,
182
+ "argv[0]: wrong argument type %s (Eigen::Symm::Workspace expected",
183
+ rb_class2name(CLASS_OF(argv[0])));
137
184
  Data_Get_Struct(argv[0], gsl_eigen_symm_workspace, w);
138
185
  break;
139
186
  case 0:
@@ -154,65 +201,66 @@ static VALUE rb_gsl_eigen_symm(int argc, VALUE *argv, VALUE obj)
154
201
  }
155
202
 
156
203
  #ifdef HAVE_NARRAY_H
157
- static VALUE rb_gsl_eigen_symm_narray(int argc, VALUE *argv, VALUE obj)
204
+ static VALUE rb_gsl_eigen_symmv_narray(int argc, VALUE *argv, VALUE obj)
158
205
  {
159
206
  struct NARRAY *na;
160
- VALUE nary;
207
+ VALUE eval, evec;
161
208
  gsl_matrix *A = NULL;
162
- gsl_eigen_symm_workspace *w = NULL;
209
+ gsl_eigen_symmv_workspace *w = NULL;
210
+ gsl_matrix_view mv;
163
211
  gsl_vector_view vv;
164
- int shape[1];
212
+ int shape1[1], shape2[2];
165
213
  int flagw = 0;
166
214
  switch (argc) {
167
215
  case 2:
168
- if (!NA_IsNArray(argv[0]))
169
- rb_raise(rb_eTypeError, "wrong argument type %s (NArray expected)",
170
- rb_class2name(CLASS_OF(argv[0])));
216
+ if (!NA_IsNArray(argv[0]))
217
+ rb_raise(rb_eTypeError, "wrong argument type %s (NArray expected)",
218
+ rb_class2name(CLASS_OF(argv[0])));
171
219
  GetNArray(argv[0], na);
172
220
  if (na->rank < 2) rb_raise(rb_eRuntimeError, "rank >= 2 required");
173
221
  if (na->shape[0] != na->shape[1])
174
222
  rb_raise(rb_eRuntimeError, "square matrix required");
175
223
  A = gsl_matrix_alloc(na->shape[1], na->shape[0]);
176
224
  memcpy(A->data, (double*) na->ptr, sizeof(double)*A->size1*A->size2);
177
- if (CLASS_OF(argv[1]) != cgsl_eigen_symm_workspace)
178
- rb_raise(rb_eTypeError,
179
- "argv[1]: wrong argument type %s (Eigen::Symm::Workspace expected",
180
- rb_class2name(CLASS_OF(argv[1])));
181
- Data_Get_Struct(argv[1], gsl_eigen_symm_workspace, w);
225
+ if (CLASS_OF(argv[1]) != cgsl_eigen_symmv_workspace)
226
+ rb_raise(rb_eTypeError,
227
+ "argv[1]: wrong argument type %s (Eigen::Symm::Workspace expected",
228
+ rb_class2name(CLASS_OF(argv[1])));
229
+ Data_Get_Struct(argv[1], gsl_eigen_symmv_workspace, w);
182
230
  flagw = 0;
183
231
  break;
184
232
  case 1:
185
- if (!NA_IsNArray(argv[0]))
186
- rb_raise(rb_eTypeError, "wrong argument type %s (NArray expected)",
187
- rb_class2name(CLASS_OF(argv[0])));
233
+ if (!NA_IsNArray(argv[0]))
234
+ rb_raise(rb_eTypeError, "wrong argument type %s (NArray expected)",
235
+ rb_class2name(CLASS_OF(argv[0])));
188
236
  GetNArray(argv[0], na);
189
237
  if (na->rank < 2) rb_raise(rb_eRuntimeError, "rank >= 2 required");
190
238
  if (na->shape[0] != na->shape[1])
191
239
  rb_raise(rb_eRuntimeError, "square matrix required");
192
240
  A = gsl_matrix_alloc(na->shape[1], na->shape[0]);
193
241
  memcpy(A->data, (double*) na->ptr, sizeof(double)*A->size1*A->size2);
194
- w = gsl_eigen_symm_alloc(A->size1);
242
+ w = gsl_eigen_symmv_alloc(A->size1);
195
243
  flagw = 1;
196
244
  break;
197
245
  default:
198
246
  rb_raise(rb_eArgError, "matrix not given");
199
247
  break;
200
248
  }
201
- shape[0] = A->size1;
202
- nary = na_make_object(NA_DFLOAT, 1, shape, cNVector);
203
- vv = gsl_vector_view_array(NA_PTR_TYPE(nary,double*), A->size1);
204
- gsl_eigen_symm(A, &vv.vector, w);
249
+ shape1[0] = A->size1;
250
+ shape2[0] = A->size1;
251
+ shape2[1] = A->size1;
252
+ eval = na_make_object(NA_DFLOAT, 1, shape1, cNVector);
253
+ evec = na_make_object(NA_DFLOAT, 2, shape2, CLASS_OF(argv[0]));
254
+ vv = gsl_vector_view_array(NA_PTR_TYPE(eval,double*), A->size1);
255
+ mv = gsl_matrix_view_array(NA_PTR_TYPE(evec,double*), A->size1, A->size2);
256
+ gsl_eigen_symmv(A, &vv.vector, &mv.matrix, w);
205
257
  /* gsl_sort_vector(v);*/
206
258
  gsl_matrix_free(A);
207
- if (flagw == 1) gsl_eigen_symm_free(w);
208
- return nary;
259
+ if (flagw == 1) gsl_eigen_symmv_free(w);
260
+ return rb_ary_new3(2, eval, evec);
209
261
  }
210
262
  #endif
211
263
 
212
- #ifdef HAVE_NARRAY_H
213
- static VALUE rb_gsl_eigen_symmv_narray(int argc, VALUE *argv, VALUE obj);
214
- #endif
215
-
216
264
  static VALUE rb_gsl_eigen_symmv(int argc, VALUE *argv, VALUE obj)
217
265
  {
218
266
  gsl_matrix *Atmp = NULL, *A = NULL, *em = NULL;
@@ -227,19 +275,19 @@ static VALUE rb_gsl_eigen_symmv(int argc, VALUE *argv, VALUE obj)
227
275
  switch (argc) {
228
276
  case 2:
229
277
  #ifdef HAVE_NARRAY_H
230
- if (NA_IsNArray(argv[0])) return rb_gsl_eigen_symmv_narray(argc, argv, obj);
278
+ if (NA_IsNArray(argv[0])) return rb_gsl_eigen_symmv_narray(argc, argv, obj);
231
279
  #endif
232
280
  CHECK_MATRIX(argv[0]);
233
281
  Data_Get_Struct(argv[0], gsl_matrix, Atmp);
234
282
  if (CLASS_OF(argv[1]) != cgsl_eigen_symmv_workspace)
235
- rb_raise(rb_eTypeError,
236
- "argv[1]: wrong argument type %s (Eigen::Symmv::Workspace expected)",
237
- rb_class2name(CLASS_OF(argv[1])));
283
+ rb_raise(rb_eTypeError,
284
+ "argv[1]: wrong argument type %s (Eigen::Symmv::Workspace expected)",
285
+ rb_class2name(CLASS_OF(argv[1])));
238
286
  Data_Get_Struct(argv[1], gsl_eigen_symmv_workspace, w);
239
287
  break;
240
288
  case 1:
241
289
  #ifdef HAVE_NARRAY_H
242
- if (NA_IsNArray(argv[0])) return rb_gsl_eigen_symmv_narray(argc, argv, obj);
290
+ if (NA_IsNArray(argv[0])) return rb_gsl_eigen_symmv_narray(argc, argv, obj);
243
291
  #endif
244
292
  CHECK_MATRIX(argv[0]);
245
293
  Data_Get_Struct(argv[0], gsl_matrix, Atmp);
@@ -256,10 +304,9 @@ static VALUE rb_gsl_eigen_symmv(int argc, VALUE *argv, VALUE obj)
256
304
  switch (argc) {
257
305
  case 1:
258
306
  if (CLASS_OF(argv[0]) != cgsl_eigen_symmv_workspace)
259
- rb_raise(rb_eTypeError,
260
- "argv[0]: wrong argument type %s (Eigen::Symmv::Workspace expected)",
261
- rb_class2name(CLASS_OF(argv[0])));
262
-
307
+ rb_raise(rb_eTypeError,
308
+ "argv[0]: wrong argument type %s (Eigen::Symmv::Workspace expected)",
309
+ rb_class2name(CLASS_OF(argv[0])));
263
310
  Data_Get_Struct(argv[0], gsl_eigen_symmv_workspace, w);
264
311
  break;
265
312
  case 0:
@@ -283,67 +330,6 @@ static VALUE rb_gsl_eigen_symmv(int argc, VALUE *argv, VALUE obj)
283
330
  return rb_ary_new3(2, vval, vvec);
284
331
  }
285
332
 
286
- #ifdef HAVE_NARRAY_H
287
- static VALUE rb_gsl_eigen_symmv_narray(int argc, VALUE *argv, VALUE obj)
288
- {
289
- struct NARRAY *na;
290
- VALUE eval, evec;
291
- gsl_matrix *A = NULL;
292
- gsl_eigen_symmv_workspace *w = NULL;
293
- gsl_matrix_view mv;
294
- gsl_vector_view vv;
295
- int shape1[1], shape2[2];
296
- int flagw = 0;
297
- switch (argc) {
298
- case 2:
299
- if (!NA_IsNArray(argv[0]))
300
- rb_raise(rb_eTypeError, "wrong argument type %s (NArray expected)",
301
- rb_class2name(CLASS_OF(argv[0])));
302
- GetNArray(argv[0], na);
303
- if (na->rank < 2) rb_raise(rb_eRuntimeError, "rank >= 2 required");
304
- if (na->shape[0] != na->shape[1])
305
- rb_raise(rb_eRuntimeError, "square matrix required");
306
- A = gsl_matrix_alloc(na->shape[1], na->shape[0]);
307
- memcpy(A->data, (double*) na->ptr, sizeof(double)*A->size1*A->size2);
308
- if (CLASS_OF(argv[1]) != cgsl_eigen_symmv_workspace)
309
- rb_raise(rb_eTypeError,
310
- "argv[1]: wrong argument type %s (Eigen::Symm::Workspace expected",
311
- rb_class2name(CLASS_OF(argv[1])));
312
- Data_Get_Struct(argv[1], gsl_eigen_symmv_workspace, w);
313
- flagw = 0;
314
- break;
315
- case 1:
316
- if (!NA_IsNArray(argv[0]))
317
- rb_raise(rb_eTypeError, "wrong argument type %s (NArray expected)",
318
- rb_class2name(CLASS_OF(argv[0])));
319
- GetNArray(argv[0], na);
320
- if (na->rank < 2) rb_raise(rb_eRuntimeError, "rank >= 2 required");
321
- if (na->shape[0] != na->shape[1])
322
- rb_raise(rb_eRuntimeError, "square matrix required");
323
- A = gsl_matrix_alloc(na->shape[1], na->shape[0]);
324
- memcpy(A->data, (double*) na->ptr, sizeof(double)*A->size1*A->size2);
325
- w = gsl_eigen_symmv_alloc(A->size1);
326
- flagw = 1;
327
- break;
328
- default:
329
- rb_raise(rb_eArgError, "matrix not given");
330
- break;
331
- }
332
- shape1[0] = A->size1;
333
- shape2[0] = A->size1;
334
- shape2[1] = A->size1;
335
- eval = na_make_object(NA_DFLOAT, 1, shape1, cNVector);
336
- evec = na_make_object(NA_DFLOAT, 2, shape2, CLASS_OF(argv[0]));
337
- vv = gsl_vector_view_array(NA_PTR_TYPE(eval,double*), A->size1);
338
- mv = gsl_matrix_view_array(NA_PTR_TYPE(evec,double*), A->size1, A->size2);
339
- gsl_eigen_symmv(A, &vv.vector, &mv.matrix, w);
340
- /* gsl_sort_vector(v);*/
341
- gsl_matrix_free(A);
342
- if (flagw == 1) gsl_eigen_symmv_free(w);
343
- return rb_ary_new3(2, eval, evec);
344
- }
345
- #endif
346
-
347
333
  static VALUE rb_gsl_eigen_herm(int argc, VALUE *argv, VALUE obj)
348
334
  {
349
335
  gsl_matrix_complex *Atmp = NULL, *A = NULL;
@@ -360,9 +346,9 @@ static VALUE rb_gsl_eigen_herm(int argc, VALUE *argv, VALUE obj)
360
346
  CHECK_MATRIX_COMPLEX(argv[0]);
361
347
  Data_Get_Struct(argv[0], gsl_matrix_complex, Atmp);
362
348
  if (CLASS_OF(argv[1]) != cgsl_eigen_herm_workspace)
363
- rb_raise(rb_eTypeError,
364
- "argv[1]: wrong argument type %s (Eigen::Herm::Workspace expected)",
365
- rb_class2name(CLASS_OF(argv[1])));
349
+ rb_raise(rb_eTypeError,
350
+ "argv[1]: wrong argument type %s (Eigen::Herm::Workspace expected)",
351
+ rb_class2name(CLASS_OF(argv[1])));
366
352
  Data_Get_Struct(argv[1], gsl_eigen_herm_workspace, w);
367
353
  break;
368
354
  case 1:
@@ -381,10 +367,9 @@ static VALUE rb_gsl_eigen_herm(int argc, VALUE *argv, VALUE obj)
381
367
  switch (argc) {
382
368
  case 1:
383
369
  if (CLASS_OF(argv[0]) != cgsl_eigen_herm_workspace)
384
- rb_raise(rb_eTypeError,
385
- "argv[0]: wrong argument type %s (Eigen::Herm::Workspace expected)",
386
- rb_class2name(CLASS_OF(argv[0])));
387
-
370
+ rb_raise(rb_eTypeError,
371
+ "argv[0]: wrong argument type %s (Eigen::Herm::Workspace expected)",
372
+ rb_class2name(CLASS_OF(argv[0])));
388
373
  Data_Get_Struct(argv[0], gsl_eigen_herm_workspace, w);
389
374
  break;
390
375
  case 0:
@@ -420,9 +405,9 @@ static VALUE rb_gsl_eigen_hermv(int argc, VALUE *argv, VALUE obj)
420
405
  CHECK_MATRIX_COMPLEX(argv[0]);
421
406
  Data_Get_Struct(argv[0], gsl_matrix_complex, Atmp);
422
407
  if (CLASS_OF(argv[1]) != cgsl_eigen_hermv_workspace)
423
- rb_raise(rb_eTypeError,
424
- "argv[1]: wrong argument type %s (Eigen::Hermv::Workspace expected)",
425
- rb_class2name(CLASS_OF(argv[1])));
408
+ rb_raise(rb_eTypeError,
409
+ "argv[1]: wrong argument type %s (Eigen::Hermv::Workspace expected)",
410
+ rb_class2name(CLASS_OF(argv[1])));
426
411
  Data_Get_Struct(argv[1], gsl_eigen_hermv_workspace, w);
427
412
  break;
428
413
  case 1:
@@ -441,10 +426,9 @@ static VALUE rb_gsl_eigen_hermv(int argc, VALUE *argv, VALUE obj)
441
426
  switch (argc) {
442
427
  case 1:
443
428
  if (CLASS_OF(argv[0]) != cgsl_eigen_hermv_workspace)
444
- rb_raise(rb_eTypeError,
445
- "argv[0]: wrong argument type %s (Eigen::Hermv::Workspace expected)",
446
- rb_class2name(CLASS_OF(argv[0])));
447
-
429
+ rb_raise(rb_eTypeError,
430
+ "argv[0]: wrong argument type %s (Eigen::Hermv::Workspace expected)",
431
+ rb_class2name(CLASS_OF(argv[0])));
448
432
  Data_Get_Struct(argv[0], gsl_eigen_hermv_workspace, w);
449
433
  break;
450
434
  case 0:
@@ -500,7 +484,7 @@ static VALUE rb_gsl_eigen_vectors_complex_unpack(VALUE obj)
500
484
  for (i = 0; i < m->size1; i++) {
501
485
  v = gsl_vector_complex_alloc(m->size2);
502
486
  for (j = 0; j < m->size2; j++) {
503
- z= gsl_matrix_complex_get(m, j, i);
487
+ z = gsl_matrix_complex_get(m, j, i);
504
488
  gsl_vector_complex_set(v, j, z);
505
489
  }
506
490
  tmp = Data_Wrap_Struct(cgsl_eigen_vector_complex, 0, gsl_vector_complex_free, v);
@@ -515,7 +499,7 @@ static void rb_gsl_eigen_define_const(VALUE topmodule, VALUE module)
515
499
  rb_define_const(topmodule, "EIGEN_SORT_VAL_DESC", INT2FIX(GSL_EIGEN_SORT_VAL_DESC));
516
500
  rb_define_const(topmodule, "EIGEN_SORT_ABS_ASC", INT2FIX(GSL_EIGEN_SORT_ABS_ASC));
517
501
  rb_define_const(topmodule, "EIGEN_SORT_ABS_DESC", INT2FIX(GSL_EIGEN_SORT_ABS_DESC));
518
-
502
+
519
503
  rb_define_const(module, "SORT_VAL_ASC", INT2FIX(GSL_EIGEN_SORT_VAL_ASC));
520
504
  rb_define_const(module, "SORT_VAL_DESC", INT2FIX(GSL_EIGEN_SORT_VAL_DESC));
521
505
  rb_define_const(module, "SORT_ABS_ASC", INT2FIX(GSL_EIGEN_SORT_ABS_ASC));
@@ -528,7 +512,7 @@ static void rb_gsl_eigen_define_const(VALUE topmodule, VALUE module)
528
512
  }
529
513
 
530
514
  static VALUE rb_gsl_eigen_real_sort(int argc, VALUE *argv, VALUE obj,
531
- int (*sortfunc)(gsl_vector*, gsl_matrix*, gsl_eigen_sort_t))
515
+ int (*sortfunc)(gsl_vector*, gsl_matrix*, gsl_eigen_sort_t))
532
516
  {
533
517
  gsl_vector *v = NULL;
534
518
  gsl_matrix *m = NULL;
@@ -537,10 +521,10 @@ static VALUE rb_gsl_eigen_real_sort(int argc, VALUE *argv, VALUE obj,
537
521
  case 3:
538
522
  CHECK_FIXNUM(argv[2]);
539
523
  type = FIX2INT(argv[2]);
540
- /* no break, do next */
524
+ /* no break, do next */
541
525
  case 2:
542
526
  if (argv[0] == Qnil) {
543
- v = NULL;
527
+ v = NULL;
544
528
  } else {
545
529
  CHECK_VECTOR(argv[0]);
546
530
  Data_Get_Struct(argv[0], gsl_vector, v);
@@ -560,7 +544,7 @@ static VALUE rb_gsl_eigen_real_sort(int argc, VALUE *argv, VALUE obj,
560
544
 
561
545
 
562
546
  static VALUE rb_gsl_eigen_complex_sort(int argc, VALUE *argv, VALUE obj,
563
- int (*sortfunc)(gsl_vector*, gsl_matrix_complex*, gsl_eigen_sort_t))
547
+ int (*sortfunc)(gsl_vector*, gsl_matrix_complex*, gsl_eigen_sort_t))
564
548
  {
565
549
  gsl_vector *v = NULL;
566
550
  gsl_matrix_complex *m = NULL;
@@ -570,7 +554,7 @@ static VALUE rb_gsl_eigen_complex_sort(int argc, VALUE *argv, VALUE obj,
570
554
  case 3:
571
555
  CHECK_FIXNUM(argv[2]);
572
556
  type = FIX2INT(argv[2]);
573
- /* no break, do next */
557
+ /* no break, do next */
574
558
  case 2:
575
559
  if (argv[0] == Qnil) {
576
560
  v = NULL;
@@ -582,7 +566,7 @@ static VALUE rb_gsl_eigen_complex_sort(int argc, VALUE *argv, VALUE obj,
582
566
  m = NULL;
583
567
  } else {
584
568
  CHECK_MATRIX_COMPLEX(argv[1]);
585
- Data_Get_Struct(argv[1], gsl_matrix_complex, m);
569
+ Data_Get_Struct(argv[1], gsl_matrix_complex, m);
586
570
  }
587
571
  break;
588
572
  default:
@@ -596,11 +580,11 @@ static VALUE rb_gsl_eigen_symmv_sort(int argc, VALUE *argv, VALUE obj)
596
580
  }
597
581
  static VALUE rb_gsl_eigen_hermv_sort(int argc, VALUE *argv, VALUE obj)
598
582
  {
599
- return rb_gsl_eigen_complex_sort(argc, argv, obj, gsl_eigen_hermv_sort);
583
+ return rb_gsl_eigen_complex_sort(argc, argv, obj, gsl_eigen_hermv_sort);
600
584
  }
601
585
 
602
586
 
603
- #ifdef HAVE_EIGEN_FRANCIS
587
+ #ifdef HAVE_GSL_EIGEN_FRANCIS
604
588
  static VALUE rb_gsl_eigen_francis_alloc(VALUE klass)
605
589
  {
606
590
  gsl_eigen_francis_workspace *w = NULL;
@@ -626,7 +610,59 @@ static VALUE rb_gsl_eigen_francis_T(int argc, VALUE *argv, VALUE obj)
626
610
  }
627
611
 
628
612
  #ifdef HAVE_NARRAY_H
629
- static VALUE rb_gsl_eigen_francis_narray(int argc, VALUE *argv, VALUE obj);
613
+ static VALUE rb_gsl_eigen_francis_narray(int argc, VALUE *argv, VALUE obj)
614
+ {
615
+ struct NARRAY *na;
616
+ VALUE nary;
617
+ gsl_matrix *A = NULL;
618
+ gsl_eigen_francis_workspace *w = NULL;
619
+ gsl_vector_complex_view vv;
620
+ int shape[1];
621
+ int flagw = 0;
622
+ switch (argc) {
623
+ case 2:
624
+ if (!NA_IsNArray(argv[0]))
625
+ rb_raise(rb_eTypeError, "wrong argument type %s (NArray expected)",
626
+ rb_class2name(CLASS_OF(argv[0])));
627
+ GetNArray(argv[0], na);
628
+ if (na->rank < 2) rb_raise(rb_eRuntimeError, "rank >= 2 required");
629
+ if (na->shape[0] != na->shape[1])
630
+ rb_raise(rb_eRuntimeError, "square matrix required");
631
+ A = gsl_matrix_alloc(na->shape[1], na->shape[0]);
632
+ memcpy(A->data, (double*) na->ptr, sizeof(double)*A->size1*A->size2);
633
+ if (CLASS_OF(argv[1]) != cgsl_eigen_francis_workspace)
634
+ rb_raise(rb_eTypeError,
635
+ "argv[1]: wrong argument type %s (Eigen::Symm::Workspace expected",
636
+ rb_class2name(CLASS_OF(argv[1])));
637
+ Data_Get_Struct(argv[1], gsl_eigen_francis_workspace, w);
638
+ flagw = 0;
639
+ break;
640
+ case 1:
641
+ if (!NA_IsNArray(argv[0]))
642
+ rb_raise(rb_eTypeError, "wrong argument type %s (NArray expected)",
643
+ rb_class2name(CLASS_OF(argv[0])));
644
+ GetNArray(argv[0], na);
645
+ if (na->rank < 2) rb_raise(rb_eRuntimeError, "rank >= 2 required");
646
+ if (na->shape[0] != na->shape[1])
647
+ rb_raise(rb_eRuntimeError, "square matrix required");
648
+ A = gsl_matrix_alloc(na->shape[1], na->shape[0]);
649
+ memcpy(A->data, (double*) na->ptr, sizeof(double)*A->size1*A->size2);
650
+ w = gsl_eigen_francis_alloc();
651
+ flagw = 1;
652
+ break;
653
+ default:
654
+ rb_raise(rb_eArgError, "matrix not given");
655
+ break;
656
+ }
657
+ shape[0] = A->size1;
658
+ nary = na_make_object(NA_DCOMPLEX, 1, shape, cNVector);
659
+ vv = gsl_vector_complex_view_array(NA_PTR_TYPE(nary,double*), A->size1);
660
+ gsl_eigen_francis(A, &vv.vector, w);
661
+ /* gsl_sort_vector(v);*/
662
+ gsl_matrix_free(A);
663
+ if (flagw == 1) gsl_eigen_francis_free(w);
664
+ return nary;
665
+ }
630
666
  #endif
631
667
 
632
668
  static VALUE rb_gsl_eigen_francis(int argc, VALUE *argv, VALUE obj)
@@ -640,7 +676,7 @@ static VALUE rb_gsl_eigen_francis(int argc, VALUE *argv, VALUE obj)
640
676
 
641
677
  #ifdef HAVE_NARRAY_H
642
678
  if (NA_IsNArray(obj)) return rb_gsl_eigen_francis_narray(argc, argv, obj);
643
- if (argc >= 1 && NA_IsNArray(argv[0]))
679
+ if (argc >= 1 && NA_IsNArray(argv[0]))
644
680
  return rb_gsl_eigen_francis_narray(argc, argv, obj);
645
681
  #endif
646
682
 
@@ -654,7 +690,6 @@ static VALUE rb_gsl_eigen_francis(int argc, VALUE *argv, VALUE obj)
654
690
  istart = 1;
655
691
  argv2 = argv + 1;
656
692
  }
657
-
658
693
  switch (argc-istart) {
659
694
  case 0:
660
695
  v = gsl_vector_complex_alloc(m->size1);
@@ -666,7 +701,7 @@ static VALUE rb_gsl_eigen_francis(int argc, VALUE *argv, VALUE obj)
666
701
  if (CLASS_OF(argv2[0]) == cgsl_vector_complex) {
667
702
  Data_Get_Struct(argv2[0], gsl_vector_complex, v);
668
703
  w = gsl_eigen_francis_alloc();
669
- wflag = 1;
704
+ wflag = 1;
670
705
  } else if (CLASS_OF(argv2[0]) == cgsl_eigen_francis_workspace) {
671
706
  v = gsl_vector_complex_alloc(m->size1);
672
707
  vflag = 1;
@@ -696,62 +731,6 @@ static VALUE rb_gsl_eigen_francis(int argc, VALUE *argv, VALUE obj)
696
731
  return argv2[0];
697
732
  }
698
733
 
699
- #ifdef HAVE_NARRAY_H
700
- static VALUE rb_gsl_eigen_francis_narray(int argc, VALUE *argv, VALUE obj)
701
- {
702
- struct NARRAY *na;
703
- VALUE nary;
704
- gsl_matrix *A = NULL;
705
- gsl_eigen_francis_workspace *w = NULL;
706
- gsl_vector_complex_view vv;
707
- int shape[1];
708
- int flagw = 0;
709
- switch (argc) {
710
- case 2:
711
- if (!NA_IsNArray(argv[0]))
712
- rb_raise(rb_eTypeError, "wrong argument type %s (NArray expected)",
713
- rb_class2name(CLASS_OF(argv[0])));
714
- GetNArray(argv[0], na);
715
- if (na->rank < 2) rb_raise(rb_eRuntimeError, "rank >= 2 required");
716
- if (na->shape[0] != na->shape[1])
717
- rb_raise(rb_eRuntimeError, "square matrix required");
718
- A = gsl_matrix_alloc(na->shape[1], na->shape[0]);
719
- memcpy(A->data, (double*) na->ptr, sizeof(double)*A->size1*A->size2);
720
- if (CLASS_OF(argv[1]) != cgsl_eigen_francis_workspace)
721
- rb_raise(rb_eTypeError,
722
- "argv[1]: wrong argument type %s (Eigen::Symm::Workspace expected",
723
- rb_class2name(CLASS_OF(argv[1])));
724
- Data_Get_Struct(argv[1], gsl_eigen_francis_workspace, w);
725
- flagw = 0;
726
- break;
727
- case 1:
728
- if (!NA_IsNArray(argv[0]))
729
- rb_raise(rb_eTypeError, "wrong argument type %s (NArray expected)",
730
- rb_class2name(CLASS_OF(argv[0])));
731
- GetNArray(argv[0], na);
732
- if (na->rank < 2) rb_raise(rb_eRuntimeError, "rank >= 2 required");
733
- if (na->shape[0] != na->shape[1])
734
- rb_raise(rb_eRuntimeError, "square matrix required");
735
- A = gsl_matrix_alloc(na->shape[1], na->shape[0]);
736
- memcpy(A->data, (double*) na->ptr, sizeof(double)*A->size1*A->size2);
737
- w = gsl_eigen_francis_alloc();
738
- flagw = 1;
739
- break;
740
- default:
741
- rb_raise(rb_eArgError, "matrix not given");
742
- break;
743
- }
744
- shape[0] = A->size1;
745
- nary = na_make_object(NA_DCOMPLEX, 1, shape, cNVector);
746
- vv = gsl_vector_complex_view_array(NA_PTR_TYPE(nary,double*), A->size1);
747
- gsl_eigen_francis(A, &vv.vector, w);
748
- /* gsl_sort_vector(v);*/
749
- gsl_matrix_free(A);
750
- if (flagw == 1) gsl_eigen_francis_free(w);
751
- return nary;
752
- }
753
- #endif
754
-
755
734
  static VALUE rb_gsl_eigen_francis_Z(int argc, VALUE *argv, VALUE obj)
756
735
  {
757
736
  gsl_matrix *m, *mtmp, *Z;
@@ -771,7 +750,6 @@ static VALUE rb_gsl_eigen_francis_Z(int argc, VALUE *argv, VALUE obj)
771
750
  istart = 1;
772
751
  argv2 = argv + 1;
773
752
  }
774
-
775
753
  switch (argc-istart) {
776
754
  case 0:
777
755
  v = gsl_vector_complex_alloc(m->size1);
@@ -819,7 +797,6 @@ static VALUE rb_gsl_eigen_francis_Z(int argc, VALUE *argv, VALUE obj)
819
797
  }
820
798
  #endif
821
799
 
822
- #ifdef GSL_1_9_LATER
823
800
  static VALUE rb_gsl_eigen_nonsymm_alloc(VALUE klass, VALUE nn)
824
801
  {
825
802
  size_t n;
@@ -852,78 +829,7 @@ static VALUE rb_gsl_eigen_nonsymm_params(int argc, VALUE *argv, VALUE obj)
852
829
  }
853
830
 
854
831
  #ifdef HAVE_NARRAY_H
855
- static VALUE rb_gsl_eigen_nonsymm_narray(int argc, VALUE *argv, VALUE obj);
856
- #endif
857
-
858
- static VALUE rb_gsl_eigen_nonsymm(int argc, VALUE *argv, VALUE obj)
859
- {
860
- gsl_matrix *m;
861
- gsl_vector_complex *v;
862
- gsl_eigen_nonsymm_workspace *w;
863
- int vflag = 0, wflag = 0;
864
- int istart = 0;
865
- VALUE *argv2;
866
-
867
- #ifdef HAVE_NARRAY_H
868
- if (NA_IsNArray(obj)) return rb_gsl_eigen_nonsymm_narray(argc, argv, obj);
869
- if (argc >= 1 && NA_IsNArray(argv[0]))
870
- return rb_gsl_eigen_nonsymm_narray(argc, argv, obj);
871
- #endif
872
-
873
- if (MATRIX_P(obj)) {
874
- Data_Get_Struct(obj, gsl_matrix, m);
875
- argv2 = argv;
876
- istart = 0;
877
- } else {
878
- if (argc < 1) rb_raise(rb_eArgError, "Wrong number of arguments.\n");
879
- Data_Get_Struct(argv[0], gsl_matrix, m);
880
- istart = 1;
881
- argv2 = argv + 1;
882
- }
883
-
884
- switch (argc-istart) {
885
- case 0:
886
- v = gsl_vector_complex_alloc(m->size1);
887
- w = gsl_eigen_nonsymm_alloc(m->size1);
888
- vflag = 1;
889
- wflag = 1;
890
- break;
891
- case 1:
892
- if (CLASS_OF(argv2[0]) == cgsl_vector_complex) {
893
- Data_Get_Struct(argv2[0], gsl_vector_complex, v);
894
- w = gsl_eigen_nonsymm_alloc(m->size1);
895
- wflag = 1;
896
- } else if (CLASS_OF(argv2[0]) == cgsl_eigen_nonsymm_workspace) {
897
- v = gsl_vector_complex_alloc(m->size1);
898
- vflag = 1;
899
- Data_Get_Struct(argv2[0], gsl_eigen_nonsymm_workspace, w);
900
- } else {
901
- rb_raise(rb_eArgError, "Wrong argument type.\n");
902
- }
903
- break;
904
- case 2:
905
- CHECK_VECTOR_COMPLEX(argv2[0]);
906
- if (CLASS_OF(argv2[1]) != cgsl_eigen_nonsymm_workspace) {
907
- rb_raise(rb_eArgError, "argv[1] must be a GSL::Eigen::Nonsymm::Workspace.\n");
908
- }
909
- Data_Get_Struct(argv2[0], gsl_vector_complex, v);
910
- Data_Get_Struct(argv2[1], gsl_eigen_nonsymm_workspace, w);
911
- break;
912
- default:
913
- rb_raise(rb_eArgError, "Wrong number of arguments (%d for 0-2).\n", argc);
914
- }
915
- // mtmp = make_matrix_clone(m);
916
- gsl_eigen_nonsymm(m, v, w);
917
- // gsl_matrix_free(mtmp);
918
- if (wflag == 1) gsl_eigen_nonsymm_free(w);
919
- if (vflag == 1)
920
- return Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, v);
921
- else
922
- return argv2[0];
923
- }
924
-
925
- #ifdef HAVE_NARRAY_H
926
- static VALUE rb_gsl_eigen_nonsymm_narray(int argc, VALUE *argv, VALUE obj)
832
+ static VALUE rb_gsl_eigen_nonsymm_narray(int argc, VALUE *argv, VALUE obj)
927
833
  {
928
834
  struct NARRAY *na;
929
835
  VALUE nary;
@@ -934,9 +840,9 @@ static VALUE rb_gsl_eigen_nonsymm_narray(int argc, VALUE *argv, VALUE obj)
934
840
  int flagw = 0;
935
841
  switch (argc) {
936
842
  case 2:
937
- if (!NA_IsNArray(argv[0]))
938
- rb_raise(rb_eTypeError, "wrong argument type %s (NArray expected)",
939
- rb_class2name(CLASS_OF(argv[0])));
843
+ if (!NA_IsNArray(argv[0]))
844
+ rb_raise(rb_eTypeError, "wrong argument type %s (NArray expected)",
845
+ rb_class2name(CLASS_OF(argv[0])));
940
846
  GetNArray(argv[0], na);
941
847
  if (na->rank < 2) rb_raise(rb_eRuntimeError, "rank >= 2 required");
942
848
  if (na->shape[0] != na->shape[1])
@@ -944,16 +850,16 @@ static VALUE rb_gsl_eigen_nonsymm_narray(int argc, VALUE *argv, VALUE obj)
944
850
  A = gsl_matrix_alloc(na->shape[1], na->shape[0]);
945
851
  memcpy(A->data, (double*) na->ptr, sizeof(double)*A->size1*A->size2);
946
852
  if (CLASS_OF(argv[1]) != cgsl_eigen_nonsymm_workspace)
947
- rb_raise(rb_eTypeError,
948
- "argv[1]: wrong argument type %s (Eigen::Symm::Workspace expected",
949
- rb_class2name(CLASS_OF(argv[1])));
853
+ rb_raise(rb_eTypeError,
854
+ "argv[1]: wrong argument type %s (Eigen::Symm::Workspace expected",
855
+ rb_class2name(CLASS_OF(argv[1])));
950
856
  Data_Get_Struct(argv[1], gsl_eigen_nonsymm_workspace, w);
951
857
  flagw = 0;
952
858
  break;
953
859
  case 1:
954
- if (!NA_IsNArray(argv[0]))
955
- rb_raise(rb_eTypeError, "wrong argument type %s (NArray expected)",
956
- rb_class2name(CLASS_OF(argv[0])));
860
+ if (!NA_IsNArray(argv[0]))
861
+ rb_raise(rb_eTypeError, "wrong argument type %s (NArray expected)",
862
+ rb_class2name(CLASS_OF(argv[0])));
957
863
  GetNArray(argv[0], na);
958
864
  if (na->rank < 2) rb_raise(rb_eRuntimeError, "rank >= 2 required");
959
865
  if (na->shape[0] != na->shape[1])
@@ -978,6 +884,72 @@ static VALUE rb_gsl_eigen_nonsymm_narray(int argc, VALUE *argv, VALUE obj)
978
884
  }
979
885
  #endif
980
886
 
887
+ static VALUE rb_gsl_eigen_nonsymm(int argc, VALUE *argv, VALUE obj)
888
+ {
889
+ gsl_matrix *m;
890
+ gsl_vector_complex *v;
891
+ gsl_eigen_nonsymm_workspace *w;
892
+ int vflag = 0, wflag = 0;
893
+ int istart = 0;
894
+ VALUE *argv2;
895
+
896
+ #ifdef HAVE_NARRAY_H
897
+ if (NA_IsNArray(obj)) return rb_gsl_eigen_nonsymm_narray(argc, argv, obj);
898
+ if (argc >= 1 && NA_IsNArray(argv[0]))
899
+ return rb_gsl_eigen_nonsymm_narray(argc, argv, obj);
900
+ #endif
901
+
902
+ if (MATRIX_P(obj)) {
903
+ Data_Get_Struct(obj, gsl_matrix, m);
904
+ argv2 = argv;
905
+ istart = 0;
906
+ } else {
907
+ if (argc < 1) rb_raise(rb_eArgError, "Wrong number of arguments.\n");
908
+ Data_Get_Struct(argv[0], gsl_matrix, m);
909
+ istart = 1;
910
+ argv2 = argv + 1;
911
+ }
912
+ switch (argc-istart) {
913
+ case 0:
914
+ v = gsl_vector_complex_alloc(m->size1);
915
+ w = gsl_eigen_nonsymm_alloc(m->size1);
916
+ vflag = 1;
917
+ wflag = 1;
918
+ break;
919
+ case 1:
920
+ if (CLASS_OF(argv2[0]) == cgsl_vector_complex) {
921
+ Data_Get_Struct(argv2[0], gsl_vector_complex, v);
922
+ w = gsl_eigen_nonsymm_alloc(m->size1);
923
+ wflag = 1;
924
+ } else if (CLASS_OF(argv2[0]) == cgsl_eigen_nonsymm_workspace) {
925
+ v = gsl_vector_complex_alloc(m->size1);
926
+ vflag = 1;
927
+ Data_Get_Struct(argv2[0], gsl_eigen_nonsymm_workspace, w);
928
+ } else {
929
+ rb_raise(rb_eArgError, "Wrong argument type.\n");
930
+ }
931
+ break;
932
+ case 2:
933
+ CHECK_VECTOR_COMPLEX(argv2[0]);
934
+ if (CLASS_OF(argv2[1]) != cgsl_eigen_nonsymm_workspace) {
935
+ rb_raise(rb_eArgError, "argv[1] must be a GSL::Eigen::Nonsymm::Workspace.\n");
936
+ }
937
+ Data_Get_Struct(argv2[0], gsl_vector_complex, v);
938
+ Data_Get_Struct(argv2[1], gsl_eigen_nonsymm_workspace, w);
939
+ break;
940
+ default:
941
+ rb_raise(rb_eArgError, "Wrong number of arguments (%d for 0-2).\n", argc);
942
+ }
943
+ // mtmp = make_matrix_clone(m);
944
+ gsl_eigen_nonsymm(m, v, w);
945
+ // gsl_matrix_free(mtmp);
946
+ if (wflag == 1) gsl_eigen_nonsymm_free(w);
947
+ if (vflag == 1)
948
+ return Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, v);
949
+ else
950
+ return argv2[0];
951
+ }
952
+
981
953
  static VALUE rb_gsl_eigen_nonsymm_Z(int argc, VALUE *argv, VALUE obj)
982
954
  {
983
955
  gsl_matrix *m, *Z;
@@ -997,7 +969,6 @@ static VALUE rb_gsl_eigen_nonsymm_Z(int argc, VALUE *argv, VALUE obj)
997
969
  istart = 1;
998
970
  argv2 = argv + 1;
999
971
  }
1000
-
1001
972
  switch (argc-istart) {
1002
973
  case 0:
1003
974
  v = gsl_vector_complex_alloc(m->size1);
@@ -1054,14 +1025,69 @@ static VALUE rb_gsl_eigen_nonsymmv_alloc(VALUE klass, VALUE nn)
1054
1025
  }
1055
1026
 
1056
1027
  #ifdef HAVE_NARRAY_H
1057
- static VALUE rb_gsl_eigen_nonsymmv_narray(int argc, VALUE *argv, VALUE obj);
1028
+ static VALUE rb_gsl_eigen_nonsymmv_narray(int argc, VALUE *argv, VALUE obj)
1029
+ {
1030
+ struct NARRAY *na;
1031
+ VALUE nary, nvec;
1032
+ gsl_matrix *A = NULL;
1033
+ gsl_eigen_nonsymmv_workspace *w = NULL;
1034
+ gsl_vector_complex_view vv;
1035
+ gsl_matrix_complex_view mm;
1036
+ int shape[1], shape2[2];
1037
+ int flagw = 0;
1038
+ switch (argc) {
1039
+ case 2:
1040
+ if (!NA_IsNArray(argv[0]))
1041
+ rb_raise(rb_eTypeError, "wrong argument type %s (NArray expected)",
1042
+ rb_class2name(CLASS_OF(argv[0])));
1043
+ GetNArray(argv[0], na);
1044
+ if (na->rank < 2) rb_raise(rb_eRuntimeError, "rank >= 2 required");
1045
+ if (na->shape[0] != na->shape[1])
1046
+ rb_raise(rb_eRuntimeError, "square matrix required");
1047
+ A = gsl_matrix_alloc(na->shape[1], na->shape[0]);
1048
+ memcpy(A->data, (double*) na->ptr, sizeof(double)*A->size1*A->size2);
1049
+ if (CLASS_OF(argv[1]) != cgsl_eigen_nonsymmv_workspace)
1050
+ rb_raise(rb_eTypeError,
1051
+ "argv[1]: wrong argument type %s (Eigen::Symm::Workspace expected",
1052
+ rb_class2name(CLASS_OF(argv[1])));
1053
+ Data_Get_Struct(argv[1], gsl_eigen_nonsymmv_workspace, w);
1054
+ flagw = 0;
1055
+ break;
1056
+ case 1:
1057
+ if (!NA_IsNArray(argv[0]))
1058
+ rb_raise(rb_eTypeError, "wrong argument type %s (NArray expected)",
1059
+ rb_class2name(CLASS_OF(argv[0])));
1060
+ GetNArray(argv[0], na);
1061
+ if (na->rank < 2) rb_raise(rb_eRuntimeError, "rank >= 2 required");
1062
+ if (na->shape[0] != na->shape[1])
1063
+ rb_raise(rb_eRuntimeError, "square matrix required");
1064
+ A = gsl_matrix_alloc(na->shape[1], na->shape[0]);
1065
+ memcpy(A->data, (double*) na->ptr, sizeof(double)*A->size1*A->size2);
1066
+ w = gsl_eigen_nonsymmv_alloc(A->size1);
1067
+ flagw = 1;
1068
+ break;
1069
+ default:
1070
+ rb_raise(rb_eArgError, "matrix not given");
1071
+ break;
1072
+ }
1073
+ shape[0] = A->size1; shape2[0] = A->size1; shape2[1] = A->size2;
1074
+ nary = na_make_object(NA_DCOMPLEX, 1, shape, cNVector);
1075
+ vv = gsl_vector_complex_view_array(NA_PTR_TYPE(nary,double*), A->size1);
1076
+ nvec = na_make_object(NA_DCOMPLEX, 2, shape2, CLASS_OF(argv[0]));
1077
+ mm = gsl_matrix_complex_view_array(NA_PTR_TYPE(nvec,double*), A->size1, A->size2);
1078
+ gsl_eigen_nonsymmv(A, &vv.vector, &mm.matrix, w);
1079
+ /* gsl_sort_vector(v);*/
1080
+ gsl_matrix_free(A);
1081
+ if (flagw == 1) gsl_eigen_nonsymmv_free(w);
1082
+ return rb_ary_new3(2, nary, nvec);
1083
+ }
1058
1084
  #endif
1059
1085
 
1060
1086
  static VALUE rb_gsl_eigen_nonsymmv(int argc, VALUE *argv, VALUE obj)
1061
1087
  {
1062
1088
  gsl_matrix *m;
1063
- gsl_vector_complex *v;
1064
- gsl_matrix_complex *evec;
1089
+ gsl_vector_complex *v = NULL;
1090
+ gsl_matrix_complex *evec = NULL;
1065
1091
  gsl_eigen_nonsymmv_workspace *w;
1066
1092
  int vflag = 0, wflag = 0;
1067
1093
  int istart = 0;
@@ -1069,7 +1095,7 @@ static VALUE rb_gsl_eigen_nonsymmv(int argc, VALUE *argv, VALUE obj)
1069
1095
 
1070
1096
  #ifdef HAVE_NARRAY_H
1071
1097
  if (NA_IsNArray(obj)) return rb_gsl_eigen_nonsymmv_narray(argc, argv, obj);
1072
- if (argc >= 1 && NA_IsNArray(argv[0]))
1098
+ if (argc >= 1 && NA_IsNArray(argv[0]))
1073
1099
  return rb_gsl_eigen_nonsymmv_narray(argc, argv, obj);
1074
1100
  #endif
1075
1101
 
@@ -1083,7 +1109,6 @@ static VALUE rb_gsl_eigen_nonsymmv(int argc, VALUE *argv, VALUE obj)
1083
1109
  istart = 1;
1084
1110
  argv2 = argv + 1;
1085
1111
  }
1086
-
1087
1112
  switch (argc-istart) {
1088
1113
  case 0:
1089
1114
  v = gsl_vector_complex_alloc(m->size1);
@@ -1127,78 +1152,19 @@ static VALUE rb_gsl_eigen_nonsymmv(int argc, VALUE *argv, VALUE obj)
1127
1152
 
1128
1153
  if (wflag == 1) gsl_eigen_nonsymmv_free(w);
1129
1154
  if (vflag == 1) {
1130
- return rb_ary_new3(2,
1131
- Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, v),
1132
- Data_Wrap_Struct(cgsl_matrix_complex, 0, gsl_matrix_complex_free, evec));
1155
+ return rb_ary_new3(2,
1156
+ Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, v),
1157
+ Data_Wrap_Struct(cgsl_matrix_complex, 0, gsl_matrix_complex_free, evec));
1133
1158
  } else {
1134
1159
  return rb_ary_new3(2, argv2[0], argv2[1]);
1135
1160
  }
1136
1161
  }
1137
1162
 
1138
- #ifdef HAVE_NARRAY_H
1139
- static VALUE rb_gsl_eigen_nonsymmv_narray(int argc, VALUE *argv, VALUE obj)
1140
- {
1141
- struct NARRAY *na;
1142
- VALUE nary, nvec;
1143
- gsl_matrix *A = NULL;
1144
- gsl_eigen_nonsymmv_workspace *w = NULL;
1145
- gsl_vector_complex_view vv;
1146
- gsl_matrix_complex_view mm;
1147
- int shape[1], shape2[2];
1148
- int flagw = 0;
1149
- switch (argc) {
1150
- case 2:
1151
- if (!NA_IsNArray(argv[0]))
1152
- rb_raise(rb_eTypeError, "wrong argument type %s (NArray expected)",
1153
- rb_class2name(CLASS_OF(argv[0])));
1154
- GetNArray(argv[0], na);
1155
- if (na->rank < 2) rb_raise(rb_eRuntimeError, "rank >= 2 required");
1156
- if (na->shape[0] != na->shape[1])
1157
- rb_raise(rb_eRuntimeError, "square matrix required");
1158
- A = gsl_matrix_alloc(na->shape[1], na->shape[0]);
1159
- memcpy(A->data, (double*) na->ptr, sizeof(double)*A->size1*A->size2);
1160
- if (CLASS_OF(argv[1]) != cgsl_eigen_nonsymmv_workspace)
1161
- rb_raise(rb_eTypeError,
1162
- "argv[1]: wrong argument type %s (Eigen::Symm::Workspace expected",
1163
- rb_class2name(CLASS_OF(argv[1])));
1164
- Data_Get_Struct(argv[1], gsl_eigen_nonsymmv_workspace, w);
1165
- flagw = 0;
1166
- break;
1167
- case 1:
1168
- if (!NA_IsNArray(argv[0]))
1169
- rb_raise(rb_eTypeError, "wrong argument type %s (NArray expected)",
1170
- rb_class2name(CLASS_OF(argv[0])));
1171
- GetNArray(argv[0], na);
1172
- if (na->rank < 2) rb_raise(rb_eRuntimeError, "rank >= 2 required");
1173
- if (na->shape[0] != na->shape[1])
1174
- rb_raise(rb_eRuntimeError, "square matrix required");
1175
- A = gsl_matrix_alloc(na->shape[1], na->shape[0]);
1176
- memcpy(A->data, (double*) na->ptr, sizeof(double)*A->size1*A->size2);
1177
- w = gsl_eigen_nonsymmv_alloc(A->size1);
1178
- flagw = 1;
1179
- break;
1180
- default:
1181
- rb_raise(rb_eArgError, "matrix not given");
1182
- break;
1183
- }
1184
- shape[0] = A->size1; shape2[0] = A->size1; shape2[1] = A->size2;
1185
- nary = na_make_object(NA_DCOMPLEX, 1, shape, cNVector);
1186
- vv = gsl_vector_complex_view_array(NA_PTR_TYPE(nary,double*), A->size1);
1187
- nvec = na_make_object(NA_DCOMPLEX, 2, shape2, CLASS_OF(argv[0]));
1188
- mm = gsl_matrix_complex_view_array(NA_PTR_TYPE(nvec,double*), A->size1, A->size2);
1189
- gsl_eigen_nonsymmv(A, &vv.vector, &mm.matrix, w);
1190
- /* gsl_sort_vector(v);*/
1191
- gsl_matrix_free(A);
1192
- if (flagw == 1) gsl_eigen_nonsymmv_free(w);
1193
- return rb_ary_new3(2, nary, nvec);
1194
- }
1195
- #endif
1196
-
1197
1163
  static VALUE rb_gsl_eigen_nonsymmv_Z(int argc, VALUE *argv, VALUE obj)
1198
1164
  {
1199
- gsl_matrix *m, *Z;
1200
- gsl_vector_complex *v;
1201
- gsl_matrix_complex *evec;
1165
+ gsl_matrix *m, *Z = NULL;
1166
+ gsl_vector_complex *v = NULL;
1167
+ gsl_matrix_complex *evec = NULL;
1202
1168
  gsl_eigen_nonsymmv_workspace *w;
1203
1169
  int vflag = 0, wflag = 0;
1204
1170
  int istart = 0;
@@ -1214,7 +1180,6 @@ static VALUE rb_gsl_eigen_nonsymmv_Z(int argc, VALUE *argv, VALUE obj)
1214
1180
  istart = 1;
1215
1181
  argv2 = argv + 1;
1216
1182
  }
1217
-
1218
1183
  switch (argc-istart) {
1219
1184
  case 0:
1220
1185
  v = gsl_vector_complex_alloc(m->size1);
@@ -1262,17 +1227,17 @@ static VALUE rb_gsl_eigen_nonsymmv_Z(int argc, VALUE *argv, VALUE obj)
1262
1227
 
1263
1228
  if (wflag == 1) gsl_eigen_nonsymmv_free(w);
1264
1229
  if (vflag == 1) {
1265
- return rb_ary_new3(3,
1266
- Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, v),
1267
- Data_Wrap_Struct(cgsl_matrix_complex, 0, gsl_matrix_complex_free, evec),
1268
- Data_Wrap_Struct(cgsl_matrix, 0, gsl_matrix_free, Z));
1230
+ return rb_ary_new3(3,
1231
+ Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, v),
1232
+ Data_Wrap_Struct(cgsl_matrix_complex, 0, gsl_matrix_complex_free, evec),
1233
+ Data_Wrap_Struct(cgsl_matrix, 0, gsl_matrix_free, Z));
1269
1234
  } else {
1270
1235
  return rb_ary_new3(2, argv2[0], argv2[1], argv2[2]);
1271
1236
  }
1272
1237
  }
1273
1238
 
1274
1239
  static VALUE rb_gsl_eigen_complex_sort2(int argc, VALUE *argv, VALUE obj,
1275
- int (*sortfunc)(gsl_vector_complex*, gsl_matrix_complex*, gsl_eigen_sort_t))
1240
+ int (*sortfunc)(gsl_vector_complex*, gsl_matrix_complex*, gsl_eigen_sort_t))
1276
1241
  {
1277
1242
  gsl_vector_complex *v = NULL;
1278
1243
  gsl_matrix_complex *m = NULL;
@@ -1282,19 +1247,19 @@ static VALUE rb_gsl_eigen_complex_sort2(int argc, VALUE *argv, VALUE obj,
1282
1247
  case 3:
1283
1248
  CHECK_FIXNUM(argv[2]);
1284
1249
  type = FIX2INT(argv[2]);
1285
- /* no break, do next */
1250
+ /* no break, do next */
1286
1251
  case 2:
1287
1252
  if (argv[0] == Qnil) {
1288
1253
  v = NULL;
1289
1254
  } else {
1290
1255
  CHECK_VECTOR_COMPLEX(argv[0]);
1291
- Data_Get_Struct(argv[0], gsl_vector_complex, v);
1256
+ Data_Get_Struct(argv[0], gsl_vector_complex, v);
1292
1257
  }
1293
1258
  if (argv[1] == Qnil) {
1294
1259
  m = NULL;
1295
1260
  } else {
1296
1261
  CHECK_MATRIX_COMPLEX(argv[1]);
1297
- Data_Get_Struct(argv[1], gsl_matrix_complex, m);
1262
+ Data_Get_Struct(argv[1], gsl_matrix_complex, m);
1298
1263
  }
1299
1264
  break;
1300
1265
  default:
@@ -1306,13 +1271,9 @@ static VALUE rb_gsl_eigen_complex_sort2(int argc, VALUE *argv, VALUE obj,
1306
1271
 
1307
1272
  static VALUE rb_gsl_eigen_nonsymmv_sort(int argc, VALUE *argv, VALUE obj)
1308
1273
  {
1309
- return rb_gsl_eigen_complex_sort2(argc, argv, obj, gsl_eigen_nonsymmv_sort);
1274
+ return rb_gsl_eigen_complex_sort2(argc, argv, obj, gsl_eigen_nonsymmv_sort);
1310
1275
  }
1311
1276
 
1312
- #endif
1313
-
1314
- #ifdef GSL_1_10_LATER
1315
-
1316
1277
  static VALUE rb_gsl_eigen_gensymm_alloc(VALUE klass, VALUE nn)
1317
1278
  {
1318
1279
  gsl_eigen_gensymm_workspace *w = NULL;
@@ -1343,373 +1304,371 @@ static VALUE rb_gsl_eigen_genhermv_alloc(VALUE klass, VALUE nn)
1343
1304
  }
1344
1305
 
1345
1306
  static int check_argv_gensymm(int argc, VALUE *argv, VALUE obj, gsl_matrix **A, gsl_matrix **B,
1346
- gsl_vector **eval, gsl_eigen_gensymm_workspace **w)
1307
+ gsl_vector **eval, gsl_eigen_gensymm_workspace **w)
1347
1308
  {
1348
- int argc2 = argc;
1349
- int flag = 0;
1350
- if (CLASS_OF(obj) == cgensymm) {
1351
- Data_Get_Struct(obj, gsl_eigen_gensymm_workspace, *w);
1352
- } else {
1353
- if (rb_obj_is_kind_of(argv[argc-1], cgensymm)) {
1354
- Data_Get_Struct(argv[argc-1], gsl_eigen_gensymm_workspace, *w);
1355
- argc2 = argc-1;
1356
- } else {
1357
- /* workspace is not given */
1358
- }
1359
- }
1360
- switch (argc2) {
1361
- case 2:
1362
- CHECK_MATRIX(argv[0]); CHECK_MATRIX(argv[1]);
1363
- Data_Get_Struct(argv[0], gsl_matrix, *A);
1364
- Data_Get_Struct(argv[1], gsl_matrix, *B);
1365
- break;
1366
- case 3:
1367
- if (rb_obj_is_kind_of(argv[2], cgensymm)) {
1368
- Data_Get_Struct(argv[2], gsl_eigen_gensymm_workspace, *w);
1369
- } else {
1370
- CHECK_VECTOR(argv[2]);
1371
- Data_Get_Struct(argv[2], gsl_vector, *eval);
1372
- }
1373
- CHECK_MATRIX(argv[0]); CHECK_MATRIX(argv[1]);
1374
- Data_Get_Struct(argv[0], gsl_matrix, *A);
1375
- Data_Get_Struct(argv[1], gsl_matrix, *B);
1376
- break;
1377
- default:
1378
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 2 or 3)", argc);
1379
- }
1380
- if (*eval == NULL) {
1381
- *eval = gsl_vector_alloc((*A)->size1);
1382
- flag += 1;
1383
- }
1384
- if (*w == NULL) {
1385
- *w = gsl_eigen_gensymm_alloc((*A)->size1);
1386
- flag += 2;
1387
- }
1388
- return flag;
1309
+ int argc2 = argc;
1310
+ int flag = 0;
1311
+ if (CLASS_OF(obj) == cgensymm) {
1312
+ Data_Get_Struct(obj, gsl_eigen_gensymm_workspace, *w);
1313
+ } else {
1314
+ if (rb_obj_is_kind_of(argv[argc-1], cgensymm)) {
1315
+ Data_Get_Struct(argv[argc-1], gsl_eigen_gensymm_workspace, *w);
1316
+ argc2 = argc-1;
1317
+ } else {
1318
+ /* workspace is not given */
1319
+ }
1320
+ }
1321
+ switch (argc2) {
1322
+ case 2:
1323
+ CHECK_MATRIX(argv[0]); CHECK_MATRIX(argv[1]);
1324
+ Data_Get_Struct(argv[0], gsl_matrix, *A);
1325
+ Data_Get_Struct(argv[1], gsl_matrix, *B);
1326
+ break;
1327
+ case 3:
1328
+ if (rb_obj_is_kind_of(argv[2], cgensymm)) {
1329
+ Data_Get_Struct(argv[2], gsl_eigen_gensymm_workspace, *w);
1330
+ } else {
1331
+ CHECK_VECTOR(argv[2]);
1332
+ Data_Get_Struct(argv[2], gsl_vector, *eval);
1333
+ }
1334
+ CHECK_MATRIX(argv[0]); CHECK_MATRIX(argv[1]);
1335
+ Data_Get_Struct(argv[0], gsl_matrix, *A);
1336
+ Data_Get_Struct(argv[1], gsl_matrix, *B);
1337
+ break;
1338
+ default:
1339
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 2 or 3)", argc);
1340
+ }
1341
+ if (*eval == NULL) {
1342
+ *eval = gsl_vector_alloc((*A)->size1);
1343
+ flag += 1;
1344
+ }
1345
+ if (*w == NULL) {
1346
+ *w = gsl_eigen_gensymm_alloc((*A)->size1);
1347
+ flag += 2;
1348
+ }
1349
+ return flag;
1389
1350
  }
1390
1351
 
1391
1352
  static int check_argv_gensymmv(int argc, VALUE *argv, VALUE obj, gsl_matrix **A, gsl_matrix **B,
1392
- gsl_vector **eval, gsl_matrix **evec, gsl_eigen_gensymmv_workspace **w)
1353
+ gsl_vector **eval, gsl_matrix **evec, gsl_eigen_gensymmv_workspace **w)
1393
1354
  {
1394
- int argc2 = argc;
1395
- int flag = 0;
1396
- if (CLASS_OF(obj) == cgensymmv) {
1397
- Data_Get_Struct(obj, gsl_eigen_gensymmv_workspace, *w);
1398
- } else {
1399
- if (rb_obj_is_kind_of(argv[argc-1], cgensymmv)) {
1400
- Data_Get_Struct(argv[argc-1], gsl_eigen_gensymmv_workspace, *w);
1401
- argc2 = argc-1;
1402
- } else {
1403
-
1404
- /* workspace is not given */
1405
- }
1406
- }
1407
-
1408
- switch (argc2) {
1409
- case 2:
1410
- CHECK_MATRIX(argv[0]); CHECK_MATRIX(argv[1]);
1411
- Data_Get_Struct(argv[0], gsl_matrix, *A);
1412
- Data_Get_Struct(argv[1], gsl_matrix, *B);
1413
- break;
1414
- case 3:
1415
- if (rb_obj_is_kind_of(argv[2], cgensymmv)) {
1416
- Data_Get_Struct(argv[2], gsl_eigen_gensymmv_workspace, *w);
1417
- } else {
1355
+ int argc2 = argc;
1356
+ int flag = 0;
1357
+ if (CLASS_OF(obj) == cgensymmv) {
1358
+ Data_Get_Struct(obj, gsl_eigen_gensymmv_workspace, *w);
1359
+ } else {
1360
+ if (rb_obj_is_kind_of(argv[argc-1], cgensymmv)) {
1361
+ Data_Get_Struct(argv[argc-1], gsl_eigen_gensymmv_workspace, *w);
1362
+ argc2 = argc-1;
1363
+ } else {
1364
+
1365
+ /* workspace is not given */
1366
+ }
1367
+ }
1368
+ switch (argc2) {
1369
+ case 2:
1370
+ CHECK_MATRIX(argv[0]); CHECK_MATRIX(argv[1]);
1371
+ Data_Get_Struct(argv[0], gsl_matrix, *A);
1372
+ Data_Get_Struct(argv[1], gsl_matrix, *B);
1373
+ break;
1374
+ case 3:
1375
+ if (rb_obj_is_kind_of(argv[2], cgensymmv)) {
1376
+ Data_Get_Struct(argv[2], gsl_eigen_gensymmv_workspace, *w);
1377
+ } else {
1418
1378
  rb_raise(rb_eTypeError, "Wrong argument type %s (GSL::Eigen::Gensymmv::Workspace expected)",
1419
- rb_class2name(CLASS_OF(argv[2])));
1420
- }
1421
- CHECK_MATRIX(argv[0]); CHECK_MATRIX(argv[1]);
1422
- Data_Get_Struct(argv[0], gsl_matrix, *A);
1423
- Data_Get_Struct(argv[1], gsl_matrix, *B);
1424
-
1425
- break;
1426
- case 5:
1427
- if (rb_obj_is_kind_of(argv[4], cgensymmv)) {
1428
- Data_Get_Struct(argv[4], gsl_eigen_gensymmv_workspace, *w);
1429
- } else {
1379
+ rb_class2name(CLASS_OF(argv[2])));
1380
+ }
1381
+ CHECK_MATRIX(argv[0]); CHECK_MATRIX(argv[1]);
1382
+ Data_Get_Struct(argv[0], gsl_matrix, *A);
1383
+ Data_Get_Struct(argv[1], gsl_matrix, *B);
1384
+
1385
+ break;
1386
+ case 5:
1387
+ if (rb_obj_is_kind_of(argv[4], cgensymmv)) {
1388
+ Data_Get_Struct(argv[4], gsl_eigen_gensymmv_workspace, *w);
1389
+ } else {
1430
1390
  rb_raise(rb_eTypeError, "Wrong argument type %s (GSL::Eigen::Gensymmv::Workspace expected)",
1431
- rb_class2name(CLASS_OF(argv[4])));
1391
+ rb_class2name(CLASS_OF(argv[4])));
1432
1392
  }
1433
- CHECK_VECTOR(argv[2]);
1434
- Data_Get_Struct(argv[2], gsl_vector, *eval);
1435
- CHECK_MATRIX(argv[3]);
1436
- Data_Get_Struct(argv[3], gsl_matrix, *evec);
1437
-
1438
- CHECK_MATRIX(argv[0]); CHECK_MATRIX(argv[1]);
1439
- Data_Get_Struct(argv[0], gsl_matrix, *A);
1440
- Data_Get_Struct(argv[1], gsl_matrix, *B);
1441
- break;
1442
- default:
1443
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 2, 3 or 5)", argc);
1444
- }
1445
- if (*eval == NULL && *evec == NULL) {
1446
- *eval = gsl_vector_alloc((*A)->size1);
1447
- *evec = gsl_matrix_alloc((*A)->size1, (*A)->size2);
1448
- flag += 1;
1449
- }
1450
- if (*w == NULL) {
1451
- *w = gsl_eigen_gensymmv_alloc((*A)->size1);
1452
- flag += 2;
1453
- }
1454
- return flag;
1393
+ CHECK_VECTOR(argv[2]);
1394
+ Data_Get_Struct(argv[2], gsl_vector, *eval);
1395
+ CHECK_MATRIX(argv[3]);
1396
+ Data_Get_Struct(argv[3], gsl_matrix, *evec);
1397
+
1398
+ CHECK_MATRIX(argv[0]); CHECK_MATRIX(argv[1]);
1399
+ Data_Get_Struct(argv[0], gsl_matrix, *A);
1400
+ Data_Get_Struct(argv[1], gsl_matrix, *B);
1401
+ break;
1402
+ default:
1403
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 2, 3 or 5)", argc);
1404
+ }
1405
+ if (*eval == NULL && *evec == NULL) {
1406
+ *eval = gsl_vector_alloc((*A)->size1);
1407
+ *evec = gsl_matrix_alloc((*A)->size1, (*A)->size2);
1408
+ flag += 1;
1409
+ }
1410
+ if (*w == NULL) {
1411
+ *w = gsl_eigen_gensymmv_alloc((*A)->size1);
1412
+ flag += 2;
1413
+ }
1414
+ return flag;
1455
1415
  }
1456
1416
 
1457
1417
  static int check_argv_genherm(int argc, VALUE *argv, VALUE obj, gsl_matrix_complex **A, gsl_matrix_complex **B,
1458
- gsl_vector **eval, gsl_eigen_genherm_workspace **w)
1418
+ gsl_vector **eval, gsl_eigen_genherm_workspace **w)
1459
1419
  {
1460
- int argc2 = argc;
1461
- int flag = 0;
1462
- if (CLASS_OF(obj) == cgenherm) {
1463
- Data_Get_Struct(obj, gsl_eigen_genherm_workspace, *w);
1464
- } else {
1465
- if (rb_obj_is_kind_of(argv[argc-1], cgenherm)) {
1466
- Data_Get_Struct(argv[argc-1], gsl_eigen_genherm_workspace, *w);
1467
- argc2 = argc-1;
1468
- } else {
1469
- /* workspace is not given */
1470
- }
1471
- }
1472
- switch (argc2) {
1473
- case 2:
1474
- CHECK_MATRIX_COMPLEX(argv[0]); CHECK_MATRIX_COMPLEX(argv[1]);
1475
- Data_Get_Struct(argv[0], gsl_matrix_complex, *A);
1476
- Data_Get_Struct(argv[1], gsl_matrix_complex, *B);
1477
- break;
1478
- case 3:
1479
- if (rb_obj_is_kind_of(argv[2], cgenherm)) {
1480
- Data_Get_Struct(argv[2], gsl_eigen_genherm_workspace, *w);
1481
- } else {
1482
- CHECK_VECTOR(argv[2]);
1483
- Data_Get_Struct(argv[2], gsl_vector, *eval);
1484
- }
1485
- CHECK_MATRIX_COMPLEX(argv[0]); CHECK_MATRIX_COMPLEX(argv[1]);
1486
- Data_Get_Struct(argv[0], gsl_matrix_complex, *A);
1487
- Data_Get_Struct(argv[1], gsl_matrix_complex, *B);
1488
- break;
1489
- default:
1490
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 2 or 3)", argc);
1491
- }
1492
- if (*eval == NULL) {
1493
- *eval = gsl_vector_alloc((*A)->size1);
1494
- flag += 1;
1495
- }
1496
- if (*w == NULL) {
1497
- *w = gsl_eigen_genherm_alloc((*A)->size1);
1498
- flag += 2;
1499
- }
1500
- return flag;
1420
+ int argc2 = argc;
1421
+ int flag = 0;
1422
+ if (CLASS_OF(obj) == cgenherm) {
1423
+ Data_Get_Struct(obj, gsl_eigen_genherm_workspace, *w);
1424
+ } else {
1425
+ if (rb_obj_is_kind_of(argv[argc-1], cgenherm)) {
1426
+ Data_Get_Struct(argv[argc-1], gsl_eigen_genherm_workspace, *w);
1427
+ argc2 = argc-1;
1428
+ } else {
1429
+ /* workspace is not given */
1430
+ }
1431
+ }
1432
+ switch (argc2) {
1433
+ case 2:
1434
+ CHECK_MATRIX_COMPLEX(argv[0]); CHECK_MATRIX_COMPLEX(argv[1]);
1435
+ Data_Get_Struct(argv[0], gsl_matrix_complex, *A);
1436
+ Data_Get_Struct(argv[1], gsl_matrix_complex, *B);
1437
+ break;
1438
+ case 3:
1439
+ if (rb_obj_is_kind_of(argv[2], cgenherm)) {
1440
+ Data_Get_Struct(argv[2], gsl_eigen_genherm_workspace, *w);
1441
+ } else {
1442
+ CHECK_VECTOR(argv[2]);
1443
+ Data_Get_Struct(argv[2], gsl_vector, *eval);
1444
+ }
1445
+ CHECK_MATRIX_COMPLEX(argv[0]); CHECK_MATRIX_COMPLEX(argv[1]);
1446
+ Data_Get_Struct(argv[0], gsl_matrix_complex, *A);
1447
+ Data_Get_Struct(argv[1], gsl_matrix_complex, *B);
1448
+ break;
1449
+ default:
1450
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 2 or 3)", argc);
1451
+ }
1452
+ if (*eval == NULL) {
1453
+ *eval = gsl_vector_alloc((*A)->size1);
1454
+ flag += 1;
1455
+ }
1456
+ if (*w == NULL) {
1457
+ *w = gsl_eigen_genherm_alloc((*A)->size1);
1458
+ flag += 2;
1459
+ }
1460
+ return flag;
1501
1461
  }
1502
1462
  static int check_argv_genhermv(int argc, VALUE *argv, VALUE obj, gsl_matrix_complex **A, gsl_matrix_complex **B,
1503
- gsl_vector **eval, gsl_matrix_complex **evec, gsl_eigen_genhermv_workspace **w)
1463
+ gsl_vector **eval, gsl_matrix_complex **evec, gsl_eigen_genhermv_workspace **w)
1504
1464
  {
1505
- int argc2 = argc;
1506
- int flag = 0;
1507
- if (CLASS_OF(obj) == cgenhermv) {
1508
- Data_Get_Struct(obj, gsl_eigen_genhermv_workspace, *w);
1509
- } else {
1510
- if (rb_obj_is_kind_of(argv[argc-1], cgenhermv)) {
1511
- Data_Get_Struct(argv[argc-1], gsl_eigen_genhermv_workspace, *w);
1512
- argc2 = argc-1;
1513
- } else {
1514
-
1515
- /* workspace is not given */
1516
- }
1517
- }
1518
-
1519
- switch (argc2) {
1520
- case 2:
1521
- CHECK_MATRIX_COMPLEX(argv[0]); CHECK_MATRIX_COMPLEX(argv[1]);
1522
- Data_Get_Struct(argv[0], gsl_matrix_complex, *A);
1523
- Data_Get_Struct(argv[1], gsl_matrix_complex, *B);
1524
- break;
1525
- case 3:
1526
- if (rb_obj_is_kind_of(argv[2], cgenhermv)) {
1527
- Data_Get_Struct(argv[2], gsl_eigen_genhermv_workspace, *w);
1528
- } else {
1465
+ int argc2 = argc;
1466
+ int flag = 0;
1467
+ if (CLASS_OF(obj) == cgenhermv) {
1468
+ Data_Get_Struct(obj, gsl_eigen_genhermv_workspace, *w);
1469
+ } else {
1470
+ if (rb_obj_is_kind_of(argv[argc-1], cgenhermv)) {
1471
+ Data_Get_Struct(argv[argc-1], gsl_eigen_genhermv_workspace, *w);
1472
+ argc2 = argc-1;
1473
+ } else {
1474
+
1475
+ /* workspace is not given */
1476
+ }
1477
+ }
1478
+ switch (argc2) {
1479
+ case 2:
1480
+ CHECK_MATRIX_COMPLEX(argv[0]); CHECK_MATRIX_COMPLEX(argv[1]);
1481
+ Data_Get_Struct(argv[0], gsl_matrix_complex, *A);
1482
+ Data_Get_Struct(argv[1], gsl_matrix_complex, *B);
1483
+ break;
1484
+ case 3:
1485
+ if (rb_obj_is_kind_of(argv[2], cgenhermv)) {
1486
+ Data_Get_Struct(argv[2], gsl_eigen_genhermv_workspace, *w);
1487
+ } else {
1529
1488
  rb_raise(rb_eTypeError, "Wrong argument type %s (GSL::Eigen::Genhermv::Workspace expected)",
1530
- rb_class2name(CLASS_OF(argv[2])));
1531
- }
1532
- CHECK_MATRIX_COMPLEX(argv[0]); CHECK_MATRIX_COMPLEX(argv[1]);
1533
- Data_Get_Struct(argv[0], gsl_matrix_complex, *A);
1534
- Data_Get_Struct(argv[1], gsl_matrix_complex, *B);
1535
-
1536
- break;
1537
- case 5:
1538
- if (rb_obj_is_kind_of(argv[4], cgenhermv)) {
1539
- Data_Get_Struct(argv[4], gsl_eigen_genhermv_workspace, *w);
1540
- } else {
1489
+ rb_class2name(CLASS_OF(argv[2])));
1490
+ }
1491
+ CHECK_MATRIX_COMPLEX(argv[0]); CHECK_MATRIX_COMPLEX(argv[1]);
1492
+ Data_Get_Struct(argv[0], gsl_matrix_complex, *A);
1493
+ Data_Get_Struct(argv[1], gsl_matrix_complex, *B);
1494
+
1495
+ break;
1496
+ case 5:
1497
+ if (rb_obj_is_kind_of(argv[4], cgenhermv)) {
1498
+ Data_Get_Struct(argv[4], gsl_eigen_genhermv_workspace, *w);
1499
+ } else {
1541
1500
  rb_raise(rb_eTypeError, "Wrong argument type %s (GSL::Eigen::Genhermv::Workspace expected)",
1542
- rb_class2name(CLASS_OF(argv[4])));
1501
+ rb_class2name(CLASS_OF(argv[4])));
1543
1502
  }
1544
- CHECK_VECTOR(argv[2]);
1545
- Data_Get_Struct(argv[2], gsl_vector, *eval);
1546
- CHECK_MATRIX_COMPLEX(argv[3]);
1547
- Data_Get_Struct(argv[3], gsl_matrix_complex, *evec);
1548
-
1549
- CHECK_MATRIX_COMPLEX(argv[0]); CHECK_MATRIX_COMPLEX(argv[1]);
1550
- Data_Get_Struct(argv[0], gsl_matrix_complex, *A);
1551
- Data_Get_Struct(argv[1], gsl_matrix_complex, *B);
1552
- break;
1553
- default:
1554
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 2, 3 or 5)", argc);
1555
- }
1556
- if (*eval == NULL && *evec == NULL) {
1557
- *eval = gsl_vector_alloc((*A)->size1);
1558
- *evec = gsl_matrix_complex_alloc((*A)->size1, (*A)->size2);
1559
- flag += 1;
1560
- }
1561
- if (*w == NULL) {
1562
- *w = gsl_eigen_genhermv_alloc((*A)->size1);
1563
- flag += 2;
1564
- }
1565
- return flag;
1503
+ CHECK_VECTOR(argv[2]);
1504
+ Data_Get_Struct(argv[2], gsl_vector, *eval);
1505
+ CHECK_MATRIX_COMPLEX(argv[3]);
1506
+ Data_Get_Struct(argv[3], gsl_matrix_complex, *evec);
1507
+
1508
+ CHECK_MATRIX_COMPLEX(argv[0]); CHECK_MATRIX_COMPLEX(argv[1]);
1509
+ Data_Get_Struct(argv[0], gsl_matrix_complex, *A);
1510
+ Data_Get_Struct(argv[1], gsl_matrix_complex, *B);
1511
+ break;
1512
+ default:
1513
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 2, 3 or 5)", argc);
1514
+ }
1515
+ if (*eval == NULL && *evec == NULL) {
1516
+ *eval = gsl_vector_alloc((*A)->size1);
1517
+ *evec = gsl_matrix_complex_alloc((*A)->size1, (*A)->size2);
1518
+ flag += 1;
1519
+ }
1520
+ if (*w == NULL) {
1521
+ *w = gsl_eigen_genhermv_alloc((*A)->size1);
1522
+ flag += 2;
1523
+ }
1524
+ return flag;
1566
1525
  }
1567
1526
  static VALUE rb_gsl_eigen_gensymm(int argc, VALUE *argv, VALUE obj)
1568
1527
  {
1569
- gsl_matrix *A = NULL, *B = NULL;
1570
- gsl_matrix *Atmp = NULL;
1571
- gsl_vector *eval = NULL;
1572
- gsl_eigen_gensymm_workspace *w = NULL;
1573
- int flag;
1574
- VALUE veval;
1575
- flag = check_argv_gensymm(argc, argv, obj, &A, &B, &eval, &w);
1528
+ gsl_matrix *A = NULL, *B = NULL;
1529
+ gsl_matrix *Atmp = NULL;
1530
+ gsl_vector *eval = NULL;
1531
+ gsl_eigen_gensymm_workspace *w = NULL;
1532
+ int flag;
1533
+ VALUE veval = Qnil;
1534
+ flag = check_argv_gensymm(argc, argv, obj, &A, &B, &eval, &w);
1576
1535
  Atmp = make_matrix_clone(A);
1577
- // Btmp = make_matrix_clone(B);
1578
- gsl_eigen_gensymm(Atmp, B, eval, w);
1536
+ // Btmp = make_matrix_clone(B);
1537
+ gsl_eigen_gensymm(Atmp, B, eval, w);
1579
1538
  gsl_matrix_free(Atmp);
1580
- // gsl_matrix_free(Btmp);
1581
- switch (flag) {
1582
- case 0:
1583
- veval = argv[2];
1584
- break;
1585
- case 1:
1586
- veval = Data_Wrap_Struct(cgsl_eigen_values, 0, gsl_vector_free, eval);
1587
- break;
1588
- case 2:
1589
- veval = argv[2];
1590
- gsl_eigen_gensymm_free(w);
1591
- break;
1592
- case 3:
1593
- veval = Data_Wrap_Struct(cgsl_eigen_values, 0, gsl_vector_free, eval);
1594
- gsl_eigen_gensymm_free(w);
1595
- break;
1596
- }
1597
-
1598
- return veval;
1539
+ // gsl_matrix_free(Btmp);
1540
+ switch (flag) {
1541
+ case 0:
1542
+ veval = argv[2];
1543
+ break;
1544
+ case 1:
1545
+ veval = Data_Wrap_Struct(cgsl_eigen_values, 0, gsl_vector_free, eval);
1546
+ break;
1547
+ case 2:
1548
+ veval = argv[2];
1549
+ gsl_eigen_gensymm_free(w);
1550
+ break;
1551
+ case 3:
1552
+ veval = Data_Wrap_Struct(cgsl_eigen_values, 0, gsl_vector_free, eval);
1553
+ gsl_eigen_gensymm_free(w);
1554
+ break;
1555
+ }
1556
+
1557
+ return veval;
1599
1558
  }
1600
1559
 
1601
1560
  static VALUE rb_gsl_eigen_gensymmv(int argc, VALUE *argv, VALUE obj)
1602
1561
  {
1603
- gsl_matrix *A = NULL, *B = NULL;
1604
- gsl_matrix *Atmp = NULL;
1605
- gsl_vector *eval = NULL;
1606
- gsl_matrix *evec = NULL;
1607
- gsl_eigen_gensymmv_workspace *w = NULL;
1608
- int flag;
1609
- VALUE veval, vevec;
1610
- flag = check_argv_gensymmv(argc, argv, obj, &A, &B, &eval, &evec, &w);
1562
+ gsl_matrix *A = NULL, *B = NULL;
1563
+ gsl_matrix *Atmp = NULL;
1564
+ gsl_vector *eval = NULL;
1565
+ gsl_matrix *evec = NULL;
1566
+ gsl_eigen_gensymmv_workspace *w = NULL;
1567
+ int flag;
1568
+ VALUE veval = Qnil, vevec = Qnil;
1569
+ flag = check_argv_gensymmv(argc, argv, obj, &A, &B, &eval, &evec, &w);
1611
1570
  Atmp = make_matrix_clone(A);
1612
- // Btmp = make_matrix_clone(B);
1613
- gsl_eigen_gensymmv(Atmp, B, eval, evec, w);
1571
+ // Btmp = make_matrix_clone(B);
1572
+ gsl_eigen_gensymmv(Atmp, B, eval, evec, w);
1614
1573
  gsl_matrix_free(Atmp);
1615
- // gsl_matrix_free(Btmp);
1616
-
1617
- switch (flag) {
1618
- case 0:
1619
- veval = argv[2];
1620
- vevec = argv[3];
1621
- break;
1622
- case 1:
1623
- veval = Data_Wrap_Struct(cgsl_eigen_values, 0, gsl_vector_free, eval);
1624
- vevec = Data_Wrap_Struct(cgsl_eigen_vectors, 0, gsl_matrix_free, evec);
1625
- break;
1626
- case 2:
1627
- veval = argv[2];
1628
- vevec = argv[3];
1629
- gsl_eigen_gensymmv_free(w);
1630
- break;
1631
- case 3:
1632
- veval = Data_Wrap_Struct(cgsl_eigen_values, 0, gsl_vector_free, eval);
1633
- vevec = Data_Wrap_Struct(cgsl_eigen_vectors, 0, gsl_matrix_free, evec);
1634
- gsl_eigen_gensymmv_free(w);
1635
- break;
1636
- }
1637
-
1638
- return rb_ary_new3(2, veval, vevec);
1574
+ // gsl_matrix_free(Btmp);
1575
+
1576
+ switch (flag) {
1577
+ case 0:
1578
+ veval = argv[2];
1579
+ vevec = argv[3];
1580
+ break;
1581
+ case 1:
1582
+ veval = Data_Wrap_Struct(cgsl_eigen_values, 0, gsl_vector_free, eval);
1583
+ vevec = Data_Wrap_Struct(cgsl_eigen_vectors, 0, gsl_matrix_free, evec);
1584
+ break;
1585
+ case 2:
1586
+ veval = argv[2];
1587
+ vevec = argv[3];
1588
+ gsl_eigen_gensymmv_free(w);
1589
+ break;
1590
+ case 3:
1591
+ veval = Data_Wrap_Struct(cgsl_eigen_values, 0, gsl_vector_free, eval);
1592
+ vevec = Data_Wrap_Struct(cgsl_eigen_vectors, 0, gsl_matrix_free, evec);
1593
+ gsl_eigen_gensymmv_free(w);
1594
+ break;
1595
+ }
1596
+
1597
+ return rb_ary_new3(2, veval, vevec);
1639
1598
  }
1640
1599
 
1641
1600
  static VALUE rb_gsl_eigen_genherm(int argc, VALUE *argv, VALUE obj)
1642
1601
  {
1643
- gsl_matrix_complex *A = NULL, *B = NULL;
1644
- gsl_matrix_complex *Atmp = NULL, *Btmp = NULL;
1645
- gsl_vector *eval = NULL;
1646
- gsl_eigen_genherm_workspace *w = NULL;
1647
- int flag;
1648
- VALUE veval;
1649
- flag = check_argv_genherm(argc, argv, obj, &A, &B, &eval, &w);
1602
+ gsl_matrix_complex *A = NULL, *B = NULL;
1603
+ gsl_matrix_complex *Atmp = NULL, *Btmp = NULL;
1604
+ gsl_vector *eval = NULL;
1605
+ gsl_eigen_genherm_workspace *w = NULL;
1606
+ int flag;
1607
+ VALUE veval = Qnil;
1608
+ flag = check_argv_genherm(argc, argv, obj, &A, &B, &eval, &w);
1650
1609
  Atmp = make_matrix_complex_clone(A);
1651
- Btmp = make_matrix_complex_clone(B);
1652
- gsl_eigen_genherm(Atmp, Btmp, eval, w);
1610
+ Btmp = make_matrix_complex_clone(B);
1611
+ gsl_eigen_genherm(Atmp, Btmp, eval, w);
1653
1612
  gsl_matrix_complex_free(Atmp);
1654
- gsl_matrix_complex_free(Btmp);
1655
- switch (flag) {
1656
- case 0:
1657
- veval = argv[2];
1658
- break;
1659
- case 1:
1660
- veval = Data_Wrap_Struct(cgsl_eigen_values, 0, gsl_vector_free, eval);
1661
- break;
1662
- case 2:
1663
- veval = argv[2];
1664
- gsl_eigen_genherm_free(w);
1665
- break;
1666
- case 3:
1667
- veval = Data_Wrap_Struct(cgsl_eigen_values, 0, gsl_vector_free, eval);
1668
- gsl_eigen_genherm_free(w);
1669
- break;
1670
- }
1671
-
1672
- return veval;
1613
+ gsl_matrix_complex_free(Btmp);
1614
+ switch (flag) {
1615
+ case 0:
1616
+ veval = argv[2];
1617
+ break;
1618
+ case 1:
1619
+ veval = Data_Wrap_Struct(cgsl_eigen_values, 0, gsl_vector_free, eval);
1620
+ break;
1621
+ case 2:
1622
+ veval = argv[2];
1623
+ gsl_eigen_genherm_free(w);
1624
+ break;
1625
+ case 3:
1626
+ veval = Data_Wrap_Struct(cgsl_eigen_values, 0, gsl_vector_free, eval);
1627
+ gsl_eigen_genherm_free(w);
1628
+ break;
1629
+ }
1630
+
1631
+ return veval;
1673
1632
  }
1674
1633
 
1675
1634
  static VALUE rb_gsl_eigen_genhermv(int argc, VALUE *argv, VALUE obj)
1676
1635
  {
1677
- gsl_matrix_complex *A = NULL, *B = NULL;
1678
- gsl_matrix_complex *Atmp = NULL, *Btmp = NULL;
1679
- gsl_vector *eval = NULL;
1680
- gsl_matrix_complex *evec = NULL;
1681
- gsl_eigen_genhermv_workspace *w = NULL;
1682
- int flag;
1683
- VALUE veval, vevec;
1684
- flag = check_argv_genhermv(argc, argv, obj, &A, &B, &eval, &evec, &w);
1636
+ gsl_matrix_complex *A = NULL, *B = NULL;
1637
+ gsl_matrix_complex *Atmp = NULL, *Btmp = NULL;
1638
+ gsl_vector *eval = NULL;
1639
+ gsl_matrix_complex *evec = NULL;
1640
+ gsl_eigen_genhermv_workspace *w = NULL;
1641
+ int flag;
1642
+ VALUE veval = Qnil, vevec = Qnil;
1643
+ flag = check_argv_genhermv(argc, argv, obj, &A, &B, &eval, &evec, &w);
1685
1644
  Atmp = make_matrix_complex_clone(A);
1686
- Btmp = make_matrix_complex_clone(B);
1687
- gsl_eigen_genhermv(Atmp, Btmp, eval, evec, w);
1645
+ Btmp = make_matrix_complex_clone(B);
1646
+ gsl_eigen_genhermv(Atmp, Btmp, eval, evec, w);
1688
1647
  gsl_matrix_complex_free(Atmp);
1689
- gsl_matrix_complex_free(Btmp);
1690
-
1691
- switch (flag) {