rb-gsl 1.16.0 → 1.16.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +6 -0
  3. data/README +11 -15
  4. data/Rakefile +6 -10
  5. data/ext/{alf.c → gsl/alf.c} +1 -1
  6. data/ext/{array.c → gsl/array.c} +4 -6
  7. data/ext/{array_complex.c → gsl/array_complex.c} +2 -3
  8. data/ext/{blas.c → gsl/blas.c} +2 -3
  9. data/ext/{blas1.c → gsl/blas1.c} +3 -4
  10. data/ext/{blas2.c → gsl/blas2.c} +3 -4
  11. data/ext/{blas3.c → gsl/blas3.c} +3 -4
  12. data/ext/{block.c → gsl/block.c} +11 -12
  13. data/ext/{block_source.c → gsl/block_source.c} +0 -0
  14. data/ext/{bspline.c → gsl/bspline.c} +1 -1
  15. data/ext/{bundle.c → gsl/bundle.c} +0 -0
  16. data/ext/{cdf.c → gsl/cdf.c} +3 -5
  17. data/ext/{cheb.c → gsl/cheb.c} +4 -4
  18. data/ext/{combination.c → gsl/combination.c} +2 -3
  19. data/ext/{common.c → gsl/common.c} +8 -10
  20. data/ext/{complex.c → gsl/complex.c} +3 -3
  21. data/ext/{const.c → gsl/const.c} +2 -3
  22. data/ext/{const_additional.c → gsl/const_additional.c} +2 -2
  23. data/ext/{cqp.c → gsl/cqp.c} +1 -1
  24. data/ext/{deriv.c → gsl/deriv.c} +3 -3
  25. data/ext/{dht.c → gsl/dht.c} +3 -3
  26. data/ext/{diff.c → gsl/diff.c} +3 -3
  27. data/ext/{dirac.c → gsl/dirac.c} +1 -1
  28. data/ext/{eigen.c → gsl/eigen.c} +16 -16
  29. data/ext/{error.c → gsl/error.c} +5 -5
  30. data/ext/gsl/extconf.rb +121 -0
  31. data/ext/{fcmp.c → gsl/fcmp.c} +0 -2
  32. data/ext/{fft.c → gsl/fft.c} +1 -2
  33. data/ext/{fit.c → gsl/fit.c} +1 -2
  34. data/ext/{fresnel.c → gsl/fresnel.c} +2 -2
  35. data/ext/{function.c → gsl/function.c} +3 -3
  36. data/ext/{geometry.c → gsl/geometry.c} +1 -1
  37. data/ext/{graph.c → gsl/graph.c} +2 -2
  38. data/ext/{gsl.c → gsl/gsl.c} +2 -10
  39. data/ext/{gsl_narray.c → gsl/gsl_narray.c} +2 -3
  40. data/ext/{histogram.c → gsl/histogram.c} +3 -4
  41. data/ext/{histogram2d.c → gsl/histogram2d.c} +3 -4
  42. data/ext/{histogram3d.c → gsl/histogram3d.c} +4 -4
  43. data/ext/{histogram3d_source.c → gsl/histogram3d_source.c} +1 -1
  44. data/ext/{histogram_find.c → gsl/histogram_find.c} +1 -1
  45. data/ext/{histogram_oper.c → gsl/histogram_oper.c} +0 -0
  46. data/ext/{ieee.c → gsl/ieee.c} +4 -8
  47. data/{include → ext/gsl/include}/rb_gsl.h +4 -19
  48. data/{include → ext/gsl/include}/rb_gsl_array.h +0 -14
  49. data/{include → ext/gsl/include}/rb_gsl_cheb.h +0 -2
  50. data/{include → ext/gsl/include}/rb_gsl_common.h +11 -15
  51. data/{include → ext/gsl/include}/rb_gsl_complex.h +1 -1
  52. data/{include → ext/gsl/include}/rb_gsl_const.h +1 -2
  53. data/ext/gsl/include/rb_gsl_dirac.h +6 -0
  54. data/{include → ext/gsl/include}/rb_gsl_eigen.h +1 -1
  55. data/{include → ext/gsl/include}/rb_gsl_fft.h +0 -10
  56. data/{include → ext/gsl/include}/rb_gsl_fit.h +0 -2
  57. data/{include → ext/gsl/include}/rb_gsl_function.h +0 -4
  58. data/{include → ext/gsl/include}/rb_gsl_graph.h +0 -2
  59. data/{include → ext/gsl/include}/rb_gsl_histogram.h +0 -0
  60. data/{include → ext/gsl/include}/rb_gsl_histogram3d.h +0 -0
  61. data/{include → ext/gsl/include}/rb_gsl_integration.h +1 -1
  62. data/{include → ext/gsl/include}/rb_gsl_interp.h +0 -5
  63. data/{include → ext/gsl/include}/rb_gsl_linalg.h +2 -5
  64. data/{include → ext/gsl/include}/rb_gsl_math.h +0 -2
  65. data/{include → ext/gsl/include}/rb_gsl_odeiv.h +0 -3
  66. data/{include → ext/gsl/include}/rb_gsl_poly.h +0 -4
  67. data/{include → ext/gsl/include}/rb_gsl_rational.h +0 -7
  68. data/{include → ext/gsl/include}/rb_gsl_rng.h +0 -1
  69. data/{include → ext/gsl/include}/rb_gsl_root.h +1 -1
  70. data/{include → ext/gsl/include}/rb_gsl_sf.h +0 -5
  71. data/{include → ext/gsl/include}/rb_gsl_statistics.h +1 -1
  72. data/{include → ext/gsl/include}/rb_gsl_tensor.h +0 -2
  73. data/{include → ext/gsl/include}/rb_gsl_with_narray.h +3 -1
  74. data/{include → ext/gsl/include}/templates_off.h +0 -0
  75. data/{include → ext/gsl/include}/templates_on.h +0 -0
  76. data/ext/{integration.c → gsl/integration.c} +4 -6
  77. data/ext/{interp.c → gsl/interp.c} +1 -6
  78. data/ext/{jacobi.c → gsl/jacobi.c} +1 -1
  79. data/ext/{linalg.c → gsl/linalg.c} +3 -4
  80. data/ext/{linalg_complex.c → gsl/linalg_complex.c} +3 -4
  81. data/ext/{math.c → gsl/math.c} +2 -3
  82. data/ext/{matrix.c → gsl/matrix.c} +9 -10
  83. data/ext/{matrix_complex.c → gsl/matrix_complex.c} +2 -3
  84. data/ext/{matrix_double.c → gsl/matrix_double.c} +5 -5
  85. data/ext/{matrix_int.c → gsl/matrix_int.c} +4 -4
  86. data/ext/{matrix_source.c → gsl/matrix_source.c} +2 -6
  87. data/ext/{min.c → gsl/min.c} +2 -2
  88. data/ext/{monte.c → gsl/monte.c} +3 -3
  89. data/ext/{multifit.c → gsl/multifit.c} +4 -4
  90. data/ext/{multimin.c → gsl/multimin.c} +5 -5
  91. data/ext/{multimin_fsdf.c → gsl/multimin_fsdf.c} +1 -1
  92. data/ext/{multiroots.c → gsl/multiroots.c} +6 -6
  93. data/ext/{multiset.c → gsl/multiset.c} +1 -1
  94. data/ext/{ndlinear.c → gsl/ndlinear.c} +1 -1
  95. data/ext/{nmf.c → gsl/nmf.c} +0 -0
  96. data/ext/{nmf_wrap.c → gsl/nmf_wrap.c} +0 -0
  97. data/ext/{ntuple.c → gsl/ntuple.c} +6 -6
  98. data/ext/{odeiv.c → gsl/odeiv.c} +4 -8
  99. data/ext/{ool.c → gsl/ool.c} +2 -2
  100. data/ext/{oper_complex_source.c → gsl/oper_complex_source.c} +2 -4
  101. data/ext/{permutation.c → gsl/permutation.c} +2 -2
  102. data/ext/{poly.c → gsl/poly.c} +8 -8
  103. data/ext/{poly2.c → gsl/poly2.c} +4 -4
  104. data/ext/{poly_source.c → gsl/poly_source.c} +7 -11
  105. data/ext/{qrng.c → gsl/qrng.c} +3 -3
  106. data/ext/{randist.c → gsl/randist.c} +4 -4
  107. data/ext/{rational.c → gsl/rational.c} +3 -3
  108. data/ext/{rng.c → gsl/rng.c} +1 -2
  109. data/ext/{root.c → gsl/root.c} +4 -5
  110. data/ext/{sf.c → gsl/sf.c} +2 -2
  111. data/ext/{sf_airy.c → gsl/sf_airy.c} +2 -2
  112. data/ext/{sf_bessel.c → gsl/sf_bessel.c} +1 -1
  113. data/ext/{sf_clausen.c → gsl/sf_clausen.c} +1 -1
  114. data/ext/{sf_coulomb.c → gsl/sf_coulomb.c} +1 -1
  115. data/ext/{sf_coupling.c → gsl/sf_coupling.c} +1 -1
  116. data/ext/{sf_dawson.c → gsl/sf_dawson.c} +1 -1
  117. data/ext/{sf_debye.c → gsl/sf_debye.c} +1 -1
  118. data/ext/{sf_dilog.c → gsl/sf_dilog.c} +1 -1
  119. data/ext/{sf_elementary.c → gsl/sf_elementary.c} +1 -1
  120. data/ext/{sf_ellint.c → gsl/sf_ellint.c} +1 -1
  121. data/ext/{sf_elljac.c → gsl/sf_elljac.c} +1 -1
  122. data/ext/{sf_erfc.c → gsl/sf_erfc.c} +1 -1
  123. data/ext/{sf_exp.c → gsl/sf_exp.c} +1 -1
  124. data/ext/{sf_expint.c → gsl/sf_expint.c} +1 -1
  125. data/ext/{sf_fermi_dirac.c → gsl/sf_fermi_dirac.c} +1 -1
  126. data/ext/{sf_gamma.c → gsl/sf_gamma.c} +1 -1
  127. data/ext/{sf_gegenbauer.c → gsl/sf_gegenbauer.c} +1 -1
  128. data/ext/{sf_hyperg.c → gsl/sf_hyperg.c} +1 -1
  129. data/ext/{sf_laguerre.c → gsl/sf_laguerre.c} +1 -1
  130. data/ext/{sf_lambert.c → gsl/sf_lambert.c} +1 -1
  131. data/ext/{sf_legendre.c → gsl/sf_legendre.c} +1 -1
  132. data/ext/{sf_log.c → gsl/sf_log.c} +1 -1
  133. data/ext/{sf_mathieu.c → gsl/sf_mathieu.c} +1 -1
  134. data/ext/{sf_power.c → gsl/sf_power.c} +1 -1
  135. data/ext/{sf_psi.c → gsl/sf_psi.c} +1 -1
  136. data/ext/{sf_synchrotron.c → gsl/sf_synchrotron.c} +1 -1
  137. data/ext/{sf_transport.c → gsl/sf_transport.c} +1 -1
  138. data/ext/{sf_trigonometric.c → gsl/sf_trigonometric.c} +1 -1
  139. data/ext/{sf_zeta.c → gsl/sf_zeta.c} +1 -1
  140. data/ext/{signal.c → gsl/signal.c} +2 -3
  141. data/ext/{siman.c → gsl/siman.c} +9 -9
  142. data/ext/{sort.c → gsl/sort.c} +4 -4
  143. data/ext/{spline.c → gsl/spline.c} +3 -3
  144. data/ext/{stats.c → gsl/stats.c} +3 -3
  145. data/ext/{sum.c → gsl/sum.c} +2 -2
  146. data/ext/{tamu_anova.c → gsl/tamu_anova.c} +1 -1
  147. data/ext/{tensor.c → gsl/tensor.c} +6 -7
  148. data/ext/{tensor_source.c → gsl/tensor_source.c} +3 -4
  149. data/ext/{vector.c → gsl/vector.c} +9 -10
  150. data/ext/{vector_complex.c → gsl/vector_complex.c} +3 -3
  151. data/ext/{vector_double.c → gsl/vector_double.c} +5 -6
  152. data/ext/{vector_int.c → gsl/vector_int.c} +4 -4
  153. data/ext/{vector_source.c → gsl/vector_source.c} +1 -5
  154. data/ext/{wavelet.c → gsl/wavelet.c} +3 -4
  155. data/lib/gsl.rb +13 -3
  156. data/lib/gsl/gnuplot.rb +1 -1
  157. data/lib/gsl/version.rb +5 -0
  158. data/lib/rbgsl.rb +1 -3
  159. data/rdoc/index.rdoc +0 -9
  160. metadata +199 -160
  161. data/VERSION +0 -1
  162. data/ext/extconf.rb +0 -309
  163. data/include/rb_gsl_config.h +0 -71
  164. data/include/rb_gsl_dirac.h +0 -13
