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
@@ -33,12 +33,9 @@ static VALUE cgsl_eigen_herm_vectors;
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,7 +580,7 @@ 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
 
@@ -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,7 +1025,62 @@ 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)
@@ -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,73 +1152,14 @@ 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
1165
  gsl_matrix *m, *Z = NULL;
@@ -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 = Qnil;
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 = Qnil, vevec = Qnil;
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 = Qnil;
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 = Qnil, vevec = Qnil;
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) {
1692
- case 0:
1693
- veval = argv[2];
1694
- vevec = argv[3];
1695
- break;
1696
- case 1:
1697
- veval = Data_Wrap_Struct(cgsl_eigen_values, 0, gsl_vector_free, eval);
1698
- vevec = Data_Wrap_Struct(cgsl_eigen_herm_vectors, 0, gsl_matrix_complex_free, evec);
1699
- break;
1700
- case 2:
1701
- veval = argv[2];
1702
- vevec = argv[3];
1703
- gsl_eigen_genhermv_free(w);
1704
- break;
1705
- case 3:
1706
- veval = Data_Wrap_Struct(cgsl_eigen_values, 0, gsl_vector_free, eval);
1707
- vevec = Data_Wrap_Struct(cgsl_eigen_herm_vectors, 0, gsl_matrix_complex_free, evec);
1708
- gsl_eigen_genhermv_free(w);
1709
- break;
1710
- }
1711
-
1712
- return rb_ary_new3(2, veval, vevec);
1648
+ gsl_matrix_complex_free(Btmp);
1649
+
1650
+ switch (flag) {
1651
+ case 0:
1652
+ veval = argv[2];
1653
+ vevec = argv[3];
1654
+ break;
1655
+ case 1:
1656
+ veval = Data_Wrap_Struct(cgsl_eigen_values, 0, gsl_vector_free, eval);
1657
+ vevec = Data_Wrap_Struct(cgsl_eigen_herm_vectors, 0, gsl_matrix_complex_free, evec);
1658
+ break;
1659
+ case 2:
1660
+ veval = argv[2];
1661
+ vevec = argv[3];
1662
+ gsl_eigen_genhermv_free(w);
1663
+ break;
1664
+ case 3:
1665
+ veval = Data_Wrap_Struct(cgsl_eigen_values, 0, gsl_vector_free, eval);
1666
+ vevec = Data_Wrap_Struct(cgsl_eigen_herm_vectors, 0, gsl_matrix_complex_free, evec);
1667
+ gsl_eigen_genhermv_free(w);
1668
+ break;
1669
+ }
1670
+
1671
+ return rb_ary_new3(2, veval, vevec);
1713
1672
  }
1714
1673
 
1715
1674
  static VALUE rb_gsl_eigen_gensymmv_sort(int argc, VALUE *argv, VALUE obj)
@@ -1718,7 +1677,7 @@ static VALUE rb_gsl_eigen_gensymmv_sort(int argc, VALUE *argv, VALUE obj)
1718
1677
  }
1719
1678
  static VALUE rb_gsl_eigen_genhermv_sort(int argc, VALUE *argv, VALUE obj)
1720
1679
  {
1721
- return rb_gsl_eigen_complex_sort(argc, argv, obj, gsl_eigen_genhermv_sort);
1680
+ return rb_gsl_eigen_complex_sort(argc, argv, obj, gsl_eigen_genhermv_sort);
1722
1681
  }
1723
1682
 
1724
1683
  static VALUE rb_gsl_eigen_gen_alloc(VALUE klass, VALUE n)
@@ -1744,9 +1703,9 @@ static VALUE rb_gsl_eigen_gen_params(int argc, VALUE *argv, VALUE obj)
1744
1703
  istart = 0;
1745
1704
  } else {
1746
1705
  if (argc != 4) rb_raise(rb_eArgError, "too few arguments (%d for 3)\n", argc);
1747
- if (CLASS_OF(argv[3]) != cgenw)
1706
+ if (CLASS_OF(argv[3]) != cgenw)
1748
1707
  rb_raise(rb_eTypeError, "Wrong argument type %s (GSL::Eigen::Gen::Workspace expected)",
1749
- rb_class2name(CLASS_OF(argv[3])));
1708
+ rb_class2name(CLASS_OF(argv[3])));
1750
1709
  Data_Get_Struct(argv[3], gsl_eigen_gen_workspace, w);
1751
1710
  istart = 1;
1752
1711
  }
@@ -1761,318 +1720,316 @@ static VALUE rb_gsl_eigen_gen_params(int argc, VALUE *argv, VALUE obj)
1761
1720
  }
1762
1721
 
