rb-gsl 1.15.3.1 → 1.15.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (222) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHORS +2 -2
  3. data/ChangeLog +8 -0
  4. data/Rakefile +39 -96
  5. data/VERSION +1 -1
  6. data/ext/array.c +2 -2
  7. data/ext/block_source.c +1 -1
  8. data/ext/dirac.c +1 -1
  9. data/ext/eigen.c +13 -13
  10. data/ext/extconf.rb +17 -11
  11. data/ext/function.c +5 -5
  12. data/ext/gsl_narray.c +6 -6
  13. data/ext/histogram.c +7 -6
  14. data/ext/histogram2d.c +4 -4
  15. data/ext/interp.c +1 -1
  16. data/ext/linalg.c +13 -11
  17. data/ext/linalg_complex.c +8 -6
  18. data/ext/math.c +1 -1
  19. data/ext/matrix_complex.c +6 -6
  20. data/ext/matrix_source.c +10 -10
  21. data/ext/monte.c +2 -2
  22. data/ext/multimin.c +4 -4
  23. data/ext/multiroots.c +8 -8
  24. data/ext/nmf.c +6 -6
  25. data/ext/ntuple.c +4 -4
  26. data/ext/odeiv.c +2 -2
  27. data/ext/permutation.c +1 -1
  28. data/ext/poly2.c +6 -6
  29. data/ext/poly_source.c +9 -6
  30. data/ext/sf.c +31 -45
  31. data/ext/signal.c +2 -2
  32. data/ext/vector_complex.c +11 -10
  33. data/ext/vector_double.c +7 -4
  34. data/ext/vector_source.c +29 -26
  35. data/ext/wavelet.c +1 -1
  36. data/include/rb_gsl_common.h +12 -0
  37. data/include/rb_gsl_config.h +10 -1
  38. data/rdoc/blas.rdoc +4 -4
  39. data/rdoc/bspline.rdoc +8 -8
  40. data/rdoc/cheb.rdoc +9 -9
  41. data/rdoc/cholesky_complex.rdoc +1 -1
  42. data/rdoc/combi.rdoc +10 -10
  43. data/rdoc/complex.rdoc +12 -12
  44. data/rdoc/const.rdoc +21 -21
  45. data/rdoc/dht.rdoc +7 -7
  46. data/rdoc/diff.rdoc +7 -7
  47. data/rdoc/ehandling.rdoc +4 -4
  48. data/rdoc/eigen.rdoc +12 -12
  49. data/rdoc/fft.rdoc +27 -27
  50. data/rdoc/fit.rdoc +19 -19
  51. data/rdoc/function.rdoc +1 -1
  52. data/rdoc/graph.rdoc +3 -3
  53. data/rdoc/hist.rdoc +17 -17
  54. data/rdoc/hist2d.rdoc +5 -5
  55. data/rdoc/hist3d.rdoc +4 -4
  56. data/rdoc/index.rdoc +4 -4
  57. data/rdoc/integration.rdoc +17 -17
  58. data/rdoc/interp.rdoc +12 -12
  59. data/rdoc/intro.rdoc +4 -4
  60. data/rdoc/linalg.rdoc +21 -21
  61. data/rdoc/linalg_complex.rdoc +1 -1
  62. data/rdoc/math.rdoc +14 -14
  63. data/rdoc/matrix.rdoc +21 -21
  64. data/rdoc/min.rdoc +10 -10
  65. data/rdoc/monte.rdoc +4 -4
  66. data/rdoc/multimin.rdoc +13 -13
  67. data/rdoc/multiroot.rdoc +13 -13
  68. data/rdoc/narray.rdoc +10 -10
  69. data/rdoc/ndlinear.rdoc +5 -5
  70. data/rdoc/nonlinearfit.rdoc +18 -18
  71. data/rdoc/ntuple.rdoc +6 -6
  72. data/rdoc/odeiv.rdoc +13 -13
  73. data/rdoc/perm.rdoc +12 -12
  74. data/rdoc/poly.rdoc +18 -18
  75. data/rdoc/qrng.rdoc +10 -10
  76. data/rdoc/randist.rdoc +11 -11
  77. data/rdoc/ref.rdoc +50 -50
  78. data/rdoc/rng.rdoc +10 -10
  79. data/rdoc/rngextra.rdoc +5 -5
  80. data/rdoc/roots.rdoc +13 -13
  81. data/rdoc/sf.rdoc +36 -36
  82. data/rdoc/siman.rdoc +4 -4
  83. data/rdoc/sort.rdoc +7 -7
  84. data/rdoc/start.rdoc +1 -1
  85. data/rdoc/stats.rdoc +14 -14
  86. data/rdoc/sum.rdoc +5 -5
  87. data/rdoc/tensor.rdoc +4 -4
  88. data/rdoc/tut.rdoc +1 -1
  89. data/rdoc/use.rdoc +5 -5
  90. data/rdoc/vector.rdoc +29 -29
  91. data/rdoc/vector_complex.rdoc +6 -6
  92. data/rdoc/wavelet.rdoc +9 -9
  93. data/test/gsl/blas_test.rb +79 -0
  94. data/test/gsl/bspline_test.rb +63 -0
  95. data/test/gsl/cdf_test.rb +1512 -0
  96. data/test/gsl/cheb_test.rb +80 -0
  97. data/test/gsl/combination_test.rb +100 -0
  98. data/test/gsl/complex_test.rb +20 -0
  99. data/test/gsl/const_test.rb +29 -0
  100. data/test/gsl/deriv_test.rb +62 -0
  101. data/test/gsl/dht_test.rb +79 -0
  102. data/test/gsl/diff_test.rb +53 -0
  103. data/test/gsl/eigen_test.rb +563 -0
  104. data/test/gsl/err_test.rb +23 -0
  105. data/test/gsl/fit_test.rb +101 -0
  106. data/test/gsl/histo_test.rb +14 -0
  107. data/test/gsl/integration_test.rb +274 -0
  108. data/test/gsl/interp_test.rb +27 -0
  109. data/test/gsl/linalg_test.rb +463 -0
  110. data/test/gsl/matrix_nmf_test.rb +37 -0
  111. data/test/gsl/matrix_test.rb +77 -0
  112. data/test/gsl/min_test.rb +89 -0
  113. data/test/gsl/monte_test.rb +77 -0
  114. data/test/gsl/multifit_test.rb +753 -0
  115. data/test/gsl/multimin_test.rb +157 -0
  116. data/test/gsl/multiroot_test.rb +135 -0
  117. data/test/gsl/multiset_test.rb +52 -0
  118. data/test/gsl/odeiv_test.rb +275 -0
  119. data/test/gsl/poly_test.rb +338 -0
  120. data/test/gsl/qrng_test.rb +94 -0
  121. data/test/gsl/quartic_test.rb +28 -0
  122. data/test/gsl/randist_test.rb +122 -0
  123. data/test/gsl/rng_test.rb +303 -0
  124. data/test/gsl/roots_test.rb +78 -0
  125. data/test/gsl/sf_test.rb +2079 -0
  126. data/test/gsl/stats_test.rb +122 -0
  127. data/test/gsl/sum_test.rb +69 -0
  128. data/test/gsl/tensor_test.rb +396 -0
  129. data/test/gsl/vector_test.rb +223 -0
  130. data/test/gsl/wavelet_test.rb +130 -0
  131. data/test/gsl_test.rb +321 -0
  132. data/test/test_helper.rb +42 -0
  133. metadata +107 -150
  134. data/setup.rb +0 -1585
  135. data/tests/blas/amax.rb +0 -14
  136. data/tests/blas/asum.rb +0 -16
  137. data/tests/blas/axpy.rb +0 -25
  138. data/tests/blas/copy.rb +0 -23
  139. data/tests/blas/dot.rb +0 -23
  140. data/tests/bspline.rb +0 -53
  141. data/tests/cdf.rb +0 -1388
  142. data/tests/cheb.rb +0 -112
  143. data/tests/combination.rb +0 -123
  144. data/tests/complex.rb +0 -17
  145. data/tests/const.rb +0 -24
  146. data/tests/deriv.rb +0 -85
  147. data/tests/dht/dht1.rb +0 -17
  148. data/tests/dht/dht2.rb +0 -23
  149. data/tests/dht/dht3.rb +0 -23
  150. data/tests/dht/dht4.rb +0 -23
  151. data/tests/diff.rb +0 -78
  152. data/tests/eigen/eigen.rb +0 -220
  153. data/tests/eigen/gen.rb +0 -105
  154. data/tests/eigen/genherm.rb +0 -66
  155. data/tests/eigen/gensymm.rb +0 -68
  156. data/tests/eigen/nonsymm.rb +0 -53
  157. data/tests/eigen/nonsymmv.rb +0 -53
  158. data/tests/eigen/symm-herm.rb +0 -74
  159. data/tests/err.rb +0 -58
  160. data/tests/fit.rb +0 -124
  161. data/tests/gsl_test.rb +0 -118
  162. data/tests/gsl_test2.rb +0 -110
  163. data/tests/histo.rb +0 -12
  164. data/tests/integration/integration1.rb +0 -72
  165. data/tests/integration/integration2.rb +0 -71
  166. data/tests/integration/integration3.rb +0 -71
  167. data/tests/integration/integration4.rb +0 -71
  168. data/tests/interp.rb +0 -45
  169. data/tests/linalg/HH.rb +0 -64
  170. data/tests/linalg/LU.rb +0 -47
  171. data/tests/linalg/QR.rb +0 -77
  172. data/tests/linalg/SV.rb +0 -24
  173. data/tests/linalg/TDN.rb +0 -116
  174. data/tests/linalg/TDS.rb +0 -122
  175. data/tests/linalg/bidiag.rb +0 -73
  176. data/tests/linalg/cholesky.rb +0 -20
  177. data/tests/linalg/linalg.rb +0 -158
  178. data/tests/matrix/matrix_complex_test.rb +0 -36
  179. data/tests/matrix/matrix_nmf_test.rb +0 -39
  180. data/tests/matrix/matrix_test.rb +0 -48
  181. data/tests/min.rb +0 -99
  182. data/tests/monte/miser.rb +0 -31
  183. data/tests/monte/vegas.rb +0 -45
  184. data/tests/multifit/test_2dgauss.rb +0 -112
  185. data/tests/multifit/test_brown.rb +0 -90
  186. data/tests/multifit/test_enso.rb +0 -246
  187. data/tests/multifit/test_filip.rb +0 -155
  188. data/tests/multifit/test_gauss.rb +0 -97
  189. data/tests/multifit/test_longley.rb +0 -110
  190. data/tests/multifit/test_multifit.rb +0 -52
  191. data/tests/multimin.rb +0 -139
  192. data/tests/multiroot.rb +0 -131
  193. data/tests/multiset.rb +0 -52
  194. data/tests/narray/blas_dnrm2.rb +0 -20
  195. data/tests/odeiv.rb +0 -353
  196. data/tests/poly/poly.rb +0 -290
  197. data/tests/poly/special.rb +0 -65
  198. data/tests/qrng.rb +0 -131
  199. data/tests/quartic.rb +0 -29
  200. data/tests/randist.rb +0 -134
  201. data/tests/rng.rb +0 -305
  202. data/tests/roots.rb +0 -76
  203. data/tests/run-test.sh +0 -17
  204. data/tests/sf/gsl_test_sf.rb +0 -249
  205. data/tests/sf/test_airy.rb +0 -83
  206. data/tests/sf/test_bessel.rb +0 -306
  207. data/tests/sf/test_coulomb.rb +0 -17
  208. data/tests/sf/test_dilog.rb +0 -25
  209. data/tests/sf/test_gamma.rb +0 -209
  210. data/tests/sf/test_hyperg.rb +0 -356
  211. data/tests/sf/test_legendre.rb +0 -227
  212. data/tests/sf/test_mathieu.rb +0 -59
  213. data/tests/sf/test_mode.rb +0 -19
  214. data/tests/sf/test_sf.rb +0 -839
  215. data/tests/stats.rb +0 -174
  216. data/tests/stats_mt.rb +0 -16
  217. data/tests/sum.rb +0 -98
  218. data/tests/sys.rb +0 -323
  219. data/tests/tensor.rb +0 -419
  220. data/tests/vector/vector_complex_test.rb +0 -101
  221. data/tests/vector/vector_test.rb +0 -141
  222. data/tests/wavelet.rb +0 -142