@@ -9,9 +9,9 @@
9
9
  WITHOUT ANY WARRANTY.
10
10
  */
11
11
 
12
- #include "rb_gsl.h"
13
- #include "rb_gsl_array.h"
14
- #include "rb_gsl_common.h"
12
+ #include "include/rb_gsl.h"
13
+ #include "include/rb_gsl_array.h"
14
+ #include "include/rb_gsl_common.h"
15
15
  #include <gsl/gsl_dht.h>
16
16
  #ifdef HAVE_NARRAY_H
17
17
  #include "narray.h"
@@ -8,9 +8,9 @@
8
8
  This library is distributed in the hope that it will be useful, but
9
9
  WITHOUT ANY WARRANTY.
10
10
  */
11
- #include "rb_gsl_config.h"
12
- #include "rb_gsl_common.h"
13
- #include "rb_gsl_function.h"
11
+
12
+ #include "include/rb_gsl_common.h"
13
+ #include "include/rb_gsl_function.h"
14
14
  #include <gsl/gsl_math.h>
15
15
  #include <gsl/gsl_diff.h>
16
16
 
@@ -1,4 +1,4 @@
1
- #include "rb_gsl_dirac.h"
1
+ #include "include/rb_gsl_dirac.h"
2
2
 
3
3
  static VALUE cgsl_matrix_complex_const;