1763
1722
  static int check_argv_gen(int argc, VALUE *argv, VALUE obj, gsl_matrix **A, gsl_matrix **B,
1764
- gsl_vector_complex **alpha, gsl_vector **beta, gsl_eigen_gen_workspace **w)
1723
+ gsl_vector_complex **alpha, gsl_vector **beta, gsl_eigen_gen_workspace **w)
1765
1724
  {
1766
- int argc2 = argc;
1767
- int flag = 0;
1768
- if (CLASS_OF(obj) == cgenw) {
1769
- Data_Get_Struct(obj, gsl_eigen_gen_workspace, *w);
1770
- } else {
1771
- if (rb_obj_is_kind_of(argv[argc-1], cgenw)) {
1772
- Data_Get_Struct(argv[argc-1], gsl_eigen_gen_workspace, *w);
1773
- argc2 = argc-1;
1774
- } else {
1775
-
1776
- /* workspace is not given */
1777
- }
1778
- }
1779
-
1780
- switch (argc2) {
1781
- case 2:
1782
- CHECK_MATRIX(argv[0]); CHECK_MATRIX(argv[1]);
1783
- Data_Get_Struct(argv[0], gsl_matrix, *A);
1784
- Data_Get_Struct(argv[1], gsl_matrix, *B);
1785
- break;
1786
- case 3:
1787
- if (rb_obj_is_kind_of(argv[2], cgenw)) {
1788
- Data_Get_Struct(argv[2], gsl_eigen_gen_workspace, *w);
1789
- } else {
1725
+ int argc2 = argc;
1726
+ int flag = 0;
1727
+ if (CLASS_OF(obj) == cgenw) {
1728
+ Data_Get_Struct(obj, gsl_eigen_gen_workspace, *w);
1729
+ } else {
1730
+ if (rb_obj_is_kind_of(argv[argc-1], cgenw)) {
1731
+ Data_Get_Struct(argv[argc-1], gsl_eigen_gen_workspace, *w);
1732
+ argc2 = argc-1;
1733
+ } else {
1734
+
1735
+ /* workspace is not given */
1736
+ }
1737
+ }
1738
+ switch (argc2) {
1739
+ case 2:
1740
+ CHECK_MATRIX(argv[0]); CHECK_MATRIX(argv[1]);
1741
+ Data_Get_Struct(argv[0], gsl_matrix, *A);
1742
+ Data_Get_Struct(argv[1], gsl_matrix, *B);
1743
+ break;
1744
+ case 3:
1745
+ if (rb_obj_is_kind_of(argv[2], cgenw)) {
1746
+ Data_Get_Struct(argv[2], gsl_eigen_gen_workspace, *w);
1747
+ } else {
1790
1748
  rb_raise(rb_eTypeError, "Wrong argument type %s (GSL::Eigen::Gen::Workspace expected)",
1791
- rb_class2name(CLASS_OF(argv[2])));
1792
- }
1793
- CHECK_MATRIX(argv[0]); CHECK_MATRIX(argv[1]);
1794
- Data_Get_Struct(argv[0], gsl_matrix, *A);
1795
- Data_Get_Struct(argv[1], gsl_matrix, *B);
1796
- break;
1797
- case 5:
1798
- if (rb_obj_is_kind_of(argv[4], cgenw)) {
1799
- Data_Get_Struct(argv[4], gsl_eigen_gen_workspace, *w);
1800
- } else {
1749
+ rb_class2name(CLASS_OF(argv[2])));
1750
+ }
1751
+ CHECK_MATRIX(argv[0]); CHECK_MATRIX(argv[1]);
1752
+ Data_Get_Struct(argv[0], gsl_matrix, *A);
1753
+ Data_Get_Struct(argv[1], gsl_matrix, *B);
1754
+ break;
1755
+ case 5:
1756
+ if (rb_obj_is_kind_of(argv[4], cgenw)) {
1757
+ Data_Get_Struct(argv[4], gsl_eigen_gen_workspace, *w);
1758
+ } else {
1801
1759
  rb_raise(rb_eTypeError, "Wrong argument type %s (GSL::Eigen::Gen::Workspace expected)",
1802
- rb_class2name(CLASS_OF(argv[4])));
1760
+ rb_class2name(CLASS_OF(argv[4])));
1803
1761
  }
1804
- CHECK_VECTOR_COMPLEX(argv[2]);
1805
- Data_Get_Struct(argv[2], gsl_vector_complex, *alpha);
1806
- CHECK_VECTOR(argv[3]);
1807
- Data_Get_Struct(argv[3], gsl_vector, *beta);
1808
-
1809
- CHECK_MATRIX(argv[0]); CHECK_MATRIX(argv[1]);
1810
- Data_Get_Struct(argv[0], gsl_matrix, *A);
1811
- Data_Get_Struct(argv[1], gsl_matrix, *B);
1812
- break;
1813
- default:
1814
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 2, 3 or 5)", argc);
1815
- }
1816
- if (*alpha == NULL && *beta == NULL) {
1817
- *alpha = gsl_vector_complex_alloc((*A)->size1);
1818
- *beta = gsl_vector_alloc((*A)->size1);
1819
- flag += 1;
1820
- }
1821
- if (*w == NULL) {
1822
- *w = gsl_eigen_gen_alloc((*A)->size1);
1823
- flag += 2;
1824
- }
1825
- return flag;
1762
+ CHECK_VECTOR_COMPLEX(argv[2]);
1763
+ Data_Get_Struct(argv[2], gsl_vector_complex, *alpha);
1764
+ CHECK_VECTOR(argv[3]);
1765
+ Data_Get_Struct(argv[3], gsl_vector, *beta);
1766
+
1767
+ CHECK_MATRIX(argv[0]); CHECK_MATRIX(argv[1]);
1768
+ Data_Get_Struct(argv[0], gsl_matrix, *A);
1769
+ Data_Get_Struct(argv[1], gsl_matrix, *B);
1770
+ break;
1771
+ default:
1772
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 2, 3 or 5)", argc);
1773
+ }
1774
+ if (*alpha == NULL && *beta == NULL) {
1775
+ *alpha = gsl_vector_complex_alloc((*A)->size1);
1776
+ *beta = gsl_vector_alloc((*A)->size1);
1777
+ flag += 1;
1778
+ }
1779
+ if (*w == NULL) {
1780
+ *w = gsl_eigen_gen_alloc((*A)->size1);
1781
+ flag += 2;
1782
+ }
1783
+ return flag;
1826
1784
  }
1827
1785
 
1828
1786
  static VALUE rb_gsl_eigen_gen(int argc, VALUE *argv, VALUE obj)
1829
1787
  {
1830
- gsl_matrix *A = NULL, *B = NULL;
1831
- // gsl_matrix *Atmp = NULL, *Btmp = NULL;
1832
- gsl_vector_complex *alpha = NULL;
1833
- gsl_vector *beta = NULL;
1834
- gsl_eigen_gen_workspace *w = NULL;
1835
- int flag;
1836
- VALUE valpha = Qnil, vbeta = Qnil;
1837
- flag = check_argv_gen(argc, argv, obj, &A, &B, &alpha, &beta, &w);
1788
+ gsl_matrix *A = NULL, *B = NULL;
1789
+ // gsl_matrix *Atmp = NULL, *Btmp = NULL;
1790
+ gsl_vector_complex *alpha = NULL;
1791
+ gsl_vector *beta = NULL;
1792
+ gsl_eigen_gen_workspace *w = NULL;
1793
+ int flag;
1794
+ VALUE valpha = Qnil, vbeta = Qnil;
1795
+ flag = check_argv_gen(argc, argv, obj, &A, &B, &alpha, &beta, &w);
1838
1796
  // Atmp = make_matrix_clone(A);
1839
- // Btmp = make_matrix_clone(B);
1840
- gsl_eigen_gen(A, B, alpha, beta, w);
1797
+ // Btmp = make_matrix_clone(B);
1798
+ gsl_eigen_gen(A, B, alpha, beta, w);
1841
1799
  // gsl_matrix_free(Atmp);
1842
- // gsl_matrix_free(Btmp);
1843
-
1844
- switch (flag) {
1845
- case 0:
1846
- valpha = argv[2];
1847
- vbeta = argv[3];
1848
- break;
1849
- case 1:
1850
- valpha = Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, alpha);
1851
- vbeta = Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, beta);
1852
- break;
1853
- case 2:
1854
- valpha = argv[2];
1855
- vbeta = argv[3];
1856
- gsl_eigen_gen_free(w);
1857
- break;
1858
- case 3:
1859
- valpha = Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, alpha);
1860
- vbeta = Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, beta);
1861
- gsl_eigen_gen_free(w);
1862
- break;
1863
- }
1864
-
1865
- return rb_ary_new3(2, valpha, vbeta);
1800
+ // gsl_matrix_free(Btmp);
1801
+
1802
+ switch (flag) {
1803
+ case 0:
1804
+ valpha = argv[2];
1805
+ vbeta = argv[3];
1806
+ break;
1807
+ case 1:
1808
+ valpha = Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, alpha);
1809
+ vbeta = Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, beta);
1810
+ break;
1811
+ case 2:
1812
+ valpha = argv[2];
1813
+ vbeta = argv[3];
1814
+ gsl_eigen_gen_free(w);
1815
+ break;
1816
+ case 3:
1817
+ valpha = Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, alpha);
1818
+ vbeta = Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, beta);
1819
+ gsl_eigen_gen_free(w);
1820
+ break;
1821
+ }
1822
+
1823
+ return rb_ary_new3(2, valpha, vbeta);
1866
1824
  }
1867
1825
 
1868
1826
  static VALUE rb_gsl_eigen_gen_QZ(int argc, VALUE *argv, VALUE obj)