data/ext/nmf.c CHANGED
@@ -32,8 +32,8 @@ void pp(const gsl_matrix *m)
32
32
  {
33
33
  int r, c;
34
34
 
35
- for(r=0; r<m->size1; r++) {
36
- for(c=0; c<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");
@@ -47,9 +47,9 @@ double difcost(const gsl_matrix *a, const gsl_matrix *b)
47
47
  int i, j;
48
48
  double dif=0, d;
49
49
 
50
- for (i=0; i < a->size1; i++)
50
+ for (i=0; i < (int) a->size1; i++)
51
51
  {
52
- for (j=0; j < 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;
@@ -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 < m->size1; i++)
69
+ for(i=0; i < (int) m->size1; i++)
70
70
  {
71
- for(j=0; j < 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);
@@ -191,7 +191,7 @@ static VALUE rb_gsl_ntuple_select_fn_set_f(int argc, VALUE *argv, VALUE obj)
191
191
  CHECK_PROC(argv[0]);
192
192
  rb_ary_store(ary, 0, argv[0]);
193
193
  ary2 = rb_ary_new2(argc-1);
194
- for (i = 1; i < argc; i++) rb_ary_store(ary2, i-1, argv[i]);
194
+ for (i = 1; (int) i < argc; i++) rb_ary_store(ary2, i-1, argv[i]);
195
195
  rb_ary_store(ary, 1, ary2);
196
196
  break;
197
197
  }
@@ -236,7 +236,7 @@ static VALUE rb_gsl_ntuple_select_fn_set_params(int argc, VALUE *argv, VALUE obj
236
236
  rb_ary_store(ary, 1, argv[0]);
237
237
  } else {
238
238
  ary2 = rb_ary_new2(argc);
239
- for (i = 0; i < argc; i++) rb_ary_store(ary2, i, argv[i]);
239
+ for (i = 0; (int) i < argc; i++) rb_ary_store(ary2, i, argv[i]);
240
240
  rb_ary_store(ary, 1, ary2);
241
241
  }
242
242
  return obj;
@@ -310,7 +310,7 @@ static VALUE rb_gsl_ntuple_value_fn_set_f(int argc, VALUE *argv, VALUE obj)
310
310
  CHECK_PROC(argv[0]);
311
311
  rb_ary_store(ary, 0, argv[0]);
312
312
  ary2 = rb_ary_new2(argc-1);
313
- for (i = 1; i < argc; i++) rb_ary_store(ary2, i-1, argv[i]);
313
+ for (i = 1; (int) i < argc; i++) rb_ary_store(ary2, i-1, argv[i]);
314
314
  rb_ary_store(ary, 1, ary2);
315
315
  break;
316
316
  }
@@ -353,7 +353,7 @@ static VALUE rb_gsl_ntuple_value_fn_set_params(int argc, VALUE *argv, VALUE obj)
353
353
  rb_ary_store(ary, 1, argv[0]);
354
354
  } else {
355
355
  ary2 = rb_ary_new2(argc);
356
- for (i = 0; i < argc; i++) rb_ary_store(ary2, i, argv[i]);
356
+ for (i = 0; (int) i < argc; i++) rb_ary_store(ary2, i, argv[i]);
357
357
  rb_ary_store(ary, 1, ary2);
358
358
  }
359
359
  return obj;
@@ -223,7 +223,7 @@ static void set_sys(int argc, VALUE *argv, gsl_odeiv_system *sys)
223
223
  break;
224
224
  default:
225
225
  vparams = rb_ary_new2(argc-itmp);
226
- for (i = itmp, j = 0; i < argc; i++, j++) rb_ary_store(vparams, j, argv[i]);
226
+ for (i = itmp, j = 0; (int) i < argc; i++, j++) rb_ary_store(vparams, j, argv[i]);
227
227
  }
228
228
  dimension = FIX2INT(dim);
229
229
  sys->dimension = dimension;
@@ -251,7 +251,7 @@ static VALUE rb_gsl_odeiv_system_set_params(int argc, VALUE *argv, VALUE obj)
251
251
  break;
252
252
  default:
253
253
  vparams = rb_ary_new2(argc);
254
- for (i = 0; i < argc; i++) rb_ary_store(vparams, i, argv[i]);
254
+ for (i = 0; (int) i < argc; i++) rb_ary_store(vparams, i, argv[i]);
255
255
  }
