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.
- checksums.yaml +4 -4
- data/.gitignore +12 -0
- data/.travis.yml +24 -0
- data/AUTHORS +6 -0
- data/COPYING +341 -339
- data/ChangeLog +608 -587
- data/Gemfile +4 -0
- data/README.md +77 -0
- data/Rakefile +14 -33
- data/THANKS +1 -1
- data/examples/blas/blas.rb +1 -1
- data/examples/bspline.rb +3 -3
- data/examples/complex/functions.rb +4 -4
- data/examples/complex/mul.rb +1 -1
- data/examples/const/physconst.rb +4 -4
- data/examples/const/travel.rb +4 -4
- data/examples/eigen/nonsymmv.rb +1 -1
- data/examples/eigen/qhoscillator.rb +3 -3
- data/examples/fft/radix2.rb +1 -1
- data/examples/fft/real-halfcomplex.rb +3 -3
- data/examples/fft/real-halfcomplex2.rb +3 -3
- data/examples/fit/expfit.rb +1 -1
- data/examples/fit/multifit.rb +1 -1
- data/examples/fit/ndlinear.rb +44 -44
- data/examples/fit/nonlinearfit.rb +1 -1
- data/examples/fit/wlinear.rb +3 -3
- data/examples/function/function.rb +1 -1
- data/examples/function/min.rb +1 -1
- data/examples/function/synchrotron.rb +2 -2
- data/examples/gallery/koch.rb +1 -1
- data/examples/histogram/cauchy.rb +2 -2
- data/examples/histogram/exponential.rb +1 -1
- data/examples/histogram/histo3d.rb +1 -1
- data/examples/histogram/histogram-pdf.rb +2 -2
- data/examples/histogram/xexp.rb +1 -1
- data/examples/integration/ahmed.rb +2 -2
- data/examples/integration/cosmology.rb +7 -7
- data/examples/integration/friedmann.rb +4 -4
- data/examples/integration/qng.rb +1 -1
- data/examples/interp/demo.rb +2 -2
- data/examples/linalg/LQ_solve.rb +1 -1
- data/examples/linalg/LU.rb +1 -1
- data/examples/linalg/LU2.rb +1 -1
- data/examples/linalg/LU_narray.rb +1 -1
- data/examples/linalg/PTLQ.rb +1 -1
- data/examples/linalg/QRPT.rb +1 -1
- data/examples/linalg/chol.rb +1 -1
- data/examples/linalg/chol_narray.rb +1 -1
- data/examples/linalg/complex.rb +1 -1
- data/examples/math/elementary.rb +1 -1
- data/examples/math/functions.rb +1 -1
- data/examples/math/inf_nan.rb +1 -1
- data/examples/math/minmax.rb +1 -1
- data/examples/math/power.rb +1 -1
- data/examples/math/test.rb +1 -1
- data/examples/min.rb +1 -1
- data/examples/multimin/bundle.rb +1 -1
- data/examples/multimin/cqp.rb +17 -17
- data/examples/multiroot/fsolver3.rb +1 -1
- data/examples/odeiv/binarysystem.rb +12 -12
- data/examples/odeiv/demo.rb +3 -3
- data/examples/odeiv/frei1.rb +7 -7
- data/examples/odeiv/frei2.rb +4 -4
- data/examples/odeiv/oscillator.rb +1 -1
- data/examples/odeiv/sedov.rb +3 -3
- data/examples/odeiv/whitedwarf.rb +11 -11
- data/examples/permutation/ex1.rb +2 -2
- data/examples/permutation/permutation.rb +1 -1
- data/examples/poly/demo.rb +1 -1
- data/examples/random/diffusion.rb +1 -1
- data/examples/random/generator.rb +2 -2
- data/examples/random/randomwalk.rb +3 -3
- data/examples/random/rng.rb +1 -1
- data/examples/roots/bisection.rb +1 -1
- data/examples/roots/brent.rb +1 -1
- data/examples/roots/demo.rb +1 -1
- data/examples/roots/newton.rb +2 -2
- data/examples/roots/recombination.gp +0 -1
- data/examples/sf/hyperg.rb +1 -1
- data/examples/sf/sphbessel.rb +1 -1
- data/examples/sort/sort.rb +1 -1
- data/examples/tamu_anova.rb +4 -4
- data/examples/vector/add.rb +1 -1
- data/examples/vector/decimate.rb +1 -1
- data/examples/vector/gnuplot.rb +8 -8
- data/examples/vector/vector.rb +2 -2
- data/examples/wavelet/wavelet1.rb +1 -1
- data/ext/{gsl → gsl_native}/alf.c +9 -9
- data/ext/{gsl → gsl_native}/array.c +64 -151
- data/ext/{gsl → gsl_native}/array_complex.c +61 -63
- data/ext/{gsl → gsl_native}/blas.c +0 -0
- data/ext/{gsl → gsl_native}/blas1.c +32 -32
- data/ext/{gsl → gsl_native}/blas2.c +54 -58
- data/ext/{gsl → gsl_native}/blas3.c +54 -54
- data/ext/{gsl → gsl_native}/block.c +3 -6
- data/ext/{gsl/block_source.c → gsl_native/block_source.h} +109 -111
- data/ext/gsl_native/bspline.c +122 -0
- data/ext/{gsl → gsl_native}/bundle.c +0 -0
- data/ext/{gsl → gsl_native}/cdf.c +76 -88
- data/ext/{gsl → gsl_native}/cheb.c +74 -85
- data/ext/{gsl → gsl_native}/combination.c +9 -16
- data/ext/{gsl → gsl_native}/common.c +7 -37
- data/ext/{gsl → gsl_native}/complex.c +113 -115
- data/ext/gsl_native/const.c +331 -0
- data/ext/{gsl → gsl_native}/const_additional.c +12 -33
- data/ext/gsl_native/cqp.c +283 -0
- data/ext/{gsl → gsl_native}/deriv.c +22 -30
- data/ext/{gsl → gsl_native}/dht.c +20 -28
- data/ext/{gsl → gsl_native}/diff.c +23 -25
- data/ext/{gsl → gsl_native}/dirac.c +44 -45
- data/ext/{gsl → gsl_native}/eigen.c +1031 -1082
- data/ext/{gsl → gsl_native}/error.c +13 -13
- data/ext/{gsl → gsl_native}/extconf.rb +5 -13
- data/ext/{gsl → gsl_native}/fft.c +192 -198
- data/ext/{gsl → gsl_native}/fit.c +16 -16
- data/ext/gsl_native/fresnel.c +312 -0
- data/ext/{gsl → gsl_native}/function.c +29 -35
- data/ext/{gsl → gsl_native}/geometry.c +15 -15
- data/ext/{gsl → gsl_native}/graph.c +37 -87
- data/ext/{gsl → gsl_native}/gsl.c +10 -23
- data/ext/{gsl → gsl_native}/gsl_narray.c +15 -24
- data/ext/{gsl → gsl_native}/histogram.c +123 -150
- data/ext/{gsl → gsl_native}/histogram2d.c +71 -96
- data/ext/{gsl → gsl_native}/histogram3d.c +72 -72
- data/ext/{gsl → gsl_native}/histogram3d_source.c +195 -196
- data/ext/{gsl → gsl_native}/histogram_find.c +31 -33
- data/ext/{gsl → gsl_native}/histogram_oper.c +43 -52
- data/ext/{gsl → gsl_native}/ieee.c +7 -15
- data/ext/{gsl → gsl_native}/include/rb_gsl.h +0 -7
- data/ext/{gsl → gsl_native}/include/rb_gsl_array.h +15 -25
- data/ext/{gsl → gsl_native}/include/rb_gsl_cheb.h +0 -0
- data/ext/{gsl → gsl_native}/include/rb_gsl_common.h +44 -52
- data/ext/{gsl → gsl_native}/include/rb_gsl_complex.h +0 -0
- data/ext/{gsl → gsl_native}/include/rb_gsl_const.h +0 -5
- data/ext/{gsl → gsl_native}/include/rb_gsl_dirac.h +0 -0
- data/ext/{gsl → gsl_native}/include/rb_gsl_eigen.h +0 -0
- data/ext/{gsl → gsl_native}/include/rb_gsl_fft.h +0 -3
- data/ext/{gsl → gsl_native}/include/rb_gsl_fit.h +0 -0
- data/ext/{gsl → gsl_native}/include/rb_gsl_function.h +0 -0
- data/ext/{gsl → gsl_native}/include/rb_gsl_graph.h +2 -2
- data/ext/{gsl → gsl_native}/include/rb_gsl_histogram.h +8 -8
- data/ext/{gsl → gsl_native}/include/rb_gsl_histogram3d.h +50 -50
- data/ext/{gsl → gsl_native}/include/rb_gsl_integration.h +0 -0
- data/ext/{gsl → gsl_native}/include/rb_gsl_interp.h +0 -0
- data/ext/{gsl → gsl_native}/include/rb_gsl_linalg.h +0 -1
- data/ext/{gsl → gsl_native}/include/rb_gsl_math.h +0 -4
- data/ext/{gsl → gsl_native}/include/rb_gsl_odeiv.h +0 -0
- data/ext/{gsl → gsl_native}/include/rb_gsl_poly.h +3 -3
- data/ext/{gsl → gsl_native}/include/rb_gsl_rational.h +1 -1
- data/ext/{gsl → gsl_native}/include/rb_gsl_rng.h +0 -0
- data/ext/{gsl → gsl_native}/include/rb_gsl_root.h +0 -0
- data/ext/{gsl → gsl_native}/include/rb_gsl_sf.h +39 -43
- data/ext/{gsl → gsl_native}/include/rb_gsl_statistics.h +0 -0
- data/ext/{gsl → gsl_native}/include/rb_gsl_tensor.h +0 -0
- data/ext/{gsl → gsl_native}/include/rb_gsl_with_narray.h +0 -0
- data/ext/{gsl → gsl_native}/include/templates_off.h +0 -0
- data/ext/{gsl → gsl_native}/include/templates_on.h +1 -1
- data/ext/{gsl → gsl_native}/integration.c +160 -183
- data/ext/{gsl → gsl_native}/interp.c +23 -31
- data/ext/gsl_native/jacobi.c +733 -0
- data/ext/{gsl → gsl_native}/linalg.c +448 -576
- data/ext/{gsl → gsl_native}/linalg_complex.c +84 -98
- data/ext/{gsl → gsl_native}/math.c +45 -63
- data/ext/{gsl → gsl_native}/matrix.c +4 -6
- data/ext/{gsl → gsl_native}/matrix_complex.c +111 -114
- data/ext/{gsl → gsl_native}/matrix_double.c +74 -77
- data/ext/{gsl → gsl_native}/matrix_int.c +49 -50
- data/ext/{gsl/matrix_source.c → gsl_native/matrix_source.h} +280 -302
- data/ext/{gsl → gsl_native}/min.c +43 -74
- data/ext/{gsl → gsl_native}/monte.c +45 -59
- data/ext/{gsl → gsl_native}/multifit.c +138 -147
- data/ext/{gsl → gsl_native}/multimin.c +55 -83
- data/ext/{gsl → gsl_native}/multimin_fsdf.c +15 -15
- data/ext/{gsl → gsl_native}/multiroots.c +61 -64
- data/ext/{gsl → gsl_native}/multiset.c +3 -7
- data/ext/{gsl → gsl_native}/ndlinear.c +320 -321
- data/ext/{gsl → gsl_native}/nmf.c +11 -11
- data/ext/{gsl → gsl_native}/nmf_wrap.c +1 -1
- data/ext/{gsl → gsl_native}/ntuple.c +13 -13
- data/ext/{gsl → gsl_native}/odeiv.c +95 -106
- data/ext/gsl_native/ool.c +879 -0
- data/ext/{gsl → gsl_native}/permutation.c +36 -34
- data/ext/{gsl → gsl_native}/poly.c +2 -5
- data/ext/{gsl → gsl_native}/poly2.c +6 -6
- data/ext/{gsl/poly_source.c → gsl_native/poly_source.h} +232 -275
- data/ext/{gsl → gsl_native}/qrng.c +6 -17
- data/ext/{gsl → gsl_native}/randist.c +218 -243
- data/ext/{gsl → gsl_native}/rational.c +9 -9
- data/ext/{gsl → gsl_native}/rng.c +29 -45
- data/ext/{gsl → gsl_native}/root.c +43 -43
- data/ext/{gsl → gsl_native}/sf.c +163 -197
- data/ext/{gsl → gsl_native}/sf_airy.c +0 -0
- data/ext/{gsl → gsl_native}/sf_bessel.c +6 -6
- data/ext/{gsl → gsl_native}/sf_clausen.c +0 -0
- data/ext/{gsl → gsl_native}/sf_coulomb.c +39 -39
- data/ext/{gsl → gsl_native}/sf_coupling.c +29 -29
- data/ext/{gsl → gsl_native}/sf_dawson.c +0 -0
- data/ext/{gsl → gsl_native}/sf_debye.c +0 -9
- data/ext/{gsl → gsl_native}/sf_dilog.c +0 -0
- data/ext/{gsl → gsl_native}/sf_elementary.c +2 -2
- data/ext/{gsl → gsl_native}/sf_ellint.c +42 -42
- data/ext/{gsl → gsl_native}/sf_elljac.c +2 -2
- data/ext/{gsl → gsl_native}/sf_erfc.c +0 -4
- data/ext/{gsl → gsl_native}/sf_exp.c +2 -2
- data/ext/{gsl → gsl_native}/sf_expint.c +1 -11
- data/ext/{gsl → gsl_native}/sf_fermi_dirac.c +0 -0
- data/ext/{gsl → gsl_native}/sf_gamma.c +1 -5
- data/ext/{gsl → gsl_native}/sf_gegenbauer.c +0 -0
- data/ext/{gsl → gsl_native}/sf_hyperg.c +0 -0
- data/ext/{gsl → gsl_native}/sf_laguerre.c +3 -3
- data/ext/{gsl → gsl_native}/sf_lambert.c +0 -0
- data/ext/{gsl → gsl_native}/sf_legendre.c +0 -0
- data/ext/{gsl → gsl_native}/sf_log.c +3 -3
- data/ext/gsl_native/sf_mathieu.c +235 -0
- data/ext/{gsl → gsl_native}/sf_power.c +0 -0
- data/ext/{gsl → gsl_native}/sf_psi.c +2 -11
- data/ext/{gsl → gsl_native}/sf_synchrotron.c +0 -0
- data/ext/{gsl → gsl_native}/sf_transport.c +0 -0
- data/ext/{gsl → gsl_native}/sf_trigonometric.c +3 -3
- data/ext/{gsl → gsl_native}/sf_zeta.c +0 -4
- data/ext/{gsl → gsl_native}/signal.c +60 -64
- data/ext/{gsl → gsl_native}/siman.c +36 -40
- data/ext/{gsl → gsl_native}/sort.c +3 -4
- data/ext/{gsl → gsl_native}/spline.c +25 -43
- data/ext/{gsl → gsl_native}/stats.c +102 -115
- data/ext/{gsl → gsl_native}/sum.c +32 -32
- data/ext/{gsl → gsl_native}/tamu_anova.c +0 -0
- data/ext/{gsl → gsl_native}/tensor.c +2 -4
- data/ext/{gsl/tensor_source.c → gsl_native/tensor_source.h} +144 -144
- data/ext/{gsl → gsl_native}/vector.c +2 -4
- data/ext/{gsl → gsl_native}/vector_complex.c +165 -171
- data/ext/{gsl → gsl_native}/vector_double.c +167 -174
- data/ext/{gsl → gsl_native}/vector_int.c +23 -25
- data/ext/{gsl/vector_source.c → gsl_native/vector_source.h} +400 -414
- data/ext/{gsl → gsl_native}/wavelet.c +215 -236
- data/lib/gsl.rb +1 -7
- data/lib/gsl/gnuplot.rb +2 -2
- data/lib/gsl/version.rb +1 -3
- data/rb-gsl.gemspec +29 -0
- data/rdoc/blas.rdoc +3 -3
- data/rdoc/bspline.rdoc +7 -7
- data/rdoc/cheb.rdoc +8 -8
- data/rdoc/cholesky_complex.rdoc +1 -1
- data/rdoc/combi.rdoc +9 -9
- data/rdoc/complex.rdoc +11 -11
- data/rdoc/const.rdoc +20 -20
- data/rdoc/dht.rdoc +6 -6
- data/rdoc/diff.rdoc +6 -6
- data/rdoc/ehandling.rdoc +3 -3
- data/rdoc/eigen.rdoc +11 -11
- data/rdoc/fft.rdoc +26 -26
- data/rdoc/fit.rdoc +18 -18
- data/rdoc/graph.rdoc +2 -2
- data/rdoc/hist.rdoc +16 -16
- data/rdoc/hist2d.rdoc +4 -4
- data/rdoc/hist3d.rdoc +3 -3
- data/rdoc/integration.rdoc +16 -16
- data/rdoc/interp.rdoc +11 -11
- data/rdoc/intro.rdoc +3 -3
- data/rdoc/linalg.rdoc +20 -20
- data/rdoc/linalg_complex.rdoc +1 -1
- data/rdoc/math.rdoc +13 -13
- data/rdoc/matrix.rdoc +22 -22
- data/rdoc/min.rdoc +9 -9
- data/rdoc/monte.rdoc +3 -3
- data/rdoc/multimin.rdoc +12 -12
- data/rdoc/multiroot.rdoc +12 -12
- data/rdoc/narray.rdoc +9 -9
- data/rdoc/ndlinear.rdoc +4 -4
- data/rdoc/nonlinearfit.rdoc +17 -17
- data/rdoc/ntuple.rdoc +5 -5
- data/rdoc/odeiv.rdoc +12 -12
- data/rdoc/perm.rdoc +11 -11
- data/rdoc/poly.rdoc +17 -17
- data/rdoc/qrng.rdoc +9 -9
- data/rdoc/randist.rdoc +10 -10
- data/rdoc/ref.rdoc +49 -49
- data/rdoc/rng.rdoc +9 -9
- data/rdoc/roots.rdoc +12 -12
- data/rdoc/sf.rdoc +35 -35
- data/rdoc/siman.rdoc +3 -3
- data/rdoc/sort.rdoc +6 -6
- data/rdoc/start.rdoc +2 -2
- data/rdoc/stats.rdoc +13 -13
- data/rdoc/sum.rdoc +4 -4
- data/rdoc/tensor.rdoc +3 -3
- data/rdoc/tut.rdoc +1 -1
- data/rdoc/use.rdoc +3 -3
- data/rdoc/vector.rdoc +28 -28
- data/rdoc/vector_complex.rdoc +6 -6
- data/rdoc/wavelet.rdoc +8 -8
- data/test/gsl/blas_test.rb +1 -1
- data/test/gsl/index_test.rb +61 -0
- data/test/gsl/matrix_test.rb +21 -0
- data/uncrustify.cfg +1693 -0
- metadata +212 -243
- data/README +0 -28
- data/ext/gsl/bspline.c +0 -130
- data/ext/gsl/const.c +0 -672
- data/ext/gsl/cqp.c +0 -283
- data/ext/gsl/fcmp.c +0 -64
- data/ext/gsl/fresnel.c +0 -312
- data/ext/gsl/jacobi.c +0 -739
- data/ext/gsl/ool.c +0 -879
- data/ext/gsl/oper_complex_source.c +0 -251
- data/ext/gsl/sf_mathieu.c +0 -238
- 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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
109
|
-
|
110
|
-
|
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
|
-
|
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
|
-
|
134
|
-
|
135
|
-
|
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
|
204
|
+
static VALUE rb_gsl_eigen_symmv_narray(int argc, VALUE *argv, VALUE obj)
|
158
205
|
{
|
159
206
|
struct NARRAY *na;
|
160
|
-
VALUE
|
207
|
+
VALUE eval, evec;
|
161
208
|
gsl_matrix *A = NULL;
|
162
|
-
|
209
|
+
gsl_eigen_symmv_workspace *w = NULL;
|
210
|
+
gsl_matrix_view mv;
|
163
211
|
gsl_vector_view vv;
|
164
|
-
int
|
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
|
-
|
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]) !=
|
178
|
-
rb_raise(rb_eTypeError,
|
179
|
-
|
180
|
-
|
181
|
-
Data_Get_Struct(argv[1],
|
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
|
-
|
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 =
|
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
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
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)
|
208
|
-
return
|
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
|
-
|
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
|
-
|
236
|
-
|
237
|
-
|
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
|
-
|
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
|
-
|
260
|
-
|
261
|
-
|
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
|
-
|
364
|
-
|
365
|
-
|
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
|
-
|
385
|
-
|
386
|
-
|
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
|
-
|
424
|
-
|
425
|
-
|
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
|
-
|
445
|
-
|
446
|
-
|
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
|
-
|
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
|
-
|
524
|
+
/* no break, do next */
|
541
525
|
case 2:
|
542
526
|
if (argv[0] == Qnil) {
|
543
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
949
|
-
|
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
|
-
|
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
|
-
|
1132
|
-
|
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
|
-
|
1267
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
1307
|
+
gsl_vector **eval, gsl_eigen_gensymm_workspace **w)
|
1347
1308
|
{
|
1348
|
-
|
1349
|
-
|
1350
|
-
|
1351
|
-
|
1352
|
-
|
1353
|
-
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1372
|
-
|
1373
|
-
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
1377
|
-
|
1378
|
-
|
1379
|
-
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
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
|
-
|
1353
|
+
gsl_vector **eval, gsl_matrix **evec, gsl_eigen_gensymmv_workspace **w)
|
1393
1354
|
{
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1415
|
-
|
1416
|
-
|
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
|
-
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1426
|
-
|
1427
|
-
|
1428
|
-
|
1429
|
-
|
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
|
-
|
1391
|
+
rb_class2name(CLASS_OF(argv[4])));
|
1432
1392
|
}
|
1433
|
-
|
1434
|
-
|
1435
|
-
|
1436
|
-
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
1440
|
-
|
1441
|
-
|
1442
|
-
|
1443
|
-
|
1444
|
-
}
|
1445
|
-
|
1446
|
-
|
1447
|
-
|
1448
|
-
|
1449
|
-
|
1450
|
-
|
1451
|
-
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
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
|
-
|
1418
|
+
gsl_vector **eval, gsl_eigen_genherm_workspace **w)
|
1459
1419
|
{
|
1460
|
-
|
1461
|
-
|
1462
|
-
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1468
|
-
|
1469
|
-
|
1470
|
-
|
1471
|
-
|
1472
|
-
|
1473
|
-
|
1474
|
-
|
1475
|
-
|
1476
|
-
|
1477
|
-
|
1478
|
-
|
1479
|
-
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
1486
|
-
|
1487
|
-
|
1488
|
-
|
1489
|
-
|
1490
|
-
|
1491
|
-
|
1492
|
-
|
1493
|
-
|
1494
|
-
|
1495
|
-
|
1496
|
-
|
1497
|
-
|
1498
|
-
|
1499
|
-
|
1500
|
-
|
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
|
-
|
1463
|
+
gsl_vector **eval, gsl_matrix_complex **evec, gsl_eigen_genhermv_workspace **w)
|
1504
1464
|
{
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
1517
|
-
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1526
|
-
|
1527
|
-
|
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
|
-
|
1531
|
-
|
1532
|
-
|
1533
|
-
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
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
|
-
|
1501
|
+
rb_class2name(CLASS_OF(argv[4])));
|
1543
1502
|
}
|
1544
|
-
|
1545
|
-
|
1546
|
-
|
1547
|
-
|
1548
|
-
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1552
|
-
|
1553
|
-
|
1554
|
-
|
1555
|
-
}
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1564
|
-
|
1565
|
-
|
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
|
-
|
1570
|
-
|
1571
|
-
|
1572
|
-
|
1573
|
-
|
1574
|
-
|
1575
|
-
|
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
|
-
|
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
|
-
|
1582
|
-
|
1583
|
-
|
1584
|
-
|
1585
|
-
|
1586
|
-
|
1587
|
-
|
1588
|
-
|
1589
|
-
|
1590
|
-
|
1591
|
-
|
1592
|
-
|
1593
|
-
|
1594
|
-
|
1595
|
-
|
1596
|
-
|
1597
|
-
|
1598
|
-
|
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
|
-
|
1604
|
-
|
1605
|
-
|
1606
|
-
|
1607
|
-
|
1608
|
-
|
1609
|
-
|
1610
|
-
|
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
|
-
|
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
|
-
|
1618
|
-
|
1619
|
-
|
1620
|
-
|
1621
|
-
|
1622
|
-
|
1623
|
-
|
1624
|
-
|
1625
|
-
|
1626
|
-
|
1627
|
-
|
1628
|
-
|
1629
|
-
|
1630
|
-
|
1631
|
-
|
1632
|
-
|
1633
|
-
|
1634
|
-
|
1635
|
-
|
1636
|
-
|
1637
|
-
|
1638
|
-
|
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
|
-
|
1644
|
-
|
1645
|
-
|
1646
|
-
|
1647
|
-
|
1648
|
-
|
1649
|
-
|
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
|
-
|
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
|
-
|
1656
|
-
|
1657
|
-
|
1658
|
-
|
1659
|
-
|
1660
|
-
|
1661
|
-
|
1662
|
-
|
1663
|
-
|
1664
|
-
|
1665
|
-
|
1666
|
-
|
1667
|
-
|
1668
|
-
|
1669
|
-
|
1670
|
-
|
1671
|
-
|
1672
|
-
|
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
|
-
|
1678
|
-
|
1679
|
-
|
1680
|
-
|
1681
|
-
|
1682
|
-
|
1683
|
-
|
1684
|
-
|
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
|
-
|
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
|
-
|
1692
|
-
|
1693
|
-
|
1694
|
-
|
1695
|
-
|
1696
|
-
|
1697
|
-
|
1698
|
-
|
1699
|
-
|
1700
|
-
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1704
|
-
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
1708
|
-
|
1709
|
-
|
1710
|
-
|
1711
|
-
|
1712
|
-
|
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
|
-
|
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
|
-
|
1723
|
+
gsl_vector_complex **alpha, gsl_vector **beta, gsl_eigen_gen_workspace **w)
|
1765
1724
|
{
|
1766
|
-
|
1767
|
-
|
1768
|
-
|
1769
|
-
|
1770
|
-
|
1771
|
-
|
1772
|
-
|
1773
|
-
|
1774
|
-
|
1775
|
-
|
1776
|
-
|
1777
|
-
|
1778
|
-
|
1779
|
-
|
1780
|
-
|
1781
|
-
|
1782
|
-
|
1783
|
-
|
1784
|
-
|
1785
|
-
|
1786
|
-
|
1787
|
-
|
1788
|
-
|
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
|
-
|
1792
|
-
|
1793
|
-
|
1794
|
-
|
1795
|
-
|
1796
|
-
|
1797
|
-
|
1798
|
-
|
1799
|
-
|
1800
|
-
|
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
|
-
|
1760
|
+
rb_class2name(CLASS_OF(argv[4])));
|
1803
1761
|
}
|
1804
|
-
|
1805
|
-
|
1806
|
-
|
1807
|
-
|
1808
|
-
|
1809
|
-
|
1810
|
-
|
1811
|
-
|
1812
|
-
|
1813
|
-
|
1814
|
-
|
1815
|
-
}
|
1816
|
-
|
1817
|
-
|
1818
|
-
|
1819
|
-
|
1820
|
-
|
1821
|
-
|
1822
|
-
|
1823
|
-
|
1824
|
-
|
1825
|
-
|
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
|
-
|
1831
|
-
//
|
1832
|
-
|
1833
|
-
|
1834
|
-
|
1835
|
-
|
1836
|
-
|
1837
|
-
|
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
|
-
|
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
|
-
|
1845
|
-
|
1846
|
-
|
1847
|
-
|
1848
|
-
|
1849
|
-
|
1850
|
-
|
1851
|
-
|
1852
|
-
|
1853
|
-
|
1854
|
-
|
1855
|
-
|
1856
|
-
|
1857
|
-
|
1858
|
-
|
1859
|
-
|
1860
|
-
|
1861
|
-
|
1862
|
-
|
1863
|
-
|
1864
|
-
|
1865
|
-
|
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
|
-
|
1871
|
-
//
|
1872
|
-
|
1873
|
-
|
1874
|
-
|
1875
|
-
|
1876
|
-
|
1877
|
-
|
1878
|
-
|
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
|
-
//
|
1884
|
-
|
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
|
-
|
1889
|
-
|
1890
|
-
|
1891
|
-
|
1892
|
-
|
1893
|
-
|
1894
|
-
|
1895
|
-
|
1896
|
-
|
1897
|
-
|
1898
|
-
|
1899
|
-
|
1900
|
-
|
1901
|
-
|
1902
|
-
|
1903
|
-
|
1904
|
-
|
1905
|
-
|
1906
|
-
|
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
|
-
|
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
|
-
|
1872
|
+
gsl_vector_complex **alpha, gsl_vector **beta, gsl_matrix_complex **evec, gsl_eigen_genv_workspace **w)
|
1915
1873
|
{
|
1916
|
-
|
1917
|
-
|
1918
|
-
|
1919
|
-
|
1920
|
-
|
1921
|
-
|
1922
|
-
|
1923
|
-
|
1924
|
-
|
1925
|
-
|
1926
|
-
|
1927
|
-
|
1928
|
-
|
1929
|
-
|
1930
|
-
|
1931
|
-
|
1932
|
-
|
1933
|
-
|
1934
|
-
|
1935
|
-
|
1936
|
-
|
1937
|
-
|
1938
|
-
|
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
|
-
|
1942
|
-
|
1943
|
-
|
1944
|
-
|
1945
|
-
|
1946
|
-
|
1947
|
-
|
1948
|
-
|
1949
|
-
|
1950
|
-
|
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
|
-
|
1909
|
+
rb_class2name(CLASS_OF(argv[4])));
|
1953
1910
|
}
|
1954
|
-
|
1955
|
-
|
1956
|
-
|
1957
|
-
|
1958
|
-
|
1959
|
-
|
1960
|
-
|
1961
|
-
|
1962
|
-
|
1963
|
-
|
1964
|
-
|
1965
|
-
|
1966
|
-
|
1967
|
-
}
|
1968
|
-
|
1969
|
-
|
1970
|
-
|
1971
|
-
|
1972
|
-
|
1973
|
-
|
1974
|
-
|
1975
|
-
|
1976
|
-
|
1977
|
-
|
1978
|
-
|
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
|
-
|
1984
|
-
//
|
1985
|
-
|
1986
|
-
|
1987
|
-
|
1988
|
-
|
1989
|
-
|
1990
|
-
|
1991
|
-
|
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
|
-
//
|
1995
|
-
|
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
|
-
|
2000
|
-
|
2001
|
-
|
2002
|
-
|
2003
|
-
|
2004
|
-
|
2005
|
-
|
2006
|
-
|
2007
|
-
|
2008
|
-
|
2009
|
-
|
2010
|
-
|
2011
|
-
|
2012
|
-
|
2013
|
-
|
2014
|
-
|
2015
|
-
|
2016
|
-
|
2017
|
-
|
2018
|
-
|
2019
|
-
|
2020
|
-
|
2021
|
-
|
2022
|
-
|
2023
|
-
|
2024
|
-
|
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
|
-
|
2031
|
-
//
|
2032
|
-
|
2033
|
-
|
2034
|
-
|
2035
|
-
|
2036
|
-
|
2037
|
-
|
2038
|
-
|
2039
|
-
|
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
|
-
//
|
2045
|
-
|
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
|
-
|
2050
|
-
|
2051
|
-
|
2052
|
-
|
2053
|
-
|
2054
|
-
|
2055
|
-
|
2056
|
-
|
2057
|
-
|
2058
|
-
|
2059
|
-
|
2060
|
-
|
2061
|
-
|
2062
|
-
|
2063
|
-
|
2064
|
-
|
2065
|
-
|
2066
|
-
|
2067
|
-
|
2068
|
-
|
2069
|
-
|
2070
|
-
|
2071
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
2094
|
+
cgsl_vector);
|
2141
2095
|
cgsl_eigen_vectors = rb_define_class_under(mgsl_eigen, "EigenVectors",
|
2142
|
-
|
2096
|
+
cgsl_matrix);
|
2143
2097
|
cgsl_eigen_vector = rb_define_class_under(mgsl_eigen, "EigenVector",
|
2144
|
-
|
2098
|
+
cgsl_vector);
|
2145
2099
|
cgsl_eigen_herm_vectors = rb_define_class_under(mgsl_eigen, "ComplexEigenVectors",
|
2146
|
-
|
2100
|
+
cgsl_matrix_complex);
|
2147
2101
|
cgsl_eigen_vector_complex = rb_define_class_under(mgsl_eigen, "ComplexEigenVector",
|
2148
|
-
|
2149
|
-
cgsl_eigen_symm_workspace = rb_define_class_under(mgsl_eigen_symm,
|
2150
|
-
|
2151
|
-
cgsl_eigen_symmv_workspace = rb_define_class_under(mgsl_eigen_symmv,
|
2152
|
-
|
2153
|
-
cgsl_eigen_herm_workspace = rb_define_class_under(mgsl_eigen_herm,
|
2154
|
-
|
2155
|
-
|
2156
|
-
cgsl_eigen_hermv_workspace = rb_define_class_under(mgsl_eigen_hermv,
|
2157
|
-
|
2158
|
-
|
2159
|
-
rb_define_singleton_method(cgsl_eigen_symm_workspace, "alloc",
|
2160
|
-
|
2161
|
-
rb_define_singleton_method(cgsl_eigen_symmv_workspace, "alloc",
|
2162
|
-
|
2163
|
-
rb_define_singleton_method(cgsl_eigen_herm_workspace, "alloc",
|
2164
|
-
|
2165
|
-
rb_define_singleton_method(cgsl_eigen_hermv_workspace, "alloc",
|
2166
|
-
|
2167
|
-
|
2168
|
-
rb_define_singleton_method(mgsl_eigen_symm, "alloc",
|
2169
|
-
|
2170
|
-
rb_define_singleton_method(mgsl_eigen_symmv, "alloc",
|
2171
|
-
|
2172
|
-
rb_define_singleton_method(mgsl_eigen_herm, "alloc",
|
2173
|
-
|
2174
|
-
rb_define_singleton_method(mgsl_eigen_hermv, "alloc",
|
2175
|
-
|
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
|
-
|
2132
|
+
rb_gsl_eigen_symm, -1);
|
2179
2133
|
rb_define_module_function(mgsl_eigen, "symmv",
|
2180
|
-
|
2134
|
+
rb_gsl_eigen_symmv, -1);
|
2181
2135
|
rb_define_module_function(mgsl_eigen, "herm",
|
2182
|
-
|
2136
|
+
rb_gsl_eigen_herm, -1);
|
2183
2137
|
rb_define_module_function(mgsl_eigen, "hermv",
|
2184
|
-
|
2138
|
+
rb_gsl_eigen_hermv, -1);
|
2185
2139
|
|
2186
2140
|
rb_define_module_function(module, "eigen_symm",
|
2187
|
-
|
2141
|
+
rb_gsl_eigen_symm, -1);
|
2188
2142
|
rb_define_module_function(module, "eigen_symmv",
|
2189
|
-
|
2143
|
+
rb_gsl_eigen_symmv, -1);
|
2190
2144
|
rb_define_module_function(module, "eigen_herm",
|
2191
|
-
|
2145
|
+
rb_gsl_eigen_herm, -1);
|
2192
2146
|
rb_define_module_function(module, "eigen_hermv",
|
2193
|
-
|
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
|
-
|
2207
|
-
rb_define_module_function(mgsl_eigen, "hermv_sort",
|
2208
|
-
|
2209
|
-
rb_define_module_function(mgsl_eigen_symmv, "sort",
|
2210
|
-
|
2211
|
-
rb_define_module_function(mgsl_eigen_hermv, "sort",
|
2212
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
2192
|
+
rb_gsl_eigen_nonsymm_alloc, 1);
|
2240
2193
|
rb_define_singleton_method(mgsl_eigen_nonsymm, "alloc",
|
2241
|
-
|
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
|
-
|
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
|
-
|
2209
|
+
rb_gsl_eigen_nonsymmv_alloc, 1);
|
2257
2210
|
rb_define_singleton_method(mgsl_eigen_nonsymmv, "alloc",
|
2258
|
-
|
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
|
-
|
2270
|
-
rb_define_module_function(mgsl_eigen_nonsymmv, "sort",
|
2271
|
-
|
2272
|
-
rb_define_module_function(module, "eigen_nonsymmv_sort",
|
2273
|
-
|
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
|
-
|
2300
|
-
rb_define_module_function(mgensymmv, "sort",
|
2301
|
-
|
2302
|
-
rb_define_module_function(module, "eigen_gensymmv_sort",
|
2303
|
-
|
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
|
-
|
2328
|
-
rb_define_module_function(mgenhermv, "sort",
|
2329
|
-
|
2330
|
-
rb_define_module_function(module, "eigen_genhermv_sort",
|
2331
|
-
|
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
|
|