gsl 1.14.7 → 1.15.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +139 -134
- data/Rakefile +4 -3
- data/VERSION +1 -1
- data/ext/array.c +0 -24
- data/ext/array_complex.c +11 -10
- data/ext/blas1.c +9 -6
- data/ext/block_source.c +4 -3
- data/ext/dirac.c +0 -6
- data/ext/error.c +1 -2
- data/ext/extconf.rb +9 -4
- data/ext/fft.c +22 -12
- data/ext/function.c +2 -2
- data/ext/graph.c +2 -0
- data/ext/gsl_narray.c +1 -7
- data/ext/histogram.c +0 -8
- data/ext/ieee.c +3 -1
- data/ext/integration.c +5 -3
- data/ext/linalg.c +11 -16
- data/ext/linalg_complex.c +1 -3
- data/ext/matrix_complex.c +10 -5
- data/ext/matrix_int.c +10 -10
- data/ext/matrix_source.c +3 -2
- data/ext/multifit.c +21 -29
- data/ext/multimin.c +1 -3
- data/ext/odeiv.c +9 -6
- data/ext/poly_source.c +82 -52
- data/ext/sf_bessel.c +8 -4
- data/ext/sf_coulomb.c +8 -8
- data/ext/sf_coupling.c +9 -6
- data/ext/sf_dilog.c +3 -2
- data/ext/sf_elementary.c +6 -4
- data/ext/sf_elljac.c +3 -2
- data/ext/sf_exp.c +15 -10
- data/ext/sf_gamma.c +9 -6
- data/ext/sf_gegenbauer.c +3 -2
- data/ext/sf_hyperg.c +18 -12
- data/ext/sf_laguerre.c +3 -2
- data/ext/sf_legendre.c +3 -2
- data/ext/sf_log.c +3 -2
- data/ext/sf_power.c +3 -2
- data/ext/sf_trigonometric.c +9 -6
- data/ext/signal.c +1 -3
- data/ext/siman.c +1 -2
- data/ext/stats.c +1 -0
- data/ext/vector_complex.c +5 -2
- data/ext/vector_double.c +13 -8
- data/ext/vector_source.c +6 -5
- data/ext/wavelet.c +16 -8
- data/include/rb_gsl_common.h +5 -6
- data/include/rb_gsl_config.h +62 -0
- data/include/rb_gsl_with_narray.h +6 -1
- data/lib/gsl.rb +3 -0
- data/lib/rbgsl.rb +3 -0
- data/rdoc/fit.rdoc +5 -5
- data/rdoc/ndlinear.rdoc +5 -2
- data/tests/gsl_test2.rb +3 -0
- data/tests/matrix/matrix_complex_test.rb +36 -0
- data/tests/narray/blas_dnrm2.rb +20 -0
- data/tests/poly/poly.rb +48 -0
- data/tests/sf/test_mode.rb +19 -0
- data/tests/stats_mt.rb +16 -0
- metadata +15 -11
- data/ext/MANIFEST +0 -119
data/ext/ieee.c
CHANGED
@@ -21,6 +21,7 @@ static VALUE rb_gsl_ieee_fprintf_double(int argc, VALUE *argv, VALUE obj)
|
|
21
21
|
{
|
22
22
|
#ifdef RUBY_1_9_LATER
|
23
23
|
rb_io_t *fptr = NULL;
|
24
|
+
double ftmp;
|
24
25
|
#else
|
25
26
|
OpenFile *fptr = NULL;
|
26
27
|
#endif
|
@@ -61,7 +62,8 @@ static VALUE rb_gsl_ieee_fprintf_double(int argc, VALUE *argv, VALUE obj)
|
|
61
62
|
rb_raise(rb_eTypeError, "wrong argument type %s (Float expected)",
|
62
63
|
rb_class2name(CLASS_OF(vtmp)));
|
63
64
|
#ifdef RUBY_1_9_LATER
|
64
|
-
|
65
|
+
ftmp = RFLOAT_VALUE(vtmp);
|
66
|
+
gsl_ieee_fprintf_double(fp, &ftmp);
|
65
67
|
#else
|
66
68
|
gsl_ieee_fprintf_double(fp, &(RFLOAT(vtmp)->value));
|
67
69
|
#endif
|
data/ext/integration.c
CHANGED
@@ -267,7 +267,9 @@ static VALUE rb_gsl_integration_qng(int argc, VALUE *argv, VALUE obj)
|
|
267
267
|
double result, abserr;
|
268
268
|
size_t neval;
|
269
269
|
gsl_function *F = NULL;
|
270
|
-
int status
|
270
|
+
int status;
|
271
|
+
// local variable 'itmp' declared and set, but never used
|
272
|
+
//int itmp;
|
271
273
|
|
272
274
|
if (argc < 1) rb_raise(rb_eArgError,
|
273
275
|
"wrong number of arguments (%d for >= 1)", argc);
|
@@ -276,10 +278,10 @@ static VALUE rb_gsl_integration_qng(int argc, VALUE *argv, VALUE obj)
|
|
276
278
|
case T_MODULE: case T_CLASS: case T_OBJECT:
|
277
279
|
CHECK_FUNCTION(argv[0]);
|
278
280
|
Data_Get_Struct(argv[0], gsl_function, F);
|
279
|
-
itmp
|
281
|
+
/*itmp =*/ get_a_b_epsabs_epsrel(argc, argv, 1, &a, &b, &epsabs, &epsrel);
|
280
282
|
break;
|
281
283
|
default:
|
282
|
-
itmp
|
284
|
+
/*itmp =*/ get_a_b_epsabs_epsrel(argc, argv, 0, &a, &b, &epsabs, &epsrel);
|
283
285
|
Data_Get_Struct(obj, gsl_function, F);
|
284
286
|
break;
|
285
287
|
}
|
data/ext/linalg.c
CHANGED
@@ -666,7 +666,6 @@ static VALUE rb_gsl_linalg_QR_LQ_decomposition(int argc, VALUE *argv, VALUE obj,
|
|
666
666
|
gsl_vector *tau = NULL;
|
667
667
|
int (*fdecomp)(gsl_matrix *, gsl_vector *);
|
668
668
|
int itmp, status;
|
669
|
-
size_t size;
|
670
669
|
VALUE vtau, mdecomp, omatrix;
|
671
670
|
|
672
671
|
switch (TYPE(obj)) {
|
@@ -712,7 +711,6 @@ static VALUE rb_gsl_linalg_QR_LQ_decomposition(int argc, VALUE *argv, VALUE obj,
|
|
712
711
|
rb_raise(rb_eRuntimeError, "unknown operation");
|
713
712
|
break;
|
714
713
|
}
|
715
|
-
size = m->size1;
|
716
714
|
switch (argc - itmp) {
|
717
715
|
case 0:
|
718
716
|
tau = gsl_vector_alloc(GSL_MIN(mtmp->size1, mtmp->size2));
|
@@ -931,7 +929,7 @@ static VALUE rb_gsl_linalg_QR_LQ_lssolve(int argc, VALUE *argv, VALUE obj, int f
|
|
931
929
|
gsl_matrix *m = NULL;
|
932
930
|
gsl_vector *b = NULL, *x = NULL, *tau = NULL, *r = NULL;
|
933
931
|
VALUE omatrix;
|
934
|
-
int flagm = 0, flagt = 0, flagb = 0,
|
932
|
+
int flagm = 0, flagt = 0, flagb = 0, itmp, status;
|
935
933
|
size_t size;
|
936
934
|
int (*fdecomp)(gsl_matrix*, gsl_vector*);
|
937
935
|
int (*flssolve)(const gsl_matrix*, const gsl_vector*, const gsl_vector*, gsl_vector*,
|
@@ -991,22 +989,17 @@ static VALUE rb_gsl_linalg_QR_LQ_lssolve(int argc, VALUE *argv, VALUE obj, int f
|
|
991
989
|
case 2:
|
992
990
|
CHECK_VECTOR(argv[argc-2]);
|
993
991
|
Data_Get_Struct(argv[argc-2], gsl_vector, x);
|
994
|
-
flagx = 0;
|
995
992
|
CHECK_VECTOR(argv[argc-1]);
|
996
993
|
Data_Get_Struct(argv[argc-1], gsl_vector, r);
|
997
|
-
flagr = 0;
|
998
994
|
break;
|
999
995
|
case 1:
|
1000
996
|
CHECK_VECTOR(argv[argc-1]);
|
1001
997
|
Data_Get_Struct(argv[argc-1], gsl_vector, x);
|
1002
|
-
flagx = 0;
|
1003
998
|
r = gsl_vector_alloc(x->size);
|
1004
|
-
flagr = 1;
|
1005
999
|
break;
|
1006
1000
|
case 0:
|
1007
1001
|
x = gsl_vector_alloc(m->size1);
|
1008
1002
|
r = gsl_vector_alloc(m->size1);
|
1009
|
-
flagx = 1; flagr = 1;
|
1010
1003
|
break;
|
1011
1004
|
default:
|
1012
1005
|
rb_raise(rb_eArgError, "wrong number of arguments");
|
@@ -2133,7 +2126,7 @@ static VALUE rb_gsl_linalg_QRLQPT_RLsvx(int argc, VALUE *argv, VALUE obj, int fl
|
|
2133
2126
|
gsl_matrix *QR = NULL;
|
2134
2127
|
gsl_vector *b = NULL;
|
2135
2128
|
gsl_permutation *p = NULL;
|
2136
|
-
int itmp
|
2129
|
+
int itmp;
|
2137
2130
|
VALUE vtmp, klass;
|
2138
2131
|
int (*fsvx)(const gsl_matrix*, const gsl_permutation*, gsl_vector*);
|
2139
2132
|
switch (flag) {
|
@@ -2174,7 +2167,6 @@ static VALUE rb_gsl_linalg_QRLQPT_RLsvx(int argc, VALUE *argv, VALUE obj, int fl
|
|
2174
2167
|
itmp++;
|
2175
2168
|
if (TYPE(argv[itmp]) == T_ARRAY) {
|
2176
2169
|
b = make_cvector_from_rarray(argv[itmp]);
|
2177
|
-
flagb = 1;
|
2178
2170
|
} else {
|
2179
2171
|
CHECK_VECTOR(argv[itmp]);
|
2180
2172
|
Data_Get_Struct(argv[itmp], gsl_vector, b);
|
@@ -2853,7 +2845,8 @@ static VALUE rb_gsl_linalg_bidiag_decomp(int argc, VALUE *argv, VALUE obj)
|
|
2853
2845
|
gsl_matrix *A = NULL, *Atmp = NULL;
|
2854
2846
|
gsl_vector *tau_U = NULL, *tau_V = NULL;
|
2855
2847
|
size_t size0;
|
2856
|
-
|
2848
|
+
// local variable "status" was defined and set, but never used
|
2849
|
+
//int status;
|
2857
2850
|
VALUE vu, vv, vA;
|
2858
2851
|
|
2859
2852
|
switch (TYPE(obj)) {
|
@@ -2870,7 +2863,7 @@ static VALUE rb_gsl_linalg_bidiag_decomp(int argc, VALUE *argv, VALUE obj)
|
|
2870
2863
|
size0 = GSL_MIN(A->size1, A->size2);
|
2871
2864
|
tau_U = gsl_vector_alloc(size0);
|
2872
2865
|
tau_V = gsl_vector_alloc(size0-1);
|
2873
|
-
status
|
2866
|
+
/*status =*/ gsl_linalg_bidiag_decomp(A, tau_U, tau_V);
|
2874
2867
|
vA = Data_Wrap_Struct(cgsl_matrix, 0, gsl_matrix_free, A);
|
2875
2868
|
vu = Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, tau_U);
|
2876
2869
|
vv = Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, tau_V);
|
@@ -3320,9 +3313,10 @@ static VALUE rb_gsl_linalg_balance_columns_bang(int argc, VALUE *argv, VALUE obj
|
|
3320
3313
|
gsl_matrix *A = NULL;
|
3321
3314
|
gsl_vector *D = NULL;
|
3322
3315
|
VALUE mat, vec;
|
3323
|
-
|
3316
|
+
// local variable "status" was defined and set, but never used
|
3317
|
+
//int status;
|
3324
3318
|
rb_gsl_linalg_balance_columns_init(argc, argv, obj, &mat, &vec, &A, &D);
|
3325
|
-
status
|
3319
|
+
/*status =*/ gsl_linalg_balance_columns(A, D);
|
3326
3320
|
return rb_ary_new3(2, mat, vec);
|
3327
3321
|
}
|
3328
3322
|
|
@@ -3331,11 +3325,12 @@ static VALUE rb_gsl_linalg_balance_columns(int argc, VALUE *argv, VALUE obj)
|
|
3331
3325
|
gsl_matrix *A = NULL, *Anew;
|
3332
3326
|
gsl_vector *D = NULL;
|
3333
3327
|
VALUE mat, vec;
|
3334
|
-
|
3328
|
+
// local variable "status" was defined and set, but never used
|
3329
|
+
//int status;
|
3335
3330
|
rb_gsl_linalg_balance_columns_init(argc, argv, obj, &mat, &vec, &A, &D);
|
3336
3331
|
Anew = make_matrix_clone(A);
|
3337
3332
|
mat = Data_Wrap_Struct(cgsl_matrix, 0, gsl_matrix_free, Anew);
|
3338
|
-
status
|
3333
|
+
/*status =*/ gsl_linalg_balance_columns(Anew, D);
|
3339
3334
|
return rb_ary_new3(2, mat, vec);
|
3340
3335
|
}
|
3341
3336
|
|
data/ext/linalg_complex.c
CHANGED
@@ -362,7 +362,7 @@ static VALUE rb_gsl_linalg_complex_LU_lndet(int argc, VALUE *argv, VALUE obj)
|
|
362
362
|
gsl_matrix_complex *m = NULL, *mtmp = NULL;
|
363
363
|
gsl_permutation *p = NULL;
|
364
364
|
double lndet;
|
365
|
-
int flagm = 0, signum
|
365
|
+
int flagm = 0, signum;
|
366
366
|
switch (TYPE(obj)) {
|
367
367
|
case T_MODULE:
|
368
368
|
case T_CLASS:
|
@@ -376,7 +376,6 @@ static VALUE rb_gsl_linalg_complex_LU_lndet(int argc, VALUE *argv, VALUE obj)
|
|
376
376
|
} else {
|
377
377
|
mtmp = m;
|
378
378
|
}
|
379
|
-
itmp = 1;
|
380
379
|
break;
|
381
380
|
default:
|
382
381
|
Data_Get_Struct(obj, gsl_matrix_complex, m);
|
@@ -387,7 +386,6 @@ static VALUE rb_gsl_linalg_complex_LU_lndet(int argc, VALUE *argv, VALUE obj)
|
|
387
386
|
} else {
|
388
387
|
mtmp = m;
|
389
388
|
}
|
390
|
-
itmp = 0;
|
391
389
|
}
|
392
390
|
if (flagm == 1) {
|
393
391
|
p = gsl_permutation_alloc(m->size1);
|
data/ext/matrix_complex.c
CHANGED
@@ -199,7 +199,7 @@ static VALUE rb_gsl_matrix_complex_eye(int argc, VALUE *argv, VALUE klass)
|
|
199
199
|
{
|
200
200
|
size_t n, i;
|
201
201
|
gsl_matrix_complex *m = NULL;
|
202
|
-
gsl_complex z, *
|
202
|
+
gsl_complex z, *pz = &z;
|
203
203
|
switch (argc) {
|
204
204
|
case 1:
|
205
205
|
CHECK_FIXNUM(argv[0]);
|
@@ -223,7 +223,8 @@ static VALUE rb_gsl_matrix_complex_eye(int argc, VALUE *argv, VALUE klass)
|
|
223
223
|
break;
|
224
224
|
default:
|
225
225
|
if (rb_obj_is_kind_of(argv[1], cgsl_complex)) {
|
226
|
-
Data_Get_Struct(argv[1], gsl_complex,
|
226
|
+
Data_Get_Struct(argv[1], gsl_complex, pz);
|
227
|
+
z = *pz;
|
227
228
|
} else {
|
228
229
|
rb_raise(rb_eTypeError,
|
229
230
|
"wrong argument type %s", rb_class2name(CLASS_OF(argv[1])));
|
@@ -422,6 +423,7 @@ static VALUE rb_gsl_matrix_complex_set_row(int argc, VALUE *argv, VALUE obj)
|
|
422
423
|
default:
|
423
424
|
CHECK_COMPLEX(argv[k]);
|
424
425
|
Data_Get_Struct(argv[k], gsl_complex, pz);
|
426
|
+
z = *pz;
|
425
427
|
break;
|
426
428
|
}
|
427
429
|
gsl_matrix_complex_set(A, i, k-1, z);
|
@@ -448,6 +450,7 @@ static VALUE rb_gsl_matrix_complex_set_col(int argc, VALUE *argv, VALUE obj)
|
|
448
450
|
default:
|
449
451
|
CHECK_COMPLEX(argv[k]);
|
450
452
|
Data_Get_Struct(argv[k], gsl_complex, pz);
|
453
|
+
z = *pz;
|
451
454
|
break;
|
452
455
|
}
|
453
456
|
gsl_matrix_complex_set(A, k-1, j, z);
|
@@ -1519,8 +1522,10 @@ static VALUE rb_gsl_matrix_complex_indgen_singleton(int argc, VALUE *argv, VALUE
|
|
1519
1522
|
return Data_Wrap_Struct(cgsl_matrix_complex, 0, gsl_matrix_complex_free, mnew);
|
1520
1523
|
}
|
1521
1524
|
|
1522
|
-
|
1523
|
-
|
1525
|
+
// Starting with version 1.15, GSL provides a gsl_matrix_complex_equal
|
1526
|
+
// function, but it only determines absolute equality (i.e. is has no epsilon
|
1527
|
+
// argument).
|
1528
|
+
static int gsl_matrix_complex_equal_eps(const gsl_matrix_complex *m1,
|
1524
1529
|
const gsl_matrix_complex *m2, double eps)
|
1525
1530
|
{
|
1526
1531
|
gsl_complex z1, z2;
|
@@ -1555,7 +1560,7 @@ static VALUE rb_gsl_matrix_complex_equal(int argc, VALUE *argv, VALUE obj)
|
|
1555
1560
|
Data_Get_Struct(obj, gsl_matrix_complex, m1);
|
1556
1561
|
CHECK_MATRIX_COMPLEX(argv[0]);
|
1557
1562
|
Data_Get_Struct(argv[0], gsl_matrix_complex, m2);
|
1558
|
-
ret =
|
1563
|
+
ret = gsl_matrix_complex_equal_eps(m1, m2, eps);
|
1559
1564
|
if (ret == 1) return Qtrue;
|
1560
1565
|
else return Qfalse;
|
1561
1566
|
}
|
data/ext/matrix_int.c
CHANGED
@@ -71,13 +71,13 @@ enum {
|
|
71
71
|
GSL_MATRIX_INT_DIV,
|
72
72
|
};
|
73
73
|
|
74
|
-
static VALUE rb_gsl_matrix_int_operation1(VALUE obj, VALUE other, int flag);
|
75
74
|
static VALUE rb_gsl_matrix_int_operation1(VALUE obj, VALUE other, int flag)
|
76
75
|
{
|
77
76
|
gsl_matrix_int *a, *anew, *b;
|
78
77
|
gsl_vector_int *vi, *vinew;
|
79
78
|
double bval;
|
80
|
-
|
79
|
+
// local variable "result" declared and set, but never used
|
80
|
+
//int result;
|
81
81
|
Data_Get_Struct(obj, gsl_matrix_int, a);
|
82
82
|
switch (TYPE(other)) {
|
83
83
|
case T_FIXNUM:
|
@@ -86,16 +86,16 @@ static VALUE rb_gsl_matrix_int_operation1(VALUE obj, VALUE other, int flag)
|
|
86
86
|
anew = make_matrix_int_clone(a);
|
87
87
|
switch (flag) {
|
88
88
|
case GSL_MATRIX_INT_ADD:
|
89
|
-
result
|
89
|
+
/*result =*/ gsl_matrix_int_add_constant(anew, bval);
|
90
90
|
break;
|
91
91
|
case GSL_MATRIX_INT_SUB:
|
92
|
-
result
|
92
|
+
/*result =*/ gsl_matrix_int_add_constant(anew, -bval);
|
93
93
|
break;
|
94
94
|
case GSL_MATRIX_INT_MUL:
|
95
|
-
result
|
95
|
+
/*result =*/ gsl_matrix_int_scale(anew, bval);
|
96
96
|
break;
|
97
97
|
case GSL_MATRIX_INT_DIV:
|
98
|
-
result
|
98
|
+
/*result =*/ gsl_matrix_int_scale(anew, 1.0/bval);
|
99
99
|
break;
|
100
100
|
default:
|
101
101
|
break;
|
@@ -109,16 +109,16 @@ static VALUE rb_gsl_matrix_int_operation1(VALUE obj, VALUE other, int flag)
|
|
109
109
|
Data_Get_Struct(other, gsl_matrix_int, b);
|
110
110
|
switch (flag) {
|
111
111
|
case GSL_MATRIX_INT_ADD:
|
112
|
-
result
|
112
|
+
/*result =*/ gsl_matrix_int_add(anew, b);
|
113
113
|
break;
|
114
114
|
case GSL_MATRIX_INT_SUB:
|
115
|
-
result
|
115
|
+
/*result =*/ gsl_matrix_int_sub(anew, b);
|
116
116
|
break;
|
117
117
|
case GSL_MATRIX_INT_MUL:
|
118
|
-
result
|
118
|
+
/*result =*/ gsl_matrix_int_mul_elements(anew, b);
|
119
119
|
break;
|
120
120
|
case GSL_MATRIX_INT_DIV:
|
121
|
-
result
|
121
|
+
/*result =*/ gsl_matrix_int_div_elements(anew, b);
|
122
122
|
break;
|
123
123
|
default:
|
124
124
|
break;
|
data/ext/matrix_source.c
CHANGED
@@ -875,14 +875,15 @@ static VALUE FUNCTION(rb_gsl_matrix,to_s)(VALUE obj)
|
|
875
875
|
char buf[32], format[32], format2[32];
|
876
876
|
size_t i, j;
|
877
877
|
VALUE str;
|
878
|
-
BASE x
|
878
|
+
BASE x;
|
879
879
|
int dig = 8;
|
880
880
|
#ifdef BASE_INT
|
881
|
+
BASE min;
|
881
882
|
BASE max;
|
882
883
|
#endif
|
883
884
|
Data_Get_Struct(obj, GSL_TYPE(gsl_matrix), m);
|
884
|
-
min = FUNCTION(gsl_matrix,min)(m);
|
885
885
|
#ifdef BASE_INT
|
886
|
+
min = FUNCTION(gsl_matrix,min)(m);
|
886
887
|
max = gsl_matrix_int_max(m);
|
887
888
|
dig = (int) GSL_MAX(fabs(max),fabs(min));
|
888
889
|
if (dig > 0) dig = ceil(log10(dig+1e-10));
|
data/ext/multifit.c
CHANGED
@@ -354,14 +354,15 @@ static VALUE rb_gsl_multifit_fdfsolver_gradient(int argc, VALUE *argv, VALUE obj
|
|
354
354
|
{
|
355
355
|
gsl_multifit_fdfsolver *solver = NULL;
|
356
356
|
gsl_vector *g = NULL;
|
357
|
-
|
357
|
+
// local variable "status" declared and set, but never used
|
358
|
+
//int status;
|
358
359
|
Data_Get_Struct(obj, gsl_multifit_fdfsolver, solver);
|
359
360
|
if (argc == 1) {
|
360
361
|
Data_Get_Vector(argv[0], g);
|
361
362
|
return INT2FIX(gsl_multifit_gradient(solver->J, solver->f, g));
|
362
363
|
} else {
|
363
364
|
g = gsl_vector_alloc(solver->x->size);
|
364
|
-
status
|
365
|
+
/*status =*/ gsl_multifit_gradient(solver->J, solver->f, g);
|
365
366
|
return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, g);
|
366
367
|
}
|
367
368
|
}
|
@@ -371,7 +372,8 @@ static VALUE rb_gsl_multifit_fdfsolver_covar(int argc, VALUE *argv, VALUE obj)
|
|
371
372
|
gsl_multifit_fdfsolver *solver = NULL;
|
372
373
|
gsl_matrix *covar = NULL;
|
373
374
|
double epsrel;
|
374
|
-
|
375
|
+
// local variable "status" declared and set, but never used
|
376
|
+
//int status;
|
375
377
|
if (argc < 1) rb_raise(rb_eArgError, "too few arguments");
|
376
378
|
Need_Float(argv[0]);
|
377
379
|
Data_Get_Struct(obj, gsl_multifit_fdfsolver, solver);
|
@@ -379,7 +381,7 @@ static VALUE rb_gsl_multifit_fdfsolver_covar(int argc, VALUE *argv, VALUE obj)
|
|
379
381
|
switch (argc) {
|
380
382
|
case 1:
|
381
383
|
covar = gsl_matrix_alloc(solver->x->size, solver->x->size);
|
382
|
-
status
|
384
|
+
/*status =*/ gsl_multifit_covar(solver->J, epsrel, covar);
|
383
385
|
return Data_Wrap_Struct(cgsl_matrix, 0, gsl_matrix_free, covar);
|
384
386
|
break;
|
385
387
|
case 2:
|
@@ -442,13 +444,14 @@ static VALUE rb_gsl_multifit_gradient(int argc, VALUE *argv, VALUE obj)
|
|
442
444
|
{
|
443
445
|
gsl_vector *g = NULL, *f = NULL;
|
444
446
|
gsl_matrix *J = NULL;
|
445
|
-
|
447
|
+
// local variable "status" declared and set, but never used
|
448
|
+
//int status;
|
446
449
|
switch (argc) {
|
447
450
|
case 2:
|
448
451
|
Data_Get_Matrix(argv[0], J);
|
449
452
|
Data_Get_Vector(argv[1], f);
|
450
453
|
g = gsl_vector_alloc(f->size);
|
451
|
-
status
|
454
|
+
/*status =*/ gsl_multifit_gradient(J, f, g);
|
452
455
|
return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, g);
|
453
456
|
break;
|
454
457
|
case 3:
|
@@ -474,7 +477,7 @@ static VALUE rb_gsl_multifit_covar(int argc, VALUE *argv, VALUE obj)
|
|
474
477
|
Data_Get_Matrix(argv[0], J);
|
475
478
|
epsrel = NUM2DBL(argv[1]);
|
476
479
|
covar = gsl_matrix_alloc(J->size2, J->size2);
|
477
|
-
status
|
480
|
+
/*status =*/ gsl_multifit_covar(J, epsrel, covar);
|
478
481
|
return Data_Wrap_Struct(cgsl_matrix, 0, gsl_matrix_free, covar);
|
479
482
|
break;
|
480
483
|
case 3:
|
@@ -783,10 +786,9 @@ static int Gaussian_df(const gsl_vector *v, void *data, gsl_matrix *J)
|
|
783
786
|
double A, x0, var, xi, yy, wi;
|
784
787
|
size_t i;
|
785
788
|
struct fitting_xydata *xydata;
|
786
|
-
gsl_vector *x, *
|
789
|
+
gsl_vector *x, *w;
|
787
790
|
xydata = (struct fitting_xydata*) data;
|
788
791
|
x = xydata->x;
|
789
|
-
y = xydata->y;
|
790
792
|
w = xydata->w;
|
791
793
|
var = gsl_vector_get(v, 3);
|
792
794
|
x0 = gsl_vector_get(v, 2);
|
@@ -854,10 +856,9 @@ static int Gaussian_2peaks_df(const gsl_vector *v, void *data, gsl_matrix *J)
|
|
854
856
|
double A1, x01, var1, A2, x02, var2, xi, yy, wi;
|
855
857
|
size_t i;
|
856
858
|
struct fitting_xydata *xydata;
|
857
|
-
gsl_vector *x, *
|
859
|
+
gsl_vector *x, *w;
|
858
860
|
xydata = (struct fitting_xydata*) data;
|
859
861
|
x = xydata->x;
|
860
|
-
y = xydata->y;
|
861
862
|
w = xydata->w;
|
862
863
|
A1 = gsl_vector_get(v, 1);
|
863
864
|
x01 = gsl_vector_get(v, 2);
|
@@ -925,10 +926,9 @@ static int Exponential_df(const gsl_vector *v, void *data, gsl_matrix *J)
|
|
925
926
|
double A, b, xi, yy, wi;
|
926
927
|
size_t i;
|
927
928
|
struct fitting_xydata *xydata;
|
928
|
-
gsl_vector *x, *
|
929
|
+
gsl_vector *x, *w;
|
929
930
|
xydata = (struct fitting_xydata*) data;
|
930
931
|
x = xydata->x;
|
931
|
-
y = xydata->y;
|
932
932
|
w = xydata->w;
|
933
933
|
A = gsl_vector_get(v, 1);
|
934
934
|
b = gsl_vector_get(v, 2);
|
@@ -991,10 +991,9 @@ static int DblExponential_df(const gsl_vector *v, void *data, gsl_matrix *J)
|
|
991
991
|
double A1, b1, A2, b2, xi, yy1, yy2, wi;
|
992
992
|
size_t i;
|
993
993
|
struct fitting_xydata *xydata;
|
994
|
-
gsl_vector *x, *
|
994
|
+
gsl_vector *x, *w;
|
995
995
|
xydata = (struct fitting_xydata*) data;
|
996
996
|
x = xydata->x;
|
997
|
-
y = xydata->y;
|
998
997
|
w = xydata->w;
|
999
998
|
A1 = gsl_vector_get(v, 1);
|
1000
999
|
b1 = gsl_vector_get(v, 2);
|
@@ -1059,10 +1058,9 @@ static int Lorentzian_df(const gsl_vector *v, void *data, gsl_matrix *J)
|
|
1059
1058
|
double A, B, x0, xi, yy, wi;
|
1060
1059
|
size_t i;
|
1061
1060
|
struct fitting_xydata *xydata;
|
1062
|
-
gsl_vector *x, *
|
1061
|
+
gsl_vector *x, *w;
|
1063
1062
|
xydata = (struct fitting_xydata*) data;
|
1064
1063
|
x = xydata->x;
|
1065
|
-
y = xydata->y;
|
1066
1064
|
w = xydata->w;
|
1067
1065
|
A = gsl_vector_get(v, 1);
|
1068
1066
|
x0 = gsl_vector_get(v, 2);
|
@@ -1124,10 +1122,9 @@ static int Sin_df(const gsl_vector *v, void *data, gsl_matrix *J)
|
|
1124
1122
|
double A, fc, phi, xi, ys, yc, wi;
|
1125
1123
|
size_t i;
|
1126
1124
|
struct fitting_xydata *xydata;
|
1127
|
-
gsl_vector *x, *
|
1125
|
+
gsl_vector *x, *w;
|
1128
1126
|
xydata = (struct fitting_xydata*) data;
|
1129
1127
|
x = xydata->x;
|
1130
|
-
y = xydata->y;
|
1131
1128
|
w = xydata->w;
|
1132
1129
|
A = gsl_vector_get(v, 1);
|
1133
1130
|
fc = gsl_vector_get(v, 2);
|
@@ -1190,10 +1187,9 @@ static int Hill_df(const gsl_vector *v, void *data, gsl_matrix *J)
|
|
1190
1187
|
double y0, m, xhalf, r, yy, xi, wi, a;
|
1191
1188
|
size_t i;
|
1192
1189
|
struct fitting_xydata *xydata;
|
1193
|
-
gsl_vector *x, *
|
1190
|
+
gsl_vector *x, *w;
|
1194
1191
|
xydata = (struct fitting_xydata*) data;
|
1195
1192
|
x = xydata->x;
|
1196
|
-
y = xydata->y;
|
1197
1193
|
w = xydata->w;
|
1198
1194
|
y0 = gsl_vector_get(v, 0);
|
1199
1195
|
m = gsl_vector_get(v, 1);
|
@@ -1257,10 +1253,9 @@ static int Sigmoid_df(const gsl_vector *v, void *data, gsl_matrix *J)
|
|
1257
1253
|
double m, x0, r, xi, wi, a, yy;
|
1258
1254
|
size_t i;
|
1259
1255
|
struct fitting_xydata *xydata;
|
1260
|
-
gsl_vector *x, *
|
1256
|
+
gsl_vector *x, *w;
|
1261
1257
|
xydata = (struct fitting_xydata*) data;
|
1262
1258
|
x = xydata->x;
|
1263
|
-
y = xydata->y;
|
1264
1259
|
w = xydata->w;
|
1265
1260
|
m = gsl_vector_get(v, 1);
|
1266
1261
|
x0 = gsl_vector_get(v, 2);
|
@@ -1322,10 +1317,9 @@ static int Power_df(const gsl_vector *v, void *data, gsl_matrix *J)
|
|
1322
1317
|
double A, r, xi, wi, a;
|
1323
1318
|
size_t i;
|
1324
1319
|
struct fitting_xydata *xydata;
|
1325
|
-
gsl_vector *x, *
|
1320
|
+
gsl_vector *x, *w;
|
1326
1321
|
xydata = (struct fitting_xydata*) data;
|
1327
1322
|
x = xydata->x;
|
1328
|
-
y = xydata->y;
|
1329
1323
|
w = xydata->w;
|
1330
1324
|
A = gsl_vector_get(v, 1);
|
1331
1325
|
r = gsl_vector_get(v, 2);
|
@@ -1387,10 +1381,9 @@ static int Lognormal_df(const gsl_vector *v, void *data, gsl_matrix *J)
|
|
1387
1381
|
double A, x0, width, xi, wi, a, b;
|
1388
1382
|
size_t i;
|
1389
1383
|
struct fitting_xydata *xydata;
|
1390
|
-
gsl_vector *x, *
|
1384
|
+
gsl_vector *x, *w;
|
1391
1385
|
xydata = (struct fitting_xydata*) data;
|
1392
1386
|
x = xydata->x;
|
1393
|
-
y = xydata->y;
|
1394
1387
|
w = xydata->w;
|
1395
1388
|
A = gsl_vector_get(v, 1);
|
1396
1389
|
x0 = gsl_vector_get(v, 2);
|
@@ -1449,10 +1442,9 @@ static int Rayleigh_df(const gsl_vector *v, void *data, gsl_matrix *J)
|
|
1449
1442
|
double A, var, xi, yy, wi;
|
1450
1443
|
size_t i;
|
1451
1444
|
struct fitting_xydata *xydata;
|
1452
|
-
gsl_vector *x, *
|
1445
|
+
gsl_vector *x, *w;
|
1453
1446
|
xydata = (struct fitting_xydata*) data;
|
1454
1447
|
x = xydata->x;
|
1455
|
-
y = xydata->y;
|
1456
1448
|
w = xydata->w;
|
1457
1449
|
var = gsl_vector_get(v, 1);
|
1458
1450
|
A = gsl_vector_get(v, 0);
|