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
@@ -31,9 +31,9 @@ int rb_gsl_comparison_complex(const void *aa, const void *bb)
|
|
31
31
|
gsl_complex *a = NULL, *b = NULL;
|
32
32
|
a = (gsl_complex *) aa;
|
33
33
|
b = (gsl_complex *) bb;
|
34
|
-
return FIX2INT(rb_funcall(rb_block_proc(), RBGSL_ID_call, 2,
|
35
|
-
|
36
|
-
|
34
|
+
return FIX2INT(rb_funcall(rb_block_proc(), RBGSL_ID_call, 2,
|
35
|
+
Data_Wrap_Struct(cgsl_complex, 0, NULL, a),
|
36
|
+
Data_Wrap_Struct(cgsl_complex, 0, NULL, b)));
|
37
37
|
}
|
38
38
|
|
39
39
|
static VALUE rb_gsl_heapsort_vector(VALUE obj)
|
@@ -141,7 +141,6 @@ static VALUE rb_gsl_heapsort_index(VALUE obj, VALUE vv)
|
|
141
141
|
/*****/
|
142
142
|
|
143
143
|
#ifdef HAVE_NARRAY_H
|
144
|
-
#include "narray.h"
|
145
144
|
static VALUE rb_gsl_sort_narray(VALUE obj)
|
146
145
|
{
|
147
146
|
struct NARRAY *na;
|
@@ -33,10 +33,10 @@ static VALUE rb_gsl_spline_new(int argc, VALUE *argv, VALUE klass)
|
|
33
33
|
break;
|
34
34
|
default:
|
35
35
|
if (ptrx == NULL) {
|
36
|
-
|
36
|
+
ptrx = get_vector_ptr(argv[i], &stride, &sizex);
|
37
37
|
} else {
|
38
|
-
|
39
|
-
|
38
|
+
ptry = get_vector_ptr(argv[i], &stride, &sizey);
|
39
|
+
size = GSL_MIN_INT(sizex, sizey);
|
40
40
|
}
|
41
41
|
break;
|
42
42
|
}
|
@@ -65,9 +65,6 @@ static VALUE rb_gsl_spline_init(VALUE obj, VALUE xxa, VALUE yya)
|
|
65
65
|
size_t i, size;
|
66
66
|
int flagx = 0, flagy = 0;
|
67
67
|
double *ptr1 = NULL, *ptr2 = NULL;
|
68
|
-
#ifdef HAVE_NARRAY_H
|
69
|
-
struct NARRAY *nax = NULL, *nay = NULL;
|
70
|
-
#endif
|
71
68
|
Data_Get_Struct(obj, rb_gsl_spline, sp);
|
72
69
|
p = sp->s;
|
73
70
|
if (TYPE(xxa) == T_ARRAY) {
|
@@ -83,9 +80,10 @@ static VALUE rb_gsl_spline_init(VALUE obj, VALUE xxa, VALUE yya)
|
|
83
80
|
ptr1 = xa->data;
|
84
81
|
#ifdef HAVE_NARRAY_H
|
85
82
|
} else if (NA_IsNArray(xxa)) {
|
86
|
-
|
87
|
-
|
88
|
-
|
83
|
+
struct NARRAY *nax = NULL;
|
84
|
+
GetNArray(xxa, nax);
|
85
|
+
size = nax->total;
|
86
|
+
ptr1 = (double *) nax->ptr;
|
89
87
|
#endif
|
90
88
|
} else {
|
91
89
|
rb_raise(rb_eTypeError, "not a vector");
|
@@ -97,8 +95,9 @@ static VALUE rb_gsl_spline_init(VALUE obj, VALUE xxa, VALUE yya)
|
|
97
95
|
flagy = 1;
|
98
96
|
#ifdef HAVE_NARRAY_H
|
99
97
|
} else if (NA_IsNArray(yya)) {
|
100
|
-
|
101
|
-
|
98
|
+
struct NARRAY *nay = NULL;
|
99
|
+
GetNArray(yya, nay);
|
100
|
+
ptr2 = (double *) nay->ptr;
|
102
101
|
#endif
|
103
102
|
} else if (VECTOR_P(yya)) {
|
104
103
|
Data_Get_Struct(yya, gsl_vector, ya);
|
@@ -120,8 +119,8 @@ static VALUE rb_gsl_spline_accel(VALUE obj)
|
|
120
119
|
}
|
121
120
|
|
122
121
|
static VALUE rb_gsl_spline_evaluate(VALUE obj, VALUE xx,
|
123
|
-
|
124
|
-
|
122
|
+
double (*eval)(const gsl_spline *, double,
|
123
|
+
gsl_interp_accel *))
|
125
124
|
{
|
126
125
|
rb_gsl_spline *rgs = NULL;
|
127
126
|
gsl_vector *v = NULL, *vnew = NULL;
|
@@ -129,10 +128,6 @@ static VALUE rb_gsl_spline_evaluate(VALUE obj, VALUE xx,
|
|
129
128
|
VALUE ary, x;
|
130
129
|
double val;
|
131
130
|
size_t n, i, j;
|
132
|
-
#ifdef HAVE_NARRAY_H
|
133
|
-
double *ptr1 = NULL, *ptr2 = NULL;
|
134
|
-
struct NARRAY *na = NULL;
|
135
|
-
#endif
|
136
131
|
Data_Get_Struct(obj, rb_gsl_spline, rgs);
|
137
132
|
if (CLASS_OF(xx) == rb_cRange) xx = rb_gsl_range2ary(xx);
|
138
133
|
switch (TYPE(xx)) {
|
@@ -155,13 +150,15 @@ static VALUE rb_gsl_spline_evaluate(VALUE obj, VALUE xx,
|
|
155
150
|
default:
|
156
151
|
#ifdef HAVE_NARRAY_H
|
157
152
|
if (NA_IsNArray(xx)) {
|
153
|
+
double *ptr1 = NULL, *ptr2 = NULL;
|
154
|
+
struct NARRAY *na = NULL;
|
158
155
|
GetNArray(xx, na);
|
159
156
|
ptr1 = (double *) na->ptr;
|
160
157
|
n = na->total;
|
161
158
|
ary = na_make_object(NA_DFLOAT, na->rank, na->shape, CLASS_OF(xx));
|
162
159
|
ptr2 = NA_PTR_TYPE(ary, double*);
|
163
|
-
for (i = 0; i < n; i++)
|
164
|
-
|
160
|
+
for (i = 0; i < n; i++)
|
161
|
+
ptr2[i] = (*eval)(rgs->s, ptr1[i], rgs->a);
|
165
162
|
return ary;
|
166
163
|
}
|
167
164
|
#endif
|
@@ -169,18 +166,18 @@ static VALUE rb_gsl_spline_evaluate(VALUE obj, VALUE xx,
|
|
169
166
|
Data_Get_Struct(xx, gsl_vector, v);
|
170
167
|
vnew = gsl_vector_alloc(v->size);
|
171
168
|
for (i = 0; i < v->size; i++) {
|
172
|
-
|
173
|
-
|
169
|
+
val = (*eval)(rgs->s, gsl_vector_get(v, i), rgs->a);
|
170
|
+
gsl_vector_set(vnew, i, val);
|
174
171
|
}
|
175
172
|
return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, vnew);
|
176
173
|
} else if (MATRIX_P(xx)) {
|
177
174
|
Data_Get_Struct(xx, gsl_matrix, m);
|
178
175
|
mnew = gsl_matrix_alloc(m->size1, m->size2);
|
179
176
|
for (i = 0; i < m->size1; i++) {
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
177
|
+
for (j = 0; j < m->size2; j++) {
|
178
|
+
val = (*eval)(rgs->s, gsl_matrix_get(m, i, j), rgs->a);
|
179
|
+
gsl_matrix_set(mnew, i, j, val);
|
180
|
+
}
|
184
181
|
}
|
185
182
|
return Data_Wrap_Struct(cgsl_matrix, 0, gsl_matrix_free, mnew);
|
186
183
|
} else {
|
@@ -270,7 +267,7 @@ static VALUE rb_gsl_spline_eval_deriv_e(VALUE obj, VALUE xx)
|
|
270
267
|
default:
|
271
268
|
return rb_float_new(val);
|
272
269
|
break;
|
273
|
-
}
|
270
|
+
}
|
274
271
|
return Qnil;
|
275
272
|
}
|
276
273
|
|
@@ -289,7 +286,7 @@ static VALUE rb_gsl_spline_eval_deriv2_e(VALUE obj, VALUE xx)
|
|
289
286
|
default:
|
290
287
|
return rb_float_new(val);
|
291
288
|
break;
|
292
|
-
}
|
289
|
+
}
|
293
290
|
return Qnil;
|
294
291
|
}
|
295
292
|
|
@@ -308,7 +305,7 @@ static VALUE rb_gsl_spline_eval_integ_e(VALUE obj, VALUE a, VALUE b)
|
|
308
305
|
default:
|
309
306
|
return rb_float_new(val);
|
310
307
|
break;
|
311
|
-
}
|
308
|
+
}
|
312
309
|
return Qnil;
|
313
310
|
}
|
314
311
|
|
@@ -326,7 +323,6 @@ static VALUE rb_gsl_spline_info(VALUE obj)
|
|
326
323
|
return rb_str_new2(buf);
|
327
324
|
}
|
328
325
|
|
329
|
-
#ifdef GSL_1_8_LATER
|
330
326
|
static VALUE rb_gsl_spline_name(VALUE obj)
|
331
327
|
{
|
332
328
|
rb_gsl_spline *p = NULL;
|
@@ -340,17 +336,6 @@ static VALUE rb_gsl_spline_min_size(VALUE obj)
|
|
340
336
|
return UINT2NUM(gsl_spline_min_size(sp->s));
|
341
337
|
}
|
342
338
|
|
343
|
-
#else
|
344
|
-
|
345
|
-
static VALUE rb_gsl_spline_name(VALUE obj)
|
346
|
-
{
|
347
|
-
rb_gsl_spline *sp = NULL;
|
348
|
-
Data_Get_Struct(obj, rb_gsl_spline, sp);
|
349
|
-
return rb_str_new2(gsl_interp_name(sp->s->interp));
|
350
|
-
}
|
351
|
-
|
352
|
-
#endif
|
353
|
-
|
354
339
|
void Init_gsl_spline(VALUE module)
|
355
340
|
{
|
356
341
|
VALUE cgsl_spline;
|
@@ -388,8 +373,5 @@ void Init_gsl_spline(VALUE module)
|
|
388
373
|
|
389
374
|
rb_define_method(cgsl_spline, "info", rb_gsl_spline_info, 0);
|
390
375
|
|
391
|
-
#ifdef GSL_1_8_LATER
|
392
376
|
rb_define_method(cgsl_spline, "min_size", rb_gsl_spline_min_size, 0);
|
393
|
-
#endif
|
394
|
-
|
395
377
|
}
|
@@ -11,12 +11,9 @@
|
|
11
11
|
|
12
12
|
#include "include/rb_gsl_array.h"
|
13
13
|
#include "include/rb_gsl_statistics.h"
|
14
|
-
#ifdef HAVE_NARRAY_H
|
15
|
-
#include "narray.h"
|
16
|
-
#endif
|
17
14
|
|
18
|
-
static double* get_vector_stats2(int argc, VALUE *argv, VALUE obj,
|
19
|
-
|
15
|
+
static double* get_vector_stats2(int argc, VALUE *argv, VALUE obj,
|
16
|
+
size_t *stride, size_t *size)
|
20
17
|
{
|
21
18
|
double *v = NULL;
|
22
19
|
switch (TYPE(obj)) {
|
@@ -32,7 +29,7 @@ static double* get_vector_stats2(int argc, VALUE *argv, VALUE obj,
|
|
32
29
|
}
|
33
30
|
|
34
31
|
static VALUE rb_gsl_stats_XXX(int argc, VALUE *argv, VALUE obj,
|
35
|
-
|
32
|
+
double (*f)(const double*, size_t, size_t))
|
36
33
|
{
|
37
34
|
size_t stride, size;
|
38
35
|
double *data = NULL;
|
@@ -40,8 +37,8 @@ static VALUE rb_gsl_stats_XXX(int argc, VALUE *argv, VALUE obj,
|
|
40
37
|
return rb_float_new((*f)(data, stride, size));
|
41
38
|
}
|
42
39
|
|
43
|
-
static VALUE rb_gsl_stats_XXX1(int argc, VALUE *argv, VALUE obj,
|
44
|
-
|
40
|
+
static VALUE rb_gsl_stats_XXX1(int argc, VALUE *argv, VALUE obj,
|
41
|
+
double (*f)(const double*, size_t, size_t, double))
|
45
42
|
{
|
46
43
|
size_t stride, size;
|
47
44
|
double *data = NULL;
|
@@ -50,9 +47,9 @@ static VALUE rb_gsl_stats_XXX1(int argc, VALUE *argv, VALUE obj,
|
|
50
47
|
return rb_float_new((*f)(data, stride, size, NUM2DBL(argv[argc-1])));
|
51
48
|
}
|
52
49
|
|
53
|
-
static VALUE rb_gsl_stats_XXX2(int argc, VALUE *argv, VALUE obj,
|
54
|
-
|
55
|
-
|
50
|
+
static VALUE rb_gsl_stats_XXX2(int argc, VALUE *argv, VALUE obj,
|
51
|
+
double (*f)(const double*, size_t, size_t),
|
52
|
+
double (*fm)(const double*, size_t, size_t, double, double))
|
56
53
|
{
|
57
54
|
double x, a, b, *data = NULL;
|
58
55
|
size_t stride, size;
|
@@ -69,8 +66,8 @@ static VALUE rb_gsl_stats_XXX2(int argc, VALUE *argv, VALUE obj,
|
|
69
66
|
x = (*f)(data, stride, size);
|
70
67
|
break;
|
71
68
|
default:
|
72
|
-
rb_raise(rb_eArgError,
|
73
|
-
|
69
|
+
rb_raise(rb_eArgError,
|
70
|
+
"wrong number of arguments (%d for 1 or 2)", argc);
|
74
71
|
break;
|
75
72
|
}
|
76
73
|
break;
|
@@ -86,8 +83,8 @@ static VALUE rb_gsl_stats_XXX2(int argc, VALUE *argv, VALUE obj,
|
|
86
83
|
x = (*fm)(data, stride, size, a, b);
|
87
84
|
break;
|
88
85
|
default:
|
89
|
-
rb_raise(rb_eArgError,
|
90
|
-
|
86
|
+
rb_raise(rb_eArgError,
|
87
|
+
"wrong number of arguments (%d for 0 or 1)", argc);
|
91
88
|
break;
|
92
89
|
}
|
93
90
|
break;
|
@@ -101,8 +98,8 @@ static VALUE rb_gsl_stats_mean(int argc, VALUE *argv, VALUE obj)
|
|
101
98
|
}
|
102
99
|
|
103
100
|
static VALUE rb_gsl_stats_XXX_m(int argc, VALUE *argv, VALUE obj,
|
104
|
-
|
105
|
-
|
101
|
+
double (*f)(const double*, size_t, size_t),
|
102
|
+
double (*fm)(const double*, size_t, size_t, double))
|
106
103
|
{
|
107
104
|
double x, mean, *data = NULL;
|
108
105
|
size_t stride, size;
|
@@ -119,8 +116,8 @@ static VALUE rb_gsl_stats_XXX_m(int argc, VALUE *argv, VALUE obj,
|
|
119
116
|
x = (*f)(data, stride, size);
|
120
117
|
break;
|
121
118
|
default:
|
122
|
-
rb_raise(rb_eArgError,
|
123
|
-
|
119
|
+
rb_raise(rb_eArgError,
|
120
|
+
"wrong number of arguments (%d for 1 or 2)", argc);
|
124
121
|
break;
|
125
122
|
}
|
126
123
|
break;
|
@@ -136,8 +133,8 @@ static VALUE rb_gsl_stats_XXX_m(int argc, VALUE *argv, VALUE obj,
|
|
136
133
|
x = (*fm)(data, stride, size, mean);
|
137
134
|
break;
|
138
135
|
default:
|
139
|
-
rb_raise(rb_eArgError,
|
140
|
-
|
136
|
+
rb_raise(rb_eArgError,
|
137
|
+
"wrong number of arguments (%d for 0 or 1)", argc);
|
141
138
|
break;
|
142
139
|
}
|
143
140
|
break;
|
@@ -148,70 +145,68 @@ static VALUE rb_gsl_stats_XXX_m(int argc, VALUE *argv, VALUE obj,
|
|
148
145
|
static VALUE rb_gsl_stats_variance_m(int argc, VALUE *argv, VALUE obj)
|
149
146
|
{
|
150
147
|
return rb_gsl_stats_XXX_m(argc, argv, obj,
|
151
|
-
|
148
|
+
gsl_stats_variance, gsl_stats_variance_m);
|
152
149
|
}
|
153
150
|
|
154
151
|
static VALUE rb_gsl_stats_sd_m(int argc, VALUE *argv, VALUE obj)
|
155
152
|
{
|
156
153
|
return rb_gsl_stats_XXX_m(argc, argv, obj,
|
157
|
-
|
154
|
+
gsl_stats_sd, gsl_stats_sd_m);
|
158
155
|
}
|
159
156
|
|
160
|
-
#ifdef GSL_1_11_LATER
|
161
157
|
static VALUE rb_gsl_stats_tss_m(int argc, VALUE *argv, VALUE obj)
|
162
158
|
{
|
163
159
|
return rb_gsl_stats_XXX_m(argc, argv, obj,
|
164
|
-
|
160
|
+
gsl_stats_tss, gsl_stats_tss_m);
|
165
161
|
}
|
166
|
-
#endif
|
167
162
|
|
168
|
-
static VALUE rb_gsl_stats_variance_with_fixed_mean(int argc, VALUE *argv,
|
169
|
-
|
163
|
+
static VALUE rb_gsl_stats_variance_with_fixed_mean(int argc, VALUE *argv,
|
164
|
+
VALUE obj)
|
170
165
|
{
|
171
166
|
return rb_gsl_stats_XXX1(argc, argv, obj,
|
172
|
-
|
167
|
+
gsl_stats_variance_with_fixed_mean);
|
173
168
|
}
|
174
169
|
|
175
|
-
static VALUE rb_gsl_stats_sd_with_fixed_mean(int argc, VALUE *argv,
|
176
|
-
|
170
|
+
static VALUE rb_gsl_stats_sd_with_fixed_mean(int argc, VALUE *argv,
|
171
|
+
VALUE obj)
|
177
172
|
{
|
178
173
|
return rb_gsl_stats_XXX1(argc, argv, obj,
|
179
|
-
|
174
|
+
gsl_stats_sd_with_fixed_mean);
|
180
175
|
}
|
181
176
|
|
182
177
|
static VALUE rb_gsl_stats_absdev_m(int argc, VALUE *argv, VALUE obj)
|
183
178
|
{
|
184
179
|
return rb_gsl_stats_XXX_m(argc, argv, obj,
|
185
|
-
|
180
|
+
gsl_stats_absdev, gsl_stats_absdev_m);
|
186
181
|
}
|
187
182
|
|
188
|
-
static VALUE rb_gsl_stats_skew(int argc, VALUE *argv,
|
189
|
-
|
183
|
+
static VALUE rb_gsl_stats_skew(int argc, VALUE *argv,
|
184
|
+
VALUE obj)
|
190
185
|
{
|
191
186
|
return rb_gsl_stats_XXX2(argc, argv, obj,
|
192
|
-
|
193
|
-
|
187
|
+
gsl_stats_skew,
|
188
|
+
gsl_stats_skew_m_sd);
|
194
189
|
}
|
195
190
|
|
196
|
-
static VALUE rb_gsl_stats_kurtosis(int argc, VALUE *argv,
|
197
|
-
|
191
|
+
static VALUE rb_gsl_stats_kurtosis(int argc, VALUE *argv,
|
192
|
+
VALUE obj)
|
198
193
|
{
|
199
194
|
return rb_gsl_stats_XXX2(argc, argv, obj,
|
200
|
-
|
201
|
-
|
195
|
+
gsl_stats_kurtosis,
|
196
|
+
gsl_stats_kurtosis_m_sd);
|
202
197
|
}
|
203
198
|
|
204
199
|
static VALUE rb_gsl_stats_lag1_autocorrelation(int argc, VALUE *argv, VALUE obj)
|
205
200
|
{
|
206
201
|
return rb_gsl_stats_XXX_m(argc, argv, obj,
|
207
|
-
|
202
|
+
gsl_stats_lag1_autocorrelation, gsl_stats_lag1_autocorrelation_m);
|
208
203
|
}
|
209
204
|
|
210
205
|
/****************************/
|
211
206
|
|
212
|
-
static void get_vector_stats3(int argc, VALUE *argv, VALUE obj,
|
213
|
-
|
214
|
-
|
207
|
+
static void get_vector_stats3(int argc, VALUE *argv, VALUE obj,
|
208
|
+
double **w, size_t *stridew, size_t *sizew,
|
209
|
+
double **x, size_t *stridex, size_t *sizex)
|
215
210
|
{
|
216
211
|
switch (TYPE(obj)) {
|
217
212
|
case T_MODULE: case T_CLASS: case T_OBJECT:
|
@@ -228,8 +223,8 @@ static void get_vector_stats3(int argc, VALUE *argv, VALUE obj,
|
|
228
223
|
}
|
229
224
|
|
230
225
|
static VALUE rb_gsl_stats_wXXX(int argc, VALUE *argv, VALUE obj,
|
231
|
-
|
232
|
-
|
226
|
+
double (*f)(const double*, size_t, const double*,
|
227
|
+
size_t, size_t))
|
233
228
|
{
|
234
229
|
double *w, *x;
|
235
230
|
double mean;
|
@@ -240,8 +235,8 @@ static VALUE rb_gsl_stats_wXXX(int argc, VALUE *argv, VALUE obj,
|
|
240
235
|
}
|
241
236
|
|
242
237
|
static VALUE rb_gsl_stats_wXXX_m(int argc, VALUE *argv, VALUE obj,
|
243
|
-
|
244
|
-
|
238
|
+
double (*f)(const double*, size_t, const double*,
|
239
|
+
size_t, size_t, double))
|
245
240
|
{
|
246
241
|
double *w, *x;
|
247
242
|
double mean;
|
@@ -314,7 +309,7 @@ static VALUE rb_gsl_stats_wskew_m_sd(VALUE obj, VALUE ww, VALUE wm, VALUE wsd)
|
|
314
309
|
x = get_vector_ptr(obj, &stridex, &sizex);
|
315
310
|
w = get_vector_ptr(ww, &stridew, &sizew);
|
316
311
|
skew_m = gsl_stats_wskew_m_sd(w, stridew, x, stridex, sizex, NUM2DBL(wm),
|
317
|
-
|
312
|
+
NUM2DBL(wsd));
|
318
313
|
return rb_float_new(skew_m);
|
319
314
|
}
|
320
315
|
|
@@ -326,7 +321,7 @@ static VALUE rb_gsl_stats_wkurtosis_m_sd(VALUE obj, VALUE ww, VALUE wm, VALUE ws
|
|
326
321
|
x = get_vector_ptr(obj, &stridex, &sizex);
|
327
322
|
w = get_vector_ptr(ww, &stridew, &sizew);
|
328
323
|
kurtosis_m = gsl_stats_wkurtosis_m_sd(w, stridew, x, stridex, sizex, NUM2DBL(wm),
|
329
|
-
|
324
|
+
NUM2DBL(wsd));
|
330
325
|
return rb_float_new(kurtosis_m);
|
331
326
|
}
|
332
327
|
|
@@ -409,7 +404,7 @@ static VALUE rb_gsl_stats_median(int argc, VALUE *argv, VALUE obj)
|
|
409
404
|
static VALUE rb_gsl_stats_quantile_from_sorted_data(int argc, VALUE *argv, VALUE obj)
|
410
405
|
{
|
411
406
|
return rb_gsl_stats_XXX1(argc, argv, obj,
|
412
|
-
|
407
|
+
gsl_stats_quantile_from_sorted_data);
|
413
408
|
/* size_t stride, size;
|
414
409
|
double quantile, *data = NULL;
|
415
410
|
data = get_vector_ptr(obj, &stride, &size);
|
@@ -437,21 +432,20 @@ static VALUE rb_gsl_stats_covariance2(VALUE obj, VALUE vv1, VALUE vv2)
|
|
437
432
|
data1 = get_vector_ptr(vv1, &stride1, &size);
|
438
433
|
data2 = get_vector_ptr(vv2, &stride2, &size);
|
439
434
|
return rb_float_new(gsl_stats_covariance(data1, stride1, data2,
|
440
|
-
|
435
|
+
stride2, size));
|
441
436
|
}
|
442
437
|
|
443
438
|
static VALUE rb_gsl_stats_covariance_m2(VALUE obj, VALUE vv1, VALUE vv2,
|
444
|
-
|
439
|
+
VALUE m1, VALUE m2)
|
445
440
|
{
|
446
441
|
double *data1, *data2;
|
447
442
|
size_t stride1, stride2, size;
|
448
443
|
data1 = get_vector_ptr(vv1, &stride1, &size);
|
449
444
|
data2 = get_vector_ptr(vv2, &stride2, &size);
|
450
445
|
return rb_float_new(gsl_stats_covariance_m(data1, stride1, data2,
|
451
|
-
|
446
|
+
stride2, size, NUM2DBL(m1), NUM2DBL(m2)));
|
452
447
|
}
|
453
448
|
|
454
|
-
#ifdef GSL_1_10_LATER
|
455
449
|
static VALUE rb_gsl_stats_correlation(VALUE obj, VALUE vv1, VALUE vv2)
|
456
450
|
{
|
457
451
|
double *data1, *data2;
|
@@ -459,7 +453,7 @@ static VALUE rb_gsl_stats_correlation(VALUE obj, VALUE vv1, VALUE vv2)
|
|
459
453
|
data1 = get_vector_ptr(vv1, &stride1, &size);
|
460
454
|
data2 = get_vector_ptr(vv2, &stride2, &size);
|
461
455
|
return rb_float_new(gsl_stats_correlation(data1, stride1, data2,
|
462
|
-
|
456
|
+
stride2, size));
|
463
457
|
}
|
464
458
|
static VALUE rb_gsl_stats_pvariance(VALUE obj, VALUE vv1, VALUE vv2)
|
465
459
|
{
|
@@ -468,7 +462,7 @@ static VALUE rb_gsl_stats_pvariance(VALUE obj, VALUE vv1, VALUE vv2)
|
|
468
462
|
data1 = get_vector_ptr(vv1, &stride1, &size1);
|
469
463
|
data2 = get_vector_ptr(vv2, &stride2, &size2);
|
470
464
|
return rb_float_new(gsl_stats_pvariance(data1, stride1, size1, data2,
|
471
|
-
|
465
|
+
stride2, size2));
|
472
466
|
}
|
473
467
|
static VALUE rb_gsl_stats_ttest(VALUE obj, VALUE vv1, VALUE vv2)
|
474
468
|
{
|
@@ -477,9 +471,8 @@ static VALUE rb_gsl_stats_ttest(VALUE obj, VALUE vv1, VALUE vv2)
|
|
477
471
|
data1 = get_vector_ptr(vv1, &stride1, &size1);
|
478
472
|
data2 = get_vector_ptr(vv2, &stride2, &size2);
|
479
473
|
return rb_float_new(gsl_stats_ttest(data1, stride1, size1, data2,
|
480
|
-
|
474
|
+
stride2, size2));
|
481
475
|
}
|
482
|
-
#endif
|
483
476
|
|
484
477
|
static VALUE rb_gsl_stats_wmean2(VALUE obj, VALUE ww, VALUE dd)
|
485
478
|
{
|
@@ -535,8 +528,8 @@ static VALUE rb_gsl_stats_wsd_m2(VALUE obj, VALUE ww, VALUE dd, VALUE mm)
|
|
535
528
|
return rb_float_new(wsd);
|
536
529
|
}
|
537
530
|
|
538
|
-
static VALUE rb_gsl_stats_wvariance_with_fixed_mean2(VALUE obj, VALUE ww, VALUE dd,
|
539
|
-
|
531
|
+
static VALUE rb_gsl_stats_wvariance_with_fixed_mean2(VALUE obj, VALUE ww, VALUE dd,
|
532
|
+
VALUE mm)
|
540
533
|
{
|
541
534
|
double wvariance, m;
|
542
535
|
double *dataw = NULL, *data = NULL;
|
@@ -544,14 +537,14 @@ static VALUE rb_gsl_stats_wvariance_with_fixed_mean2(VALUE obj, VALUE ww, VALUE
|
|
544
537
|
dataw = get_vector_ptr(ww, &stridew, &size);
|
545
538
|
data = get_vector_ptr(dd, &strided, &size);
|
546
539
|
m = NUM2DBL(mm);
|
547
|
-
wvariance = gsl_stats_wvariance_with_fixed_mean(dataw, stridew,
|
548
|
-
|
540
|
+
wvariance = gsl_stats_wvariance_with_fixed_mean(dataw, stridew,
|
541
|
+
data, strided, size, m);
|
549
542
|
|
550
543
|
return rb_float_new(wvariance);
|
551
544
|
}
|
552
545
|
|
553
|
-
static VALUE rb_gsl_stats_wsd_with_fixed_mean2(VALUE obj, VALUE ww, VALUE dd,
|
554
|
-
|
546
|
+
static VALUE rb_gsl_stats_wsd_with_fixed_mean2(VALUE obj, VALUE ww, VALUE dd,
|
547
|
+
VALUE mm)
|
555
548
|
{
|
556
549
|
double wsd, m;
|
557
550
|
double *dataw = NULL, *data = NULL;
|
@@ -651,10 +644,8 @@ void Init_gsl_stats(VALUE module)
|
|
651
644
|
|
652
645
|
rb_define_singleton_method(mgsl_stats, "sd", rb_gsl_stats_sd_m, -1);
|
653
646
|
rb_define_singleton_method(mgsl_stats, "sd_m", rb_gsl_stats_sd_m, -1);
|
654
|
-
#ifdef GSL_1_11_LATER
|
655
647
|
rb_define_singleton_method(mgsl_stats, "tss", rb_gsl_stats_tss_m, -1);
|
656
648
|
rb_define_singleton_method(mgsl_stats, "tss_m", rb_gsl_stats_tss_m, -1);
|
657
|
-
#endif
|
658
649
|
rb_define_singleton_method(mgsl_stats, "sdev", rb_gsl_stats_sd_m, -1);
|
659
650
|
rb_define_singleton_method(mgsl_stats, "sigma", rb_gsl_stats_sd_m, -1);
|
660
651
|
rb_define_method(cgsl_vector, "stats_sd_m", rb_gsl_stats_sd_m, -1);
|
@@ -663,26 +654,24 @@ void Init_gsl_stats(VALUE module)
|
|
663
654
|
rb_define_alias(cgsl_vector, "sd", "stats_sd_m");
|
664
655
|
rb_define_alias(cgsl_vector, "sigma", "stats_sd_m");
|
665
656
|
rb_define_alias(cgsl_vector, "sdev", "stats_sd_m");
|
666
|
-
#ifdef GSL_1_11_LATER
|
667
657
|
rb_define_method(cgsl_vector, "stats_tss_m", rb_gsl_stats_tss_m, -1);
|
668
658
|
rb_define_alias(cgsl_vector, "stats_tss", "stats_tss_m");
|
669
659
|
rb_define_alias(cgsl_vector, "tss_m", "stats_tss_m");
|
670
660
|
rb_define_alias(cgsl_vector, "tss", "stats_tss_m");
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
"stats_sd_with_fixed_mean");
|
661
|
+
|
662
|
+
rb_define_singleton_method(mgsl_stats, "variance_with_fixed_mean",
|
663
|
+
rb_gsl_stats_variance_with_fixed_mean, -1);
|
664
|
+
rb_define_method(cgsl_vector, "stats_variance_with_fixed_mean",
|
665
|
+
rb_gsl_stats_variance_with_fixed_mean, -1);
|
666
|
+
rb_define_alias(cgsl_vector, "variance_with_fixed_mean",
|
667
|
+
"stats_variance_with_fixed_mean");
|
668
|
+
|
669
|
+
rb_define_singleton_method(mgsl_stats, "sd_with_fixed_mean",
|
670
|
+
rb_gsl_stats_sd_with_fixed_mean, -1);
|
671
|
+
rb_define_method(cgsl_vector, "stats_sd_with_fixed_mean",
|
672
|
+
rb_gsl_stats_sd_with_fixed_mean, -1);
|
673
|
+
rb_define_alias(cgsl_vector, "sd_with_fixed_mean",
|
674
|
+
"stats_sd_with_fixed_mean");
|
686
675
|
|
687
676
|
rb_define_singleton_method(mgsl_stats, "absdev", rb_gsl_stats_absdev_m, -1);
|
688
677
|
rb_define_singleton_method(mgsl_stats, "absdev_m", rb_gsl_stats_absdev_m, -1);
|
@@ -710,24 +699,22 @@ void Init_gsl_stats(VALUE module)
|
|
710
699
|
|
711
700
|
rb_define_singleton_method(mgsl_stats, "covariance", rb_gsl_stats_covariance2, 2);
|
712
701
|
rb_define_singleton_method(mgsl_stats, "covariance_m", rb_gsl_stats_covariance_m2, 4);
|
713
|
-
|
714
|
-
|
715
|
-
rb_define_singleton_method(mgsl_stats, "
|
716
|
-
rb_define_singleton_method(mgsl_stats, "
|
717
|
-
rb_define_singleton_method(mgsl_stats, "ttest", rb_gsl_stats_ttest, 2);
|
718
|
-
#endif
|
702
|
+
|
703
|
+
rb_define_singleton_method(mgsl_stats, "correlation", rb_gsl_stats_correlation, 2);
|
704
|
+
rb_define_singleton_method(mgsl_stats, "pvariance", rb_gsl_stats_pvariance, 2);
|
705
|
+
rb_define_singleton_method(mgsl_stats, "ttest", rb_gsl_stats_ttest, 2);
|
719
706
|
|
720
707
|
/*****/
|
721
|
-
|
708
|
+
|
722
709
|
rb_define_singleton_method(mgsl_stats, "wmean", rb_gsl_stats_wmean2, -1);
|
723
710
|
rb_define_singleton_method(mgsl_stats, "wvariance", rb_gsl_stats_wvariance2, -1);
|
724
711
|
rb_define_singleton_method(mgsl_stats, "wvariance_m", rb_gsl_stats_wvariance_m2, -1);
|
725
712
|
rb_define_singleton_method(mgsl_stats, "wsd", rb_gsl_stats_wsd2, -1);
|
726
713
|
rb_define_singleton_method(mgsl_stats, "wsd_m", rb_gsl_stats_wsd_m2, -1);
|
727
|
-
rb_define_singleton_method(mgsl_stats, "wvariance_with_fixed_mean",
|
728
|
-
|
729
|
-
rb_define_singleton_method(mgsl_stats, "wsd_with_fixed_mean",
|
730
|
-
|
714
|
+
rb_define_singleton_method(mgsl_stats, "wvariance_with_fixed_mean",
|
715
|
+
rb_gsl_stats_wvariance_with_fixed_mean2, -1);
|
716
|
+
rb_define_singleton_method(mgsl_stats, "wsd_with_fixed_mean",
|
717
|
+
rb_gsl_stats_wsd_with_fixed_mean2, -1);
|
731
718
|
rb_define_singleton_method(mgsl_stats, "wabsdev", rb_gsl_stats_wabsdev2, -1);
|
732
719
|
rb_define_singleton_method(mgsl_stats, "wabsdev_m", rb_gsl_stats_wabsdev_m2, -1);
|
733
720
|
rb_define_singleton_method(mgsl_stats, "wskew", rb_gsl_stats_wskew2, -1);
|
@@ -747,12 +734,12 @@ void Init_gsl_stats(VALUE module)
|
|
747
734
|
rb_define_alias(cgsl_vector, "wsd", "stats_wsd");
|
748
735
|
rb_define_method(cgsl_vector, "stats_wsd_m", rb_gsl_stats_wsd_m, -1);
|
749
736
|
rb_define_alias(cgsl_vector, "wsd_m", "stats_wsd_m");
|
750
|
-
rb_define_method(cgsl_vector, "stats_wvariance_with_fixed_mean",
|
751
|
-
|
752
|
-
rb_define_alias(cgsl_vector, "wvariance_with_fixed_mean",
|
753
|
-
|
754
|
-
rb_define_method(cgsl_vector, "stats_wsd_with_fixed_mean",
|
755
|
-
|
737
|
+
rb_define_method(cgsl_vector, "stats_wvariance_with_fixed_mean",
|
738
|
+
rb_gsl_stats_wvariance_with_fixed_mean, -1);
|
739
|
+
rb_define_alias(cgsl_vector, "wvariance_with_fixed_mean",
|
740
|
+
"stats_wvariance_with_fixed_mean");
|
741
|
+
rb_define_method(cgsl_vector, "stats_wsd_with_fixed_mean",
|
742
|
+
rb_gsl_stats_wsd_with_fixed_mean, -1);
|
756
743
|
rb_define_alias(cgsl_vector, "wsd_with_fixed_mean", "stats_wsd_with_fixed_mean");
|
757
744
|
rb_define_method(cgsl_vector, "stats_wabsdev", rb_gsl_stats_wabsdev, -1);
|
758
745
|
rb_define_alias(cgsl_vector, "wabsdev", "stats_wabsdev");
|
@@ -764,8 +751,8 @@ void Init_gsl_stats(VALUE module)
|
|
764
751
|
rb_define_alias(cgsl_vector, "wskew_m_sd", "stats_wskew_m_sd");
|
765
752
|
rb_define_method(cgsl_vector, "stats_wkurtosis", rb_gsl_stats_wkurtosis, -1);
|
766
753
|
rb_define_alias(cgsl_vector, "wkurtosis", "stats_wkurtosis");
|
767
|
-
rb_define_method(cgsl_vector, "stats_wkurtosis_m_sd",
|
768
|
-
|
754
|
+
rb_define_method(cgsl_vector, "stats_wkurtosis_m_sd",
|
755
|
+
rb_gsl_stats_wkurtosis_m_sd, 2);
|
769
756
|
rb_define_alias(cgsl_vector, "wkurtosis_m_sd", "stats_wkurtosis_m_sd");
|
770
757
|
|
771
758
|
/*****/
|
@@ -774,8 +761,8 @@ void Init_gsl_stats(VALUE module)
|
|
774
761
|
rb_define_singleton_method(mgsl_stats, "minmax", rb_gsl_stats_minmax, -1);
|
775
762
|
rb_define_singleton_method(mgsl_stats, "max_index", rb_gsl_stats_max_index, -1);
|
776
763
|
rb_define_singleton_method(mgsl_stats, "min_index", rb_gsl_stats_min_index, -1);
|
777
|
-
rb_define_singleton_method(mgsl_stats, "minmax_index",
|
778
|
-
|
764
|
+
rb_define_singleton_method(mgsl_stats, "minmax_index",
|
765
|
+
rb_gsl_stats_minmax_index, -1);
|
779
766
|
|
780
767
|
rb_define_method(cgsl_vector, "stats_max", rb_gsl_stats_max, -1);
|
781
768
|
rb_define_method(cgsl_vector, "stats_min", rb_gsl_stats_min, -1);
|
@@ -784,17 +771,17 @@ void Init_gsl_stats(VALUE module)
|
|
784
771
|
rb_define_method(cgsl_vector, "stats_min_index", rb_gsl_stats_min_index, -1);
|
785
772
|
rb_define_method(cgsl_vector, "stats_minmax_index", rb_gsl_stats_minmax_index, -1);
|
786
773
|
|
787
|
-
rb_define_singleton_method(mgsl_stats, "median_from_sorted_data",
|
788
|
-
|
789
|
-
rb_define_method(cgsl_vector, "stats_median_from_sorted_data",
|
790
|
-
|
791
|
-
rb_define_alias(cgsl_vector, "median_from_sorted_data",
|
792
|
-
|
774
|
+
rb_define_singleton_method(mgsl_stats, "median_from_sorted_data",
|
775
|
+
rb_gsl_stats_median_from_sorted_data, -1);
|
776
|
+
rb_define_method(cgsl_vector, "stats_median_from_sorted_data",
|
777
|
+
rb_gsl_stats_median_from_sorted_data, -1);
|
778
|
+
rb_define_alias(cgsl_vector, "median_from_sorted_data",
|
779
|
+
"stats_median_from_sorted_data");
|
793
780
|
rb_define_method(cgsl_vector, "median", rb_gsl_stats_median, -1);
|
794
781
|
|
795
|
-
rb_define_method(cgsl_vector, "stats_quantile_from_sorted_data",
|
796
|
-
|
797
|
-
rb_define_alias(cgsl_vector, "quantile_from_sorted_data",
|
798
|
-
|
782
|
+
rb_define_method(cgsl_vector, "stats_quantile_from_sorted_data",
|
783
|
+
rb_gsl_stats_quantile_from_sorted_data, -1);
|
784
|
+
rb_define_alias(cgsl_vector, "quantile_from_sorted_data",
|
785
|
+
"stats_quantile_from_sorted_data");
|
799
786
|
|
800
787
|
}
|