1869
1827
  {
1870
- gsl_matrix *A = NULL, *B = NULL;
1871
- // gsl_matrix *Atmp = NULL, *Btmp = NULL;
1872
- gsl_vector_complex *alpha = NULL;
1873
- gsl_vector *beta = NULL;
1874
- gsl_matrix *Q, *Z;
1875
- gsl_eigen_gen_workspace *w = NULL;
1876
- int flag;
1877
- VALUE valpha = Qnil, vbeta = Qnil, vQ, vZ;
1878
- flag = check_argv_gen(argc, argv, obj, &A, &B, &alpha, &beta, &w);
1828
+ gsl_matrix *A = NULL, *B = NULL;
1829
+ // gsl_matrix *Atmp = NULL, *Btmp = NULL;
1830
+ gsl_vector_complex *alpha = NULL;
1831
+ gsl_vector *beta = NULL;
1832
+ gsl_matrix *Q, *Z;
1833
+ gsl_eigen_gen_workspace *w = NULL;
1834
+ int flag;
1835
+ VALUE valpha = Qnil, vbeta = Qnil, vQ, vZ;
1836
+ flag = check_argv_gen(argc, argv, obj, &A, &B, &alpha, &beta, &w);
1879
1837
  /* Atmp = make_matrix_clone(A);
1880
- Btmp = make_matrix_clone(B); */
1838
+ Btmp = make_matrix_clone(B); */
1881
1839
  Q = gsl_matrix_alloc(A->size1, A->size2);
1882
- Z = gsl_matrix_alloc(A->size1, A->size2);
1883
- // gsl_eigen_gen_QZ(Atmp, Btmp, alpha, beta, Q, Z, w);
1884
- gsl_eigen_gen_QZ(A, B, alpha, beta, Q, Z, w);
1840
+ Z = gsl_matrix_alloc(A->size1, A->size2);
1841
+ // gsl_eigen_gen_QZ(Atmp, Btmp, alpha, beta, Q, Z, w);
1842
+ gsl_eigen_gen_QZ(A, B, alpha, beta, Q, Z, w);
1885
1843
  /* gsl_matrix_free(Atmp);
1886
1844
  gsl_matrix_free(Btmp); */
1887
-
1888
- switch (flag) {
1889
- case 0:
1890
- valpha = argv[2];
1891
- vbeta = argv[3];
1892
- break;
1893
- case 1:
1894
- valpha = Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, alpha);
1895
- vbeta = Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, beta);
1896
- break;
1897
- case 2:
1898
- valpha = argv[2];
1899
- vbeta = argv[3];
1900
- gsl_eigen_gen_free(w);
1901
- break;
1902
- case 3:
1903
- valpha = Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, alpha);
1904
- vbeta = Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, beta);
1905
- gsl_eigen_gen_free(w);
1906
- break;
1907
- }
1845
+
1846
+ switch (flag) {
1847
+ case 0:
1848
+ valpha = argv[2];
1849
+ vbeta = argv[3];
1850
+ break;
1851
+ case 1:
1852
+ valpha = Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, alpha);
1853
+ vbeta = Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, beta);
1854
+ break;
1855
+ case 2:
1856
+ valpha = argv[2];
1857
+ vbeta = argv[3];
1858
+ gsl_eigen_gen_free(w);
1859
+ break;
1860
+ case 3:
1861
+ valpha = Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, alpha);
1862
+ vbeta = Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, beta);
1863
+ gsl_eigen_gen_free(w);
1864
+ break;
1865
+ }
1908
1866
  vQ = Data_Wrap_Struct(cgsl_matrix, 0, gsl_matrix_free, Q);
1909
- vZ = Data_Wrap_Struct(cgsl_matrix, 0, gsl_matrix_free, Z);
1910
- return rb_ary_new3(4, valpha, vbeta, vQ, vZ);
1867
+ vZ = Data_Wrap_Struct(cgsl_matrix, 0, gsl_matrix_free, Z);
1868
+ return rb_ary_new3(4, valpha, vbeta, vQ, vZ);
1911
1869
  }
1912
1870
 
1913
1871
  static int check_argv_genv(int argc, VALUE *argv, VALUE obj, gsl_matrix **A, gsl_matrix **B,
1914
- gsl_vector_complex **alpha, gsl_vector **beta, gsl_matrix_complex **evec, gsl_eigen_genv_workspace **w)
1872
+ gsl_vector_complex **alpha, gsl_vector **beta, gsl_matrix_complex **evec, gsl_eigen_genv_workspace **w)
1915
1873
  {
1916
- int argc2 = argc;
1917
- int flag = 0;
1918
- if (CLASS_OF(obj) == cgenvw) {
1919
- Data_Get_Struct(obj, gsl_eigen_genv_workspace, *w);
1920
- } else {
1921
- if (rb_obj_is_kind_of(argv[argc-1], cgenvw)) {
1922
- Data_Get_Struct(argv[argc-1], gsl_eigen_genv_workspace, *w);
1923
- argc2 = argc-1;
1924
- } else {
1925
-
1926
- /* workspace is not given */
1927
- }
1928
- }
1929
-
1930
- switch (argc2) {
1931
- case 2:
1932
- CHECK_MATRIX(argv[0]); CHECK_MATRIX(argv[1]);
1933
- Data_Get_Struct(argv[0], gsl_matrix, *A);
1934
- Data_Get_Struct(argv[1], gsl_matrix, *B);
1935
- break;
1936
- case 3:
1937
- if (rb_obj_is_kind_of(argv[2], cgenvw)) {
1938
- Data_Get_Struct(argv[2], gsl_eigen_genv_workspace, *w);
1939
- } else {
1874
+ int argc2 = argc;
1875
+ int flag = 0;
1876
+ if (CLASS_OF(obj) == cgenvw) {
1877
+ Data_Get_Struct(obj, gsl_eigen_genv_workspace, *w);
1878
+ } else {
1879
+ if (rb_obj_is_kind_of(argv[argc-1], cgenvw)) {
1880
+ Data_Get_Struct(argv[argc-1], gsl_eigen_genv_workspace, *w);
1881
+ argc2 = argc-1;
1882
+ } else {
1883
+
1884
+ /* workspace is not given */
1885
+ }
1886
+ }
1887
+ switch (argc2) {
1888
+ case 2:
1889
+ CHECK_MATRIX(argv[0]); CHECK_MATRIX(argv[1]);
1890
+ Data_Get_Struct(argv[0], gsl_matrix, *A);
1891
+ Data_Get_Struct(argv[1], gsl_matrix, *B);
1892
+ break;
1893
+ case 3:
1894
+ if (rb_obj_is_kind_of(argv[2], cgenvw)) {
1895
+ Data_Get_Struct(argv[2], gsl_eigen_genv_workspace, *w);
1896
+ } else {
1940
1897
  rb_raise(rb_eTypeError, "Wrong argument type %s (GSL::Eigenv::Gen::Workspace expected)",
1941
- rb_class2name(CLASS_OF(argv[2])));
1942
- }
1943
- CHECK_MATRIX(argv[0]); CHECK_MATRIX(argv[1]);
1944
- Data_Get_Struct(argv[0], gsl_matrix, *A);
1945
- Data_Get_Struct(argv[1], gsl_matrix, *B);
1946
- break;
1947
- case 6:
1948
- if (rb_obj_is_kind_of(argv[4], cgenvw)) {
1949
- Data_Get_Struct(argv[4], gsl_eigen_genv_workspace, *w);
1950
- } else {
1898
+ rb_class2name(CLASS_OF(argv[2])));
1899
+ }
1900
+ CHECK_MATRIX(argv[0]); CHECK_MATRIX(argv[1]);
1901
+ Data_Get_Struct(argv[0], gsl_matrix, *A);
1902
+ Data_Get_Struct(argv[1], gsl_matrix, *B);
1903
+ break;
1904
+ case 6:
1905
+ if (rb_obj_is_kind_of(argv[4], cgenvw)) {
1906
+ Data_Get_Struct(argv[4], gsl_eigen_genv_workspace, *w);
1907
+ } else {
1951
1908
  rb_raise(rb_eTypeError, "Wrong argument type %s (GSL::Eigenv::Gen::Workspace expected)",
1952
- rb_class2name(CLASS_OF(argv[4])));
1909
+ rb_class2name(CLASS_OF(argv[4])));
1953
1910
  }
1954
- CHECK_VECTOR_COMPLEX(argv[2]);
1955
- Data_Get_Struct(argv[2], gsl_vector_complex, *alpha);
1956
- CHECK_VECTOR(argv[3]);
1957
- Data_Get_Struct(argv[3], gsl_vector, *beta);
1958
- CHECK_MATRIX_COMPLEX(argv[3]);
1959
- Data_Get_Struct(argv[4], gsl_matrix_complex, *evec);
1960
-
1961
- CHECK_MATRIX(argv[0]); CHECK_MATRIX(argv[1]);
1962
- Data_Get_Struct(argv[0], gsl_matrix, *A);
1963
- Data_Get_Struct(argv[1], gsl_matrix, *B);
1964
- break;
1965
- default:
1966
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 2, 3 or 6)", argc);
1967
- }
1968
- if (*alpha == NULL && *beta == NULL) {
1969
- *alpha = gsl_vector_complex_alloc((*A)->size1);
1970
- *beta = gsl_vector_alloc((*A)->size1);
1971
- *evec = gsl_matrix_complex_alloc((*A)->size1, (*A)->size2);
1972
- flag += 1;
1973
- }
1974
- if (*w == NULL) {
1975
- *w = gsl_eigen_genv_alloc((*A)->size1);
1976
- flag += 2;
1977
- }
1978
- return flag;
1911
+ CHECK_VECTOR_COMPLEX(argv[2]);
1912
+ Data_Get_Struct(argv[2], gsl_vector_complex, *alpha);
1913
+ CHECK_VECTOR(argv[3]);
1914
+ Data_Get_Struct(argv[3], gsl_vector, *beta);
1915
+ CHECK_MATRIX_COMPLEX(argv[3]);
1916
+ Data_Get_Struct(argv[4], gsl_matrix_complex, *evec);
1917
+
1918
+ CHECK_MATRIX(argv[0]); CHECK_MATRIX(argv[1]);
1919
+ Data_Get_Struct(argv[0], gsl_matrix, *A);
1920
+ Data_Get_Struct(argv[1], gsl_matrix, *B);
1921
+ break;
1922
+ default:
1923
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 2, 3 or 6)", argc);
1924
+ }
1925
+ if (*alpha == NULL && *beta == NULL) {
1926
+ *alpha = gsl_vector_complex_alloc((*A)->size1);
1927
+ *beta = gsl_vector_alloc((*A)->size1);
1928
+ *evec = gsl_matrix_complex_alloc((*A)->size1, (*A)->size2);
1929
+ flag += 1;
1930
+ }
1931
+ if (*w == NULL) {
1932
+ *w = gsl_eigen_genv_alloc((*A)->size1);
1933
+ flag += 2;
1934
+ }
1935
+ return flag;
1979
1936
  }
