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
@@ -32,8 +32,8 @@ void pp(const gsl_matrix *m)
|
|
32
32
|
{
|
33
33
|
int r, c;
|
34
34
|
|
35
|
-
for(r=0; r < (int) m->size1; r++) {
|
36
|
-
for(c=0; c < (int) m->size2; c++) {
|
35
|
+
for(r = 0; r < (int) m->size1; r++) {
|
36
|
+
for(c = 0; c < (int) m->size2; c++) {
|
37
37
|
printf(" %.2f", gsl_matrix_get(m, r, c));
|
38
38
|
}
|
39
39
|
printf("\n");
|
@@ -45,15 +45,15 @@ void pp(const gsl_matrix *m)
|
|
45
45
|
double difcost(const gsl_matrix *a, const gsl_matrix *b)
|
46
46
|
{
|
47
47
|
int i, j;
|
48
|
-
double dif=0, d;
|
48
|
+
double dif = 0, d;
|
49
49
|
|
50
|
-
for (i=0; i < (int) a->size1; i++)
|
50
|
+
for (i = 0; i < (int) a->size1; i++)
|
51
51
|
{
|
52
|
-
for (j=0; j < (int) a->size2; j++)
|
52
|
+
for (j = 0; j < (int) a->size2; j++)
|
53
53
|
{
|
54
54
|
d = gsl_matrix_get(a, i, j) - gsl_matrix_get(b, i, j);
|
55
55
|
dif += d*d;
|
56
|
-
|
56
|
+
// dif += pow(gsl_matrix_get(a, i, j) - gsl_matrix_get(b, i, j), 2);
|
57
57
|
}
|
58
58
|
}
|
59
59
|
return dif;
|
@@ -66,9 +66,9 @@ static void initmatrix(gsl_matrix *m, double min, double max)
|
|
66
66
|
|
67
67
|
srand(time(NULL));
|
68
68
|
|
69
|
-
for(i=0; i < (int) m->size1; i++)
|
69
|
+
for(i = 0; i < (int) m->size1; i++)
|
70
70
|
{
|
71
|
-
for(j=0; j < (int) m->size2; j++)
|
71
|
+
for(j = 0; j < (int) m->size2; j++)
|
72
72
|
{
|
73
73
|
val = min + (int) (max * (rand() / (RAND_MAX + min)));
|
74
74
|
gsl_matrix_set(m, i, j, val);
|
@@ -79,10 +79,10 @@ static void initmatrix(gsl_matrix *m, double min, double max)
|
|
79
79
|
static double update(gsl_matrix *v, gsl_matrix *w, gsl_matrix *h)
|
80
80
|
{
|
81
81
|
double dist = 0;
|
82
|
-
gsl_matrix *wt=NULL, *ht=NULL, *wh=NULL;
|
83
|
-
gsl_matrix *w_h=NULL, *wt_w=NULL;
|
82
|
+
gsl_matrix *wt = NULL, *ht = NULL, *wh = NULL;
|
83
|
+
gsl_matrix *w_h = NULL, *wt_w = NULL;
|
84
84
|
gsl_matrix *wt_v = NULL;
|
85
|
-
gsl_matrix *v_ht=NULL, *wt_w_h=NULL, *w_h_ht=NULL;
|
85
|
+
gsl_matrix *v_ht = NULL, *wt_w_h = NULL, *w_h_ht = NULL;
|
86
86
|
|
87
87
|
wt = gsl_matrix_alloc(w->size2, w->size1);
|
88
88
|
gsl_matrix_transpose_memcpy(wt, w);
|
@@ -28,7 +28,7 @@ static VALUE nmf_wrap(VALUE obj, VALUE matrix, VALUE cols)
|
|
28
28
|
unsigned int c;
|
29
29
|
VALUE arr;
|
30
30
|
|
31
|
-
if ( !
|
31
|
+
if ( !FIXNUM_P(cols) || (c = NUM2INT(cols)) <= 0 ) {
|
32
32
|
rb_raise(rb_eArgError, "Number of columns should be a positive integer.");
|
33
33
|
}
|
34
34
|
arr = rb_ary_new2(2);
|
@@ -372,7 +372,7 @@ static VALUE rb_gsl_ntuple_value_fn_new(int argc, VALUE *argv, VALUE klass)
|
|
372
372
|
|
373
373
|
/* singleton method */
|
374
374
|
static VALUE rb_gsl_ntuple_project(VALUE obj, VALUE hh, VALUE nn,
|
375
|
-
|
375
|
+
VALUE vvfn, VALUE vsfn)
|
376
376
|
{
|
377
377
|
gsl_histogram *h = NULL;
|
378
378
|
gsl_ntuple *n = NULL;
|
@@ -386,10 +386,10 @@ static VALUE rb_gsl_ntuple_project(VALUE obj, VALUE hh, VALUE nn,
|
|
386
386
|
if (!rb_obj_is_kind_of(nn, cgsl_ntuple))
|
387
387
|
rb_raise(rb_eTypeError, "argument 2: Ntuple expected");
|
388
388
|
Data_Get_Struct(nn, gsl_ntuple, n);
|
389
|
-
if (!rb_obj_is_kind_of(vvfn, cgsl_ntuple_value_fn))
|
389
|
+
if (!rb_obj_is_kind_of(vvfn, cgsl_ntuple_value_fn))
|
390
390
|
rb_raise(rb_eTypeError, "argument 3: Ntuple::ValueFn expected");
|
391
391
|
Data_Get_Struct(vvfn, gsl_ntuple_value_fn, vfn);
|
392
|
-
if (!rb_obj_is_kind_of(vsfn, cgsl_ntuple_select_fn))
|
392
|
+
if (!rb_obj_is_kind_of(vsfn, cgsl_ntuple_select_fn))
|
393
393
|
rb_raise(rb_eTypeError, "argument 4: Ntuple::SelectFn expected");
|
394
394
|
Data_Get_Struct(vsfn, gsl_ntuple_select_fn, sfn);
|
395
395
|
|
@@ -412,10 +412,10 @@ static VALUE rb_gsl_ntuple_project2(VALUE obj, VALUE hh, VALUE vvfn, VALUE vsfn)
|
|
412
412
|
CHECK_HISTOGRAM(hh);
|
413
413
|
Data_Get_Struct(obj, gsl_ntuple, n);
|
414
414
|
Data_Get_Struct(hh, gsl_histogram, h);
|
415
|
-
if (!rb_obj_is_kind_of(vvfn, cgsl_ntuple_value_fn))
|
415
|
+
if (!rb_obj_is_kind_of(vvfn, cgsl_ntuple_value_fn))
|
416
416
|
rb_raise(rb_eTypeError, "argument 2: Ntuple::ValueFn expected");
|
417
417
|
Data_Get_Struct(vvfn, gsl_ntuple_value_fn, vfn);
|
418
|
-
if (!rb_obj_is_kind_of(vsfn, cgsl_ntuple_select_fn))
|
418
|
+
if (!rb_obj_is_kind_of(vsfn, cgsl_ntuple_select_fn))
|
419
419
|
rb_raise(rb_eTypeError, "argument 3: Ntuple::SelectFn expected");
|
420
420
|
Data_Get_Struct(vsfn, gsl_ntuple_select_fn, sfn);
|
421
421
|
size = n->size/sizeof(double);
|
@@ -447,22 +447,22 @@ void Init_gsl_ntuple(VALUE module)
|
|
447
447
|
rb_define_alias(cgsl_ntuple, "ntuple_data", "data");
|
448
448
|
|
449
449
|
rb_define_singleton_method(cgsl_ntuple_select_fn, "alloc",
|
450
|
-
|
450
|
+
rb_gsl_ntuple_select_fn_new, -1);
|
451
451
|
rb_define_method(cgsl_ntuple_select_fn, "set",
|
452
|
-
|
452
|
+
rb_gsl_ntuple_select_fn_set_f, -1);
|
453
453
|
rb_define_method(cgsl_ntuple_select_fn, "set_params",
|
454
|
-
|
454
|
+
rb_gsl_ntuple_select_fn_set_params, -1);
|
455
455
|
rb_define_method(cgsl_ntuple_select_fn, "params",
|
456
|
-
|
456
|
+
rb_gsl_ntuple_select_fn_params, 0);
|
457
457
|
|
458
458
|
rb_define_singleton_method(cgsl_ntuple_value_fn, "alloc",
|
459
|
-
|
459
|
+
rb_gsl_ntuple_value_fn_new, -1);
|
460
460
|
rb_define_method(cgsl_ntuple_value_fn, "set",
|
461
|
-
|
461
|
+
rb_gsl_ntuple_value_fn_set_f, -1);
|
462
462
|
rb_define_method(cgsl_ntuple_value_fn, "set_params",
|
463
|
-
|
463
|
+
rb_gsl_ntuple_value_fn_set_params, -1);
|
464
464
|
rb_define_method(cgsl_ntuple_value_fn, "params",
|
465
|
-
|
465
|
+
rb_gsl_ntuple_value_fn_params, 0);
|
466
466
|
|
467
467
|
rb_define_singleton_method(cgsl_ntuple, "project", rb_gsl_ntuple_project, 4);
|
468
468
|
rb_define_method(cgsl_ntuple, "project", rb_gsl_ntuple_project2, 3);
|
@@ -14,38 +14,38 @@
|
|
14
14
|
#include "include/rb_gsl_function.h"
|
15
15
|
|
16
16
|
#ifndef CHECK_SYSTEM
|
17
|
-
#define CHECK_SYSTEM(x) if(CLASS_OF(x)!=cgsl_odeiv_system)\
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
#define CHECK_SYSTEM(x) if(CLASS_OF(x)!=cgsl_odeiv_system) \
|
18
|
+
rb_raise(rb_eTypeError, \
|
19
|
+
"wrong argument type %s (GSL::Odeiv::System expected)", \
|
20
|
+
rb_class2name(CLASS_OF(x)));
|
21
21
|
#endif
|
22
22
|
|
23
23
|
#ifndef CHECK_STEP
|
24
|
-
#define CHECK_STEP(x) if(CLASS_OF(x)!=cgsl_odeiv_step)\
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
#define CHECK_STEP(x) if(CLASS_OF(x)!=cgsl_odeiv_step) \
|
25
|
+
rb_raise(rb_eTypeError, \
|
26
|
+
"wrong argument type %s (GSL::Odeiv::Step expected)", \
|
27
|
+
rb_class2name(CLASS_OF(x)));
|
28
28
|
#endif
|
29
29
|
|
30
30
|
#ifndef CHECK_CONTROL
|
31
|
-
#define CHECK_CONTROL(x) if(CLASS_OF(x)!=cgsl_odeiv_control)\
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
#define CHECK_CONTROL(x) if(CLASS_OF(x)!=cgsl_odeiv_control) \
|
32
|
+
rb_raise(rb_eTypeError, \
|
33
|
+
"wrong argument type %s (GSL::Odeiv::Control expected)", \
|
34
|
+
rb_class2name(CLASS_OF(x)));
|
35
35
|
#endif
|
36
36
|
|
37
37
|
#ifndef CHECK_EVOLVE
|
38
|
-
#define CHECK_EVOLVE(x) if(CLASS_OF(x)!=cgsl_odeiv_evolve)\
|
39
|
-
|
40
|
-
|
41
|
-
|
38
|
+
#define CHECK_EVOLVE(x) if(CLASS_OF(x)!=cgsl_odeiv_evolve) \
|
39
|
+
rb_raise(rb_eTypeError, \
|
40
|
+
"wrong argument type %s (GSL::Odeiv::Evolve expected)", \
|
41
|
+
rb_class2name(CLASS_OF(x)));
|
42
42
|
#endif
|
43
43
|
|
44
44
|
#ifndef CHECK_SOLVER
|
45
|
-
#define CHECK_SOLVER(x) if(CLASS_OF(x)!=cgsl_odeiv_solver)\
|
46
|
-
|
47
|
-
|
48
|
-
|
45
|
+
#define CHECK_SOLVER(x) if(CLASS_OF(x)!=cgsl_odeiv_solver) \
|
46
|
+
rb_raise(rb_eTypeError, \
|
47
|
+
"wrong argument type %s (GSL::Odeiv::Solver expected)", \
|
48
|
+
rb_class2name(CLASS_OF(x)));
|
49
49
|
#endif
|
50
50
|
|
51
51
|
static VALUE cgsl_odeiv_system;
|
@@ -101,10 +101,9 @@ static int calc_func(double t, const double y[], double dydt[], void *data)
|
|
101
101
|
vy = Data_Wrap_Struct(cgsl_vector_view_ro, 0, NULL, &ytmp);
|
102
102
|
vdydt = Data_Wrap_Struct(cgsl_vector_view, 0, NULL, &dydttmp);
|
103
103
|
|
104
|
-
if (NIL_P(params)) /*result =*/ rb_funcall((VALUE) proc, RBGSL_ID_call, 3, rb_float_new(t),
|
105
|
-
|
104
|
+
if (NIL_P(params)) /*result =*/ rb_funcall((VALUE) proc, RBGSL_ID_call, 3, rb_float_new(t),
|
105
|
+
vy, vdydt);
|
106
106
|
else /*result =*/ rb_funcall((VALUE) proc, RBGSL_ID_call, 4, rb_float_new(t), vy, vdydt, params);
|
107
|
-
|
108
107
|
return GSL_SUCCESS;
|
109
108
|
}
|
110
109
|
|
@@ -118,11 +117,10 @@ static int calc_jac(double t, const double y[], double *dfdy, double dfdt[], voi
|
|
118
117
|
gsl_vector_view ytmp, dfdttmp;
|
119
118
|
gsl_matrix_view mv;
|
120
119
|
size_t dim;
|
121
|
-
|
120
|
+
|
122
121
|
ary = (VALUE) data;
|
123
122
|
proc = rb_ary_entry(ary, 1);
|
124
123
|
if (NIL_P(proc)) rb_raise(rb_eRuntimeError, "df function not given");
|
125
|
-
|
126
124
|
dim = FIX2INT(rb_ary_entry(ary, 2));
|
127
125
|
params = rb_ary_entry(ary, 3);
|
128
126
|
|
@@ -137,9 +135,9 @@ static int calc_jac(double t, const double y[], double *dfdy, double dfdt[], voi
|
|
137
135
|
vmjac = Data_Wrap_Struct(cgsl_matrix_view, 0, NULL, &mv);
|
138
136
|
vdfdt = Data_Wrap_Struct(cgsl_vector_view, 0, NULL, &dfdttmp);
|
139
137
|
if (NIL_P(params)) /*result =*/ rb_funcall((VALUE) proc, RBGSL_ID_call, 4, rb_float_new(t),
|
140
|
-
|
141
|
-
else /*result =*/ rb_funcall((VALUE) proc, RBGSL_ID_call, 5, rb_float_new(t),
|
142
|
-
|
138
|
+
vy, vmjac, vdfdt);
|
139
|
+
else /*result =*/ rb_funcall((VALUE) proc, RBGSL_ID_call, 5, rb_float_new(t),
|
140
|
+
vy, vmjac, vdfdt, params);
|
143
141
|
return GSL_SUCCESS;
|
144
142
|
}
|
145
143
|
|
@@ -195,7 +193,6 @@ static void set_sys(int argc, VALUE *argv, gsl_odeiv_system *sys)
|
|
195
193
|
sys->function = &calc_func;
|
196
194
|
sys->jacobian = &calc_jac;
|
197
195
|
}
|
198
|
-
|
199
196
|
if (sys->params == NULL) {
|
200
197
|
ary = rb_ary_new2(4);
|
201
198
|
/* (VALUE) sys->params = ary;*/
|
@@ -213,7 +210,7 @@ static void set_sys(int argc, VALUE *argv, gsl_odeiv_system *sys)
|
|
213
210
|
} else {
|
214
211
|
vjac = Qnil;
|
215
212
|
}
|
216
|
-
if ((dim =argv[itmp++]) == Qnil) dim = argv[itmp++];
|
213
|
+
if ((dim = argv[itmp++]) == Qnil) dim = argv[itmp++];
|
217
214
|
switch (argc - itmp) {
|
218
215
|
case 0:
|
219
216
|
vparams = Qnil;
|
@@ -227,10 +224,10 @@ static void set_sys(int argc, VALUE *argv, gsl_odeiv_system *sys)
|
|
227
224
|
}
|
228
225
|
dimension = FIX2INT(dim);
|
229
226
|
sys->dimension = dimension;
|
230
|
-
rb_ary_store(ary, 0, argv[0]);
|
227
|
+
rb_ary_store(ary, 0, argv[0]);
|
231
228
|
rb_ary_store(ary, 1, vjac);
|
232
|
-
rb_ary_store(ary, 2, dim);
|
233
|
-
rb_ary_store(ary, 3, vparams);
|
229
|
+
rb_ary_store(ary, 2, dim);
|
230
|
+
rb_ary_store(ary, 3, vparams);
|
234
231
|
}
|
235
232
|
|
236
233
|
static VALUE rb_gsl_odeiv_system_set_params(int argc, VALUE *argv, VALUE obj);
|
@@ -254,7 +251,7 @@ static VALUE rb_gsl_odeiv_system_set_params(int argc, VALUE *argv, VALUE obj)
|
|
254
251
|
for (i = 0; (int) i < argc; i++) rb_ary_store(vparams, i, argv[i]);
|
255
252
|
}
|
256
253
|
// rb_ary_delete_at(ary, 3);
|
257
|
-
rb_ary_store(ary, 3, vparams);
|
254
|
+
rb_ary_store(ary, 3, vparams);
|
258
255
|
return obj;
|
259
256
|
}
|
260
257
|
|
@@ -341,9 +338,7 @@ static const gsl_odeiv_step_type* rb_gsl_odeiv_step_type_get(VALUE tt)
|
|
341
338
|
case GSL_ODEIV_STEP_BSIMP: T = gsl_odeiv_step_bsimp; break;
|
342
339
|
case GSL_ODEIV_STEP_GEAR1: T = gsl_odeiv_step_gear1; break;
|
343
340
|
case GSL_ODEIV_STEP_GEAR2: T = gsl_odeiv_step_gear2; break;
|
344
|
-
#ifdef GSL_1_6_LATER
|
345
341
|
case GSL_ODEIV_STEP_RK2SIMP: T = gsl_odeiv_step_rk2simp; break;
|
346
|
-
#endif
|
347
342
|
default:
|
348
343
|
rb_raise(rb_eArgError, "wrong argument type (Fixnum expected)");
|
349
344
|
break;
|
@@ -361,16 +356,14 @@ static const gsl_odeiv_step_type* rb_gsl_odeiv_step_type_get(VALUE tt)
|
|
361
356
|
else if (str_tail_grep(name, "bsimp") == 0) T = gsl_odeiv_step_bsimp;
|
362
357
|
else if (str_tail_grep(name, "gear1") == 0) T = gsl_odeiv_step_gear1;
|
363
358
|
else if (str_tail_grep(name, "gear2") == 0) T = gsl_odeiv_step_gear2;
|
364
|
-
#ifdef GSL_1_6_LATER
|
365
359
|
else if (str_tail_grep(name, "rk2simp") == 0) T = gsl_odeiv_step_rk2simp;
|
366
|
-
#endif
|
367
360
|
else {
|
368
361
|
rb_raise(rb_eArgError, "wrong argument type %s", name);
|
369
362
|
}
|
370
363
|
break;
|
371
364
|
default:
|
372
365
|
rb_raise(rb_eArgError, "wrong argument type %s (String or Fixnum expected)",
|
373
|
-
|
366
|
+
rb_class2name(CLASS_OF(tt)));
|
374
367
|
break;
|
375
368
|
}
|
376
369
|
return T;
|
@@ -420,7 +413,7 @@ static VALUE rb_gsl_odeiv_step_apply(int argc, VALUE *argv, VALUE obj)
|
|
420
413
|
Data_Get_Struct(argv[5], gsl_vector, vtmp2);
|
421
414
|
if (vtmp2) dydt_out = vtmp2->data;
|
422
415
|
}
|
423
|
-
|
416
|
+
/* no break */
|
424
417
|
case 6:
|
425
418
|
if (VECTOR_P(argv[4])) {
|
426
419
|
Data_Get_Struct(argv[4], gsl_vector, vtmp1);
|
@@ -440,8 +433,8 @@ static VALUE rb_gsl_odeiv_step_apply(int argc, VALUE *argv, VALUE obj)
|
|
440
433
|
Data_Get_Struct(argv[2], gsl_vector, y);
|
441
434
|
Data_Get_Struct(argv[3], gsl_vector, yerr);
|
442
435
|
Data_Get_Struct(argv[argc-1], gsl_odeiv_system, sys);
|
443
|
-
return INT2FIX(gsl_odeiv_step_apply(s, t, h, y->data, yerr->data,
|
444
|
-
|
436
|
+
return INT2FIX(gsl_odeiv_step_apply(s, t, h, y->data, yerr->data,
|
437
|
+
dydt_in, dydt_out, sys));
|
445
438
|
}
|
446
439
|
|
447
440
|
static VALUE rb_gsl_odeiv_step_info(VALUE obj)
|
@@ -456,27 +449,27 @@ static VALUE rb_gsl_odeiv_step_info(VALUE obj)
|
|
456
449
|
return rb_str_new2(buf);
|
457
450
|
}
|
458
451
|
|
459
|
-
static gsl_odeiv_control* make_control_standard(VALUE epsabs,
|
460
|
-
|
461
|
-
|
452
|
+
static gsl_odeiv_control* make_control_standard(VALUE epsabs,
|
453
|
+
VALUE epsrel,
|
454
|
+
VALUE ay, VALUE adydt);
|
462
455
|
static gsl_odeiv_control* make_control_y(VALUE epsabs, VALUE epsrel);
|
463
|
-
static VALUE rb_gsl_odeiv_control_standard_new(VALUE klass, VALUE epsabs,
|
464
|
-
|
465
|
-
|
456
|
+
static VALUE rb_gsl_odeiv_control_standard_new(VALUE klass, VALUE epsabs,
|
457
|
+
VALUE epsrel,
|
458
|
+
VALUE ay, VALUE adydt)
|
466
459
|
{
|
467
460
|
gsl_odeiv_control *c = NULL;
|
468
|
-
c = make_control_standard(epsabs, epsrel, ay, adydt);
|
461
|
+
c = make_control_standard(epsabs, epsrel, ay, adydt);
|
469
462
|
return Data_Wrap_Struct(klass, 0, gsl_odeiv_control_free, c);
|
470
463
|
}
|
471
464
|
|
472
|
-
static gsl_odeiv_control* make_control_standard(VALUE epsabs,
|
473
|
-
|
474
|
-
|
465
|
+
static gsl_odeiv_control* make_control_standard(VALUE epsabs,
|
466
|
+
VALUE epsrel,
|
467
|
+
VALUE ay, VALUE adydt)
|
475
468
|
{
|
476
469
|
Need_Float(epsabs); Need_Float(epsrel);
|
477
470
|
Need_Float(ay); Need_Float(adydt);
|
478
|
-
return gsl_odeiv_control_standard_new(NUM2DBL(epsabs), NUM2DBL(epsrel),
|
479
|
-
|
471
|
+
return gsl_odeiv_control_standard_new(NUM2DBL(epsabs), NUM2DBL(epsrel),
|
472
|
+
NUM2DBL(ay), NUM2DBL(adydt));
|
480
473
|
}
|
481
474
|
|
482
475
|
static gsl_odeiv_control* make_control_y(VALUE epsabs, VALUE epsrel)
|
@@ -485,16 +478,16 @@ static gsl_odeiv_control* make_control_y(VALUE epsabs, VALUE epsrel)
|
|
485
478
|
return gsl_odeiv_control_y_new(NUM2DBL(epsabs), NUM2DBL(epsrel));
|
486
479
|
}
|
487
480
|
|
488
|
-
static VALUE rb_gsl_odeiv_control_y_new(VALUE klass, VALUE epsabs,
|
489
|
-
|
481
|
+
static VALUE rb_gsl_odeiv_control_y_new(VALUE klass, VALUE epsabs,
|
482
|
+
VALUE epsrel)
|
490
483
|
{
|
491
484
|
gsl_odeiv_control *c = NULL;
|
492
485
|
c = make_control_y(epsabs, epsrel);
|
493
486
|
return Data_Wrap_Struct(klass, 0, gsl_odeiv_control_free, c);
|
494
487
|
}
|
495
488
|
|
496
|
-
static VALUE rb_gsl_odeiv_control_yp_new(VALUE klass, VALUE epsabs,
|
497
|
-
|
489
|
+
static VALUE rb_gsl_odeiv_control_yp_new(VALUE klass, VALUE epsabs,
|
490
|
+
VALUE epsrel)
|
498
491
|
{
|
499
492
|
gsl_odeiv_control *c = NULL;
|
500
493
|
Need_Float(epsabs); Need_Float(epsrel);
|
@@ -502,11 +495,10 @@ static VALUE rb_gsl_odeiv_control_yp_new(VALUE klass, VALUE epsabs,
|
|
502
495
|
return Data_Wrap_Struct(klass, 0, gsl_odeiv_control_free, c);
|
503
496
|
}
|
504
497
|
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
VALUE sc, VALUE dd)
|
498
|
+
static VALUE rb_gsl_odeiv_control_scaled_new(VALUE klass, VALUE epsabs,
|
499
|
+
VALUE epsrel,
|
500
|
+
VALUE ay, VALUE adydt,
|
501
|
+
VALUE sc, VALUE dd)
|
510
502
|
{
|
511
503
|
gsl_odeiv_control *c = NULL;
|
512
504
|
gsl_vector *v = NULL;
|
@@ -515,23 +507,22 @@ static VALUE rb_gsl_odeiv_control_scaled_new(VALUE klass, VALUE epsabs,
|
|
515
507
|
CHECK_FIXNUM(dd);
|
516
508
|
CHECK_VECTOR(sc);
|
517
509
|
Data_Get_Struct(sc, gsl_vector, v);
|
518
|
-
c = gsl_odeiv_control_scaled_new(NUM2DBL(epsabs), NUM2DBL(epsrel),
|
519
|
-
|
520
|
-
|
510
|
+
c = gsl_odeiv_control_scaled_new(NUM2DBL(epsabs), NUM2DBL(epsrel),
|
511
|
+
NUM2DBL(ay), NUM2DBL(adydt), v->data,
|
512
|
+
FIX2INT(dd));
|
521
513
|
return Data_Wrap_Struct(klass, 0, gsl_odeiv_control_free, c);
|
522
514
|
}
|
523
|
-
#endif
|
524
515
|
|
525
|
-
static VALUE rb_gsl_odeiv_control_init(VALUE obj, VALUE epsabs,
|
526
|
-
|
527
|
-
|
516
|
+
static VALUE rb_gsl_odeiv_control_init(VALUE obj, VALUE epsabs,
|
517
|
+
VALUE epsrel,
|
518
|
+
VALUE ay, VALUE adydt)
|
528
519
|
{
|
529
520
|
gsl_odeiv_control *c = NULL;
|
530
521
|
Need_Float(epsabs); Need_Float(epsrel);
|
531
522
|
Need_Float(ay); Need_Float(adydt);
|
532
523
|
Data_Get_Struct(obj, gsl_odeiv_control, c);
|
533
|
-
gsl_odeiv_control_init(c, NUM2DBL(epsabs), NUM2DBL(epsrel),
|
534
|
-
|
524
|
+
gsl_odeiv_control_init(c, NUM2DBL(epsabs), NUM2DBL(epsrel),
|
525
|
+
NUM2DBL(ay), NUM2DBL(adydt));
|
535
526
|
return obj;
|
536
527
|
}
|
537
528
|
|
@@ -543,7 +534,7 @@ static VALUE rb_gsl_odeiv_control_name(VALUE obj)
|
|
543
534
|
}
|
544
535
|
|
545
536
|
static VALUE rb_gsl_odeiv_control_hadjust(VALUE obj, VALUE ss, VALUE yy0,
|
546
|
-
|
537
|
+
VALUE yyerr, VALUE ddydt, VALUE hh)
|
547
538
|
{
|
548
539
|
gsl_odeiv_control *c = NULL;
|
549
540
|
gsl_odeiv_step *s = NULL;
|
@@ -559,13 +550,13 @@ static VALUE rb_gsl_odeiv_control_hadjust(VALUE obj, VALUE ss, VALUE yy0,
|
|
559
550
|
Data_Get_Struct(yyerr, gsl_vector, yerr);
|
560
551
|
Data_Get_Struct(ddydt, gsl_vector, dydt);
|
561
552
|
h = NUM2DBL(hh);
|
562
|
-
status = gsl_odeiv_control_hadjust(c, s, y0->data, yerr->data,
|
563
|
-
|
553
|
+
status = gsl_odeiv_control_hadjust(c, s, y0->data, yerr->data,
|
554
|
+
dydt->data, &h);
|
564
555
|
return rb_ary_new3(2, rb_float_new(h), INT2FIX(status));
|
565
556
|
}
|
566
557
|
|
567
558
|
static gsl_odeiv_evolve* make_evolve(VALUE dim);
|
568
|
-
static VALUE rb_gsl_odeiv_evolve_new(VALUE klass, VALUE dim)
|
559
|
+
static VALUE rb_gsl_odeiv_evolve_new(VALUE klass, VALUE dim)
|
569
560
|
{
|
570
561
|
gsl_odeiv_evolve *e = NULL;
|
571
562
|
e = make_evolve(dim);
|
@@ -639,7 +630,7 @@ static VALUE rb_gsl_odeiv_evolve_yerr(VALUE obj)
|
|
639
630
|
}
|
640
631
|
|
641
632
|
static VALUE rb_gsl_odeiv_evolve_apply(VALUE obj, VALUE cc, VALUE ss, VALUE sss,
|
642
|
-
|
633
|
+
VALUE tt, VALUE tt1, VALUE hh, VALUE yy)
|
643
634
|
{
|
644
635
|
gsl_odeiv_evolve *e = NULL;
|
645
636
|
gsl_odeiv_control *c = NULL;
|
@@ -654,7 +645,7 @@ static VALUE rb_gsl_odeiv_evolve_apply(VALUE obj, VALUE cc, VALUE ss, VALUE sss,
|
|
654
645
|
if (NIL_P(cc)) {
|
655
646
|
c = NULL;
|
656
647
|
} else {
|
657
|
-
CHECK_CONTROL(cc);
|
648
|
+
CHECK_CONTROL(cc);
|
658
649
|
Data_Get_Struct(cc, gsl_odeiv_control, c);
|
659
650
|
}
|
660
651
|
Data_Get_Struct(ss, gsl_odeiv_step, s);
|
@@ -788,8 +779,8 @@ static VALUE rb_gsl_odeiv_solver_set_sys(VALUE obj, VALUE ss)
|
|
788
779
|
return obj;
|
789
780
|
}
|
790
781
|
|
791
|
-
static VALUE rb_gsl_odeiv_solver_apply(VALUE obj, VALUE tt, VALUE tt1, VALUE hh,
|
792
|
-
|
782
|
+
static VALUE rb_gsl_odeiv_solver_apply(VALUE obj, VALUE tt, VALUE tt1, VALUE hh,
|
783
|
+
VALUE yy)
|
793
784
|
{
|
794
785
|
gsl_odeiv_solver *gos = NULL;
|
795
786
|
gsl_vector *y = NULL;
|
@@ -803,8 +794,8 @@ static VALUE rb_gsl_odeiv_solver_apply(VALUE obj, VALUE tt, VALUE tt1, VALUE hh,
|
|
803
794
|
if (TYPE(hh) != T_FLOAT) rb_raise(rb_eTypeError, "argument 2 Float expected");*/
|
804
795
|
t = NUM2DBL(tt);
|
805
796
|
h = NUM2DBL(hh);
|
806
|
-
status = gsl_odeiv_evolve_apply(gos->e, gos->c, gos->s,
|
807
|
-
|
797
|
+
status = gsl_odeiv_evolve_apply(gos->e, gos->c, gos->s,
|
798
|
+
gos->sys, &t, NUM2DBL(tt1), &h, y->data);
|
808
799
|
/* RFLOAT(tt)->value = t;
|
809
800
|
RFLOAT(hh)->value = h;
|
810
801
|
return INT2FIX(status);*/
|
@@ -836,8 +827,8 @@ static VALUE rb_gsl_odeiv_solver_set_params(int argc, VALUE *argv, VALUE obj)
|
|
836
827
|
{
|
837
828
|
gsl_odeiv_solver *gos = NULL;
|
838
829
|
Data_Get_Struct(obj, gsl_odeiv_solver, gos);
|
839
|
-
rb_gsl_odeiv_system_set_params(argc, argv,
|
840
|
-
|
830
|
+
rb_gsl_odeiv_system_set_params(argc, argv,
|
831
|
+
Data_Wrap_Struct(cgsl_odeiv_system, 0, NULL, gos->sys));
|
841
832
|
return obj;
|
842
833
|
}
|
843
834
|
|
@@ -857,8 +848,8 @@ void Init_gsl_odeiv(VALUE module)
|
|
857
848
|
rb_define_const(mgsl_odeiv, "HADJ_DEC", INT2FIX(GSL_ODEIV_HADJ_DEC));
|
858
849
|
rb_define_const(mgsl_odeiv, "HADJ_INC", INT2FIX(GSL_ODEIV_HADJ_INC));
|
859
850
|
rb_define_const(mgsl_odeiv, "HADJ_NIL", INT2FIX(GSL_ODEIV_HADJ_NIL));
|
860
|
-
cgsl_odeiv_step = rb_define_class_under(mgsl_odeiv, "Step",
|
861
|
-
|
851
|
+
cgsl_odeiv_step = rb_define_class_under(mgsl_odeiv, "Step",
|
852
|
+
cGSL_Object);
|
862
853
|
rb_define_singleton_method(cgsl_odeiv_step, "alloc", rb_gsl_odeiv_step_new, -1);
|
863
854
|
|
864
855
|
/*****/
|
@@ -885,23 +876,21 @@ void Init_gsl_odeiv(VALUE module)
|
|
885
876
|
|
886
877
|
/****/
|
887
878
|
|
888
|
-
cgsl_odeiv_control = rb_define_class_under(mgsl_odeiv, "Control",
|
889
|
-
|
879
|
+
cgsl_odeiv_control = rb_define_class_under(mgsl_odeiv, "Control",
|
880
|
+
cGSL_Object);
|
890
881
|
rb_define_singleton_method(cgsl_odeiv_control, "alloc", rb_gsl_odeiv_control_standard_new, 4);
|
891
882
|
rb_define_singleton_method(cgsl_odeiv_control, "standard_alloc", rb_gsl_odeiv_control_standard_new, 4);
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
rb_define_singleton_method(cgsl_odeiv_control, "scaled_alloc", rb_gsl_odeiv_control_scaled_new, 5);
|
896
|
-
#endif
|
883
|
+
rb_define_singleton_method(cgsl_odeiv_control, "y_new", rb_gsl_odeiv_control_y_new, 2);
|
884
|
+
rb_define_singleton_method(cgsl_odeiv_control, "yp_new", rb_gsl_odeiv_control_yp_new, 2);
|
885
|
+
rb_define_singleton_method(cgsl_odeiv_control, "scaled_alloc", rb_gsl_odeiv_control_scaled_new, 5);
|
897
886
|
|
898
887
|
rb_define_method(cgsl_odeiv_control, "init", rb_gsl_odeiv_control_init, 4);
|
899
888
|
rb_define_method(cgsl_odeiv_control, "name", rb_gsl_odeiv_control_name, 0);
|
900
889
|
rb_define_method(cgsl_odeiv_control, "hadjust", rb_gsl_odeiv_control_hadjust, 5);
|
901
890
|
|
902
|
-
|
903
|
-
cgsl_odeiv_evolve = rb_define_class_under(mgsl_odeiv, "Evolve",
|
904
|
-
|
891
|
+
/****/
|
892
|
+
cgsl_odeiv_evolve = rb_define_class_under(mgsl_odeiv, "Evolve",
|
893
|
+
cGSL_Object);
|
905
894
|
rb_define_singleton_method(cgsl_odeiv_evolve, "alloc", rb_gsl_odeiv_evolve_new, 1);
|
906
895
|
|
907
896
|
rb_define_method(cgsl_odeiv_evolve, "reset", rb_gsl_odeiv_evolve_reset, 0);
|
@@ -914,19 +903,19 @@ void Init_gsl_odeiv(VALUE module)
|
|
914
903
|
rb_define_method(cgsl_odeiv_evolve, "yerr", rb_gsl_odeiv_evolve_yerr, 0);
|
915
904
|
/*****/
|
916
905
|
|
917
|
-
cgsl_odeiv_system = rb_define_class_under(mgsl_odeiv, "System",
|
918
|
-
|
906
|
+
cgsl_odeiv_system = rb_define_class_under(mgsl_odeiv, "System",
|
907
|
+
cGSL_Object);
|
919
908
|
rb_define_singleton_method(cgsl_odeiv_system, "alloc", rb_gsl_odeiv_system_new, -1);
|
920
909
|
rb_define_method(cgsl_odeiv_system, "set", rb_gsl_odeiv_system_set, -1);
|
921
|
-
rb_define_method(cgsl_odeiv_system, "set_params",
|
922
|
-
|
923
|
-
rb_define_method(cgsl_odeiv_system, "params",
|
924
|
-
|
925
|
-
rb_define_method(cgsl_odeiv_system, "function",
|
926
|
-
|
910
|
+
rb_define_method(cgsl_odeiv_system, "set_params",
|
911
|
+
rb_gsl_odeiv_system_set_params, -1);
|
912
|
+
rb_define_method(cgsl_odeiv_system, "params",
|
913
|
+
rb_gsl_odeiv_system_params, 0);
|
914
|
+
rb_define_method(cgsl_odeiv_system, "function",
|
915
|
+
rb_gsl_odeiv_system_function, 0);
|
927
916
|
rb_define_alias(cgsl_odeiv_system, "func", "function");
|
928
|
-
rb_define_method(cgsl_odeiv_system, "jacobian",
|
929
|
-
|
917
|
+
rb_define_method(cgsl_odeiv_system, "jacobian",
|
918
|
+
rb_gsl_odeiv_system_jacobian, 0);
|
930
919
|
rb_define_alias(cgsl_odeiv_system, "jac", "jacobian");
|
931
920
|
rb_define_method(cgsl_odeiv_system, "dimension", rb_gsl_odeiv_system_dimension, 0);
|
932
921
|
rb_define_alias(cgsl_odeiv_system, "dim", "dimension");
|