4
4
  static VALUE cPauli;
@@ -9,11 +9,11 @@
9
9
  WITHOUT ANY WARRANTY.
10
10
  */
11
11
 
12
- #include "rb_gsl.h"
13
- #include "rb_gsl_array.h"
12
+ #include "include/rb_gsl.h"
13
+ #include "include/rb_gsl_array.h"
14
14
 
15
- #include "rb_gsl_eigen.h"
16
- #include "rb_gsl_complex.h"
15
+ #include "include/rb_gsl_eigen.h"
16
+ #include "include/rb_gsl_complex.h"
17
17
  #include <gsl/gsl_complex.h>
18
18
  #include <gsl/gsl_complex_math.h>
19
19
  #include <gsl/gsl_math.h>
@@ -29,7 +29,7 @@ static VALUE cgsl_eigen_vector;
29
29
  static VALUE cgsl_eigen_vector_complex;
30
30
  static VALUE cgsl_eigen_herm_vectors;
31
31
 
32
- #ifdef HAVE_EIGEN_FRANCIS
32
+ #ifdef HAVE_GSL_EIGEN_FRANCIS
33
33
  static VALUE cgsl_eigen_francis_workspace;
34
34
 
35
35
  #endif
@@ -600,7 +600,7 @@ static VALUE rb_gsl_eigen_hermv_sort(int argc, VALUE *argv, VALUE obj)
600
600
  }