1980
1937
 
1981
1938
  static VALUE rb_gsl_eigen_genv(int argc, VALUE *argv, VALUE obj)
1982
1939
  {
1983
- gsl_matrix *A = NULL, *B = NULL;
1984
- // gsl_matrix *Atmp = NULL, *Btmp = NULL;
1985
- gsl_vector_complex *alpha = NULL;
1986
- gsl_vector *beta = NULL;
1987
- gsl_matrix_complex *evec = NULL;
1988
- gsl_eigen_genv_workspace *w = NULL;
1989
- int flag;
1990
- VALUE valpha = Qnil, vbeta = Qnil, vevec = Qnil;
1991
- flag = check_argv_genv(argc, argv, obj, &A, &B, &alpha, &beta, &evec, &w);
1940
+ gsl_matrix *A = NULL, *B = NULL;
1941
+ // gsl_matrix *Atmp = NULL, *Btmp = NULL;
1942
+ gsl_vector_complex *alpha = NULL;
1943
+ gsl_vector *beta = NULL;
1944
+ gsl_matrix_complex *evec = NULL;
1945
+ gsl_eigen_genv_workspace *w = NULL;
1946
+ int flag;
1947
+ VALUE valpha = Qnil, vbeta = Qnil, vevec = Qnil;
1948
+ flag = check_argv_genv(argc, argv, obj, &A, &B, &alpha, &beta, &evec, &w);
1992
1949
  // Atmp = make_matrix_clone(A);
1993
- // Btmp = make_matrix_clone(B);
1994
- // gsl_eigen_genv(Atmp, Btmp, alpha, beta, evec, w);
1995
- gsl_eigen_genv(A, B, alpha, beta, evec, w);
1950
+ // Btmp = make_matrix_clone(B);
1951
+ // gsl_eigen_genv(Atmp, Btmp, alpha, beta, evec, w);
1952
+ gsl_eigen_genv(A, B, alpha, beta, evec, w);
1996
1953
  // gsl_matrix_free(Atmp);
1997
- // gsl_matrix_free(Btmp);
1998
-
1999
- switch (flag) {
2000
- case 0:
2001
- valpha = argv[2];
2002
- vbeta = argv[3];
2003
- vevec = argv[4];
2004
- break;
2005
- case 1:
2006
- valpha = Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, alpha);
2007
- vbeta = Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, beta);
2008
- vevec = Data_Wrap_Struct(cgsl_eigen_herm_vectors, 0, gsl_matrix_complex_free, evec);
2009
- break;
2010
- case 2:
2011
- valpha = argv[2];
2012
- vbeta = argv[3];
2013
- vevec = argv[4];
2014
- gsl_eigen_genv_free(w);
2015
- break;
2016
- case 3:
2017
- valpha = Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, alpha);
2018
- vbeta = Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, beta);
2019
- vevec = Data_Wrap_Struct(cgsl_eigen_herm_vectors, 0, gsl_matrix_complex_free, evec);
2020
- gsl_eigen_genv_free(w);
2021
- break;
2022
- }
2023
-
2024
- return rb_ary_new3(3, valpha, vbeta, vevec);
1954
+ // gsl_matrix_free(Btmp);
1955
+
1956
+ switch (flag) {
1957
+ case 0:
1958
+ valpha = argv[2];
1959
+ vbeta = argv[3];
1960
+ vevec = argv[4];
1961
+ break;
1962
+ case 1:
1963
+ valpha = Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, alpha);
1964
+ vbeta = Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, beta);
1965
+ vevec = Data_Wrap_Struct(cgsl_eigen_herm_vectors, 0, gsl_matrix_complex_free, evec);
1966
+ break;
1967
+ case 2:
1968
+ valpha = argv[2];
1969
+ vbeta = argv[3];
1970
+ vevec = argv[4];
1971
+ gsl_eigen_genv_free(w);
1972
+ break;
1973
+ case 3:
1974
+ valpha = Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, alpha);
1975
+ vbeta = Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, beta);
1976
+ vevec = Data_Wrap_Struct(cgsl_eigen_herm_vectors, 0, gsl_matrix_complex_free, evec);
1977
+ gsl_eigen_genv_free(w);
1978
+ break;
1979
+ }
1980
+
1981
+ return rb_ary_new3(3, valpha, vbeta, vevec);
2025
1982
  }
2026
1983
 
2027
1984
 
2028
1985
  static VALUE rb_gsl_eigen_genv_QZ(int argc, VALUE *argv, VALUE obj)
