gsl 1.15.3 → 1.16.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.travis.yml +24 -0
- data/AUTHORS +10 -2
- data/COPYING +341 -339
- data/ChangeLog +612 -554
- data/Gemfile +4 -0
- data/README.md +77 -0
- data/Rakefile +14 -93
- 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/{alf.c → gsl_native/alf.c} +10 -10
- data/ext/{array.c → gsl_native/array.c} +70 -159
- data/ext/{array_complex.c → gsl_native/array_complex.c} +63 -66
- data/ext/{blas.c → gsl_native/blas.c} +2 -3
- data/ext/{blas1.c → gsl_native/blas1.c} +35 -36
- data/ext/{blas2.c → gsl_native/blas2.c} +57 -62
- data/ext/{blas3.c → gsl_native/blas3.c} +57 -58
- data/ext/{block.c → gsl_native/block.c} +14 -18
- data/ext/{block_source.c → gsl_native/block_source.h} +110 -112
- data/ext/gsl_native/bspline.c +122 -0
- data/ext/{bundle.c → gsl_native/bundle.c} +0 -0
- data/ext/{cdf.c → gsl_native/cdf.c} +79 -93
- data/ext/{cheb.c → gsl_native/cheb.c} +78 -89
- data/ext/{combination.c → gsl_native/combination.c} +11 -19
- data/ext/{common.c → gsl_native/common.c} +9 -41
- data/ext/{complex.c → gsl_native/complex.c} +116 -118
- data/ext/gsl_native/const.c +331 -0
- data/ext/{const_additional.c → gsl_native/const_additional.c} +13 -34
- data/ext/gsl_native/cqp.c +283 -0
- data/ext/{deriv.c → gsl_native/deriv.c} +25 -33
- data/ext/{dht.c → gsl_native/dht.c} +23 -31
- data/ext/{diff.c → gsl_native/diff.c} +26 -28
- data/ext/{dirac.c → gsl_native/dirac.c} +45 -46
- data/ext/{eigen.c → gsl_native/eigen.c} +1044 -1095
- data/ext/{error.c → gsl_native/error.c} +18 -18
- data/ext/gsl_native/extconf.rb +118 -0
- data/ext/{fft.c → gsl_native/fft.c} +197 -204
- data/ext/{fit.c → gsl_native/fit.c} +17 -18
- data/ext/gsl_native/fresnel.c +312 -0
- data/ext/{function.c → gsl_native/function.c} +37 -43
- data/ext/{geometry.c → gsl_native/geometry.c} +16 -16
- data/ext/{graph.c → gsl_native/graph.c} +39 -89
- data/ext/{gsl.c → gsl_native/gsl.c} +12 -33
- data/ext/{gsl_narray.c → gsl_native/gsl_narray.c} +20 -30
- data/ext/{histogram.c → gsl_native/histogram.c} +133 -160
- data/ext/{histogram2d.c → gsl_native/histogram2d.c} +78 -104
- data/ext/{histogram3d.c → gsl_native/histogram3d.c} +76 -76
- data/ext/{histogram3d_source.c → gsl_native/histogram3d_source.c} +196 -197
- data/ext/{histogram_find.c → gsl_native/histogram_find.c} +32 -34
- data/ext/{histogram_oper.c → gsl_native/histogram_oper.c} +43 -52
- data/ext/{ieee.c → gsl_native/ieee.c} +9 -21
- data/{include → ext/gsl_native/include}/rb_gsl.h +4 -26
- data/{include → ext/gsl_native/include}/rb_gsl_array.h +15 -39
- data/{include → ext/gsl_native/include}/rb_gsl_cheb.h +0 -2
- data/{include → ext/gsl_native/include}/rb_gsl_common.h +61 -61
- data/{include → ext/gsl_native/include}/rb_gsl_complex.h +1 -1
- data/{include → ext/gsl_native/include}/rb_gsl_const.h +0 -6
- data/ext/gsl_native/include/rb_gsl_dirac.h +6 -0
- data/{include → ext/gsl_native/include}/rb_gsl_eigen.h +1 -1
- data/{include → ext/gsl_native/include}/rb_gsl_fft.h +0 -13
- data/{include → ext/gsl_native/include}/rb_gsl_fit.h +0 -2
- data/{include → ext/gsl_native/include}/rb_gsl_function.h +0 -4
- data/{include → ext/gsl_native/include}/rb_gsl_graph.h +2 -4
- data/{include → ext/gsl_native/include}/rb_gsl_histogram.h +8 -8
- data/{include → ext/gsl_native/include}/rb_gsl_histogram3d.h +50 -50
- data/{include → ext/gsl_native/include}/rb_gsl_integration.h +1 -1
- data/{include → ext/gsl_native/include}/rb_gsl_interp.h +0 -5
- data/{include → ext/gsl_native/include}/rb_gsl_linalg.h +2 -6
- data/{include → ext/gsl_native/include}/rb_gsl_math.h +0 -6
- data/{include → ext/gsl_native/include}/rb_gsl_odeiv.h +0 -3
- data/{include → ext/gsl_native/include}/rb_gsl_poly.h +3 -7
- data/{include → ext/gsl_native/include}/rb_gsl_rational.h +1 -8
- data/{include → ext/gsl_native/include}/rb_gsl_rng.h +0 -1
- data/{include → ext/gsl_native/include}/rb_gsl_root.h +1 -1
- data/{include → ext/gsl_native/include}/rb_gsl_sf.h +39 -48
- data/{include → ext/gsl_native/include}/rb_gsl_statistics.h +1 -1
- data/{include → ext/gsl_native/include}/rb_gsl_tensor.h +0 -2
- data/{include → ext/gsl_native/include}/rb_gsl_with_narray.h +3 -1
- data/{include → ext/gsl_native/include}/templates_off.h +0 -0
- data/{include → ext/gsl_native/include}/templates_on.h +1 -1
- data/ext/{integration.c → gsl_native/integration.c} +164 -189
- data/ext/{interp.c → gsl_native/interp.c} +25 -38
- data/ext/gsl_native/jacobi.c +733 -0
- data/ext/{linalg.c → gsl_native/linalg.c} +462 -589
- data/ext/{linalg_complex.c → gsl_native/linalg_complex.c} +93 -106
- data/ext/{math.c → gsl_native/math.c} +48 -67
- data/ext/{matrix.c → gsl_native/matrix.c} +13 -16
- data/ext/{matrix_complex.c → gsl_native/matrix_complex.c} +119 -123
- data/ext/{matrix_double.c → gsl_native/matrix_double.c} +79 -82
- data/ext/{matrix_int.c → gsl_native/matrix_int.c} +53 -54
- data/ext/{matrix_source.c → gsl_native/matrix_source.h} +292 -318
- data/ext/{min.c → gsl_native/min.c} +45 -76
- data/ext/{monte.c → gsl_native/monte.c} +50 -64
- data/ext/{multifit.c → gsl_native/multifit.c} +142 -151
- data/ext/{multimin.c → gsl_native/multimin.c} +64 -92
- data/ext/{multimin_fsdf.c → gsl_native/multimin_fsdf.c} +16 -16
- data/ext/{multiroots.c → gsl_native/multiroots.c} +73 -76
- data/ext/{multiset.c → gsl_native/multiset.c} +4 -8
- data/ext/{ndlinear.c → gsl_native/ndlinear.c} +320 -321
- data/ext/{nmf.c → gsl_native/nmf.c} +11 -11
- data/ext/{nmf_wrap.c → gsl_native/nmf_wrap.c} +1 -1
- data/ext/{ntuple.c → gsl_native/ntuple.c} +23 -23
- data/ext/{odeiv.c → gsl_native/odeiv.c} +101 -116
- data/ext/gsl_native/ool.c +879 -0
- data/ext/{permutation.c → gsl_native/permutation.c} +39 -37
- data/ext/{poly.c → gsl_native/poly.c} +10 -13
- data/ext/{poly2.c → gsl_native/poly2.c} +16 -16
- data/ext/{poly_source.c → gsl_native/poly_source.h} +249 -293
- data/ext/{qrng.c → gsl_native/qrng.c} +9 -20
- data/ext/{randist.c → gsl_native/randist.c} +222 -247
- data/ext/{rational.c → gsl_native/rational.c} +12 -12
- data/ext/{rng.c → gsl_native/rng.c} +30 -47
- data/ext/{root.c → gsl_native/root.c} +47 -48
- data/ext/{sf.c → gsl_native/sf.c} +196 -244
- data/ext/{sf_airy.c → gsl_native/sf_airy.c} +2 -2
- data/ext/{sf_bessel.c → gsl_native/sf_bessel.c} +7 -7
- data/ext/{sf_clausen.c → gsl_native/sf_clausen.c} +1 -1
- data/ext/{sf_coulomb.c → gsl_native/sf_coulomb.c} +40 -40
- data/ext/{sf_coupling.c → gsl_native/sf_coupling.c} +30 -30
- data/ext/{sf_dawson.c → gsl_native/sf_dawson.c} +1 -1
- data/ext/{sf_debye.c → gsl_native/sf_debye.c} +1 -10
- data/ext/{sf_dilog.c → gsl_native/sf_dilog.c} +1 -1
- data/ext/{sf_elementary.c → gsl_native/sf_elementary.c} +3 -3
- data/ext/{sf_ellint.c → gsl_native/sf_ellint.c} +43 -43
- data/ext/{sf_elljac.c → gsl_native/sf_elljac.c} +3 -3
- data/ext/{sf_erfc.c → gsl_native/sf_erfc.c} +1 -5
- data/ext/{sf_exp.c → gsl_native/sf_exp.c} +3 -3
- data/ext/{sf_expint.c → gsl_native/sf_expint.c} +2 -12
- data/ext/{sf_fermi_dirac.c → gsl_native/sf_fermi_dirac.c} +1 -1
- data/ext/{sf_gamma.c → gsl_native/sf_gamma.c} +2 -6
- data/ext/{sf_gegenbauer.c → gsl_native/sf_gegenbauer.c} +1 -1
- data/ext/{sf_hyperg.c → gsl_native/sf_hyperg.c} +1 -1
- data/ext/{sf_laguerre.c → gsl_native/sf_laguerre.c} +4 -4
- data/ext/{sf_lambert.c → gsl_native/sf_lambert.c} +1 -1
- data/ext/{sf_legendre.c → gsl_native/sf_legendre.c} +1 -1
- data/ext/{sf_log.c → gsl_native/sf_log.c} +4 -4
- data/ext/gsl_native/sf_mathieu.c +235 -0
- data/ext/{sf_power.c → gsl_native/sf_power.c} +1 -1
- data/ext/{sf_psi.c → gsl_native/sf_psi.c} +3 -12
- data/ext/{sf_synchrotron.c → gsl_native/sf_synchrotron.c} +1 -1
- data/ext/{sf_transport.c → gsl_native/sf_transport.c} +1 -1
- data/ext/{sf_trigonometric.c → gsl_native/sf_trigonometric.c} +4 -4
- data/ext/{sf_zeta.c → gsl_native/sf_zeta.c} +1 -5
- data/ext/{signal.c → gsl_native/signal.c} +63 -68
- data/ext/{siman.c → gsl_native/siman.c} +45 -49
- data/ext/{sort.c → gsl_native/sort.c} +6 -7
- data/ext/{spline.c → gsl_native/spline.c} +28 -46
- data/ext/{stats.c → gsl_native/stats.c} +105 -118
- data/ext/{sum.c → gsl_native/sum.c} +34 -34
- data/ext/{tamu_anova.c → gsl_native/tamu_anova.c} +1 -1
- data/ext/{tensor.c → gsl_native/tensor.c} +8 -11
- data/ext/{tensor_source.c → gsl_native/tensor_source.h} +147 -148
- data/ext/{vector.c → gsl_native/vector.c} +11 -14
- data/ext/{vector_complex.c → gsl_native/vector_complex.c} +179 -184
- data/ext/{vector_double.c → gsl_native/vector_double.c} +178 -183
- data/ext/{vector_int.c → gsl_native/vector_int.c} +27 -29
- data/ext/{vector_source.c → gsl_native/vector_source.h} +428 -443
- data/ext/{wavelet.c → gsl_native/wavelet.c} +224 -246
- data/gsl.gemspec +29 -0
- data/lib/gsl.rb +8 -3
- data/lib/gsl/gnuplot.rb +3 -3
- data/lib/gsl/oper.rb +35 -60
- data/lib/gsl/version.rb +3 -0
- data/lib/rbgsl.rb +1 -3
- data/rdoc/alf.rdoc +5 -5
- data/rdoc/blas.rdoc +9 -9
- data/rdoc/bspline.rdoc +17 -17
- data/rdoc/changes.rdoc +4 -9
- data/rdoc/cheb.rdoc +25 -25
- data/rdoc/cholesky_complex.rdoc +21 -21
- data/rdoc/combi.rdoc +37 -37
- data/rdoc/complex.rdoc +22 -22
- data/rdoc/const.rdoc +47 -47
- data/rdoc/dht.rdoc +49 -49
- data/rdoc/diff.rdoc +42 -42
- data/rdoc/ehandling.rdoc +6 -6
- data/rdoc/eigen.rdoc +153 -153
- data/rdoc/fft.rdoc +146 -146
- data/rdoc/fit.rdoc +109 -109
- data/rdoc/function.rdoc +11 -11
- data/rdoc/graph.rdoc +17 -17
- data/rdoc/hist.rdoc +103 -103
- data/rdoc/hist2d.rdoc +42 -42
- data/rdoc/hist3d.rdoc +9 -9
- data/rdoc/integration.rdoc +110 -110
- data/rdoc/interp.rdoc +71 -71
- data/rdoc/intro.rdoc +8 -8
- data/rdoc/linalg.rdoc +188 -188
- data/rdoc/linalg_complex.rdoc +1 -1
- data/rdoc/math.rdoc +58 -58
- data/rdoc/matrix.rdoc +275 -275
- data/rdoc/min.rdoc +57 -57
- data/rdoc/monte.rdoc +22 -22
- data/rdoc/multimin.rdoc +95 -95
- data/rdoc/multiroot.rdoc +80 -80
- data/rdoc/narray.rdoc +32 -32
- data/rdoc/ndlinear.rdoc +54 -54
- data/rdoc/nonlinearfit.rdoc +100 -100
- data/rdoc/ntuple.rdoc +31 -31
- data/rdoc/odeiv.rdoc +88 -88
- data/rdoc/perm.rdoc +90 -90
- data/rdoc/poly.rdoc +66 -66
- data/rdoc/qrng.rdoc +21 -21
- data/rdoc/randist.rdoc +82 -82
- data/rdoc/ref.rdoc +57 -57
- data/rdoc/rng.rdoc +85 -85
- data/rdoc/roots.rdoc +57 -57
- data/rdoc/sf.rdoc +428 -428
- data/rdoc/siman.rdoc +19 -19
- data/rdoc/sort.rdoc +30 -30
- data/rdoc/start.rdoc +8 -8
- data/rdoc/stats.rdoc +52 -52
- data/rdoc/sum.rdoc +12 -12
- data/rdoc/tensor.rdoc +31 -31
- data/rdoc/tut.rdoc +1 -1
- data/rdoc/use.rdoc +39 -39
- data/rdoc/vector.rdoc +188 -188
- data/rdoc/vector_complex.rdoc +24 -24
- data/rdoc/wavelet.rdoc +46 -46
- data/test/gsl/blas_test.rb +79 -0
- data/test/gsl/bspline_test.rb +63 -0
- data/test/gsl/cdf_test.rb +1512 -0
- data/test/gsl/cheb_test.rb +80 -0
- data/test/gsl/combination_test.rb +100 -0
- data/test/gsl/complex_test.rb +20 -0
- data/test/gsl/const_test.rb +29 -0
- data/test/gsl/deriv_test.rb +62 -0
- data/test/gsl/dht_test.rb +79 -0
- data/test/gsl/diff_test.rb +53 -0
- data/test/gsl/eigen_test.rb +563 -0
- data/test/gsl/err_test.rb +23 -0
- data/test/gsl/fit_test.rb +101 -0
- data/test/gsl/histo_test.rb +14 -0
- data/test/gsl/index_test.rb +61 -0
- data/test/gsl/integration_test.rb +274 -0
- data/test/gsl/interp_test.rb +27 -0
- data/test/gsl/linalg_test.rb +463 -0
- data/test/gsl/matrix_nmf_test.rb +37 -0
- data/test/gsl/matrix_test.rb +98 -0
- data/test/gsl/min_test.rb +89 -0
- data/test/gsl/monte_test.rb +77 -0
- data/test/gsl/multifit_test.rb +753 -0
- data/test/gsl/multimin_test.rb +157 -0
- data/test/gsl/multiroot_test.rb +135 -0
- data/test/gsl/multiset_test.rb +52 -0
- data/test/gsl/odeiv_test.rb +275 -0
- data/test/gsl/oper_test.rb +98 -0
- data/test/gsl/poly_test.rb +338 -0
- data/test/gsl/qrng_test.rb +94 -0
- data/test/gsl/quartic_test.rb +28 -0
- data/test/gsl/randist_test.rb +122 -0
- data/test/gsl/rng_test.rb +303 -0
- data/test/gsl/roots_test.rb +78 -0
- data/test/gsl/sf_test.rb +2079 -0
- data/test/gsl/stats_test.rb +122 -0
- data/test/gsl/sum_test.rb +69 -0
- data/test/gsl/tensor_test.rb +396 -0
- data/test/gsl/vector_test.rb +223 -0
- data/test/gsl/wavelet_test.rb +130 -0
- data/test/gsl_test.rb +321 -0
- data/test/test_helper.rb +42 -0
- data/uncrustify.cfg +1693 -0
- metadata +337 -378
- data/README +0 -32
- data/VERSION +0 -1
- data/ext/bspline.c +0 -130
- data/ext/const.c +0 -673
- data/ext/cqp.c +0 -283
- data/ext/extconf.rb +0 -295
- data/ext/fcmp.c +0 -66
- data/ext/fresnel.c +0 -312
- data/ext/jacobi.c +0 -739
- data/ext/ool.c +0 -879
- data/ext/oper_complex_source.c +0 -253
- data/ext/sf_mathieu.c +0 -238
- data/include/rb_gsl_config.h +0 -62
- data/include/rb_gsl_dirac.h +0 -13
- data/rdoc/index.rdoc +0 -62
- data/rdoc/rngextra.rdoc +0 -11
- data/rdoc/screenshot.rdoc +0 -40
- data/setup.rb +0 -1585
- data/tests/blas/amax.rb +0 -14
- data/tests/blas/asum.rb +0 -16
- data/tests/blas/axpy.rb +0 -25
- data/tests/blas/copy.rb +0 -23
- data/tests/blas/dot.rb +0 -23
- data/tests/bspline.rb +0 -53
- data/tests/cdf.rb +0 -1388
- data/tests/cheb.rb +0 -112
- data/tests/combination.rb +0 -123
- data/tests/complex.rb +0 -17
- data/tests/const.rb +0 -24
- data/tests/deriv.rb +0 -85
- data/tests/dht/dht1.rb +0 -17
- data/tests/dht/dht2.rb +0 -23
- data/tests/dht/dht3.rb +0 -23
- data/tests/dht/dht4.rb +0 -23
- data/tests/diff.rb +0 -78
- data/tests/eigen/eigen.rb +0 -220
- data/tests/eigen/gen.rb +0 -105
- data/tests/eigen/genherm.rb +0 -66
- data/tests/eigen/gensymm.rb +0 -68
- data/tests/eigen/nonsymm.rb +0 -53
- data/tests/eigen/nonsymmv.rb +0 -53
- data/tests/eigen/symm-herm.rb +0 -74
- data/tests/err.rb +0 -58
- data/tests/fit.rb +0 -124
- data/tests/gsl_test.rb +0 -118
- data/tests/gsl_test2.rb +0 -110
- data/tests/histo.rb +0 -12
- data/tests/integration/integration1.rb +0 -72
- data/tests/integration/integration2.rb +0 -71
- data/tests/integration/integration3.rb +0 -71
- data/tests/integration/integration4.rb +0 -71
- data/tests/interp.rb +0 -45
- data/tests/linalg/HH.rb +0 -64
- data/tests/linalg/LU.rb +0 -47
- data/tests/linalg/QR.rb +0 -77
- data/tests/linalg/SV.rb +0 -24
- data/tests/linalg/TDN.rb +0 -116
- data/tests/linalg/TDS.rb +0 -122
- data/tests/linalg/bidiag.rb +0 -73
- data/tests/linalg/cholesky.rb +0 -20
- data/tests/linalg/linalg.rb +0 -158
- data/tests/matrix/matrix_complex_test.rb +0 -36
- data/tests/matrix/matrix_nmf_test.rb +0 -39
- data/tests/matrix/matrix_test.rb +0 -48
- data/tests/min.rb +0 -99
- data/tests/monte/miser.rb +0 -31
- data/tests/monte/vegas.rb +0 -45
- data/tests/multifit/test_2dgauss.rb +0 -112
- data/tests/multifit/test_brown.rb +0 -90
- data/tests/multifit/test_enso.rb +0 -246
- data/tests/multifit/test_filip.rb +0 -155
- data/tests/multifit/test_gauss.rb +0 -97
- data/tests/multifit/test_longley.rb +0 -110
- data/tests/multifit/test_multifit.rb +0 -52
- data/tests/multimin.rb +0 -139
- data/tests/multiroot.rb +0 -131
- data/tests/multiset.rb +0 -52
- data/tests/narray/blas_dnrm2.rb +0 -20
- data/tests/odeiv.rb +0 -353
- data/tests/poly/poly.rb +0 -290
- data/tests/poly/special.rb +0 -65
- data/tests/qrng.rb +0 -131
- data/tests/quartic.rb +0 -29
- data/tests/randist.rb +0 -134
- data/tests/rng.rb +0 -305
- data/tests/roots.rb +0 -76
- data/tests/run-test.sh +0 -17
- data/tests/sf/gsl_test_sf.rb +0 -249
- data/tests/sf/test_airy.rb +0 -83
- data/tests/sf/test_bessel.rb +0 -306
- data/tests/sf/test_coulomb.rb +0 -17
- data/tests/sf/test_dilog.rb +0 -25
- data/tests/sf/test_gamma.rb +0 -209
- data/tests/sf/test_hyperg.rb +0 -356
- data/tests/sf/test_legendre.rb +0 -227
- data/tests/sf/test_mathieu.rb +0 -59
- data/tests/sf/test_mode.rb +0 -19
- data/tests/sf/test_sf.rb +0 -839
- data/tests/stats.rb +0 -174
- data/tests/stats_mt.rb +0 -16
- data/tests/sum.rb +0 -98
- data/tests/sys.rb +0 -323
- data/tests/tensor.rb +0 -419
- data/tests/vector/vector_complex_test.rb +0 -101
- data/tests/vector/vector_test.rb +0 -141
- data/tests/wavelet.rb +0 -142
@@ -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
|
63
|
+
void Init_gsl_native()
|
68
64
|
{
|
69
65
|
VALUE mgsl;
|
70
66
|
|
@@ -102,16 +98,14 @@ void Init_rb_gsl()
|
|
102
98
|
Init_gsl_eigen(mgsl);
|
103
99
|
|
104
100
|
Init_gsl_fft(mgsl);
|
105
|
-
|
101
|
+
Init_gsl_signal(mgsl);
|
106
102
|
Init_gsl_function(mgsl);
|
107
103
|
Init_gsl_integration(mgsl);
|
108
104
|
|
109
105
|
Init_gsl_rng(mgsl);
|
110
106
|
Init_gsl_qrng(mgsl);
|
111
107
|
Init_gsl_ran(mgsl);
|
112
|
-
#ifdef GSL_1_4_LATER
|
113
108
|
Init_gsl_cdf(mgsl);
|
114
|
-
#endif
|
115
109
|
Init_gsl_stats(mgsl);
|
116
110
|
|
117
111
|
Init_gsl_histogram(mgsl);
|
@@ -125,9 +119,7 @@ void Init_rb_gsl()
|
|
125
119
|
Init_gsl_interp(mgsl);
|
126
120
|
Init_gsl_spline(mgsl);
|
127
121
|
Init_gsl_diff(mgsl);
|
128
|
-
#ifdef GSL_1_4_9_LATER
|
129
122
|
Init_gsl_deriv(mgsl);
|
130
|
-
#endif
|
131
123
|
|
132
124
|
Init_gsl_cheb(mgsl);
|
133
125
|
Init_gsl_sum(mgsl);
|
@@ -165,32 +157,28 @@ void Init_rb_gsl()
|
|
165
157
|
#endif
|
166
158
|
|
167
159
|
#ifdef HAVE_OOL_OOL_VERSION_H
|
168
|
-
|
160
|
+
Init_ool(mgsl);
|
169
161
|
#endif
|
170
162
|
|
171
163
|
#ifdef HAVE_JACOBI_H
|
172
|
-
|
164
|
+
Init_jacobi(mgsl);
|
173
165
|
#endif
|
174
166
|
|
175
167
|
#ifdef HAVE_GSL_GSL_CQP_H
|
176
|
-
|
168
|
+
Init_cqp(mgsl);
|
177
169
|
#endif
|
178
170
|
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
Init_bspline(mgsl);
|
183
|
-
#endif
|
171
|
+
Init_fresnel(mgsl);
|
172
|
+
|
173
|
+
Init_bspline(mgsl);
|
184
174
|
|
185
175
|
#ifdef HAVE_ALF_ALF_H
|
186
|
-
|
176
|
+
Init_alf(mgsl);
|
187
177
|
#endif
|
188
178
|
|
189
|
-
|
179
|
+
Init_geometry(mgsl);
|
190
180
|
|
191
|
-
|
192
|
-
Init_multiset(mgsl);
|
193
|
-
#endif
|
181
|
+
Init_multiset(mgsl);
|
194
182
|
|
195
183
|
rb_gsl_define_methods(mgsl);
|
196
184
|
}
|
@@ -213,14 +201,8 @@ static void rb_gsl_define_const(VALUE module)
|
|
213
201
|
rb_define_const(module, "PREC_DOUBLE", INT2FIX(GSL_PREC_DOUBLE));
|
214
202
|
rb_define_const(module, "PREC_SINGLE", INT2FIX(GSL_PREC_SINGLE));
|
215
203
|
rb_define_const(module, "PREC_APPROX", INT2FIX(GSL_PREC_APPROX));
|
216
|
-
#ifdef GSL_VERSION
|
217
204
|
rb_define_const(module, "VERSION", rb_str_new2(GSL_VERSION));
|
218
205
|
rb_define_const(module, "GSL_VERSION", rb_str_new2(GSL_VERSION));
|
219
|
-
#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
206
|
|
225
207
|
rb_define_const(module, "DBL_EPSILON", rb_float_new(GSL_DBL_EPSILON));
|
226
208
|
rb_define_const(module, "FLT_EPSILON", rb_float_new(GSL_FLT_EPSILON));
|
@@ -248,11 +230,8 @@ static void rb_gsl_define_const(VALUE module)
|
|
248
230
|
rb_define_const(module, "ROOT6_DBL_MIN", rb_float_new(GSL_ROOT6_DBL_MIN));
|
249
231
|
rb_define_const(module, "LOG_DBL_MIN", rb_float_new(GSL_LOG_DBL_MIN));
|
250
232
|
|
251
|
-
#ifdef GSL_1_14_LATER
|
252
233
|
rb_define_const(module, "MAJOR_VERSION", INT2FIX(GSL_MAJOR_VERSION));
|
253
234
|
rb_define_const(module, "MINOR_VERSION", INT2FIX(GSL_MINOR_VERSION));
|
254
|
-
#endif
|
255
|
-
|
256
235
|
}
|
257
236
|
|
258
237
|
static VALUE rb_gsl_have_tensor(VALUE module)
|
@@ -5,11 +5,9 @@
|
|
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"
|
11
|
-
#include "
|
12
|
-
#include "rb_gsl_with_narray.h"
|
9
|
+
#include "include/rb_gsl_array.h"
|
10
|
+
#include "include/rb_gsl_with_narray.h"
|
13
11
|
|
14
12
|
static VALUE rb_gsl_na_to_gsl_matrix_method(VALUE nna);
|
15
13
|
static VALUE rb_gsl_na_to_gsl_matrix_int_method(VALUE nna);
|
@@ -31,7 +29,7 @@ static VALUE rb_gsl_vector_to_narray(VALUE obj, VALUE klass)
|
|
31
29
|
memcpy(NA_PTR_TYPE(nary,double*), v->data, shape[0]*sizeof(double));
|
32
30
|
} else {
|
33
31
|
int i;
|
34
|
-
for(i=0; i < v->size; i++) {
|
32
|
+
for(i = 0; i < (int) v->size; i++) {
|
35
33
|
(NA_PTR_TYPE(nary,double*))[i] = gsl_vector_get(v, i);
|
36
34
|
}
|
37
35
|
}
|
@@ -50,7 +48,7 @@ static VALUE rb_gsl_vector_complex_to_narray(VALUE obj, VALUE klass)
|
|
50
48
|
memcpy(NA_PTR_TYPE(nary,double*), v->data, shape[0]*2*sizeof(double));
|
51
49
|
} else {
|
52
50
|
int i;
|
53
|
-
for(i=0; i < 2*v->size; i++) {
|
51
|
+
for(i = 0; i < (int) (2*v->size); i++) {
|
54
52
|
(NA_PTR_TYPE(nary,gsl_complex*))[i] = gsl_vector_complex_get(v, i);
|
55
53
|
}
|
56
54
|
}
|
@@ -67,8 +65,7 @@ static VALUE rb_gsl_vector_to_na(VALUE obj)
|
|
67
65
|
na = rb_gsl_vector_complex_to_narray(obj, cNArray);
|
68
66
|
else
|
69
67
|
rb_raise(rb_eRuntimeError, "unexpected type '%s'",
|
70
|
-
|
71
|
-
|
68
|
+
rb_obj_classname(obj));
|
72
69
|
return na;
|
73
70
|
}
|
74
71
|
|
@@ -142,7 +139,7 @@ static VALUE rb_gsl_vector_to_narray_ref(VALUE obj, VALUE klass)
|
|
142
139
|
na->ptr = (char *) vc->data;
|
143
140
|
} else {
|
144
141
|
rb_raise(rb_eRuntimeError, "cannot convert %s to NArray reference object",
|
145
|
-
|
142
|
+
rb_obj_classname(obj));
|
146
143
|
}
|
147
144
|
nary = Data_Wrap_Struct(klass, 0, rb_gsl_na_view_free, na);
|
148
145
|
return nary;
|
@@ -170,7 +167,7 @@ static VALUE rb_gsl_vector_int_to_narray(VALUE obj, VALUE klass)
|
|
170
167
|
memcpy(NA_PTR_TYPE(nary,int*), v->data, shape[0]*sizeof(int));
|
171
168
|
} else {
|
172
169
|
int i;
|
173
|
-
for(i=0; i < v->size; i++) {
|
170
|
+
for(i = 0; i < (int) v->size; i++) {
|
174
171
|
(NA_PTR_TYPE(nary,int*))[i] = gsl_vector_int_get(v, i);
|
175
172
|
}
|
176
173
|
}
|
@@ -230,11 +227,10 @@ static VALUE rb_gsl_na_to_gsl_vector_method(VALUE na)
|
|
230
227
|
|
231
228
|
if(NA_TYPE(na) == NA_SCOMPLEX || NA_TYPE(na) == NA_DCOMPLEX)
|
232
229
|
v = Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free,
|
233
|
-
|
230
|
+
na_to_gv_complex(na));
|
234
231
|
else
|
235
232
|
v = Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free,
|
236
|
-
|
237
|
-
|
233
|
+
na_to_gv(na));
|
238
234
|
return v;
|
239
235
|
}
|
240
236
|
|
@@ -244,11 +240,10 @@ VALUE rb_gsl_na_to_gsl_vector_view_method(VALUE na)
|
|
244
240
|
|
245
241
|
if(NA_TYPE(na) == NA_SCOMPLEX || NA_TYPE(na) == NA_DCOMPLEX)
|
246
242
|
v = Data_Wrap_Struct(cgsl_vector_complex_view, 0, gsl_vector_complex_view_free,
|
247
|
-
|
243
|
+
na_to_gv_complex_view(na));
|
248
244
|
else
|
249
245
|
v = Data_Wrap_Struct(cgsl_vector_view, 0, gsl_vector_view_free,
|
250
|
-
|
251
|
-
|
246
|
+
na_to_gv_view(na));
|
252
247
|
return v;
|
253
248
|
}
|
254
249
|
|
@@ -283,7 +278,6 @@ gsl_vector_view* na_to_gv_view(VALUE na)
|
|
283
278
|
// Raise exception if na's type is not NA_DFLOAT.
|
284
279
|
if(NA_TYPE(na) != NA_DFLOAT)
|
285
280
|
rb_raise(rb_eTypeError, "GSL::Vector::View requires NArray be DFLOAT");
|
286
|
-
|
287
281
|
v = gsl_vector_view_alloc();
|
288
282
|
v->vector.data = NA_PTR_TYPE(na,double*);
|
289
283
|
v->vector.size = NA_TOTAL(na);
|
@@ -311,7 +305,6 @@ gsl_vector_complex_view* na_to_gv_complex_view(VALUE na)
|
|
311
305
|
// Raise exception if na's type is not NA_DCOMPLEX
|
312
306
|
if(NA_TYPE(na) != NA_DCOMPLEX)
|
313
307
|
rb_raise(rb_eTypeError, "GSL::Vector::Complex::View requires NArray be DCOMPLEX");
|
314
|
-
|
315
308
|
v = gsl_vector_complex_view_alloc();
|
316
309
|
v->vector.data = NA_PTR_TYPE(na,double*);
|
317
310
|
v->vector.size = NA_TOTAL(na);
|
@@ -357,8 +350,8 @@ static VALUE rb_gsl_matrix_to_narray(VALUE obj, VALUE klass)
|
|
357
350
|
shape[0] = m->size2;
|
358
351
|
shape[1] = m->size1;
|
359
352
|
nary = na_make_object(NA_DFLOAT, 2, shape, klass);
|
360
|
-
for (i = 0; i < shape[1]; i++) {
|
361
|
-
memcpy(NA_PTR_TYPE(nary,double*)+(i*shape[0]), m->data+(i*m->tda),
|
353
|
+
for (i = 0; (int) i < shape[1]; i++) {
|
354
|
+
memcpy(NA_PTR_TYPE(nary,double*)+(i*shape[0]), m->data+(i*m->tda),
|
362
355
|
shape[0]*sizeof(double));
|
363
356
|
}
|
364
357
|
return nary;
|
@@ -384,8 +377,8 @@ static VALUE rb_gsl_matrix_int_to_narray(VALUE obj, VALUE klass)
|
|
384
377
|
shape[0] = m->size2;
|
385
378
|
shape[1] = m->size1;
|
386
379
|
nary = na_make_object(NA_LINT, 2, shape, klass);
|
387
|
-
for (i = 0; i < shape[1]; i++) {
|
388
|
-
memcpy(NA_PTR_TYPE(nary,int*)+(i*shape[0]), m->data+(i*m->tda),
|
380
|
+
for (i = 0; (int) i < shape[1]; i++) {
|
381
|
+
memcpy(NA_PTR_TYPE(nary,int*)+(i*shape[0]), m->data+(i*m->tda),
|
389
382
|
shape[0]*sizeof(int));
|
390
383
|
}
|
391
384
|
return nary;
|
@@ -539,7 +532,7 @@ gsl_matrix_view* na_to_gm_view(VALUE nna)
|
|
539
532
|
m->matrix.data = NA_PTR_TYPE(ary2,double*);
|
540
533
|
m->matrix.size1 = na->shape[1];
|
541
534
|
m->matrix.size2 = na->shape[0];
|
542
|
-
m->matrix.tda = m->matrix.size2;
|
535
|
+
m->matrix.tda = m->matrix.size2;
|
543
536
|
m->matrix.owner = 0;
|
544
537
|
return m;
|
545
538
|
}
|
@@ -571,19 +564,17 @@ gsl_matrix_int_view* na_to_gm_int_view(VALUE nna)
|
|
571
564
|
m->matrix.data = NA_PTR_TYPE(ary2,int*);
|
572
565
|
m->matrix.size1 = na->shape[1];
|
573
566
|
m->matrix.size2 = na->shape[0];
|
574
|
-
m->matrix.tda = m->matrix.size2;
|
567
|
+
m->matrix.tda = m->matrix.size2;
|
575
568
|
m->matrix.owner = 0;
|
576
569
|
return m;
|
577
570
|
}
|
578
571
|
|
579
|
-
#ifdef HAVE_NARRAY_H
|
580
|
-
#include "narray.h"
|
581
572
|
#include <gsl/gsl_histogram.h>
|
582
573
|
EXTERN VALUE cgsl_histogram;
|
583
574
|
static VALUE rb_gsl_narray_histogram(int argc, VALUE *argv, VALUE obj)
|
584
575
|
{
|
585
576
|
double *ptr, *ptr_range;
|
586
|
-
gsl_histogram *h;
|
577
|
+
gsl_histogram *h = NULL;
|
587
578
|
gsl_vector *ranges;
|
588
579
|
gsl_vector_view v;
|
589
580
|
double min, max;
|
@@ -594,7 +585,7 @@ static VALUE rb_gsl_narray_histogram(int argc, VALUE *argv, VALUE obj)
|
|
594
585
|
v.vector.size = stride;
|
595
586
|
switch (argc) {
|
596
587
|
case 1:
|
597
|
-
if (rb_obj_is_kind_of(argv[0], rb_cRange))
|
588
|
+
if (rb_obj_is_kind_of(argv[0], rb_cRange))
|
598
589
|
argv[0] = rb_gsl_range2ary(argv[0]);
|
599
590
|
switch (TYPE(argv[0])) {
|
600
591
|
case T_FIXNUM:
|
@@ -653,7 +644,6 @@ static VALUE rb_gsl_narray_histogram(int argc, VALUE *argv, VALUE obj)
|
|
653
644
|
gsl_histogram_increment(h, ptr[i*stride]);
|
654
645
|
return Data_Wrap_Struct(cgsl_histogram, 0, gsl_histogram_free, h);
|
655
646
|
}
|
656
|
-
#endif
|
657
647
|
|
658
648
|
/*void rb_gsl_with_narray_define_methods()*/
|
659
649
|
void Init_gsl_narray(VALUE module)
|
@@ -766,7 +756,7 @@ void Init_gsl_narray(VALUE module)
|
|
766
756
|
rb_define_method(cNArray, "to_gslm", rb_gsl_na_to_gsl_matrix_method, 0);
|
767
757
|
rb_define_alias(cNArray, "to_gm", "to_gslm");
|
768
758
|
rb_define_method(cNArray, "to_gslm_view", rb_gsl_na_to_gsl_matrix_view_method, 0);
|
769
|
-
rb_define_alias(cNArray, "to_gm_view", "to_gslm_view");
|
759
|
+
rb_define_alias(cNArray, "to_gm_view", "to_gslm_view");
|
770
760
|
|
771
761
|
/*****/
|
772
762
|
// TODO Complex matrix
|
@@ -9,9 +9,8 @@
|
|
9
9
|
WITHOUT ANY WARRANTY.
|
10
10
|
*/
|
11
11
|
|
12
|
-
#include "
|
13
|
-
#include "
|
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>
|
@@ -22,7 +21,6 @@ VALUE cgsl_histogram_bin;
|
|
22
21
|
static VALUE cgsl_histogram_integ;
|
23
22
|
|
24
23
|
static VALUE rb_gsl_histogram_alloc_from_file(VALUE klass, VALUE name);
|
25
|
-
#ifdef GSL_0_9_4_LATER
|
26
24
|
static VALUE rb_gsl_histogram_alloc(int argc, VALUE *argv, VALUE klass)
|
27
25
|
{
|
28
26
|
gsl_histogram *h = NULL;
|
@@ -69,8 +67,8 @@ static VALUE rb_gsl_histogram_alloc(int argc, VALUE *argv, VALUE klass)
|
|
69
67
|
case T_FIXNUM:
|
70
68
|
CHECK_FIXNUM(argv[0]);
|
71
69
|
if (TYPE(argv[1]) != T_ARRAY) {
|
72
|
-
|
73
|
-
|
70
|
+
rb_raise(rb_eTypeError, "wrong argument type %s (Array expected)",
|
71
|
+
rb_class2name(CLASS_OF(argv[1])));
|
74
72
|
}
|
75
73
|
n = FIX2INT(argv[0]);
|
76
74
|
min = NUM2DBL(rb_ary_entry(argv[1], 0));
|
@@ -114,11 +112,12 @@ static VALUE rb_gsl_histogram_alloc_from_file(VALUE klass, VALUE name)
|
|
114
112
|
size_t n, i;
|
115
113
|
FILE *fp = NULL;
|
116
114
|
double upper;
|
117
|
-
strcpy(filename,
|
115
|
+
strcpy(filename, StringValuePtr(name));
|
118
116
|
sprintf(buf, "wc %s", filename);
|
119
117
|
fp = popen(buf, "r");
|
120
118
|
if (fp == NULL) rb_raise(rb_eIOError, "popen failed.");
|
121
|
-
fgets(buf, 1024, fp)
|
119
|
+
if (fgets(buf, 1024, fp) == NULL)
|
120
|
+
rb_sys_fail(0);
|
122
121
|
pclose(fp);
|
123
122
|
sscanf(buf, "%d", &nn);
|
124
123
|
n = (size_t) nn; /* vector length */
|
@@ -133,7 +132,7 @@ static VALUE rb_gsl_histogram_alloc_from_file(VALUE klass, VALUE name)
|
|
133
132
|
h->range[n] = upper;
|
134
133
|
fclose(fp);
|
135
134
|
return Data_Wrap_Struct(klass, 0, gsl_histogram_free, h);
|
136
|
-
|
135
|
+
|
137
136
|
}
|
138
137
|
|
139
138
|
/* initialization + set uniform ranges (equal spacing from min to max) */
|
@@ -172,8 +171,8 @@ static VALUE rb_gsl_histogram_alloc_uniform(int argc, VALUE *argv, VALUE klass)
|
|
172
171
|
}
|
173
172
|
|
174
173
|
/* initialization + set ranges with a given spacing from min to max */
|
175
|
-
static VALUE rb_gsl_histogram_alloc_with_min_max_step(VALUE klass, VALUE vmin,
|
176
|
-
|
174
|
+
static VALUE rb_gsl_histogram_alloc_with_min_max_step(VALUE klass, VALUE vmin,
|
175
|
+
VALUE vmax, VALUE ss)
|
177
176
|
{
|
178
177
|
gsl_histogram *h = NULL;
|
179
178
|
gsl_vector *v = NULL;
|
@@ -196,7 +195,6 @@ static VALUE rb_gsl_histogram_alloc_with_min_max_step(VALUE klass, VALUE vmin,
|
|
196
195
|
gsl_vector_free(v);
|
197
196
|
return Data_Wrap_Struct(klass, 0, gsl_histogram_free, h);
|
198
197
|
}
|
199
|
-
#endif
|
200
198
|
|
201
199
|
static VALUE rb_gsl_histogram_calloc(VALUE klass, VALUE nn)
|
202
200
|
{
|
@@ -244,7 +242,7 @@ static VALUE rb_gsl_histogram_set_ranges(int argc, VALUE *argv, VALUE obj)
|
|
244
242
|
gsl_vector *v = NULL;
|
245
243
|
size_t size;
|
246
244
|
Data_Get_Struct(obj, gsl_histogram, h);
|
247
|
-
if (argc != 1 && argc != 2)
|
245
|
+
if (argc != 1 && argc != 2)
|
248
246
|
rb_raise(rb_eArgError, "wrong number of arguments (%d for 1 or 2)", argc);
|
249
247
|
if (TYPE(argv[0]) == T_ARRAY) {
|
250
248
|
v = make_cvector_from_rarray(argv[0]);
|
@@ -336,10 +334,6 @@ static VALUE rb_gsl_histogram_accumulate(int argc, VALUE *argv, VALUE obj)
|
|
336
334
|
gsl_vector_int *vi;
|
337
335
|
size_t i;
|
338
336
|
double weight = 1;
|
339
|
-
#ifdef HAVE_NARRAY_H
|
340
|
-
double *ptr;
|
341
|
-
size_t size, stride;
|
342
|
-
#endif
|
343
337
|
switch (argc) {
|
344
338
|
case 2:
|
345
339
|
Need_Float(argv[1]);
|
@@ -355,7 +349,7 @@ static VALUE rb_gsl_histogram_accumulate(int argc, VALUE *argv, VALUE obj)
|
|
355
349
|
Data_Get_Struct(obj, gsl_histogram, h);
|
356
350
|
if (TYPE(argv[0]) == T_ARRAY) {
|
357
351
|
// for (i = 0; i < RARRAY(argv[0])->len; i++)
|
358
|
-
for (i = 0; i < RARRAY_LEN(argv[0]); i++)
|
352
|
+
for (i = 0; (int) i < RARRAY_LEN(argv[0]); i++)
|
359
353
|
gsl_histogram_accumulate(h, NUM2DBL(rb_ary_entry(argv[0], i)), weight);
|
360
354
|
} else if (VECTOR_P(argv[0])) {
|
361
355
|
Data_Get_Struct(argv[0], gsl_vector, v);
|
@@ -367,8 +361,10 @@ static VALUE rb_gsl_histogram_accumulate(int argc, VALUE *argv, VALUE obj)
|
|
367
361
|
gsl_histogram_accumulate(h, (double)gsl_vector_int_get(vi, i), weight);
|
368
362
|
#ifdef HAVE_NARRAY_H
|
369
363
|
} else if (NA_IsNArray(argv[0])) {
|
364
|
+
double *ptr;
|
365
|
+
size_t size, stride;
|
370
366
|
ptr = get_vector_ptr(argv[0], &stride, &size);
|
371
|
-
for (i = 0; i < size; i++)
|
367
|
+
for (i = 0; i < size; i++)
|
372
368
|
gsl_histogram_accumulate(h, ptr[i], weight);
|
373
369
|
#endif
|
374
370
|
} else {
|
@@ -386,7 +382,7 @@ static VALUE rb_gsl_histogram_accumulate2(int argc, VALUE *argv, VALUE obj)
|
|
386
382
|
case 2:
|
387
383
|
Need_Float(argv[1]);
|
388
384
|
weight = NUM2DBL(argv[1]);
|
389
|
-
|
385
|
+
/* no break; */
|
390
386
|
case 1:
|
391
387
|
Need_Float(argv[0]);
|
392
388
|
x = NUM2DBL(argv[0]);
|
@@ -494,17 +490,6 @@ static VALUE rb_gsl_histogram_sigma(VALUE obj)
|
|
494
490
|
return rb_float_new(gsl_histogram_sigma(h));
|
495
491
|
}
|
496
492
|
|
497
|
-
#ifndef GSL_1_1_LATER
|
498
|
-
double gsl_histogram_sum(const gsl_histogram * h)
|
499
|
-
{
|
500
|
-
double sum=0;
|
501
|
-
size_t i=0, n;
|
502
|
-
n=h->n;
|
503
|
-
while(i < n) sum += h->bin[i++];
|
504
|
-
return sum;
|
505
|
-
}
|
506
|
-
#endif
|
507
|
-
|
508
493
|
static VALUE rb_gsl_histogram_sum(VALUE obj)
|
509
494
|
{
|
510
495
|
gsl_histogram *h = NULL;
|
@@ -573,7 +558,7 @@ static VALUE rb_gsl_histogram_equal_bins_p(int argc, VALUE *argv, VALUE obj)
|
|
573
558
|
case T_CLASS:
|
574
559
|
case T_OBJECT:
|
575
560
|
if (argc != 2) rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)",
|
576
|
-
|
561
|
+
argc);
|
577
562
|
CHECK_HISTOGRAM(argv[0]);
|
578
563
|
CHECK_HISTOGRAM(argv[1]);
|
579
564
|
Data_Get_Struct(argv[0], gsl_histogram, h1);
|
@@ -581,7 +566,7 @@ static VALUE rb_gsl_histogram_equal_bins_p(int argc, VALUE *argv, VALUE obj)
|
|
581
566
|
break;
|
582
567
|
default:
|
583
568
|
if (argc != 1) rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)",
|
584
|
-
|
569
|
+
argc);
|
585
570
|
Data_Get_Struct(obj, gsl_histogram, h1);
|
586
571
|
CHECK_HISTOGRAM(argv[0]);
|
587
572
|
Data_Get_Struct(argv[0], gsl_histogram, h2);
|
@@ -598,7 +583,7 @@ static VALUE rb_gsl_histogram_equal_bins_p2(int argc, VALUE *argv, VALUE obj)
|
|
598
583
|
case T_CLASS:
|
599
584
|
case T_OBJECT:
|
600
585
|
if (argc != 2) rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)",
|
601
|
-
|
586
|
+
argc);
|
602
587
|
CHECK_HISTOGRAM(argv[0]);
|
603
588
|
CHECK_HISTOGRAM(argv[1]);
|
604
589
|
Data_Get_Struct(argv[0], gsl_histogram, h1);
|
@@ -606,7 +591,7 @@ static VALUE rb_gsl_histogram_equal_bins_p2(int argc, VALUE *argv, VALUE obj)
|
|
606
591
|
break;
|
607
592
|
default:
|
608
593
|
if (argc != 1) rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)",
|
609
|
-
|
594
|
+
argc);
|
610
595
|
Data_Get_Struct(obj, gsl_histogram, h1);
|
611
596
|
CHECK_HISTOGRAM(argv[0]);
|
612
597
|
Data_Get_Struct(argv[0], gsl_histogram, h2);
|
@@ -884,24 +869,17 @@ static VALUE rb_gsl_histogram_pdf_alloc(VALUE klass, VALUE nn)
|
|
884
869
|
{
|
885
870
|
gsl_histogram_pdf *h = NULL;
|
886
871
|
gsl_histogram *h0 = NULL;
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
CHECK_FIXNUM(nn);
|
872
|
+
if (rb_obj_is_kind_of(nn, cgsl_histogram)) {
|
873
|
+
Data_Get_Struct(nn, gsl_histogram, h0);
|
874
|
+
h = gsl_histogram_pdf_alloc(h0->n);
|
875
|
+
gsl_histogram_pdf_init(h, h0);
|
876
|
+
} else {
|
877
|
+
CHECK_FIXNUM(nn);
|
894
878
|
h = gsl_histogram_pdf_alloc(FIX2INT(nn));
|
895
879
|
}
|
896
|
-
#else
|
897
|
-
gsl_histogram *hh = NULL;
|
898
|
-
Data_Get_Struct(nn, gsl_histogram, hh);
|
899
|
-
h = gsl_histogram_pdf_alloc(hh);
|
900
|
-
#endif
|
901
880
|
return Data_Wrap_Struct(klass, 0, gsl_histogram_pdf_free, h);
|
902
881
|
}
|
903
882
|
|
904
|
-
#ifdef GSL_0_9_4_LATER
|
905
883
|
static VALUE rb_gsl_histogram_pdf_init(VALUE obj, VALUE hh)
|
906
884
|
{
|
907
885
|
gsl_histogram_pdf *p = NULL;
|
@@ -912,7 +890,6 @@ static VALUE rb_gsl_histogram_pdf_init(VALUE obj, VALUE hh)
|
|
912
890
|
gsl_histogram_pdf_init(p, h);
|
913
891
|
return obj;
|
914
892
|
}
|
915
|
-
#endif
|
916
893
|
|
917
894
|
static VALUE rb_gsl_histogram_pdf_sample(VALUE obj, VALUE r)
|
918
895
|
{
|
@@ -971,7 +948,7 @@ static VALUE rb_gsl_histogram_graph(int argc, VALUE *argv, VALUE obj)
|
|
971
948
|
fprintf(fp, "%e %e\n%e %e\n", v->range[i], v->bin[i], v->range[i+1], v->bin[i]);
|
972
949
|
}
|
973
950
|
fflush(fp);
|
974
|
-
|
951
|
+
pclose(fp);
|
975
952
|
fp = NULL;
|
976
953
|
return Qtrue;
|
977
954
|
#else
|
@@ -996,8 +973,8 @@ static VALUE rb_gsl_histogram_plot(int argc, VALUE *argv, VALUE obj)
|
|
996
973
|
case 1:
|
997
974
|
fp = popen("gnuplot -persist", "w");
|
998
975
|
if (fp == NULL) rb_raise(rb_eIOError, "GNU graph not found.");
|
999
|
-
if (TYPE(argv[0]) == T_STRING)
|
1000
|
-
fprintf(fp, "plot '-' %s\n", STR2CSTR(argv[0]));
|
976
|
+
if (TYPE(argv[0]) == T_STRING)
|
977
|
+
fprintf(fp, "plot '-' %s\n", STR2CSTR(argv[0]));
|
1001
978
|
else
|
1002
979
|
fprintf(fp, "plot '-' with fsteps\n");
|
1003
980
|
break;
|
@@ -1048,7 +1025,7 @@ static VALUE rb_gsl_histogram_fit_exponential(int argc, VALUE *argv, VALUE obj)
|
|
1048
1025
|
}
|
1049
1026
|
n = binend - binstart + 1;
|
1050
1027
|
dof = n - p;
|
1051
|
-
|
1028
|
+
|
1052
1029
|
x = gsl_vector_alloc(n);
|
1053
1030
|
w = gsl_vector_alloc(n);
|
1054
1031
|
lny = gsl_vector_alloc(n);
|
@@ -1059,15 +1036,15 @@ static VALUE rb_gsl_histogram_fit_exponential(int argc, VALUE *argv, VALUE obj)
|
|
1059
1036
|
gsl_vector_set(lny, i, log(h->bin[i+binstart]));
|
1060
1037
|
gsl_vector_set(w, i, h->bin[i+binstart]);
|
1061
1038
|
}
|
1062
|
-
gsl_fit_wlinear(x->data, 1, w->data, 1, lny->data, 1, n,
|
1063
|
-
|
1039
|
+
gsl_fit_wlinear(x->data, 1, w->data, 1, lny->data, 1, n,
|
1040
|
+
&c0, &c1, &cov00, &cov01, &cov11, &sumsq);
|
1064
1041
|
gsl_vector_free(lny);
|
1065
1042
|
gsl_vector_free(w);
|
1066
1043
|
gsl_vector_free(x);
|
1067
1044
|
c0 = exp(c0);
|
1068
|
-
return rb_ary_new3(6, rb_float_new(c0), rb_float_new(c1),
|
1069
|
-
|
1070
|
-
|
1045
|
+
return rb_ary_new3(6, rb_float_new(c0), rb_float_new(c1),
|
1046
|
+
rb_float_new(c0*sqrt(cov00)), rb_float_new(sqrt(cov11)),
|
1047
|
+
rb_float_new(sumsq), INT2FIX(dof));
|
1071
1048
|
}
|
1072
1049
|
|
1073
1050
|
static VALUE rb_gsl_histogram_fit_power(int argc, VALUE *argv, VALUE obj)
|
@@ -1094,7 +1071,7 @@ static VALUE rb_gsl_histogram_fit_power(int argc, VALUE *argv, VALUE obj)
|
|
1094
1071
|
}
|
1095
1072
|
n = binend - binstart + 1;
|
1096
1073
|
dof = n - p;
|
1097
|
-
|
1074
|
+
|
1098
1075
|
lnx = gsl_vector_alloc(n);
|
1099
1076
|
w = gsl_vector_alloc(n);
|
1100
1077
|
lny = gsl_vector_alloc(n);
|
@@ -1105,15 +1082,15 @@ static VALUE rb_gsl_histogram_fit_power(int argc, VALUE *argv, VALUE obj)
|
|
1105
1082
|
gsl_vector_set(lny, i, log(h->bin[i+binstart]));
|
1106
1083
|
gsl_vector_set(w, i, h->bin[i+binstart]);
|
1107
1084
|
}
|
1108
|
-
gsl_fit_wlinear(lnx->data, 1, w->data, 1, lny->data, 1, n,
|
1109
|
-
|
1085
|
+
gsl_fit_wlinear(lnx->data, 1, w->data, 1, lny->data, 1, n,
|
1086
|
+
&c0, &c1, &cov00, &cov01, &cov11, &sumsq);
|
1110
1087
|
gsl_vector_free(lny);
|
1111
1088
|
gsl_vector_free(w);
|
1112
1089
|
gsl_vector_free(lnx);
|
1113
1090
|
c0 = exp(c0);
|
1114
|
-
return rb_ary_new3(6, rb_float_new(c0), rb_float_new(c1),
|
1115
|
-
|
1116
|
-
|
1091
|
+
return rb_ary_new3(6, rb_float_new(c0), rb_float_new(c1),
|
1092
|
+
rb_float_new(c0*sqrt(cov00)), rb_float_new(sqrt(cov11)),
|
1093
|
+
rb_float_new(sumsq), INT2FIX(dof));
|
1117
1094
|
}
|
1118
1095
|
|
1119
1096
|
static int Gaussian_f(const gsl_vector *v, void *params, gsl_vector *f);
|
@@ -1173,8 +1150,8 @@ static int Gaussian_df(const gsl_vector *v, void *params, gsl_matrix *J)
|
|
1173
1150
|
return GSL_SUCCESS;
|
1174
1151
|
}
|
1175
1152
|
|
1176
|
-
static int Gaussian_fdf(const gsl_vector *v, void *params, gsl_vector *f,
|
1177
|
-
|
1153
|
+
static int Gaussian_fdf(const gsl_vector *v, void *params, gsl_vector *f,
|
1154
|
+
gsl_matrix *J)
|
1178
1155
|
{
|
1179
1156
|
Gaussian_f(v, params, f);
|
1180
1157
|
Gaussian_df(v, params, J);
|
@@ -1253,9 +1230,9 @@ static VALUE rb_gsl_histogram_fit_gaussian(int argc, VALUE *argv, VALUE obj)
|
|
1253
1230
|
gsl_vector_free(x);
|
1254
1231
|
gsl_matrix_free(covar);
|
1255
1232
|
return rb_ary_new3(8, rb_float_new(sigma), rb_float_new(mean),
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1233
|
+
rb_float_new(height), rb_float_new(errs),
|
1234
|
+
rb_float_new(errm), rb_float_new(errh),
|
1235
|
+
rb_float_new(chi2), INT2FIX(dof));
|
1259
1236
|
}
|
1260
1237
|
|
1261
1238
|
static int Rayleigh_f(const gsl_vector *v, void *params, gsl_vector *f);
|
@@ -1308,8 +1285,8 @@ static int Rayleigh_df(const gsl_vector *v, void *params, gsl_matrix *J)
|
|
1308
1285
|
return GSL_SUCCESS;
|
1309
1286
|
}
|
1310
1287
|
|
1311
|
-
static int Rayleigh_fdf(const gsl_vector *v, void *params, gsl_vector *f,
|
1312
|
-
|
1288
|
+
static int Rayleigh_fdf(const gsl_vector *v, void *params, gsl_vector *f,
|
1289
|
+
gsl_matrix *J)
|
1313
1290
|
{
|
1314
1291
|
Rayleigh_f(v, params, f);
|
1315
1292
|
Rayleigh_df(v, params, J);
|
@@ -1349,7 +1326,7 @@ static VALUE rb_gsl_histogram_fit_rayleigh(int argc, VALUE *argv, VALUE obj)
|
|
1349
1326
|
}
|
1350
1327
|
x = gsl_vector_alloc(p);
|
1351
1328
|
gsl_vector_set(x, 0, gsl_pow_2(gsl_histogram_sigma(h))); /* initial values, var = 1 */
|
1352
|
-
gsl_vector_set(x, 1, gsl_histogram_max_val(h));
|
1329
|
+
gsl_vector_set(x, 1, gsl_histogram_max_val(h));
|
1353
1330
|
hh.h = h;
|
1354
1331
|
hh.binstart = binstart;
|
1355
1332
|
hh.binend = binend;
|
@@ -1385,10 +1362,10 @@ static VALUE rb_gsl_histogram_fit_rayleigh(int argc, VALUE *argv, VALUE obj)
|
|
1385
1362
|
gsl_multifit_fdfsolver_free(s);
|
1386
1363
|
gsl_vector_free(x);
|
1387
1364
|
gsl_matrix_free(covar);
|
1388
|
-
return rb_ary_new3(6, rb_float_new(sigma),
|
1389
|
-
|
1390
|
-
|
1391
|
-
|
1365
|
+
return rb_ary_new3(6, rb_float_new(sigma),
|
1366
|
+
rb_float_new(height), rb_float_new(errs),
|
1367
|
+
rb_float_new(errh),
|
1368
|
+
rb_float_new(chi2), INT2FIX(dof));
|
1392
1369
|
}
|
1393
1370
|
|
1394
1371
|
/*
|
@@ -1444,8 +1421,8 @@ static int xExponential_df(const gsl_vector *v, void *params, gsl_matrix *J)
|
|
1444
1421
|
return GSL_SUCCESS;
|
1445
1422
|
}
|
1446
1423
|
|
1447
|
-
static int xExponential_fdf(const gsl_vector *v, void *params, gsl_vector *f,
|
1448
|
-
|
1424
|
+
static int xExponential_fdf(const gsl_vector *v, void *params, gsl_vector *f,
|
1425
|
+
gsl_matrix *J)
|
1449
1426
|
{
|
1450
1427
|
xExponential_f(v, params, f);
|
1451
1428
|
xExponential_df(v, params, J);
|
@@ -1485,7 +1462,7 @@ static VALUE rb_gsl_histogram_fit_xexponential(int argc, VALUE *argv, VALUE obj)
|
|
1485
1462
|
}
|
1486
1463
|
x = gsl_vector_alloc(p);
|
1487
1464
|
gsl_vector_set(x, 0, gsl_histogram_sigma(h)); /* initial values, var = 1 */
|
1488
|
-
gsl_vector_set(x, 1, gsl_histogram_max_val(h));
|
1465
|
+
gsl_vector_set(x, 1, gsl_histogram_max_val(h));
|
1489
1466
|
hh.h = h;
|
1490
1467
|
hh.binstart = binstart;
|
1491
1468
|
hh.binend = binend;
|
@@ -1521,10 +1498,10 @@ static VALUE rb_gsl_histogram_fit_xexponential(int argc, VALUE *argv, VALUE obj)
|
|
1521
1498
|
gsl_multifit_fdfsolver_free(s);
|
1522
1499
|
gsl_vector_free(x);
|
1523
1500
|
gsl_matrix_free(covar);
|
1524
|
-
return rb_ary_new3(6, rb_float_new(b),
|
1525
|
-
|
1526
|
-
|
1527
|
-
|
1501
|
+
return rb_ary_new3(6, rb_float_new(b),
|
1502
|
+
rb_float_new(height), rb_float_new(errs),
|
1503
|
+
rb_float_new(errh),
|
1504
|
+
rb_float_new(chi2), INT2FIX(dof));
|
1528
1505
|
}
|
1529
1506
|
|
1530
1507
|
static VALUE rb_gsl_histogram_fit(int argc, VALUE *argv, VALUE obj)
|
@@ -1539,30 +1516,30 @@ static VALUE rb_gsl_histogram_fit(int argc, VALUE *argv, VALUE obj)
|
|
1539
1516
|
return rb_gsl_histogram_fit_power(argc-1, argv+1, obj);
|
1540
1517
|
} else if (str_head_grep(fittype, "gaus") == 0) {
|
1541
1518
|
return rb_gsl_histogram_fit_gaussian(argc-1, argv+1, obj);
|
1542
|
-
|
1519
|
+
} else if (str_head_grep(fittype, "rayleigh") == 0) {
|
1543
1520
|
return rb_gsl_histogram_fit_rayleigh(argc-1, argv+1, obj);
|
1544
1521
|
} else if (str_head_grep(fittype, "xexp") == 0) {
|
1545
1522
|
return rb_gsl_histogram_fit_xexponential(argc-1, argv+1, obj);
|
1546
1523
|
} else {
|
1547
|
-
rb_raise(rb_eRuntimeError,
|
1548
|
-
|
1524
|
+
rb_raise(rb_eRuntimeError,
|
1525
|
+
"unknown fitting type %s (exp, power, gaus expected)", fittype);
|
1549
1526
|
}
|
1550
1527
|
return Qnil;
|
1551
1528
|
}
|
1552
1529
|
|
1553
1530
|
/* Integrate histogram: the two histograms must have the same range and bins. */
|
1554
1531
|
void mygsl_histogram_integrate(const gsl_histogram *h, gsl_histogram *hi,
|
1555
|
-
|
1532
|
+
size_t istart, size_t iend)
|
1556
1533
|
{
|
1557
1534
|
size_t i;
|
1558
1535
|
if (iend >= istart) {
|
1559
|
-
if (istart < 0) istart = 0;
|
1536
|
+
//if (istart < 0) istart = 0;
|
1560
1537
|
if (iend >= h->n) iend = h->n-1;
|
1561
1538
|
hi->bin[istart] = h->bin[istart];
|
1562
1539
|
for (i = istart+1; i <= iend; i++) hi->bin[i] = hi->bin[i-1] + h->bin[i];
|
1563
1540
|
} else {
|
1564
1541
|
if (istart >= h->n) istart = h->n-1;
|
1565
|
-
if (iend < 0) iend = 0;
|
1542
|
+
//if (iend < 0) iend = 0;
|
1566
1543
|
hi->bin[istart] = h->bin[istart];
|
1567
1544
|
for (i = istart-1; i >= iend; i--) {
|
1568
1545
|
hi->bin[i] = hi->bin[i+1] + h->bin[i];
|
@@ -1580,7 +1557,7 @@ void mygsl_histogram_differentiate(const gsl_histogram *hi, gsl_histogram *h)
|
|
1580
1557
|
|
1581
1558
|
/* Create a histogram integrating the given histogram h */
|
1582
1559
|
gsl_histogram* mygsl_histogram_calloc_integrate(const gsl_histogram *h,
|
1583
|
-
|
1560
|
+
size_t istart, size_t iend)
|
1584
1561
|
{
|
1585
1562
|
gsl_histogram *hi = NULL;
|
1586
1563
|
hi = gsl_histogram_calloc_range(h->n, h->range);
|
@@ -1616,16 +1593,16 @@ static VALUE rb_gsl_histogram_integrate(int argc, VALUE *argv, VALUE obj)
|
|
1616
1593
|
case T_FIXNUM:
|
1617
1594
|
itmp = FIX2INT(argv[0]);
|
1618
1595
|
if (itmp == -1) {
|
1619
|
-
|
1620
|
-
|
1596
|
+
istart = h->n - 1;
|
1597
|
+
iend = 0;
|
1621
1598
|
} else {
|
1622
|
-
|
1623
|
-
|
1599
|
+
istart = 0;
|
1600
|
+
iend = h->n - 1;
|
1624
1601
|
}
|
1625
1602
|
break;
|
1626
1603
|
default:
|
1627
1604
|
rb_raise(rb_eArgError, "wrong argument type %s (Arran or Fixnum expected)",
|
1628
|
-
|
1605
|
+
rb_class2name(CLASS_OF(argv[0])));
|
1629
1606
|
break;
|
1630
1607
|
}
|
1631
1608
|
break;
|
@@ -1692,27 +1669,27 @@ static VALUE rb_gsl_histogram_rebin(int argc, VALUE *argv, VALUE obj)
|
|
1692
1669
|
}
|
1693
1670
|
|
1694
1671
|
static int mygsl_histogram_fread2(FILE * stream, gsl_histogram * h)
|
1695
|
-
{
|
1672
|
+
{
|
1696
1673
|
double min, max;
|
1697
1674
|
int status;
|
1698
1675
|
status = gsl_block_raw_fread(stream, &min, 1, 1);
|
1699
|
-
if (status) return status;
|
1676
|
+
if (status) return status;
|
1700
1677
|
status = gsl_block_raw_fread(stream, &max, 1, 1);
|
1701
|
-
if (status) return status;
|
1678
|
+
if (status) return status;
|
1702
1679
|
gsl_histogram_set_ranges_uniform(h, min, max);
|
1703
|
-
status = gsl_block_raw_fread (stream, h->bin, h->n, 1);
|
1704
|
-
if (status) return status;
|
1680
|
+
status = gsl_block_raw_fread (stream, h->bin, h->n, 1);
|
1681
|
+
if (status) return status;
|
1705
1682
|
return status;
|
1706
1683
|
}
|
1707
1684
|
|
1708
1685
|
static int mygsl_histogram_fwrite2(FILE * stream, const gsl_histogram * h)
|
1709
|
-
{
|
1686
|
+
{
|
1710
1687
|
int status;
|
1711
1688
|
status = gsl_block_raw_fwrite (stream, h->range, 1, 1);
|
1712
|
-
if (status) return status;
|
1689
|
+
if (status) return status;
|
1713
1690
|
status = gsl_block_raw_fwrite (stream, h->range+h->n, 1, 1);
|
1714
|
-
if (status) return status;
|
1715
|
-
status = gsl_block_raw_fwrite (stream, h->bin, h->n, 1);
|
1691
|
+
if (status) return status;
|
1692
|
+
status = gsl_block_raw_fwrite (stream, h->bin, h->n, 1);
|
1716
1693
|
return status;
|
1717
1694
|
}
|
1718
1695
|
|
@@ -1769,7 +1746,7 @@ static VALUE rb_gsl_histogram_reverse(VALUE obj)
|
|
1769
1746
|
static double histogram_percentile(const gsl_histogram *h, double f)
|
1770
1747
|
{
|
1771
1748
|
double sum = gsl_histogram_sum(h), sf;
|
1772
|
-
double val, s = 0, x;
|
1749
|
+
double val = 0, s = 0, x;
|
1773
1750
|
double ri, ri1;
|
1774
1751
|
size_t i;
|
1775
1752
|
sf = sum * f;
|
@@ -1806,7 +1783,7 @@ static VALUE rb_gsl_histogram_median(VALUE obj)
|
|
1806
1783
|
static double histogram_percentile_inv(const gsl_histogram *h, double x)
|
1807
1784
|
{
|
1808
1785
|
double sum = gsl_histogram_sum(h);
|
1809
|
-
double val, s = 0;
|
1786
|
+
double val = 0, s = 0;
|
1810
1787
|
double ri, ri1, q;
|
1811
1788
|
size_t i;
|
1812
1789
|
|
@@ -1833,33 +1810,31 @@ void Init_gsl_histogram(VALUE module)
|
|
1833
1810
|
VALUE cgsl_histogram_pdf;
|
1834
1811
|
|
1835
1812
|
cgsl_histogram = rb_define_class_under(module, "Histogram", cGSL_Object);
|
1836
|
-
cgsl_histogram_range = rb_define_class_under(cgsl_histogram, "Range",
|
1837
|
-
|
1838
|
-
cgsl_histogram_bin = rb_define_class_under(cgsl_histogram, "Bin",
|
1839
|
-
|
1840
|
-
cgsl_histogram_integ = rb_define_class_under(cgsl_histogram, "Integral",
|
1841
|
-
|
1842
|
-
|
1843
|
-
#ifdef GSL_0_9_4_LATER
|
1813
|
+
cgsl_histogram_range = rb_define_class_under(cgsl_histogram, "Range",
|
1814
|
+
cgsl_vector_view_ro);
|
1815
|
+
cgsl_histogram_bin = rb_define_class_under(cgsl_histogram, "Bin",
|
1816
|
+
cgsl_vector_view);
|
1817
|
+
cgsl_histogram_integ = rb_define_class_under(cgsl_histogram, "Integral",
|
1818
|
+
cgsl_histogram);
|
1819
|
+
|
1844
1820
|
rb_define_singleton_method(cgsl_histogram, "alloc", rb_gsl_histogram_alloc, -1);
|
1845
1821
|
/* rb_define_singleton_method(cgsl_histogram, "new", rb_gsl_histogram_alloc, -1);*/
|
1846
1822
|
rb_define_singleton_method(cgsl_histogram, "[]", rb_gsl_histogram_alloc, -1);
|
1847
1823
|
|
1848
|
-
rb_define_singleton_method(cgsl_histogram, "alloc_uniform",
|
1849
|
-
|
1850
|
-
rb_define_singleton_method(cgsl_histogram, "new_uniform",
|
1851
|
-
|
1824
|
+
rb_define_singleton_method(cgsl_histogram, "alloc_uniform",
|
1825
|
+
rb_gsl_histogram_alloc_uniform, -1);
|
1826
|
+
rb_define_singleton_method(cgsl_histogram, "new_uniform",
|
1827
|
+
rb_gsl_histogram_alloc_uniform, -1);
|
1852
1828
|
|
1853
|
-
rb_define_singleton_method(cgsl_histogram, "alloc_with_min_max_step",
|
1854
|
-
|
1855
|
-
rb_define_singleton_method(cgsl_histogram, "new_with_min_max_step",
|
1856
|
-
|
1857
|
-
#endif
|
1829
|
+
rb_define_singleton_method(cgsl_histogram, "alloc_with_min_max_step",
|
1830
|
+
rb_gsl_histogram_alloc_with_min_max_step, 3);
|
1831
|
+
rb_define_singleton_method(cgsl_histogram, "new_with_min_max_step",
|
1832
|
+
rb_gsl_histogram_alloc_with_min_max_step, 3);
|
1858
1833
|
|
1859
|
-
rb_define_singleton_method(cgsl_histogram, "calloc",
|
1860
|
-
|
1861
|
-
rb_define_singleton_method(cgsl_histogram, "calloc_range",
|
1862
|
-
|
1834
|
+
rb_define_singleton_method(cgsl_histogram, "calloc",
|
1835
|
+
rb_gsl_histogram_calloc, 1);
|
1836
|
+
rb_define_singleton_method(cgsl_histogram, "calloc_range",
|
1837
|
+
rb_gsl_histogram_calloc_range, -1);
|
1863
1838
|
|
1864
1839
|
rb_define_method(cgsl_histogram, "bins", rb_gsl_histogram_bins, 0);
|
1865
1840
|
rb_define_alias(cgsl_histogram, "n", "bins");
|
@@ -1867,8 +1842,8 @@ void Init_gsl_histogram(VALUE module)
|
|
1867
1842
|
rb_define_method(cgsl_histogram, "set_ranges", rb_gsl_histogram_set_ranges, -1);
|
1868
1843
|
rb_define_method(cgsl_histogram, "range", rb_gsl_histogram_range, 0);
|
1869
1844
|
rb_define_method(cgsl_histogram, "bin", rb_gsl_histogram_bin, 0);
|
1870
|
-
rb_define_method(cgsl_histogram, "set_ranges_uniform",
|
1871
|
-
|
1845
|
+
rb_define_method(cgsl_histogram, "set_ranges_uniform",
|
1846
|
+
rb_gsl_histogram_set_ranges_uniform, -1);
|
1872
1847
|
rb_define_singleton_method(cgsl_histogram, "memcpy", rb_gsl_histogram_memcpy, 2);
|
1873
1848
|
rb_define_method(cgsl_histogram, "clone", rb_gsl_histogram_clone, 0);
|
1874
1849
|
rb_define_alias(cgsl_histogram, "duplicate", "clone");
|
@@ -1896,20 +1871,20 @@ void Init_gsl_histogram(VALUE module)
|
|
1896
1871
|
rb_define_method(cgsl_histogram, "sum", rb_gsl_histogram_integral, -1);
|
1897
1872
|
rb_define_alias(cgsl_histogram, "integral", "sum");
|
1898
1873
|
|
1899
|
-
rb_define_method(cgsl_histogram, "equal_bins_p",
|
1900
|
-
|
1874
|
+
rb_define_method(cgsl_histogram, "equal_bins_p",
|
1875
|
+
rb_gsl_histogram_equal_bins_p, -1);
|
1901
1876
|
rb_define_alias(cgsl_histogram, "equal_bins", "equal_bins_p");
|
1902
|
-
rb_define_singleton_method(cgsl_histogram, "equal_bins_p",
|
1903
|
-
|
1904
|
-
rb_define_singleton_method(cgsl_histogram, "equal_bins",
|
1905
|
-
|
1906
|
-
rb_define_method(cgsl_histogram, "equal_bins_p?",
|
1907
|
-
|
1877
|
+
rb_define_singleton_method(cgsl_histogram, "equal_bins_p",
|
1878
|
+
rb_gsl_histogram_equal_bins_p, -1);
|
1879
|
+
rb_define_singleton_method(cgsl_histogram, "equal_bins",
|
1880
|
+
rb_gsl_histogram_equal_bins_p, -1);
|
1881
|
+
rb_define_method(cgsl_histogram, "equal_bins_p?",
|
1882
|
+
rb_gsl_histogram_equal_bins_p2, -1);
|
1908
1883
|
rb_define_alias(cgsl_histogram, "equal_bins?", "equal_bins_p?");
|
1909
|
-
rb_define_singleton_method(cgsl_histogram, "equal_bins_p?",
|
1910
|
-
|
1911
|
-
rb_define_singleton_method(cgsl_histogram, "equal_bins?",
|
1912
|
-
|
1884
|
+
rb_define_singleton_method(cgsl_histogram, "equal_bins_p?",
|
1885
|
+
rb_gsl_histogram_equal_bins_p2, -1);
|
1886
|
+
rb_define_singleton_method(cgsl_histogram, "equal_bins?",
|
1887
|
+
rb_gsl_histogram_equal_bins_p2, -1);
|
1913
1888
|
|
1914
1889
|
rb_define_method(cgsl_histogram, "add", rb_gsl_histogram_add, 1);
|
1915
1890
|
rb_define_alias(cgsl_histogram, "+", "add");
|
@@ -1940,13 +1915,11 @@ void Init_gsl_histogram(VALUE module)
|
|
1940
1915
|
rb_define_method(cgsl_histogram, "print", rb_gsl_histogram_print, 0);
|
1941
1916
|
|
1942
1917
|
cgsl_histogram_pdf = rb_define_class_under(cgsl_histogram, "Pdf", cGSL_Object);
|
1943
|
-
rb_define_singleton_method(cgsl_histogram_pdf, "alloc",
|
1944
|
-
|
1945
|
-
/* rb_define_singleton_method(cgsl_histogram_pdf, "new",
|
1918
|
+
rb_define_singleton_method(cgsl_histogram_pdf, "alloc",
|
1919
|
+
rb_gsl_histogram_pdf_alloc, 1);
|
1920
|
+
/* rb_define_singleton_method(cgsl_histogram_pdf, "new",
|
1946
1921
|
rb_gsl_histogram_pdf_alloc, 1);*/
|
1947
|
-
#ifdef GSL_0_9_4_LATER
|
1948
1922
|
rb_define_method(cgsl_histogram_pdf, "init", rb_gsl_histogram_pdf_init, 1);
|
1949
|
-
#endif
|
1950
1923
|
rb_define_method(cgsl_histogram_pdf, "sample", rb_gsl_histogram_pdf_sample, 1);
|
1951
1924
|
|
1952
1925
|
rb_define_method(cgsl_histogram_pdf, "range", rb_gsl_histogram_pdf_range, 0);
|
@@ -1958,23 +1931,23 @@ void Init_gsl_histogram(VALUE module)
|
|
1958
1931
|
|
1959
1932
|
rb_define_method(cgsl_histogram, "plot", rb_gsl_histogram_plot, -1);
|
1960
1933
|
|
1961
|
-
rb_define_method(cgsl_histogram, "fit_gaussian",
|
1962
|
-
|
1963
|
-
rb_define_method(cgsl_histogram, "fit_exponential",
|
1964
|
-
|
1965
|
-
rb_define_method(cgsl_histogram, "fit_xexponential",
|
1966
|
-
|
1967
|
-
rb_define_method(cgsl_histogram, "fit_power",
|
1968
|
-
|
1969
|
-
rb_define_method(cgsl_histogram, "fit_rayleigh",
|
1970
|
-
|
1971
|
-
rb_define_method(cgsl_histogram, "fit",
|
1972
|
-
|
1934
|
+
rb_define_method(cgsl_histogram, "fit_gaussian",
|
1935
|
+
rb_gsl_histogram_fit_gaussian, -1);
|
1936
|
+
rb_define_method(cgsl_histogram, "fit_exponential",
|
1937
|
+
rb_gsl_histogram_fit_exponential, -1);
|
1938
|
+
rb_define_method(cgsl_histogram, "fit_xexponential",
|
1939
|
+
rb_gsl_histogram_fit_xexponential, -1);
|
1940
|
+
rb_define_method(cgsl_histogram, "fit_power",
|
1941
|
+
rb_gsl_histogram_fit_power, -1);
|
1942
|
+
rb_define_method(cgsl_histogram, "fit_rayleigh",
|
1943
|
+
rb_gsl_histogram_fit_rayleigh, -1);
|
1944
|
+
rb_define_method(cgsl_histogram, "fit",
|
1945
|
+
rb_gsl_histogram_fit, -1);
|
1973
1946
|
|
1974
1947
|
rb_define_method(cgsl_histogram, "integrate", rb_gsl_histogram_integrate, -1);
|
1975
1948
|
rb_undef_method(cgsl_histogram_integ, "integrate");
|
1976
|
-
rb_define_method(cgsl_histogram_integ, "differentiate",
|
1977
|
-
|
1949
|
+
rb_define_method(cgsl_histogram_integ, "differentiate",
|
1950
|
+
rb_gsl_histogram_differentiate, 0);
|
1978
1951
|
rb_define_alias(cgsl_histogram_integ, "diff", "differentiate");
|
1979
1952
|
|
1980
1953
|
rb_define_method(cgsl_histogram, "normalize", rb_gsl_histogram_normalize, 0);
|