256
256
  // rb_ary_delete_at(ary, 3);
257
257
  rb_ary_store(ary, 3, vparams);
@@ -101,7 +101,7 @@ static VALUE rb_gsl_permutation_get(int argc, VALUE *argv, VALUE obj)
101
101
  break;
102
102
  default:
103
103
  bnew = gsl_permutation_alloc(argc);
104
- for (j = 0; j < argc; j++) {
104
+ for (j = 0; j < (size_t) argc; j++) {
105
105
  i = FIX2INT(argv[j]);
106
106
  if (i < 0) k = b->size + i; else k = i;
107
107
  bnew->data[j] = b->data[k];
@@ -37,7 +37,7 @@ static gsl_poly_int* mygsl_poly_hermite(int n1)
37
37
  p2 = gsl_vector_int_calloc(n1 + 1);
38
38
  memcpy(p1->data, coef2, 3*sizeof(int));
39
39
  memcpy(p2->data, coef1, 2*sizeof(int));
40
- for (n = 2; n < n1; n++) {
40
+ for (n = 2; (int) n < n1; n++) {
41
41
  gsl_vector_int_memcpy(p0, p1);
42
42
  mygsl_vector_int_shift_scale2(p0, n);
43
43
  gsl_vector_int_scale(p2, 2*n);
@@ -77,7 +77,7 @@ static gsl_poly_int* mygsl_poly_cheb(int n1)
77
77
  p2 = gsl_vector_int_calloc(n1 + 1);
78
78
  memcpy(p1->data, coef2, 3*sizeof(int));
79
79
  memcpy(p2->data, coef1, 2*sizeof(int));
80
- for (n = 2; n < n1; n++) {
80
+ for (n = 2; (int) n < n1; n++) {
81
81
  gsl_vector_int_memcpy(p0, p1);
82
82
  mygsl_vector_int_shift_scale2(p0, n);
83
83
 
@@ -116,7 +116,7 @@ static gsl_poly_int* mygsl_poly_chebII(int n1)
116
116
  p2 = gsl_vector_int_calloc(n1 + 1);
117
117
  memcpy(p1->data, coef2, 3*sizeof(int));
118
118
  memcpy(p2->data, coef1, 2*sizeof(int));
119
- for (n = 2; n < n1; n++) {
119
+ for (n = 2; (int) n < n1; n++) {
120
120
  gsl_vector_int_memcpy(p0, p1);
121
121
  mygsl_vector_int_shift_scale2(p0, n);
122
122
  gsl_vector_int_sub(p0, p2);
@@ -148,7 +148,7 @@ static gsl_poly_int* mygsl_poly_laguerre(int n)
148
148
  break;
149
149
  default:
150
150
  k = gsl_sf_fact(n);
151
- for (m = 0; m <= n; m++) {
151
+ for (m = 0; (int) m <= n; m++) {
152
152
  val = k*k/gsl_sf_fact(n-m)/gsl_pow_2(gsl_sf_fact(m));
153
153
  if (m%2 == 1) val *= -1;
154
154
  gsl_vector_int_set(p0, m, val);
@@ -164,7 +164,7 @@ static gsl_poly_int* mygsl_poly_bessel(int n)
164
164
  gsl_vector_int *p0;
165
165
  if (n < 0) rb_raise(rb_eArgError, "order must be >= 0");
166
166
  p0 = gsl_vector_int_calloc(n + 1);
167
- for (k = 0; k <= n; k++) {
167
+ for (k = 0; (int) k <= n; k++) {
168
168
  gsl_vector_int_set(p0, k, gsl_sf_fact(n+k)/gsl_sf_fact(n-k)/gsl_sf_fact(k)/((int) pow(2, k)));
169
169
  }
170
170
  return p0;
@@ -191,7 +191,7 @@ static gsl_poly_int* mygsl_poly_bell(int n1)
191
191
  default:
192
192
  p1 = gsl_vector_int_calloc(n1 + 1);
193
193
  memcpy(p1->data, coef2, 3*sizeof(int));
194
- for (n = 2; n < n1; n++) {
194
+ for (n = 2; (int) n < n1; n++) {
195
195
  gsl_vector_int_memcpy(p0, p1);
196
196
  mygsl_vector_int_shift(p0, n);
197
197
  for (j = 0; j < n; j++) {
@@ -186,7 +186,7 @@ static VALUE rb_gsl_poly_eval_singleton(VALUE klass, VALUE a, VALUE x)
186
186
  #ifdef GSL_1_11_LATER
187
187
  static VALUE rb_gsl_complex_poly_complex_eval(VALUE a, VALUE b)
188
188
  {
189
- gsl_vector_complex *coef, *zb, *vnew;
189
+ gsl_vector_complex *coef = NULL, *zb, *vnew;
190
190
  gsl_complex *zc;
191
191
  gsl_complex z, *zx, *res;
192
192
  VALUE ret;
@@ -220,7 +220,7 @@ static VALUE rb_gsl_complex_poly_complex_eval(VALUE a, VALUE b)
220
220
  break;
221
221
  case T_ARRAY:
222
222
  ret = rb_ary_new2(RARRAY_LEN(b));
223
- for (i = 0; i < RARRAY_LEN(b); i++) {
223
+ for (i = 0; (int) i < RARRAY_LEN(b); i++) {
224
224
  Data_Get_Struct(rb_ary_entry(b, i), gsl_complex, zx);
225
225
  res = (gsl_complex*) malloc(sizeof(gsl_complex));
226
226
  *res = gsl_complex_poly_complex_eval(zc, N, *zx);
@@ -282,7 +282,7 @@ static VALUE FUNCTION(rb_gsl_poly,eval)(VALUE obj, VALUE xx)
282
282
  break;
283
283
  case T_ARRAY:
284
284
  ary = rb_ary_new2(RARRAY_LEN(xx));
285
- for (i = 0; i < RARRAY_LEN(xx); i++) {
285
+ for (i = 0; (int) i < RARRAY_LEN(xx); i++) {
286
286
  x = rb_ary_entry(xx, i);
287
287
  Need_Float(x);
288
288
  rb_ary_store(ary, i, rb_float_new(FUNCTION(gsl_poly,eval)(p->data, p->size, NUM2DBL(x))));
@@ -385,7 +385,7 @@ static VALUE FUNCTION(rb_gsl_poly,eval2)(int argc, VALUE *argv, VALUE obj)
385
385
  break;
386
386
  case T_ARRAY:
387
387
  ary = rb_ary_new2(RARRAY_LEN(xx));
388
- for (i = 0; i < RARRAY_LEN(xx); i++) {
388
+ for (i = 0; (int) i < RARRAY_LEN(xx); i++) {
389
389
  x = rb_ary_entry(xx, i);
390
390
  Need_Float(x);
391
391
  rb_ary_store(ary, i, rb_float_new(FUNCTION(gsl_poly,eval)(p->data, size, NUM2DBL(x))));
@@ -1265,12 +1265,15 @@ GSL_TYPE(gsl_vector)* FUNCTION(gsl_poly,deconv_vector)(const GSL_TYPE(gsl_vector
1265
1265
  FUNCTION(gsl_vector,set)(vnew, n-1, FUNCTION(gsl_vector,get)(c2, c2->size-1)/aa);
1266
1266
  for (i = n - 2, k = 1; k < n; i--, k++) {
1267
1267
  x = FUNCTION(gsl_vector,get)(c2, c2->size-1-k);
1268
- for (j = n-1; j >= 0; j--) {
1268
+ for (j = n-1;; j--) {
1269
1269
  z = FUNCTION(gsl_vector,get)(vnew, j);
1270
1270
  jj = c2->size-1-k-j;
1271
- if (jj > k || jj < 0) continue;
1271
+ //if (jj > k || jj < 0) continue;
1272
+ if (jj <= k) {
1272
1273
  y = FUNCTION(gsl_vector,get)(a2, jj);
1273
1274
  x -= y*z;
1275
+ }
1276
+ if (j == 0) break;
1274
1277
  }
1275
1278
  FUNCTION(gsl_vector,set)(vnew, i, x/aa);
1276
1279
  }
data/ext/sf.c CHANGED
@@ -775,22 +775,22 @@ VALUE rb_gsl_sf_eval_double_m(double (*func)(double, gsl_mode_t), VALUE argv, VA
775
775
  VALUE ary, xx;
776
776
  size_t i, k, n;
777
777
  double val;
778
- gsl_mode_t mode;
779
- char c;
778
+ /*gsl_mode_t mode;
779
+ char c;*/
780
780
  #ifdef HAVE_NARRAY_H
781
781
  double *ptr1, *ptr2;
782
782
  struct NARRAY *na;
783
783
  #endif
784
784
  switch (TYPE(m)) {
785
785
  case T_STRING:
786
- c = tolower(NUM2CHR(m));
786
+ /*c = tolower(NUM2CHR(m));
787
787
  if (c == 'd') mode = GSL_PREC_DOUBLE;
788
788
  else if (c == 's') mode = GSL_PREC_SINGLE;
789
789
  else if (c == 'a') mode = GSL_PREC_APPROX;
790
- else mode = GSL_PREC_DOUBLE;
790
+ else mode = GSL_PREC_DOUBLE;*/
791
791
  break;
792
792
  case T_FIXNUM:
793
- mode = FIX2INT(m);
793
+ /*mode = FIX2INT(m);*/
794
794
  break;
795
795
  default:
796
796
  rb_raise(rb_eArgError, "wrong type argument %s (String or Fixnum expected)",
@@ -859,19 +859,19 @@ VALUE rb_gsl_sf_eval_double2_m(double (*func)(double, double, gsl_mode_t),
859
859
  VALUE ary, xx;
860
860
  size_t i, k, n;
861
861
  double val, xx2;
862
- gsl_mode_t mode;
863
- char c;
862
+ /*gsl_mode_t mode;
863
+ char c;*/
864
864
  #ifdef HAVE_NARRAY_H
865
865
  double *ptr1, *ptr2;
866
866
  struct NARRAY *na;
867
867
  #endif
868
868
  Need_Float(x2);
869
869
  xx2 = NUM2DBL(x2);
870
- c = tolower(NUM2CHR(m));
870
+ /*c = tolower(NUM2CHR(m));
871
871
  if (c == 'd') mode = GSL_PREC_DOUBLE;
872
872
  else if (c == 's') mode = GSL_PREC_SINGLE;
873
873
  else if (c == 'a') mode = GSL_PREC_APPROX;
874
- else mode = GSL_PREC_DOUBLE;
874
+ else mode = GSL_PREC_DOUBLE;*/
875
875
  if (CLASS_OF(argv) == rb_cRange) argv = rb_gsl_range2ary(argv);
876
876
  switch (TYPE(argv)) {
877
877
  case T_FLOAT:
@@ -935,8 +935,8 @@ VALUE rb_gsl_sf_eval_double3_m(double (*func)(double, double, double, gsl_mode_t
935
935
  VALUE ary, xx;
936
936
  size_t i, k, n;
937
937
  double val, xx2, xx3;
938
- gsl_mode_t mode;
939
- char c;
938
+ /*gsl_mode_t mode;
939
+ char c;*/
940
940
  #ifdef HAVE_NARRAY_H
941
941
  double *ptr1, *ptr2;
942
942
  struct NARRAY *na;
@@ -944,11 +944,11 @@ VALUE rb_gsl_sf_eval_double3_m(double (*func)(double, double, double, gsl_mode_t
944
944
  Need_Float(x2); Need_Float(x3);
945
945
  xx2 = NUM2DBL(x2);
946
946
  xx3 = NUM2DBL(x3);
947
- c = tolower(NUM2CHR(m));
947
+ /*c = tolower(NUM2CHR(m));
948
948
  if (c == 'd') mode = GSL_PREC_DOUBLE;
949
949
  else if (c == 's') mode = GSL_PREC_SINGLE;
950
950
  else if (c == 'a') mode = GSL_PREC_APPROX;
951
- else mode = GSL_PREC_DOUBLE;
951
+ else mode = GSL_PREC_DOUBLE;*/
952
952
  if (CLASS_OF(argv) == rb_cRange) argv = rb_gsl_range2ary(argv);
953
953
  switch (TYPE(argv)) {
954
954
  case T_FLOAT:
@@ -1013,19 +1013,19 @@ VALUE rb_gsl_sf_eval_double4_m(double (*func)(double, double, double, double,
1013
1013
  VALUE ary, xx;
1014
1014
  size_t i, k, n;
1015
1015
  double val, xx2, xx3, xx4;
1016
- gsl_mode_t mode;
1017
- char c;
1016
+ /*gsl_mode_t mode;
1017
+ char c;*/
1018
1018
  #ifdef HAVE_NARRAY_H
1019
1019
  double *ptr1, *ptr2;
1020
1020
  struct NARRAY *na;
1021
1021
  #endif
1022
1022
  Need_Float(x2); Need_Float(x3); Need_Float(x4);
1023
1023
  xx2 = NUM2DBL(x2); xx3 = NUM2DBL(x3); xx4 = NUM2DBL(x4);
1024
- c = tolower(NUM2CHR(m));
1024
+ /*c = tolower(NUM2CHR(m));
1025
1025
  if (c == 'd') mode = GSL_PREC_DOUBLE;
1026
1026
  else if (c == 's') mode = GSL_PREC_SINGLE;
1027
1027
  else if (c == 'a') mode = GSL_PREC_APPROX;
1028
- else mode = GSL_PREC_DOUBLE;
1028
+ else mode = GSL_PREC_DOUBLE;*/
1029
1029
  if (CLASS_OF(argv) == rb_cRange) argv = rb_gsl_range2ary(argv);
1030
1030
  switch (TYPE(argv)) {
1031
1031
  case T_FLOAT:
@@ -1086,10 +1086,9 @@ VALUE rb_gsl_sf_eval_e(int (*func)(double, gsl_sf_result*), VALUE x)
1086
1086
  {
1087
1087
  gsl_sf_result *rslt = NULL;
1088
1088
  VALUE v;
1089
- int status;
1090
1089
  Need_Float(x);
1091
1090
  v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
1092
- status = (*func)(NUM2DBL(x), rslt);
1091
+ (*func)(NUM2DBL(x), rslt);
1093
1092
  return v;
1094
1093
  }
1095
1094
 
@@ -1097,10 +1096,9 @@ VALUE rb_gsl_sf_eval_e_int(int (*func)(int, gsl_sf_result*), VALUE x)
1097
1096
  {
1098
1097
  gsl_sf_result *rslt = NULL;
1099
1098
  VALUE v;
1100
- int status;
1101
1099
  CHECK_FIXNUM(x);
1102
1100
  v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
1103
- status = (*func)(NUM2INT(x), rslt);
1101
+ (*func)(NUM2INT(x), rslt);
1104
1102
  return v;
1105
1103
  }
1106
1104
 
@@ -1108,9 +1106,8 @@ VALUE rb_gsl_sf_eval_e_uint(int (*func)(unsigned int, gsl_sf_result*), VALUE x)
1108
1106
  {
1109
1107
  gsl_sf_result *rslt = NULL;
1110
1108
  VALUE v;
1111
- int status;
1112
1109
  v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
1113
- status = (*func)(NUM2UINT(x), rslt);
1110
+ (*func)(NUM2UINT(x), rslt);
1114
1111
  return v;
1115
1112
  }
1116
1113
 
@@ -1119,10 +1116,9 @@ VALUE rb_gsl_sf_eval_e_int_uint(int (*func)(int, unsigned int, gsl_sf_result*),
1119
1116
  {
1120
1117
  gsl_sf_result *rslt = NULL;
1121
1118
  VALUE v;
1122
- int status;
1123
1119
  CHECK_FIXNUM(n);
1124
1120
  v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
1125
- status = (*func)(FIX2INT(n), NUM2UINT(x), rslt);
1121
+ (*func)(FIX2INT(n), NUM2UINT(x), rslt);
1126
1122
  return v;
1127
1123
  }
1128
1124
 
@@ -1131,10 +1127,9 @@ VALUE rb_gsl_sf_eval_e_double_uint(int (*func)(double, unsigned int, gsl_sf_resu
1131
1127
  {
1132
1128
  gsl_sf_result *rslt = NULL;
1133
1129
  VALUE v;
1134
- int status;
1135
1130
  Need_Float(y);
1136
1131
  v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
1137
- status = (*func)(NUM2DBL(y), NUM2UINT(x), rslt);
1132
+ (*func)(NUM2DBL(y), NUM2UINT(x), rslt);
1138
1133
  return v;
1139
1134
  }
1140
1135
 
@@ -1143,11 +1138,10 @@ VALUE rb_gsl_sf_eval_e_int_double(int (*func)(int, double, gsl_sf_result*),
1143
1138
  {
1144
1139
  gsl_sf_result *rslt = NULL;
1145
1140
  VALUE v;
1146
- int status;
1147
1141
  CHECK_FIXNUM(n);
1148
1142
  Need_Float(x);
1149
1143
  v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
1150
- status = (*func)(FIX2INT(n), NUM2DBL(x), rslt);
1144
+ (*func)(FIX2INT(n), NUM2DBL(x), rslt);
1151
1145
  return v;
1152
1146
  }
1153
1147
 
@@ -1156,11 +1150,10 @@ VALUE rb_gsl_sf_eval_e_int_double2(int (*func)(int, double, double, gsl_sf_resul
1156
1150
  {
1157
1151
  gsl_sf_result *rslt = NULL;
1158
1152
  VALUE v;
1159
- int status;
1160
1153
  CHECK_FIXNUM(n);
1161
1154
  Need_Float(x1); Need_Float(x2);
1162
1155
  v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
1163
- status = (*func)(FIX2INT(n), NUM2DBL(x1), NUM2DBL(x2), rslt);
1156
+ (*func)(FIX2INT(n), NUM2DBL(x1), NUM2DBL(x2), rslt);
1164
1157
  return v;
1165
1158
  }
1166
1159
 
@@ -1170,11 +1163,10 @@ VALUE rb_gsl_sf_eval_e_int_int_double(int (*func)(int, int, double, gsl_sf_resul
1170
1163
  {
1171
1164
  gsl_sf_result *rslt = NULL;
1172
1165
  VALUE v;
1173
- int status;
1174
1166
  CHECK_FIXNUM(n1); CHECK_FIXNUM(n2);
1175
1167
  Need_Float(x);
1176
1168
  v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
1177
- status = (*func)(FIX2INT(n1), FIX2INT(n2), NUM2DBL(x), rslt);
1169
+ (*func)(FIX2INT(n1), FIX2INT(n2), NUM2DBL(x), rslt);
1178
1170
  return v;
1179
1171
  }
1180
1172
 
@@ -1183,10 +1175,9 @@ VALUE rb_gsl_sf_eval_e_double2(int (*func)(double, double, gsl_sf_result*),
1183
1175
  {
1184
1176
  gsl_sf_result *rslt = NULL;
1185
1177
  VALUE v;
1186
- int status;
1187
1178
  Need_Float(x1); Need_Float(x2);
1188
1179
  v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
1189
- status = (*func)(NUM2DBL(x1), NUM2DBL(x2), rslt);
1180
+ (*func)(NUM2DBL(x1), NUM2DBL(x2), rslt);
1190
1181
  return v;
1191
1182
  }
1192
1183
 
@@ -1196,10 +1187,9 @@ VALUE rb_gsl_sf_eval_e_double3(int (*func)(double, double, double, gsl_sf_result
1196
1187
  {
1197
1188
  gsl_sf_result *rslt = NULL;
1198
1189
  VALUE v;
1199
- int status;
1200
1190
  Need_Float(x1); Need_Float(x2); Need_Float(x3);
1201
1191
  v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
1202
- status = (*func)(NUM2DBL(x1), NUM2DBL(x2),NUM2DBL(x3), rslt);
1192
+ (*func)(NUM2DBL(x1), NUM2DBL(x2),NUM2DBL(x3), rslt);
1203
1193
  return v;
1204
1194
  }
1205
1195
 
@@ -1210,7 +1200,6 @@ VALUE rb_gsl_sf_eval_e_m(int (*func)(double, gsl_mode_t, gsl_sf_result*),
1210
1200
  char c;
1211
1201
  gsl_sf_result *rslt = NULL;
1212
1202
  VALUE v;
1213
- int status;
1214
1203
  Need_Float(x);
1215
1204
  switch (TYPE(m)) {
1216
1205
  case T_STRING:
@@ -1229,7 +1218,7 @@ VALUE rb_gsl_sf_eval_e_m(int (*func)(double, gsl_mode_t, gsl_sf_result*),
1229
1218
  break;
1230
1219
  }
1231
1220
  v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
1232
- status = (*func)(NUM2DBL(x), mode, rslt);
1221
+ (*func)(NUM2DBL(x), mode, rslt);
1233
1222
  return v;
1234
1223
  }
1235
1224
 
@@ -1241,7 +1230,6 @@ VALUE rb_gsl_sf_eval_e_double2_m(int (*func)(double, double, gsl_mode_t, gsl_sf_
1241
1230
  char c;
1242
1231
  gsl_sf_result *rslt = NULL;
1243
1232
  VALUE v;
1244
- int status;
1245
1233
  Need_Float(x1); Need_Float(x2);
1246
1234
  switch (TYPE(m)) {
1247
1235
  case T_STRING:
@@ -1260,7 +1248,7 @@ VALUE rb_gsl_sf_eval_e_double2_m(int (*func)(double, double, gsl_mode_t, gsl_sf_
1260
1248
  break;
1261
1249
  }
1262
1250
  v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
1263
- status = (*func)(NUM2DBL(x1), NUM2DBL(x2), mode, rslt);
1251
+ (*func)(NUM2DBL(x1), NUM2DBL(x2), mode, rslt);
1264
1252
  return v;
1265
1253
  }
1266
1254
 
@@ -1271,7 +1259,6 @@ VALUE rb_gsl_sf_eval_e_double3_m(int (*func)(double, double, double, gsl_mode_t,
1271
1259
  char c;
1272
1260
  gsl_sf_result *rslt = NULL;
1273
1261
  VALUE v;
1274
- int status;
1275
1262
  Need_Float(x1); Need_Float(x2); Need_Float(x3);
1276
1263
  switch (TYPE(m)) {
1277
1264
  case T_STRING:
@@ -1290,7 +1277,7 @@ VALUE rb_gsl_sf_eval_e_double3_m(int (*func)(double, double, double, gsl_mode_t,
1290
1277
  break;
1291
1278
  }
1292
1279
  v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
1293
- status = (*func)(NUM2DBL(x1), NUM2DBL(x2),NUM2DBL(x3), mode, rslt);
1280
+ (*func)(NUM2DBL(x1), NUM2DBL(x2),NUM2DBL(x3), mode, rslt);
1294
1281
  return v;
1295
1282
  }
1296
1283
 
@@ -1302,7 +1289,6 @@ VALUE rb_gsl_sf_eval_e_double4_m(int (*func)(double, double, double, double, gsl
1302
1289
  char c;
1303
1290
  gsl_sf_result *rslt = NULL;
1304
1291
  VALUE v;
1305
- int status;
1306
1292
  Need_Float(x1); Need_Float(x2); Need_Float(x3); Need_Float(x4);
1307
1293
  switch (TYPE(m)) {
1308
1294
  case T_STRING:
@@ -1321,7 +1307,7 @@ VALUE rb_gsl_sf_eval_e_double4_m(int (*func)(double, double, double, double, gsl
1321
1307
  break;
1322
1308
  }
1323
1309
  v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
1324
- status = (*func)(NUM2DBL(x1), NUM2DBL(x2),NUM2DBL(x3), NUM2DBL(x4), mode, rslt);
1310
+ (*func)(NUM2DBL(x1), NUM2DBL(x2),NUM2DBL(x3), NUM2DBL(x4), mode, rslt);
1325
1311
  return v;
1326
1312
  }
1327
1313