2029
1986
  {
2030
- gsl_matrix *A = NULL, *B = NULL;
2031
- // gsl_matrix *Atmp = NULL, *Btmp = NULL;
2032
- gsl_vector_complex *alpha = NULL;
2033
- gsl_vector *beta = NULL;
2034
- gsl_matrix_complex *evec = NULL;
2035
- gsl_matrix *Q, *Z;
2036
- gsl_eigen_genv_workspace *w = NULL;
2037
- int flag;
2038
- VALUE valpha = Qnil, vbeta = Qnil, vevec = Qnil, vQ, vZ;
2039
- flag = check_argv_genv(argc, argv, obj, &A, &B, &alpha, &beta, &evec, &w);
1987
+ gsl_matrix *A = NULL, *B = NULL;
1988
+ // gsl_matrix *Atmp = NULL, *Btmp = NULL;
1989
+ gsl_vector_complex *alpha = NULL;
1990
+ gsl_vector *beta = NULL;
1991
+ gsl_matrix_complex *evec = NULL;
1992
+ gsl_matrix *Q, *Z;
1993
+ gsl_eigen_genv_workspace *w = NULL;
1994
+ int flag;
1995
+ VALUE valpha = Qnil, vbeta = Qnil, vevec = Qnil, vQ, vZ;
1996
+ flag = check_argv_genv(argc, argv, obj, &A, &B, &alpha, &beta, &evec, &w);
2040
1997
  /* Atmp = make_matrix_clone(A);
2041
- Btmp = make_matrix_clone(B); */
1998
+ Btmp = make_matrix_clone(B); */
2042
1999
  Q = gsl_matrix_alloc(A->size1, A->size2);
2043
- Z = gsl_matrix_alloc(A->size1, A->size2);
2044
- // gsl_eigen_genv_QZ(Atmp, Btmp, alpha, beta, evec, Q, Z, w);
2045
- gsl_eigen_genv_QZ(A, B, alpha, beta, evec, Q, Z, w);
2000
+ Z = gsl_matrix_alloc(A->size1, A->size2);
2001
+ // gsl_eigen_genv_QZ(Atmp, Btmp, alpha, beta, evec, Q, Z, w);
2002
+ gsl_eigen_genv_QZ(A, B, alpha, beta, evec, Q, Z, w);
2046
2003
  /* gsl_matrix_free(Atmp);
2047
2004
  gsl_matrix_free(Btmp); */
2048
-
2049
- switch (flag) {
2050
- case 0:
2051
- valpha = argv[2];
2052
- vbeta = argv[3];
2053
- vevec = argv[4];
2054
- break;
2055
- case 1:
2056
- valpha = Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, alpha);
2057
- vbeta = Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, beta);
2058
- vevec = Data_Wrap_Struct(cgsl_eigen_herm_vectors, 0, gsl_matrix_complex_free, evec);
2059
- break;
2060
- case 2:
2061
- valpha = argv[2];
2062
- vbeta = argv[3];
2063
- vevec = argv[4];
2064
- gsl_eigen_genv_free(w);
2065
- break;
2066
- case 3:
2067
- valpha = Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, alpha);
2068
- vbeta = Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, beta);
2069
- vevec = Data_Wrap_Struct(cgsl_eigen_herm_vectors, 0, gsl_matrix_complex_free, evec);
2070
- gsl_eigen_genv_free(w);
2071
- break;
2072
- }
2005
+
2006
+ switch (flag) {
2007
+ case 0:
2008
+ valpha = argv[2];
2009
+ vbeta = argv[3];
2010
+ vevec = argv[4];
2011
+ break;
2012
+ case 1:
2013
+ valpha = Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, alpha);
2014
+ vbeta = Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, beta);
2015
+ vevec = Data_Wrap_Struct(cgsl_eigen_herm_vectors, 0, gsl_matrix_complex_free, evec);
2016
+ break;
2017
+ case 2:
2018
+ valpha = argv[2];
2019
+ vbeta = argv[3];
2020
+ vevec = argv[4];
2021
+ gsl_eigen_genv_free(w);
2022
+ break;
2023
+ case 3:
2024
+ valpha = Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, alpha);
2025
+ vbeta = Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, beta);
2026
+ vevec = Data_Wrap_Struct(cgsl_eigen_herm_vectors, 0, gsl_matrix_complex_free, evec);
2027
+ gsl_eigen_genv_free(w);
2028
+ break;
2029
+ }
2073
2030
  vQ = Data_Wrap_Struct(cgsl_matrix, 0, gsl_matrix_free, Q);
2074
- vZ = Data_Wrap_Struct(cgsl_matrix, 0, gsl_matrix_free, Z);
2075
- return rb_ary_new3(5, valpha, vbeta, vevec, vQ, vZ);
2031
+ vZ = Data_Wrap_Struct(cgsl_matrix, 0, gsl_matrix_free, Z);
2032
+ return rb_ary_new3(5, valpha, vbeta, vevec, vQ, vZ);
2076
2033
  }
2077
2034
 
2078
2035
  static VALUE rb_gsl_eigen_genv_sort(int argc, VALUE *argv, VALUE obj)
@@ -2086,7 +2043,7 @@ static VALUE rb_gsl_eigen_genv_sort(int argc, VALUE *argv, VALUE obj)
2086
2043
  case 4:
2087
2044
  CHECK_FIXNUM(argv[3]);
2088
2045
  type = FIX2INT(argv[3]);
2089
- /* no break, do next */
2046
+ /* no break, do next */
2090
2047
  case 3:
2091
2048
  if (argv[0] == Qnil) {
2092
2049
  alpha = NULL;
@@ -2098,21 +2055,20 @@ static VALUE rb_gsl_eigen_genv_sort(int argc, VALUE *argv, VALUE obj)
2098
2055
  beta = NULL;
2099
2056
  } else {
2100
2057
  CHECK_VECTOR(argv[1]);
2101
- Data_Get_Struct(argv[1], gsl_vector, beta);
2058
+ Data_Get_Struct(argv[1], gsl_vector, beta);
2102
2059
  }
2103
- if (argv[2] == Qnil) {
2060
+ if (argv[2] == Qnil) {
2104
2061
  evec = NULL;
2105
2062
  } else {
2106
2063
  CHECK_MATRIX_COMPLEX(argv[2]);
2107
- Data_Get_Struct(argv[2], gsl_matrix_complex, evec);
2108
- }
2064
+ Data_Get_Struct(argv[2], gsl_matrix_complex, evec);
2065
+ }
2109
2066
  break;
2110
2067
  default:
2111
2068
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 3 or 4)", argc);
2112
2069
  }
2113
2070
  return INT2FIX(gsl_eigen_genv_sort(alpha, beta, evec, type));
2114
2071
  }
2115
- #endif
2116
2072
 
2117
2073
  void Init_gsl_eigen(VALUE module)