601
601
 
602
602
 
603
- #ifdef HAVE_EIGEN_FRANCIS
603
+ #ifdef HAVE_GSL_EIGEN_FRANCIS
604
604
  static VALUE rb_gsl_eigen_francis_alloc(VALUE klass)
605
605
  {
606
606
  gsl_eigen_francis_workspace *w = NULL;
@@ -1571,7 +1571,7 @@ static VALUE rb_gsl_eigen_gensymm(int argc, VALUE *argv, VALUE obj)
1571
1571
  gsl_vector *eval = NULL;
1572
1572
  gsl_eigen_gensymm_workspace *w = NULL;
1573
1573
  int flag;
1574
- VALUE veval = NULL;
1574
+ VALUE veval = Qnil;
1575
1575
  flag = check_argv_gensymm(argc, argv, obj, &A, &B, &eval, &w);
1576
1576
  Atmp = make_matrix_clone(A);
1577
1577
  // Btmp = make_matrix_clone(B);
@@ -1606,7 +1606,7 @@ static VALUE rb_gsl_eigen_gensymmv(int argc, VALUE *argv, VALUE obj)
1606
1606
  gsl_matrix *evec = NULL;
1607
1607
  gsl_eigen_gensymmv_workspace *w = NULL;
1608
1608
  int flag;
1609
- VALUE veval = NULL, vevec = NULL;
1609
+ VALUE veval = Qnil, vevec = Qnil;
1610
1610
  flag = check_argv_gensymmv(argc, argv, obj, &A, &B, &eval, &evec, &w);
1611
1611
  Atmp = make_matrix_clone(A);
1612
1612
  // Btmp = make_matrix_clone(B);
@@ -1645,7 +1645,7 @@ static VALUE rb_gsl_eigen_genherm(int argc, VALUE *argv, VALUE obj)
1645
1645
  gsl_vector *eval = NULL;
1646
1646
  gsl_eigen_genherm_workspace *w = NULL;
1647
1647
  int flag;
1648
- VALUE veval = NULL;
1648
+ VALUE veval = Qnil;
1649
1649
  flag = check_argv_genherm(argc, argv, obj, &A, &B, &eval, &w);
1650
1650
  Atmp = make_matrix_complex_clone(A);
1651
1651
  Btmp = make_matrix_complex_clone(B);
@@ -1680,7 +1680,7 @@ static VALUE rb_gsl_eigen_genhermv(int argc, VALUE *argv, VALUE obj)
1680
1680
  gsl_matrix_complex *evec = NULL;
1681
1681
  gsl_eigen_genhermv_workspace *w = NULL;
1682
1682
  int flag;
1683
- VALUE veval = NULL, vevec = NULL;
1683
+ VALUE veval = Qnil, vevec = Qnil;
1684
1684
  flag = check_argv_genhermv(argc, argv, obj, &A, &B, &eval, &evec, &w);
1685
1685
  Atmp = make_matrix_complex_clone(A);
1686
1686
  Btmp = make_matrix_complex_clone(B);
@@ -1833,7 +1833,7 @@ static VALUE rb_gsl_eigen_gen(int argc, VALUE *argv, VALUE obj)
1833
1833
  gsl_vector *beta = NULL;
1834
1834
  gsl_eigen_gen_workspace *w = NULL;
1835
1835
  int flag;
1836
- VALUE valpha = NULL, vbeta = NULL;
1836
+ VALUE valpha = Qnil, vbeta = Qnil;
1837
1837
  flag = check_argv_gen(argc, argv, obj, &A, &B, &alpha, &beta, &w);
1838
1838
  // Atmp = make_matrix_clone(A);
1839
1839
  // Btmp = make_matrix_clone(B);
@@ -1874,7 +1874,7 @@ static VALUE rb_gsl_eigen_gen_QZ(int argc, VALUE *argv, VALUE obj)
1874
1874
  gsl_matrix *Q, *Z;
1875
1875
  gsl_eigen_gen_workspace *w = NULL;
1876
1876
  int flag;
1877
- VALUE valpha = NULL, vbeta = NULL, vQ, vZ;
1877
+ VALUE valpha = Qnil, vbeta = Qnil, vQ, vZ;
1878
1878
  flag = check_argv_gen(argc, argv, obj, &A, &B, &alpha, &beta, &w);
1879
1879
  /* Atmp = make_matrix_clone(A);
1880
1880
  Btmp = make_matrix_clone(B); */
@@ -1987,7 +1987,7 @@ static VALUE rb_gsl_eigen_genv(int argc, VALUE *argv, VALUE obj)
1987
1987
  gsl_matrix_complex *evec = NULL;
1988
1988
  gsl_eigen_genv_workspace *w = NULL;
1989
1989
  int flag;
1990
- VALUE valpha = NULL, vbeta = NULL, vevec = NULL;
1990
+ VALUE valpha = Qnil, vbeta = Qnil, vevec = Qnil;
1991
1991
  flag = check_argv_genv(argc, argv, obj, &A, &B, &alpha, &beta, &evec, &w);
1992
1992
  // Atmp = make_matrix_clone(A);
1993
1993
  // Btmp = make_matrix_clone(B);
@@ -2035,7 +2035,7 @@ static VALUE rb_gsl_eigen_genv_QZ(int argc, VALUE *argv, VALUE obj)
2035
2035
  gsl_matrix *Q, *Z;
2036
2036
  gsl_eigen_genv_workspace *w = NULL;
2037
2037
  int flag;
2038
- VALUE valpha = NULL, vbeta = NULL, vevec = NULL, vQ, vZ;
2038
+ VALUE valpha = Qnil, vbeta = Qnil, vevec = Qnil, vQ, vZ;
2039
2039
  flag = check_argv_genv(argc, argv, obj, &A, &B, &alpha, &beta, &evec, &w);
2040
2040
  /* Atmp = make_matrix_clone(A);
2041
2041
  Btmp = make_matrix_clone(B); */
@@ -2121,7 +2121,7 @@ void Init_gsl_eigen(VALUE module)
2121
2121
  VALUE mgsl_eigen_symmv;
2122
2122
  VALUE mgsl_eigen_herm;
2123
2123
  VALUE mgsl_eigen_hermv;
2124
- #ifdef HAVE_EIGEN_FRANCIS
2124
+ #ifdef HAVE_GSL_EIGEN_FRANCIS
2125
2125
  VALUE mgsl_eigen_francis;
2126
2126
  #endif
2127
2127
  #ifdef GSL_1_9_LATER
@@ -2211,7 +2211,7 @@ void Init_gsl_eigen(VALUE module)
2211
2211
  rb_define_module_function(mgsl_eigen_hermv, "sort",
2212
2212
  rb_gsl_eigen_hermv_sort, -1);
2213
2213
 
2214
- #ifdef HAVE_EIGEN_FRANCIS
2214
+ #ifdef HAVE_GSL_EIGEN_FRANCIS
2215
2215
  mgsl_eigen_francis = rb_define_module_under(mgsl_eigen, "francis");
2216
2216
  cgsl_eigen_francis_workspace = rb_define_class_under(mgsl_eigen_francis,
2217
2217
  "Workspace", cGSL_Object);
@@ -8,11 +8,11 @@
8
8
  This library is distributed in the hope that it will be useful, but
9
9
  WITHOUT ANY WARRANTY.
10
10
  */
11
- #include "rb_gsl.h"
11
+ #include "include/rb_gsl.h"
12
12
  #include <gsl/gsl_errno.h>
13
- #include "rb_gsl_array.h"
14
- #include "rb_gsl_common.h"
15
- #include "rb_gsl_function.h"
13
+ #include "include/rb_gsl_array.h"
14
+ #include "include/rb_gsl_common.h"
15
+ #include "include/rb_gsl_function.h"
16
16
 
17
17
  static VALUE eHandler;
18
18
  static VALUE cgsl_error[35];
@@ -48,7 +48,7 @@ static void rb_gsl_my_error_handler(const char *reason, const char *file,
48
48
  static VALUE rb_gsl_set_error_handler(int argc, VALUE *argv, VALUE module)
49
49
  {
50
50
  if (rb_block_given_p()) {
51
- eHandler = RB_GSL_MAKE_PROC;
51
+ eHandler = rb_block_proc();
52
52
  gsl_set_error_handler(&rb_gsl_my_error_handler);
53
53
  return Qtrue;
54
54
  }
@@ -0,0 +1,121 @@
1
+ require 'mkmf'
2
+
3
+ def gsl_config_arg(arg)
4
+ yield arg_config("--with-gsl-#{arg}") {
5
+ sh = 'sh ' if RUBY_PLATFORM =~ /mingw/
6
+ IO.popen("#{sh}gsl-config --#{arg}") { |f| f.gets.chomp }
7
+ }, lambda { |val| puts "checking gsl #{arg}... #{val}"; val }
8
+ rescue => err
9
+ abort "*** ERROR: missing required library to compile this module: #{err}"
10
+ end
11
+
12
+ def gsl_def(const, value = nil)
13
+ $defs << "-D#{const}#{"=#{value}" if value}"
14
+ end
15
+
16
+ def gsl_have_header(library, header)
17
+ have_library(library) if have_header(header)
18
+ end
19
+
20
+ def gsl_have_library(func)
21
+ have_func(func) if have_library('gsl', func)
22
+ end
23
+
24
+ def gsl_dir_config(target)
25
+ dir_config(target, $sitearchdir, $sitearchdir)
26
+ end
27
+
28
+ $CFLAGS += ' -Wall -Iinclude'
29
+
30
+ gsl_config_arg(:version) { |version, check|
31
+ gsl_def(:GSL_VERSION, check[version])
32
+
33
+ ver = version.split('.').map { |x| x.to_i }
34
+
35
+ later = lambda { |other|
36
+ ary = other.split('.').map { |x| x.to_i }
37
+
38
+ gte = ver[0] > ary[0] ? true :
39
+ ver[0] < ary[0] ? false :
40
+ ver[1] > ary[1] ? true :
41
+ ver[1] < ary[1] ? false :
42
+ ver.size < ary.size ? false :
43
+ ver.size == 3 && ary.size == 3 ? ver[2] >= ary[2] : true
44
+
45
+ ary.pop && ary[-1] += 1 if ary.last == 90
46
+
47
+ gte && gsl_def("GSL_#{ary.join('_')}_LATER")
48
+ }
49
+
50
+ raise 'Ruby/GSL requires gsl-0.9.4 or later.' unless later['0.9.4']
51
+
52
+ gsl_def(:GSL_1_4_9_LATER) if later['1.4.90']
53
+
54
+ %w[
55
+ 1.0 1.1 1.1.1 1.2 1.3 1.4 1.5.90 1.7.90
56
+ 1.8.90 1.9.90 1.11 1.12.90 1.14 1.15
57
+ ].each { |v| later[v] }
58
+ }
59
+
60
+ gsl_config_arg(:cflags) { |cflags, check|
61
+ $CFLAGS += ' ' + check[cflags]
62
+ }
63
+
64
+ gsl_config_arg(:libs) { |libs, check|
65
+ libs.tr!(File::PATH_SEPARATOR, ' ')
66
+
67
+ if enable_config('atlas')
68
+ dir_config('cblas')
69
+ dir_config('atlas')
70
+
71
+ if have_library('cblas') && have_library('atlas')
72
+ libs.gsub!('-lgslcblas', '-lcblas -latlas')
73
+ end
74
+ end
75
+
76
+ $LOCAL_LIBS += ' ' + check[libs]
77
+ }
78
+
79
+ have_header('ruby/io.h')
80
+ have_func('round')
81
+
82
+ %w[alf qrngextra rngextra tensor].each { |library|
83
+ gsl_have_header(library, "#{library}/#{library}.h")
84
+ }
85
+
86
+ gsl_have_header('bundle_method', 'gsl/gsl_multimin_fsdf.h')
87
+ gsl_have_header('cqp', 'gsl/gsl_cqp.h')
88
+ gsl_have_header('jacobi', 'jacobi.h')
89
+ gsl_have_header('ndlinear', 'ndlinear/gsl_multifit_ndlinear.h')
90
+ gsl_have_header('ool', 'ool/ool_version.h')
91
+
92
+ gsl_have_library('gsl_eigen_francis')
93
+ gsl_have_library('gsl_poly_solve_quartic')
94
+
95
+ gsl_def(:HAVE_GNU_GRAPH) if find_executable('graph')
96
+
97
+ narray = gsl_dir_config('narray')
98
+
99
+ begin
100
+ require 'rubygems'
101
+
102
+ if spec = Gem::Specification.find_by_path('narray.h')
103
+ $LOCAL_LIBS = "-L#{File.join(narray = spec.full_gem_path, 'src')} " + $LOCAL_LIBS
104
+ $CPPFLAGS = "-I#{File.join(narray, spec.require_path)} " + $CPPFLAGS
105
+
106
+ $LOCAL_LIBS += ' -l:narray.so' if RUBY_PLATFORM.include?('linux')
107
+ end
108
+ rescue LoadError
109
+ end
110
+
111
+ have_header('narray.h')
112
+ have_library('narray') if narray && RUBY_PLATFORM =~ /cygwin|mingw/
113
+
114
+ if !arg_config('--disable-tamu-anova') && gsl_dir_config('tamu_anova')
115
+ gsl_have_header('tamuanova', 'tamu_anova/tamu_anova.h')
116
+ end
117
+
118
+ $objs = Dir["#{File.dirname(__FILE__)}/*.c"].map { |f| File.basename(f, '.c') << '.o' }.
119
+ sort - %w[block matrix poly tensor vector].map { |f| "#{f}_source.o" }
120
+
121
+ create_makefile('gsl/gsl_native')
@@ -22,8 +22,6 @@
22
22
  *
23
23
  */
24
24
 
25
- #include "rb_gsl_config.h"
26
-
27
25
  #ifndef GSL_1_3_LATER
28
26
 
29
27
  #include <config.h>
@@ -9,8 +9,7 @@
9
9
  WITHOUT ANY WARRANTY.
10
10
  */
11
11
 
12
- #include "rb_gsl_config.h"
13
- #include "rb_gsl_fft.h"
12
+ #include "include/rb_gsl_fft.h"
14
13
 
15
14
  VALUE mgsl_fft;
16
15
  VALUE cgsl_fft_wavetable;
@@ -9,8 +9,7 @@
9
9
  WITHOUT ANY WARRANTY.
10
10
  */
11
11
 
12
- #include "rb_gsl_config.h"
13
- #include "rb_gsl_fit.h"
12
+ #include "include/rb_gsl_fit.h"
14
13
 
15
14
  /* linear fit without weights: y = c0 + c1 x */
16
15
  /* This returns 7 elements array */
@@ -11,8 +11,8 @@
11
11
  2006/Dec/24 Y. TSUNESADA
12
12
  */
13
13
  #include <math.h>
14
- #include "rb_gsl.h"
15
- #include "rb_gsl_sf.h"
14
+ #include "include/rb_gsl.h"
15
+ #include "include/rb_gsl_sf.h"
16
16
 
17
17
  static const double sqrt_pi_2 = 1.2533141373155002512078826424; /* sqrt(pi/2) */
18
18
  static const double sqrt_2_pi = 0.7978845608028653558798921199; /* sqrt(2/pi) */
@@ -8,8 +8,8 @@
8
8
  This library is distributed in the hope that it will be useful, but
9
9
  WITHOUT ANY WARRANTY.
10
10
  */
11
- #include "rb_gsl_config.h"
12
- #include "rb_gsl_function.h"
11
+
12
+ #include "include/rb_gsl_function.h"
13
13
  #ifdef HAVE_NARRAY_H
14
14
  #include "narray.h"
15
15
  #endif
@@ -56,7 +56,7 @@ static VALUE rb_gsl_function_set_f(int argc, VALUE *argv, VALUE obj)
56
56
  rb_ary_store(ary, 1, ary2);
57
57
  break;
58
58
  }
59
- if (rb_block_given_p()) rb_ary_store(ary, 0, RB_GSL_MAKE_PROC);
59
+ if (rb_block_given_p()) rb_ary_store(ary, 0, rb_block_proc());
60
60
  return obj;
61
61
  }
62
62
 
@@ -1,4 +1,4 @@
1
- #include "rb_gsl.h"
1
+ #include "include/rb_gsl.h"
2
2
 
3
3
  /*!
4
4
  Counter-clockwise rotation around the X-axis
@@ -8,8 +8,8 @@
8
8
  This library is distributed in the hope that it will be useful, but
9
9
  WITHOUT ANY WARRANTY.
10
10
  */
11
- #include "rb_gsl_config.h"
12
- #include "rb_gsl_graph.h"
11
+
12
+ #include "include/rb_gsl_graph.h"
13
13
 
14
14
  void make_graphcommand(char *command, VALUE hash)
15
15
  {
@@ -9,7 +9,7 @@
9
9
  WITHOUT ANY WARRANTY.
10
10
  */
11
11
 
12
- #include "rb_gsl.h"
12
+ #include "include/rb_gsl.h"
13
13
  #include <gsl/gsl_machine.h>
14
14
 
15
15
  ID rb_gsl_id_beg, rb_gsl_id_end, rb_gsl_id_excl, rb_gsl_id_to_a;
@@ -46,11 +46,7 @@ static VALUE rb_gsl_object_info(VALUE obj)
46
46
  char buf[256];
47
47
  VALUE s;
48
48
  sprintf(buf, "Class: %s\n", rb_class2name(CLASS_OF(obj)));
49
- #ifdef RUBY_1_9_LATER
50
49
  sprintf(buf, "%sSuperClass: %s\n", buf, rb_class2name(RCLASS_SUPER(CLASS_OF(obj))));
51
- #else
52
- sprintf(buf, "%sSuperClass: %s\n", buf, rb_class2name(RCLASS(CLASS_OF(obj))->super));
53
- #endif
54
50
  s = rb_rescue(rb_gsl_call_name, obj, rb_gsl_call_rescue, obj);
55
51
  if (s) sprintf(buf, "%sType: %s\n", buf, STR2CSTR(s));
56
52
  s = rb_rescue(rb_gsl_call_size, obj, rb_gsl_call_rescue, obj);
@@ -64,7 +60,7 @@ static VALUE rb_gsl_not_implemeted(VALUE obj)
64
60
  return Qnil;
65
61
  }
66
62
 
67
- void Init_rb_gsl()
63
+ void Init_gsl_native()
68
64
  {
69
65
  VALUE mgsl;
70
66
 
@@ -217,10 +213,6 @@ static void rb_gsl_define_const(VALUE module)
217
213
  rb_define_const(module, "VERSION", rb_str_new2(GSL_VERSION));
218
214
  rb_define_const(module, "GSL_VERSION", rb_str_new2(GSL_VERSION));
219
215
  #endif
220
- #ifdef RUBY_GSL_VERSION
221
- rb_define_const(module, "RUBY_GSL_VERSION", rb_str_new2(RUBY_GSL_VERSION));
222
- rb_define_const(module, "RB_GSL_VERSION", rb_str_new2(RUBY_GSL_VERSION));
223
- #endif
224
216
 
225
217
  rb_define_const(module, "DBL_EPSILON", rb_float_new(GSL_DBL_EPSILON));
226
218
  rb_define_const(module, "FLT_EPSILON", rb_float_new(GSL_FLT_EPSILON));
@@ -5,11 +5,10 @@
5
5
  Modified by Seiya Nishizawa 14/Apr/2004
6
6
  */
7
7
 
8
- #include "rb_gsl_config.h"
9
8
  #ifdef HAVE_NARRAY_H
10
- #include "rb_gsl_array.h"
9
+ #include "include/rb_gsl_array.h"
11
10
  #include "narray.h"
12
- #include "rb_gsl_with_narray.h"
11
+ #include "include/rb_gsl_with_narray.h"
13
12
 
14
13
  static VALUE rb_gsl_na_to_gsl_matrix_method(VALUE nna);
15
14
  static VALUE rb_gsl_na_to_gsl_matrix_int_method(VALUE nna);
@@ -9,9 +9,8 @@
9
9
  WITHOUT ANY WARRANTY.
10
10
  */
11
11
 
12
- #include "rb_gsl_config.h"
13
- #include "rb_gsl_histogram.h"
14
- #include "rb_gsl_array.h"
12
+ #include "include/rb_gsl_histogram.h"
13
+ #include "include/rb_gsl_array.h"
15
14
  #include <gsl/gsl_fit.h>
16
15
  #include <gsl/gsl_multifit_nlin.h>
17
16
  #include <gsl/gsl_blas.h>
@@ -114,7 +113,7 @@ static VALUE rb_gsl_histogram_alloc_from_file(VALUE klass, VALUE name)
114
113
  size_t n, i;
115
114
  FILE *fp = NULL;
116
115
  double upper;
117
- strcpy(filename, STR2CHARPTR(name));
116
+ strcpy(filename, StringValuePtr(name));
118
117
  sprintf(buf, "wc %s", filename);
119
118
  fp = popen(buf, "r");
120
119
  if (fp == NULL) rb_raise(rb_eIOError, "popen failed.");