2118
2074
  {
@@ -2124,10 +2080,8 @@ void Init_gsl_eigen(VALUE module)
2124
2080
  #ifdef HAVE_GSL_EIGEN_FRANCIS
2125
2081
  VALUE mgsl_eigen_francis;
2126
2082
  #endif
2127
- #ifdef GSL_1_9_LATER
2128
2083
  VALUE mgsl_eigen_nonsymmv;
2129
2084
  VALUE mgsl_eigen_nonsymm;
2130
- #endif
2131
2085
 
2132
2086
  mgsl_eigen = rb_define_module_under(module, "Eigen");
2133
2087
  mgsl_eigen_symm = rb_define_module_under(mgsl_eigen, "Symm");
@@ -2137,60 +2091,60 @@ void Init_gsl_eigen(VALUE module)
2137
2091
  mgsl_eigen_hermv = rb_define_module_under(mgsl_eigen, "Hermv");
2138
2092
 
2139
2093
  cgsl_eigen_values = rb_define_class_under(mgsl_eigen, "EigenValues",
2140
- cgsl_vector);
2094
+ cgsl_vector);
2141
2095
  cgsl_eigen_vectors = rb_define_class_under(mgsl_eigen, "EigenVectors",
2142
- cgsl_matrix);
2096
+ cgsl_matrix);
2143
2097
  cgsl_eigen_vector = rb_define_class_under(mgsl_eigen, "EigenVector",
2144
- cgsl_vector);
2098
+ cgsl_vector);
2145
2099
  cgsl_eigen_herm_vectors = rb_define_class_under(mgsl_eigen, "ComplexEigenVectors",
2146
- cgsl_matrix_complex);
2100
+ cgsl_matrix_complex);
2147
2101
  cgsl_eigen_vector_complex = rb_define_class_under(mgsl_eigen, "ComplexEigenVector",
2148
- cgsl_vector_complex);
2149
- cgsl_eigen_symm_workspace = rb_define_class_under(mgsl_eigen_symm,
2150
- "Workspace", cGSL_Object);
2151
- cgsl_eigen_symmv_workspace = rb_define_class_under(mgsl_eigen_symmv,
2152
- "Workspace", cGSL_Object);
2153
- cgsl_eigen_herm_workspace = rb_define_class_under(mgsl_eigen_herm,
2154
- "Workspace", cGSL_Object);
2155
-
2156
- cgsl_eigen_hermv_workspace = rb_define_class_under(mgsl_eigen_hermv,
2157
- "Workspace", cGSL_Object);
2158
-
2159
- rb_define_singleton_method(cgsl_eigen_symm_workspace, "alloc",
2160
- rb_gsl_eigen_symm_alloc, 1);
2161
- rb_define_singleton_method(cgsl_eigen_symmv_workspace, "alloc",
2162
- rb_gsl_eigen_symmv_alloc, 1);
2163
- rb_define_singleton_method(cgsl_eigen_herm_workspace, "alloc",
2164
- rb_gsl_eigen_herm_alloc, 1);
2165
- rb_define_singleton_method(cgsl_eigen_hermv_workspace, "alloc",
2166
- rb_gsl_eigen_hermv_alloc, 1);
2167
-
2168
- rb_define_singleton_method(mgsl_eigen_symm, "alloc",
2169
- rb_gsl_eigen_symm_alloc, 1);
2170
- rb_define_singleton_method(mgsl_eigen_symmv, "alloc",
2171
- rb_gsl_eigen_symmv_alloc, 1);
2172
- rb_define_singleton_method(mgsl_eigen_herm, "alloc",
2173
- rb_gsl_eigen_herm_alloc, 1);
2174
- rb_define_singleton_method(mgsl_eigen_hermv, "alloc",
2175
- rb_gsl_eigen_hermv_alloc, 1);
2176
-
2102
+ cgsl_vector_complex);
2103
+ cgsl_eigen_symm_workspace = rb_define_class_under(mgsl_eigen_symm,
2104
+ "Workspace", cGSL_Object);
2105
+ cgsl_eigen_symmv_workspace = rb_define_class_under(mgsl_eigen_symmv,
2106
+ "Workspace", cGSL_Object);
2107
+ cgsl_eigen_herm_workspace = rb_define_class_under(mgsl_eigen_herm,
2108
+ "Workspace", cGSL_Object);
2109
+
2110
+ cgsl_eigen_hermv_workspace = rb_define_class_under(mgsl_eigen_hermv,
2111
+ "Workspace", cGSL_Object);
2112
+
2113
+ rb_define_singleton_method(cgsl_eigen_symm_workspace, "alloc",
2114
+ rb_gsl_eigen_symm_alloc, 1);
2115
+ rb_define_singleton_method(cgsl_eigen_symmv_workspace, "alloc",
2116
+ rb_gsl_eigen_symmv_alloc, 1);
2117
+ rb_define_singleton_method(cgsl_eigen_herm_workspace, "alloc",
2118
+ rb_gsl_eigen_herm_alloc, 1);
2119
+ rb_define_singleton_method(cgsl_eigen_hermv_workspace, "alloc",
2120
+ rb_gsl_eigen_hermv_alloc, 1);
2121
+
2122
+ rb_define_singleton_method(mgsl_eigen_symm, "alloc",
2123
+ rb_gsl_eigen_symm_alloc, 1);
2124
+ rb_define_singleton_method(mgsl_eigen_symmv, "alloc",
2125
+ rb_gsl_eigen_symmv_alloc, 1);
2126
+ rb_define_singleton_method(mgsl_eigen_herm, "alloc",
2127
+ rb_gsl_eigen_herm_alloc, 1);
2128
+ rb_define_singleton_method(mgsl_eigen_hermv, "alloc",
2129
+ rb_gsl_eigen_hermv_alloc, 1);
2130
+
2177
2131
  rb_define_module_function(mgsl_eigen, "symm",
2178
- rb_gsl_eigen_symm, -1);
2132
+ rb_gsl_eigen_symm, -1);
2179
2133
  rb_define_module_function(mgsl_eigen, "symmv",
2180
- rb_gsl_eigen_symmv, -1);
2134
+ rb_gsl_eigen_symmv, -1);
2181
2135
  rb_define_module_function(mgsl_eigen, "herm",
2182
- rb_gsl_eigen_herm, -1);
2136
+ rb_gsl_eigen_herm, -1);
2183
2137
  rb_define_module_function(mgsl_eigen, "hermv",
2184
- rb_gsl_eigen_hermv, -1);
2138
+ rb_gsl_eigen_hermv, -1);
2185
2139
 
2186
2140
  rb_define_module_function(module, "eigen_symm",
2187
- rb_gsl_eigen_symm, -1);
2141
+ rb_gsl_eigen_symm, -1);
2188
2142
  rb_define_module_function(module, "eigen_symmv",
2189
- rb_gsl_eigen_symmv, -1);
2143
+ rb_gsl_eigen_symmv, -1);
2190
2144
  rb_define_module_function(module, "eigen_herm",
2191
- rb_gsl_eigen_herm, -1);
2145
+ rb_gsl_eigen_herm, -1);
2192
2146
  rb_define_module_function(module, "eigen_hermv",
2193
- rb_gsl_eigen_hermv, -1);
2147
+ rb_gsl_eigen_hermv, -1);
2194
2148
 
2195
2149
  rb_define_method(cgsl_matrix, "eigen_symm", rb_gsl_eigen_symm, -1);
2196
2150
  rb_define_method(cgsl_matrix, "eigen_symmv", rb_gsl_eigen_symmv, -1);
@@ -2202,21 +2156,21 @@ void Init_gsl_eigen(VALUE module)
2202
2156
 
2203
2157
  rb_gsl_eigen_define_const(module, mgsl_eigen);
2204
2158
 
2205
- rb_define_module_function(mgsl_eigen, "symmv_sort",
2206
- rb_gsl_eigen_symmv_sort, -1);
2207
- rb_define_module_function(mgsl_eigen, "hermv_sort",
2208
- rb_gsl_eigen_hermv_sort, -1);
2209
- rb_define_module_function(mgsl_eigen_symmv, "sort",
2210
- rb_gsl_eigen_symmv_sort, -1);
2211
- rb_define_module_function(mgsl_eigen_hermv, "sort",
2212
- rb_gsl_eigen_hermv_sort, -1);
2159
+ rb_define_module_function(mgsl_eigen, "symmv_sort",
2160
+ rb_gsl_eigen_symmv_sort, -1);
2161
+ rb_define_module_function(mgsl_eigen, "hermv_sort",
2162
+ rb_gsl_eigen_hermv_sort, -1);
2163
+ rb_define_module_function(mgsl_eigen_symmv, "sort",
2164
+ rb_gsl_eigen_symmv_sort, -1);
2165
+ rb_define_module_function(mgsl_eigen_hermv, "sort",
2166
+ rb_gsl_eigen_hermv_sort, -1);
2213
2167
 
2214
2168
  #ifdef HAVE_GSL_EIGEN_FRANCIS
2215
2169
  mgsl_eigen_francis = rb_define_module_under(mgsl_eigen, "francis");
2216
- cgsl_eigen_francis_workspace = rb_define_class_under(mgsl_eigen_francis,
2217
- "Workspace", cGSL_Object);
2170
+ cgsl_eigen_francis_workspace = rb_define_class_under(mgsl_eigen_francis,
2171
+ "Workspace", cGSL_Object);
2218
2172
  rb_define_singleton_method(cgsl_eigen_francis_workspace, "alloc",
2219
- rb_gsl_eigen_francis_alloc, 0);
2173
+ rb_gsl_eigen_francis_alloc, 0);
2220
2174
 
2221
2175
  rb_define_method(cgsl_matrix, "eigen_francis", rb_gsl_eigen_francis, -1);
2222
2176
  rb_define_module_function(mgsl_eigen, "francis", rb_gsl_eigen_francis, -1);
@@ -2230,16 +2184,15 @@ void Init_gsl_eigen(VALUE module)
2230
2184
 
2231
2185
  #endif
2232
2186
 
2233
- #ifdef GSL_1_9_LATER
2234
2187
  mgsl_eigen_nonsymm = rb_define_module_under(mgsl_eigen, "Nonsymm");
2235
2188
  mgsl_eigen_nonsymmv = rb_define_module_under(mgsl_eigen, "Nonsymmv");
2236
- cgsl_eigen_nonsymm_workspace = rb_define_class_under(mgsl_eigen_nonsymm,
2237
- "Workspace", cGSL_Object);
2189
+ cgsl_eigen_nonsymm_workspace = rb_define_class_under(mgsl_eigen_nonsymm,
2190
+ "Workspace", cGSL_Object);
2238
2191
  rb_define_singleton_method(cgsl_eigen_nonsymm_workspace, "alloc",
2239
- rb_gsl_eigen_nonsymm_alloc, 1);
2192
+ rb_gsl_eigen_nonsymm_alloc, 1);
2240
2193
  rb_define_singleton_method(mgsl_eigen_nonsymm, "alloc",
2241
- rb_gsl_eigen_nonsymm_alloc, 1);
2242
-
2194
+ rb_gsl_eigen_nonsymm_alloc, 1);
2195
+
2243
2196
  rb_define_method(cgsl_matrix, "eigen_nonsymm", rb_gsl_eigen_nonsymm, -1);
2244
2197
  rb_define_module_function(mgsl_eigen, "nonsymm", rb_gsl_eigen_nonsymm, -1);
2245
2198
  rb_define_module_function(module, "eigen_nonsymm", rb_gsl_eigen_nonsymm, -1);
@@ -2250,12 +2203,12 @@ void Init_gsl_eigen(VALUE module)
2250
2203
  rb_define_method(cgsl_eigen_nonsymm_workspace, "params", rb_gsl_eigen_nonsymm_params, -1);
2251
2204
  rb_define_module_function(mgsl_eigen_nonsymm, "params", rb_gsl_eigen_nonsymm_params, -1);
2252
2205
 
2253
- cgsl_eigen_nonsymmv_workspace = rb_define_class_under(mgsl_eigen_nonsymmv,
2254
- "Workspace", cGSL_Object);
2206
+ cgsl_eigen_nonsymmv_workspace = rb_define_class_under(mgsl_eigen_nonsymmv,
2207
+ "Workspace", cGSL_Object);
2255
2208
  rb_define_singleton_method(cgsl_eigen_nonsymmv_workspace, "alloc",
2256
- rb_gsl_eigen_nonsymmv_alloc, 1);
2209
+ rb_gsl_eigen_nonsymmv_alloc, 1);
2257
2210
  rb_define_singleton_method(mgsl_eigen_nonsymmv, "alloc",
2258
- rb_gsl_eigen_nonsymmv_alloc, 1);
2211
+ rb_gsl_eigen_nonsymmv_alloc, 1);
2259
2212
  rb_define_method(cgsl_matrix, "eigen_nonsymmv", rb_gsl_eigen_nonsymmv, -1);
2260
2213
  rb_define_module_function(mgsl_eigen, "nonsymmv", rb_gsl_eigen_nonsymmv, -1);
2261
2214
  rb_define_module_function(module, "eigen_nonsymmv", rb_gsl_eigen_nonsymmv, -1);
@@ -2265,15 +2218,13 @@ void Init_gsl_eigen(VALUE module)
2265
2218
  rb_define_module_function(mgsl_eigen, "nonsymmv_Z", rb_gsl_eigen_nonsymmv_Z, -1);
2266
2219
  rb_define_module_function(module, "eigen_nonsymmv_Z", rb_gsl_eigen_nonsymmv_Z, -1);
2267
2220
 
2268
- rb_define_module_function(mgsl_eigen, "nonsymmv_sort",
2269
- rb_gsl_eigen_nonsymmv_sort, -1);
2270
- rb_define_module_function(mgsl_eigen_nonsymmv, "sort",
2271
- rb_gsl_eigen_nonsymmv_sort, -1);
2272
- rb_define_module_function(module, "eigen_nonsymmv_sort",
2273
- rb_gsl_eigen_nonsymmv_sort, -1);
2274
- #endif
2221
+ rb_define_module_function(mgsl_eigen, "nonsymmv_sort",
2222
+ rb_gsl_eigen_nonsymmv_sort, -1);
2223
+ rb_define_module_function(mgsl_eigen_nonsymmv, "sort",
2224
+ rb_gsl_eigen_nonsymmv_sort, -1);
2225
+ rb_define_module_function(module, "eigen_nonsymmv_sort",
2226
+ rb_gsl_eigen_nonsymmv_sort, -1);
2275
2227
 
2276
- #ifdef GSL_1_10_LATER
2277
2228
  /** gensymm, gensymmv **/
2278
2229
  mgensymm = rb_define_module_under(mgsl_eigen, "Gensymm");
2279
2230
  cgensymm = rb_define_class_under(mgensymm, "Workspace", cGSL_Object);
@@ -2287,27 +2238,27 @@ void Init_gsl_eigen(VALUE module)
2287
2238
 
2288
2239
  rb_define_method(cgensymm, "gensymm", rb_gsl_eigen_gensymm, -1);
2289
2240
  rb_define_module_function(module, "eigen_gensymm", rb_gsl_eigen_gensymm, -1);
2290
- rb_define_module_function(mgsl_eigen, "gensymm", rb_gsl_eigen_gensymm, -1);
2291
- rb_define_module_function(mgensymm, "gensymm", rb_gsl_eigen_gensymm, -1);
2241
+ rb_define_module_function(mgsl_eigen, "gensymm", rb_gsl_eigen_gensymm, -1);
2242
+ rb_define_module_function(mgensymm, "gensymm", rb_gsl_eigen_gensymm, -1);
2292
2243
 
2293
2244
  rb_define_method(cgensymmv, "gensymmv", rb_gsl_eigen_gensymmv, -1);
2294
2245
  rb_define_module_function(module, "eigen_gensymmv", rb_gsl_eigen_gensymmv, -1);
2295
- rb_define_module_function(mgsl_eigen, "gensymmv", rb_gsl_eigen_gensymmv, -1);
2246
+ rb_define_module_function(mgsl_eigen, "gensymmv", rb_gsl_eigen_gensymmv, -1);
2296
2247
  rb_define_module_function(mgensymmv, "gensymmv", rb_gsl_eigen_gensymmv, -1);
2297
2248
 
2298
- rb_define_module_function(mgsl_eigen, "gensymmv_sort",
2299
- rb_gsl_eigen_gensymmv_sort, -1);
2300
- rb_define_module_function(mgensymmv, "sort",
2301
- rb_gsl_eigen_gensymmv_sort, -1);
2302
- rb_define_module_function(module, "eigen_gensymmv_sort",
2303
- rb_gsl_eigen_gensymmv_sort, -1);
2249
+ rb_define_module_function(mgsl_eigen, "gensymmv_sort",
2250
+ rb_gsl_eigen_gensymmv_sort, -1);
2251
+ rb_define_module_function(mgensymmv, "sort",
2252
+ rb_gsl_eigen_gensymmv_sort, -1);
2253
+ rb_define_module_function(module, "eigen_gensymmv_sort",
2254
+ rb_gsl_eigen_gensymmv_sort, -1);
2304
2255
 
2305
2256
  /** genherm, genhermv **/
2306
2257
  mgenherm = rb_define_module_under(mgsl_eigen, "Genherm");
2307
2258
  cgenherm = rb_define_class_under(mgenherm, "Workspace", cGSL_Object);
2308
2259
  mgenhermv = rb_define_module_under(mgsl_eigen, "Genhermv");
2309
2260
  cgenhermv = rb_define_class_under(mgenhermv, "Workspace", cGSL_Object);
2310
-
2261
+
2311
2262
  rb_define_singleton_method(cgenherm, "alloc", rb_gsl_eigen_genherm_alloc, 1);
2312
2263
  rb_define_singleton_method(cgenhermv, "alloc", rb_gsl_eigen_genhermv_alloc, 1);
2313
2264
  rb_define_singleton_method(mgenherm, "alloc", rb_gsl_eigen_genherm_alloc, 1);
@@ -2315,59 +2266,57 @@ void Init_gsl_eigen(VALUE module)
2315
2266
 
2316
2267
  rb_define_method(cgenherm, "genherm", rb_gsl_eigen_genherm, -1);
2317
2268
  rb_define_module_function(module, "eigen_genherm", rb_gsl_eigen_genherm, -1);
2318
- rb_define_module_function(mgsl_eigen, "genherm", rb_gsl_eigen_genherm, -1);
2319
- rb_define_module_function(mgenherm, "genherm", rb_gsl_eigen_genherm, -1);
2269
+ rb_define_module_function(mgsl_eigen, "genherm", rb_gsl_eigen_genherm, -1);
2270
+ rb_define_module_function(mgenherm, "genherm", rb_gsl_eigen_genherm, -1);
2320
2271
 
2321
2272
  rb_define_method(cgenhermv, "genhermv", rb_gsl_eigen_genhermv, -1);
2322
2273
  rb_define_module_function(module, "eigen_genhermv", rb_gsl_eigen_genhermv, -1);
2323
- rb_define_module_function(mgsl_eigen, "genhermv", rb_gsl_eigen_genhermv, -1);
2274
+ rb_define_module_function(mgsl_eigen, "genhermv", rb_gsl_eigen_genhermv, -1);
2324
2275
  rb_define_module_function(mgenhermv, "genhermv", rb_gsl_eigen_genhermv, -1);
2325
-
2326
- rb_define_module_function(mgsl_eigen, "genhermv_sort",
2327
- rb_gsl_eigen_genhermv_sort, -1);
2328
- rb_define_module_function(mgenhermv, "sort",
2329
- rb_gsl_eigen_genhermv_sort, -1);
2330
- rb_define_module_function(module, "eigen_genhermv_sort",
2331
- rb_gsl_eigen_genhermv_sort, -1);
2332
-
2276
+
2277
+ rb_define_module_function(mgsl_eigen, "genhermv_sort",
2278
+ rb_gsl_eigen_genhermv_sort, -1);
2279
+ rb_define_module_function(mgenhermv, "sort",
2280
+ rb_gsl_eigen_genhermv_sort, -1);
2281
+ rb_define_module_function(module, "eigen_genhermv_sort",
2282
+ rb_gsl_eigen_genhermv_sort, -1);
2283
+
2333
2284
  /* gen */
2334
2285
  mgen = rb_define_module_under(mgsl_eigen, "Gen");
2335
- mgenv = rb_define_module_under(mgsl_eigen, "Genv");
2286
+ mgenv = rb_define_module_under(mgsl_eigen, "Genv");
2336
2287
  cgenw = rb_define_class_under(mgen, "Workspace", cGSL_Object);
2337
2288
  cgenvw = rb_define_class_under(mgenv, "Workspace", cGSL_Object);
2338
2289
  rb_define_singleton_method(mgen, "alloc", rb_gsl_eigen_gen_alloc, 1);
2339
- rb_define_singleton_method(cgenw, "alloc", rb_gsl_eigen_gen_alloc, 1);
2290
+ rb_define_singleton_method(cgenw, "alloc", rb_gsl_eigen_gen_alloc, 1);
2340
2291
  rb_define_singleton_method(mgenv, "alloc", rb_gsl_eigen_genv_alloc, 1);
2341
2292
  rb_define_singleton_method(cgenvw, "alloc", rb_gsl_eigen_genv_alloc, 1);
2342
-
2293
+
2343
2294
  rb_define_module_function(mgen, "params", rb_gsl_eigen_gen_params, -1);
2344
2295
  rb_define_method(cgenw, "params", rb_gsl_eigen_gen_params, -1);
2345
2296
  rb_define_module_function(mgsl_eigen, "gen_params", rb_gsl_eigen_gen_params, -1);
2346
-
2347
-
2297
+
2298
+
2348
2299
  rb_define_module_function(mgen, "gen", rb_gsl_eigen_gen, -1);
2349
- rb_define_module_function(mgsl_eigen, "gen", rb_gsl_eigen_gen, -1);
2300
+ rb_define_module_function(mgsl_eigen, "gen", rb_gsl_eigen_gen, -1);
2350
2301
  rb_define_method(cgenw, "gen", rb_gsl_eigen_gen, -1);
2351
-
2302
+
2352
2303
  rb_define_module_function(mgenv, "genv", rb_gsl_eigen_genv, -1);
2353
- rb_define_module_function(mgsl_eigen, "genv", rb_gsl_eigen_genv, -1);
2304
+ rb_define_module_function(mgsl_eigen, "genv", rb_gsl_eigen_genv, -1);
2354
2305
  rb_define_method(cgenvw, "genv", rb_gsl_eigen_genv, -1);
2355
-
2306
+
2356
2307
  rb_define_module_function(mgen, "gen_QZ", rb_gsl_eigen_gen_QZ, -1);
2357
- rb_define_module_function(mgsl_eigen, "gen_QZ", rb_gsl_eigen_gen_QZ, -1);
2308
+ rb_define_module_function(mgsl_eigen, "gen_QZ", rb_gsl_eigen_gen_QZ, -1);
2358
2309
  rb_define_method(cgenw, "gen_QZ", rb_gsl_eigen_gen_QZ, -1);
2359
-
2360
- rb_define_module_function(mgenv, "genv_QZ", rb_gsl_eigen_genv_QZ, -1);
2361
- rb_define_module_function(mgsl_eigen, "genv_QZ", rb_gsl_eigen_genv_QZ, -1);
2362
- rb_define_method(cgenvw, "genv_QZ", rb_gsl_eigen_genv_QZ, -1);
2363
-
2364
- rb_define_module_function(mgsl_eigen, "genv_sort",
2365
- rb_gsl_eigen_genv_sort, -1);
2366
- rb_define_module_function(mgenv, "sort",
2367
- rb_gsl_eigen_genv_sort, -1);
2368
- rb_define_module_function(module, "eigen_genv_sort",
2369
- rb_gsl_eigen_genv_sort, -1);
2370
- #endif
2371
2310
 
2311
+ rb_define_module_function(mgenv, "genv_QZ", rb_gsl_eigen_genv_QZ, -1);
2312
+ rb_define_module_function(mgsl_eigen, "genv_QZ", rb_gsl_eigen_genv_QZ, -1);
2313
+ rb_define_method(cgenvw, "genv_QZ", rb_gsl_eigen_genv_QZ, -1);
2314
+
2315
+ rb_define_module_function(mgsl_eigen, "genv_sort",
2316
+ rb_gsl_eigen_genv_sort, -1);
2317
+ rb_define_module_function(mgenv, "sort",
2318
+ rb_gsl_eigen_genv_sort, -1);
2319
+ rb_define_module_function(module, "eigen_genv_sort",
2320
+ rb_gsl_eigen_genv_sort, -1);
2372
2321
  }
2373
2322