rb-gsl 1.15.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/AUTHORS +6 -0
- data/COPYING +339 -0
- data/ChangeLog +567 -0
- data/README +32 -0
- data/Rakefile +99 -0
- data/THANKS +17 -0
- data/VERSION +1 -0
- data/examples/alf/alf.gp +15 -0
- data/examples/alf/alf.rb +32 -0
- data/examples/blas/blas.rb +13 -0
- data/examples/blas/dnrm2.rb +16 -0
- data/examples/blas/level1.rb +81 -0
- data/examples/blas/level2.rb +11 -0
- data/examples/blas/level3.rb +12 -0
- data/examples/bspline.rb +57 -0
- data/examples/cdf.rb +16 -0
- data/examples/cheb.rb +21 -0
- data/examples/combination.rb +23 -0
- data/examples/complex/RC-lpf.rb +47 -0
- data/examples/complex/add.rb +36 -0
- data/examples/complex/coerce.rb +14 -0
- data/examples/complex/complex.rb +25 -0
- data/examples/complex/fpmi.rb +70 -0
- data/examples/complex/functions.rb +77 -0
- data/examples/complex/michelson.rb +36 -0
- data/examples/complex/mul.rb +28 -0
- data/examples/complex/oscillator.rb +17 -0
- data/examples/complex/set.rb +37 -0
- data/examples/const/physconst.rb +151 -0
- data/examples/const/travel.rb +45 -0
- data/examples/deriv/demo.rb +13 -0
- data/examples/deriv/deriv.rb +36 -0
- data/examples/deriv/diff.rb +35 -0
- data/examples/dht.rb +42 -0
- data/examples/dirac.rb +56 -0
- data/examples/eigen/eigen.rb +34 -0
- data/examples/eigen/herm.rb +22 -0
- data/examples/eigen/narray.rb +9 -0
- data/examples/eigen/nonsymm.rb +37 -0
- data/examples/eigen/nonsymmv.rb +43 -0
- data/examples/eigen/qhoscillator.gp +35 -0
- data/examples/eigen/qhoscillator.rb +90 -0
- data/examples/eigen/vander.rb +41 -0
- data/examples/fft/fft.rb +17 -0
- data/examples/fft/fft2.rb +17 -0
- data/examples/fft/forward.rb +25 -0
- data/examples/fft/forward2.rb +26 -0
- data/examples/fft/radix2.rb +18 -0
- data/examples/fft/real-halfcomplex.rb +33 -0
- data/examples/fft/real-halfcomplex2.rb +30 -0
- data/examples/fft/realradix2.rb +19 -0
- data/examples/fft/sunspot.dat +256 -0
- data/examples/fft/sunspot.rb +16 -0
- data/examples/fit/expdata.dat +20 -0
- data/examples/fit/expfit.rb +31 -0
- data/examples/fit/gaussfit.rb +29 -0
- data/examples/fit/gaussian_2peaks.rb +34 -0
- data/examples/fit/hillfit.rb +40 -0
- data/examples/fit/lognormal.rb +26 -0
- data/examples/fit/lorentzfit.rb +22 -0
- data/examples/fit/multifit.rb +72 -0
- data/examples/fit/ndlinear.rb +133 -0
- data/examples/fit/nonlinearfit.rb +89 -0
- data/examples/fit/plot.gp +36 -0
- data/examples/fit/polyfit.rb +9 -0
- data/examples/fit/powerfit.rb +21 -0
- data/examples/fit/sigmoidfit.rb +40 -0
- data/examples/fit/sinfit.rb +22 -0
- data/examples/fit/wlinear.rb +46 -0
- data/examples/fresnel.rb +11 -0
- data/examples/function/function.rb +36 -0
- data/examples/function/log.rb +7 -0
- data/examples/function/min.rb +33 -0
- data/examples/function/sin.rb +10 -0
- data/examples/function/synchrotron.rb +18 -0
- data/examples/gallery/butterfly.rb +7 -0
- data/examples/gallery/cayley.rb +12 -0
- data/examples/gallery/cornu.rb +23 -0
- data/examples/gallery/eight.rb +11 -0
- data/examples/gallery/koch.rb +40 -0
- data/examples/gallery/lemniscate.rb +11 -0
- data/examples/gallery/polar.rb +11 -0
- data/examples/gallery/rgplot/cossin.rb +35 -0
- data/examples/gallery/rgplot/rgplot.replaced +0 -0
- data/examples/gallery/rgplot/roesller.rb +55 -0
- data/examples/gallery/roesller.rb +39 -0
- data/examples/gallery/scarabaeus.rb +14 -0
- data/examples/histogram/cauchy.rb +27 -0
- data/examples/histogram/cauchy.sh +2 -0
- data/examples/histogram/exponential.rb +19 -0
- data/examples/histogram/gauss.rb +16 -0
- data/examples/histogram/gsl-histogram.rb +40 -0
- data/examples/histogram/histo2d.rb +31 -0
- data/examples/histogram/histo3d.rb +34 -0
- data/examples/histogram/histogram-pdf.rb +27 -0
- data/examples/histogram/histogram.rb +26 -0
- data/examples/histogram/integral.rb +28 -0
- data/examples/histogram/poisson.rb +27 -0
- data/examples/histogram/power.rb +25 -0
- data/examples/histogram/rebin.rb +17 -0
- data/examples/histogram/smp.dat +5 -0
- data/examples/histogram/xexp.rb +21 -0
- data/examples/integration/ahmed.rb +21 -0
- data/examples/integration/cosmology.rb +75 -0
- data/examples/integration/friedmann.gp +16 -0
- data/examples/integration/friedmann.rb +35 -0
- data/examples/integration/gamma-zeta.rb +35 -0
- data/examples/integration/integration.rb +22 -0
- data/examples/integration/qag.rb +8 -0
- data/examples/integration/qag2.rb +14 -0
- data/examples/integration/qag3.rb +8 -0
- data/examples/integration/qagi.rb +28 -0
- data/examples/integration/qagi2.rb +49 -0
- data/examples/integration/qagiu.rb +29 -0
- data/examples/integration/qagp.rb +20 -0
- data/examples/integration/qags.rb +14 -0
- data/examples/integration/qawc.rb +18 -0
- data/examples/integration/qawf.rb +41 -0
- data/examples/integration/qawo.rb +29 -0
- data/examples/integration/qaws.rb +30 -0
- data/examples/integration/qng.rb +17 -0
- data/examples/interp/demo.gp +20 -0
- data/examples/interp/demo.rb +45 -0
- data/examples/interp/interp.rb +37 -0
- data/examples/interp/points +10 -0
- data/examples/interp/spline.rb +20 -0
- data/examples/jacobi/deriv.rb +40 -0
- data/examples/jacobi/integrate.rb +34 -0
- data/examples/jacobi/interp.rb +43 -0
- data/examples/jacobi/jacobi.rb +11 -0
- data/examples/linalg/HH.rb +15 -0
- data/examples/linalg/HH_narray.rb +13 -0
- data/examples/linalg/LQ_solve.rb +73 -0
- data/examples/linalg/LU.rb +84 -0
- data/examples/linalg/LU2.rb +31 -0
- data/examples/linalg/LU_narray.rb +24 -0
- data/examples/linalg/PTLQ.rb +47 -0
- data/examples/linalg/QR.rb +18 -0
- data/examples/linalg/QRPT.rb +47 -0
- data/examples/linalg/QR_solve.rb +78 -0
- data/examples/linalg/QR_solve_narray.rb +13 -0
- data/examples/linalg/SV.rb +16 -0
- data/examples/linalg/SV_narray.rb +12 -0
- data/examples/linalg/SV_solve.rb +49 -0
- data/examples/linalg/chol.rb +29 -0
- data/examples/linalg/chol_narray.rb +15 -0
- data/examples/linalg/complex.rb +57 -0
- data/examples/linalg/invert_narray.rb +10 -0
- data/examples/math/const.rb +67 -0
- data/examples/math/elementary.rb +35 -0
- data/examples/math/functions.rb +41 -0
- data/examples/math/inf_nan.rb +34 -0
- data/examples/math/minmax.rb +22 -0
- data/examples/math/power.rb +18 -0
- data/examples/math/test.rb +31 -0
- data/examples/matrix/a.dat +0 -0
- data/examples/matrix/add.rb +45 -0
- data/examples/matrix/b.dat +4 -0
- data/examples/matrix/cat.rb +31 -0
- data/examples/matrix/colvectors.rb +24 -0
- data/examples/matrix/complex.rb +41 -0
- data/examples/matrix/det.rb +29 -0
- data/examples/matrix/diagonal.rb +23 -0
- data/examples/matrix/get_all.rb +159 -0
- data/examples/matrix/hilbert.rb +31 -0
- data/examples/matrix/iterator.rb +19 -0
- data/examples/matrix/matrix.rb +57 -0
- data/examples/matrix/minmax.rb +53 -0
- data/examples/matrix/mul.rb +39 -0
- data/examples/matrix/rand.rb +20 -0
- data/examples/matrix/read.rb +29 -0
- data/examples/matrix/rowcol.rb +47 -0
- data/examples/matrix/set.rb +41 -0
- data/examples/matrix/set_all.rb +100 -0
- data/examples/matrix/view.rb +32 -0
- data/examples/matrix/view_all.rb +148 -0
- data/examples/matrix/write.rb +23 -0
- data/examples/min.rb +29 -0
- data/examples/monte/miser.rb +47 -0
- data/examples/monte/monte.rb +47 -0
- data/examples/monte/plain.rb +47 -0
- data/examples/monte/vegas.rb +46 -0
- data/examples/multimin/bundle.rb +66 -0
- data/examples/multimin/cqp.rb +109 -0
- data/examples/multimin/fdfminimizer.rb +40 -0
- data/examples/multimin/fminimizer.rb +41 -0
- data/examples/multiroot/demo.rb +36 -0
- data/examples/multiroot/fdfsolver.rb +50 -0
- data/examples/multiroot/fsolver.rb +33 -0
- data/examples/multiroot/fsolver2.rb +32 -0
- data/examples/multiroot/fsolver3.rb +26 -0
- data/examples/narray/histogram.rb +14 -0
- data/examples/narray/mandel.rb +27 -0
- data/examples/narray/narray.rb +28 -0
- data/examples/narray/narray2.rb +44 -0
- data/examples/narray/sf.rb +26 -0
- data/examples/ntuple/create.rb +17 -0
- data/examples/ntuple/project.rb +31 -0
- data/examples/odeiv/binarysystem.gp +23 -0
- data/examples/odeiv/binarysystem.rb +104 -0
- data/examples/odeiv/demo.gp +24 -0
- data/examples/odeiv/demo.rb +69 -0
- data/examples/odeiv/demo2.gp +26 -0
- data/examples/odeiv/duffing.rb +45 -0
- data/examples/odeiv/frei1.rb +109 -0
- data/examples/odeiv/frei2.rb +76 -0
- data/examples/odeiv/legendre.rb +52 -0
- data/examples/odeiv/odeiv.rb +32 -0
- data/examples/odeiv/odeiv2.rb +45 -0
- data/examples/odeiv/oscillator.rb +42 -0
- data/examples/odeiv/sedov.rb +97 -0
- data/examples/odeiv/whitedwarf.gp +40 -0
- data/examples/odeiv/whitedwarf.rb +158 -0
- data/examples/ool/conmin.rb +100 -0
- data/examples/ool/gencan.rb +99 -0
- data/examples/ool/pgrad.rb +100 -0
- data/examples/ool/spg.rb +100 -0
- data/examples/pdf/bernoulli.rb +5 -0
- data/examples/pdf/beta.rb +7 -0
- data/examples/pdf/binomiral.rb +10 -0
- data/examples/pdf/cauchy.rb +6 -0
- data/examples/pdf/chisq.rb +8 -0
- data/examples/pdf/exponential.rb +7 -0
- data/examples/pdf/exppow.rb +6 -0
- data/examples/pdf/fdist.rb +7 -0
- data/examples/pdf/flat.rb +7 -0
- data/examples/pdf/gamma.rb +8 -0
- data/examples/pdf/gauss-tail.rb +5 -0
- data/examples/pdf/gauss.rb +6 -0
- data/examples/pdf/geometric.rb +5 -0
- data/examples/pdf/gumbel.rb +6 -0
- data/examples/pdf/hypergeometric.rb +11 -0
- data/examples/pdf/landau.rb +5 -0
- data/examples/pdf/laplace.rb +7 -0
- data/examples/pdf/logarithmic.rb +5 -0
- data/examples/pdf/logistic.rb +6 -0
- data/examples/pdf/lognormal.rb +6 -0
- data/examples/pdf/neg-binomiral.rb +10 -0
- data/examples/pdf/pareto.rb +7 -0
- data/examples/pdf/pascal.rb +10 -0
- data/examples/pdf/poisson.rb +5 -0
- data/examples/pdf/rayleigh-tail.rb +6 -0
- data/examples/pdf/rayleigh.rb +6 -0
- data/examples/pdf/tdist.rb +6 -0
- data/examples/pdf/weibull.rb +8 -0
- data/examples/permutation/ex1.rb +22 -0
- data/examples/permutation/permutation.rb +16 -0
- data/examples/poly/bell.rb +6 -0
- data/examples/poly/bessel.rb +6 -0
- data/examples/poly/cheb.rb +6 -0
- data/examples/poly/cheb_II.rb +6 -0
- data/examples/poly/cubic.rb +9 -0
- data/examples/poly/demo.rb +20 -0
- data/examples/poly/eval.rb +28 -0
- data/examples/poly/eval_derivs.rb +14 -0
- data/examples/poly/fit.rb +21 -0
- data/examples/poly/hermite.rb +6 -0
- data/examples/poly/poly.rb +13 -0
- data/examples/poly/quadratic.rb +25 -0
- data/examples/random/diffusion.rb +34 -0
- data/examples/random/gaussian.rb +9 -0
- data/examples/random/generator.rb +27 -0
- data/examples/random/hdsobol.rb +21 -0
- data/examples/random/poisson.rb +9 -0
- data/examples/random/qrng.rb +19 -0
- data/examples/random/randomwalk.rb +37 -0
- data/examples/random/randomwalk2d.rb +19 -0
- data/examples/random/rayleigh.rb +36 -0
- data/examples/random/rng.rb +33 -0
- data/examples/random/rngextra.rb +14 -0
- data/examples/roots/bisection.rb +25 -0
- data/examples/roots/brent.rb +43 -0
- data/examples/roots/demo.rb +30 -0
- data/examples/roots/newton.rb +46 -0
- data/examples/roots/recombination.gp +12 -0
- data/examples/roots/recombination.rb +61 -0
- data/examples/roots/steffenson.rb +48 -0
- data/examples/sf/ShiChi.rb +6 -0
- data/examples/sf/SiCi.rb +6 -0
- data/examples/sf/airy_Ai.rb +8 -0
- data/examples/sf/airy_Bi.rb +8 -0
- data/examples/sf/bessel_IK.rb +12 -0
- data/examples/sf/bessel_JY.rb +13 -0
- data/examples/sf/beta_inc.rb +9 -0
- data/examples/sf/clausen.rb +6 -0
- data/examples/sf/dawson.rb +5 -0
- data/examples/sf/debye.rb +9 -0
- data/examples/sf/dilog.rb +6 -0
- data/examples/sf/ellint.rb +6 -0
- data/examples/sf/expint.rb +8 -0
- data/examples/sf/fermi.rb +10 -0
- data/examples/sf/gamma_inc_P.rb +9 -0
- data/examples/sf/gegenbauer.rb +8 -0
- data/examples/sf/hyperg.rb +7 -0
- data/examples/sf/laguerre.rb +19 -0
- data/examples/sf/lambertW.rb +5 -0
- data/examples/sf/legendre_P.rb +10 -0
- data/examples/sf/lngamma.rb +5 -0
- data/examples/sf/psi.rb +54 -0
- data/examples/sf/sphbessel.gp +27 -0
- data/examples/sf/sphbessel.rb +30 -0
- data/examples/sf/synchrotron.rb +5 -0
- data/examples/sf/transport.rb +10 -0
- data/examples/sf/zetam1.rb +5 -0
- data/examples/siman.rb +44 -0
- data/examples/sort/heapsort.rb +23 -0
- data/examples/sort/heapsort_vector_complex.rb +21 -0
- data/examples/sort/sort.rb +23 -0
- data/examples/sort/sort2.rb +16 -0
- data/examples/stats/mean.rb +17 -0
- data/examples/stats/statistics.rb +18 -0
- data/examples/stats/test.rb +9 -0
- data/examples/sum.rb +34 -0
- data/examples/tamu_anova.rb +18 -0
- data/examples/vector/a.dat +0 -0
- data/examples/vector/add.rb +56 -0
- data/examples/vector/b.dat +4 -0
- data/examples/vector/c.dat +3 -0
- data/examples/vector/collect.rb +26 -0
- data/examples/vector/compare.rb +28 -0
- data/examples/vector/complex.rb +51 -0
- data/examples/vector/complex_get_all.rb +85 -0
- data/examples/vector/complex_set_all.rb +131 -0
- data/examples/vector/complex_view_all.rb +77 -0
- data/examples/vector/connect.rb +22 -0
- data/examples/vector/decimate.rb +38 -0
- data/examples/vector/diff.rb +31 -0
- data/examples/vector/filescan.rb +17 -0
- data/examples/vector/floor.rb +23 -0
- data/examples/vector/get_all.rb +82 -0
- data/examples/vector/gnuplot.rb +38 -0
- data/examples/vector/graph.rb +28 -0
- data/examples/vector/histogram.rb +22 -0
- data/examples/vector/linspace.rb +24 -0
- data/examples/vector/log.rb +17 -0
- data/examples/vector/logic.rb +33 -0
- data/examples/vector/logspace.rb +25 -0
- data/examples/vector/minmax.rb +47 -0
- data/examples/vector/mul.rb +49 -0
- data/examples/vector/narray.rb +46 -0
- data/examples/vector/read.rb +29 -0
- data/examples/vector/set.rb +35 -0
- data/examples/vector/set_all.rb +121 -0
- data/examples/vector/smpv.dat +15 -0
- data/examples/vector/test.rb +43 -0
- data/examples/vector/test_gslblock.rb +58 -0
- data/examples/vector/vector.rb +110 -0
- data/examples/vector/view.rb +35 -0
- data/examples/vector/view_all.rb +73 -0
- data/examples/vector/where.rb +29 -0
- data/examples/vector/write.rb +24 -0
- data/examples/vector/zip.rb +34 -0
- data/examples/wavelet/ecg.dat +256 -0
- data/examples/wavelet/wavelet1.rb +50 -0
- data/ext/alf.c +206 -0
- data/ext/array.c +642 -0
- data/ext/array_complex.c +248 -0
- data/ext/blas.c +29 -0
- data/ext/blas1.c +734 -0
- data/ext/blas2.c +1093 -0
- data/ext/blas3.c +881 -0
- data/ext/block.c +44 -0
- data/ext/block_source.c +887 -0
- data/ext/bspline.c +130 -0
- data/ext/bundle.c +3 -0
- data/ext/cdf.c +754 -0
- data/ext/cheb.c +542 -0
- data/ext/combination.c +283 -0
- data/ext/common.c +325 -0
- data/ext/complex.c +1004 -0
- data/ext/const.c +673 -0
- data/ext/const_additional.c +120 -0
- data/ext/cqp.c +283 -0
- data/ext/deriv.c +195 -0
- data/ext/dht.c +361 -0
- data/ext/diff.c +166 -0
- data/ext/dirac.c +389 -0
- data/ext/eigen.c +2373 -0
- data/ext/error.c +193 -0
- data/ext/extconf.rb +303 -0
- data/ext/fcmp.c +66 -0
- data/ext/fft.c +1102 -0
- data/ext/fit.c +205 -0
- data/ext/fresnel.c +312 -0
- data/ext/function.c +524 -0
- data/ext/geometry.c +139 -0
- data/ext/graph.c +1640 -0
- data/ext/gsl.c +280 -0
- data/ext/gsl_narray.c +804 -0
- data/ext/histogram.c +1991 -0
- data/ext/histogram2d.c +1068 -0
- data/ext/histogram3d.c +884 -0
- data/ext/histogram3d_source.c +750 -0
- data/ext/histogram_find.c +101 -0
- data/ext/histogram_oper.c +159 -0
- data/ext/ieee.c +100 -0
- data/ext/integration.c +1179 -0
- data/ext/interp.c +512 -0
- data/ext/jacobi.c +739 -0
- data/ext/linalg.c +4042 -0
- data/ext/linalg_complex.c +739 -0
- data/ext/math.c +725 -0
- data/ext/matrix.c +39 -0
- data/ext/matrix_complex.c +1737 -0
- data/ext/matrix_double.c +560 -0
- data/ext/matrix_int.c +256 -0
- data/ext/matrix_source.c +2734 -0
- data/ext/min.c +250 -0
- data/ext/monte.c +992 -0
- data/ext/multifit.c +1871 -0
- data/ext/multimin.c +806 -0
- data/ext/multimin_fsdf.c +156 -0
- data/ext/multiroots.c +955 -0
- data/ext/multiset.c +214 -0
- data/ext/ndlinear.c +321 -0
- data/ext/nmf.c +171 -0
- data/ext/nmf_wrap.c +75 -0
- data/ext/ntuple.c +469 -0
- data/ext/odeiv.c +962 -0
- data/ext/ool.c +879 -0
- data/ext/oper_complex_source.c +253 -0
- data/ext/permutation.c +596 -0
- data/ext/poly.c +42 -0
- data/ext/poly2.c +265 -0
- data/ext/poly_source.c +1915 -0
- data/ext/qrng.c +171 -0
- data/ext/randist.c +1873 -0
- data/ext/rational.c +480 -0
- data/ext/rng.c +612 -0
- data/ext/root.c +408 -0
- data/ext/sf.c +1494 -0
- data/ext/sf_airy.c +200 -0
- data/ext/sf_bessel.c +871 -0
- data/ext/sf_clausen.c +28 -0
- data/ext/sf_coulomb.c +206 -0
- data/ext/sf_coupling.c +121 -0
- data/ext/sf_dawson.c +29 -0
- data/ext/sf_debye.c +157 -0
- data/ext/sf_dilog.c +43 -0
- data/ext/sf_elementary.c +46 -0
- data/ext/sf_ellint.c +206 -0
- data/ext/sf_elljac.c +30 -0
- data/ext/sf_erfc.c +93 -0
- data/ext/sf_exp.c +169 -0
- data/ext/sf_expint.c +211 -0
- data/ext/sf_fermi_dirac.c +148 -0
- data/ext/sf_gamma.c +347 -0
- data/ext/sf_gegenbauer.c +97 -0
- data/ext/sf_hyperg.c +203 -0
- data/ext/sf_laguerre.c +113 -0
- data/ext/sf_lambert.c +47 -0
- data/ext/sf_legendre.c +368 -0
- data/ext/sf_log.c +105 -0
- data/ext/sf_mathieu.c +238 -0
- data/ext/sf_power.c +47 -0
- data/ext/sf_psi.c +98 -0
- data/ext/sf_synchrotron.c +48 -0
- data/ext/sf_transport.c +76 -0
- data/ext/sf_trigonometric.c +210 -0
- data/ext/sf_zeta.c +119 -0
- data/ext/signal.c +308 -0
- data/ext/siman.c +717 -0
- data/ext/sort.c +208 -0
- data/ext/spline.c +395 -0
- data/ext/stats.c +800 -0
- data/ext/sum.c +168 -0
- data/ext/tamu_anova.c +56 -0
- data/ext/tensor.c +38 -0
- data/ext/tensor_source.c +1123 -0
- data/ext/vector.c +38 -0
- data/ext/vector_complex.c +2246 -0
- data/ext/vector_double.c +1438 -0
- data/ext/vector_int.c +204 -0
- data/ext/vector_source.c +3336 -0
- data/ext/wavelet.c +945 -0
- data/include/rb_gsl.h +158 -0
- data/include/rb_gsl_array.h +238 -0
- data/include/rb_gsl_cheb.h +21 -0
- data/include/rb_gsl_common.h +348 -0
- data/include/rb_gsl_complex.h +25 -0
- data/include/rb_gsl_config.h +62 -0
- data/include/rb_gsl_const.h +29 -0
- data/include/rb_gsl_dirac.h +13 -0
- data/include/rb_gsl_eigen.h +17 -0
- data/include/rb_gsl_fft.h +62 -0
- data/include/rb_gsl_fit.h +25 -0
- data/include/rb_gsl_function.h +27 -0
- data/include/rb_gsl_graph.h +70 -0
- data/include/rb_gsl_histogram.h +63 -0
- data/include/rb_gsl_histogram3d.h +97 -0
- data/include/rb_gsl_integration.h +17 -0
- data/include/rb_gsl_interp.h +46 -0
- data/include/rb_gsl_linalg.h +25 -0
- data/include/rb_gsl_math.h +26 -0
- data/include/rb_gsl_odeiv.h +21 -0
- data/include/rb_gsl_poly.h +71 -0
- data/include/rb_gsl_rational.h +37 -0
- data/include/rb_gsl_rng.h +21 -0
- data/include/rb_gsl_root.h +22 -0
- data/include/rb_gsl_sf.h +119 -0
- data/include/rb_gsl_statistics.h +17 -0
- data/include/rb_gsl_tensor.h +45 -0
- data/include/rb_gsl_with_narray.h +29 -0
- data/include/templates_off.h +87 -0
- data/include/templates_on.h +241 -0
- data/lib/gsl.rb +3 -0
- data/lib/gsl/gnuplot.rb +41 -0
- data/lib/gsl/oper.rb +68 -0
- data/lib/ool.rb +22 -0
- data/lib/ool/conmin.rb +30 -0
- data/lib/rbgsl.rb +3 -0
- data/rdoc/alf.rdoc +77 -0
- data/rdoc/blas.rdoc +269 -0
- data/rdoc/bspline.rdoc +42 -0
- data/rdoc/changes.rdoc +164 -0
- data/rdoc/cheb.rdoc +99 -0
- data/rdoc/cholesky_complex.rdoc +46 -0
- data/rdoc/combi.rdoc +125 -0
- data/rdoc/complex.rdoc +210 -0
- data/rdoc/const.rdoc +546 -0
- data/rdoc/dht.rdoc +122 -0
- data/rdoc/diff.rdoc +133 -0
- data/rdoc/ehandling.rdoc +50 -0
- data/rdoc/eigen.rdoc +401 -0
- data/rdoc/fft.rdoc +535 -0
- data/rdoc/fit.rdoc +284 -0
- data/rdoc/function.rdoc +94 -0
- data/rdoc/graph.rdoc +137 -0
- data/rdoc/hist.rdoc +409 -0
- data/rdoc/hist2d.rdoc +279 -0
- data/rdoc/hist3d.rdoc +112 -0
- data/rdoc/index.rdoc +62 -0
- data/rdoc/integration.rdoc +398 -0
- data/rdoc/interp.rdoc +231 -0
- data/rdoc/intro.rdoc +27 -0
- data/rdoc/linalg.rdoc +681 -0
- data/rdoc/linalg_complex.rdoc +88 -0
- data/rdoc/math.rdoc +276 -0
- data/rdoc/matrix.rdoc +1093 -0
- data/rdoc/min.rdoc +189 -0
- data/rdoc/monte.rdoc +234 -0
- data/rdoc/multimin.rdoc +312 -0
- data/rdoc/multiroot.rdoc +293 -0
- data/rdoc/narray.rdoc +177 -0
- data/rdoc/ndlinear.rdoc +250 -0
- data/rdoc/nonlinearfit.rdoc +348 -0
- data/rdoc/ntuple.rdoc +88 -0
- data/rdoc/odeiv.rdoc +378 -0
- data/rdoc/perm.rdoc +221 -0
- data/rdoc/poly.rdoc +335 -0
- data/rdoc/qrng.rdoc +90 -0
- data/rdoc/randist.rdoc +233 -0
- data/rdoc/ref.rdoc +93 -0
- data/rdoc/rng.rdoc +203 -0
- data/rdoc/rngextra.rdoc +11 -0
- data/rdoc/roots.rdoc +305 -0
- data/rdoc/screenshot.rdoc +40 -0
- data/rdoc/sf.rdoc +1622 -0
- data/rdoc/siman.rdoc +89 -0
- data/rdoc/sort.rdoc +94 -0
- data/rdoc/start.rdoc +16 -0
- data/rdoc/stats.rdoc +219 -0
- data/rdoc/sum.rdoc +65 -0
- data/rdoc/tensor.rdoc +251 -0
- data/rdoc/tut.rdoc +5 -0
- data/rdoc/use.rdoc +177 -0
- data/rdoc/vector.rdoc +1243 -0
- data/rdoc/vector_complex.rdoc +347 -0
- data/rdoc/wavelet.rdoc +218 -0
- data/setup.rb +1585 -0
- data/tests/blas/amax.rb +14 -0
- data/tests/blas/asum.rb +16 -0
- data/tests/blas/axpy.rb +25 -0
- data/tests/blas/copy.rb +23 -0
- data/tests/blas/dot.rb +23 -0
- data/tests/bspline.rb +53 -0
- data/tests/cdf.rb +1388 -0
- data/tests/cheb.rb +112 -0
- data/tests/combination.rb +123 -0
- data/tests/complex.rb +17 -0
- data/tests/const.rb +24 -0
- data/tests/deriv.rb +85 -0
- data/tests/dht/dht1.rb +17 -0
- data/tests/dht/dht2.rb +23 -0
- data/tests/dht/dht3.rb +23 -0
- data/tests/dht/dht4.rb +23 -0
- data/tests/diff.rb +78 -0
- data/tests/eigen/eigen.rb +220 -0
- data/tests/eigen/gen.rb +105 -0
- data/tests/eigen/genherm.rb +66 -0
- data/tests/eigen/gensymm.rb +68 -0
- data/tests/eigen/nonsymm.rb +53 -0
- data/tests/eigen/nonsymmv.rb +53 -0
- data/tests/eigen/symm-herm.rb +74 -0
- data/tests/err.rb +58 -0
- data/tests/fit.rb +124 -0
- data/tests/gsl_test.rb +118 -0
- data/tests/gsl_test2.rb +110 -0
- data/tests/histo.rb +12 -0
- data/tests/integration/integration1.rb +72 -0
- data/tests/integration/integration2.rb +71 -0
- data/tests/integration/integration3.rb +71 -0
- data/tests/integration/integration4.rb +71 -0
- data/tests/interp.rb +45 -0
- data/tests/linalg/HH.rb +64 -0
- data/tests/linalg/LU.rb +47 -0
- data/tests/linalg/QR.rb +77 -0
- data/tests/linalg/SV.rb +24 -0
- data/tests/linalg/TDN.rb +116 -0
- data/tests/linalg/TDS.rb +122 -0
- data/tests/linalg/bidiag.rb +73 -0
- data/tests/linalg/cholesky.rb +20 -0
- data/tests/linalg/linalg.rb +158 -0
- data/tests/matrix/matrix_complex_test.rb +36 -0
- data/tests/matrix/matrix_nmf_test.rb +39 -0
- data/tests/matrix/matrix_test.rb +48 -0
- data/tests/min.rb +99 -0
- data/tests/monte/miser.rb +31 -0
- data/tests/monte/vegas.rb +45 -0
- data/tests/multifit/test_2dgauss.rb +112 -0
- data/tests/multifit/test_brown.rb +90 -0
- data/tests/multifit/test_enso.rb +246 -0
- data/tests/multifit/test_filip.rb +155 -0
- data/tests/multifit/test_gauss.rb +97 -0
- data/tests/multifit/test_longley.rb +110 -0
- data/tests/multifit/test_multifit.rb +52 -0
- data/tests/multimin.rb +139 -0
- data/tests/multiroot.rb +131 -0
- data/tests/multiset.rb +52 -0
- data/tests/narray/blas_dnrm2.rb +20 -0
- data/tests/odeiv.rb +353 -0
- data/tests/poly/poly.rb +290 -0
- data/tests/poly/special.rb +65 -0
- data/tests/qrng.rb +131 -0
- data/tests/quartic.rb +29 -0
- data/tests/randist.rb +134 -0
- data/tests/rng.rb +305 -0
- data/tests/roots.rb +76 -0
- data/tests/run-test.sh +17 -0
- data/tests/sf/gsl_test_sf.rb +249 -0
- data/tests/sf/test_airy.rb +83 -0
- data/tests/sf/test_bessel.rb +306 -0
- data/tests/sf/test_coulomb.rb +17 -0
- data/tests/sf/test_dilog.rb +25 -0
- data/tests/sf/test_gamma.rb +209 -0
- data/tests/sf/test_hyperg.rb +356 -0
- data/tests/sf/test_legendre.rb +227 -0
- data/tests/sf/test_mathieu.rb +59 -0
- data/tests/sf/test_mode.rb +19 -0
- data/tests/sf/test_sf.rb +839 -0
- data/tests/stats.rb +174 -0
- data/tests/stats_mt.rb +16 -0
- data/tests/sum.rb +98 -0
- data/tests/sys.rb +323 -0
- data/tests/tensor.rb +419 -0
- data/tests/vector/vector_complex_test.rb +101 -0
- data/tests/vector/vector_test.rb +141 -0
- data/tests/wavelet.rb +142 -0
- metadata +789 -0
data/ext/gsl.c
ADDED
@@ -0,0 +1,280 @@
|
|
1
|
+
/*
|
2
|
+
gsl.c
|
3
|
+
Ruby/GSL: Ruby extension library for GSL (GNU Scientific Library)
|
4
|
+
(C) Copyright 2001-2006 by Yoshiki Tsunesada
|
5
|
+
|
6
|
+
Ruby/GSL is free software: you can redistribute it and/or modify it
|
7
|
+
under the terms of the GNU General Public License.
|
8
|
+
This library is distributed in the hope that it will be useful, but
|
9
|
+
WITHOUT ANY WARRANTY.
|
10
|
+
*/
|
11
|
+
|
12
|
+
#include "rb_gsl.h"
|
13
|
+
#include <gsl/gsl_machine.h>
|
14
|
+
|
15
|
+
ID rb_gsl_id_beg, rb_gsl_id_end, rb_gsl_id_excl, rb_gsl_id_to_a;
|
16
|
+
static ID rb_gsl_id_name, rb_gsl_id_size;
|
17
|
+
VALUE cGSL_Object;
|
18
|
+
static void rb_gsl_define_intern(VALUE module);
|
19
|
+
static void rb_gsl_define_const(VALUE module);
|
20
|
+
static void rb_gsl_define_methods(VALUE module);
|
21
|
+
|
22
|
+
static VALUE rb_gsl_object_inspect(VALUE obj)
|
23
|
+
{
|
24
|
+
char buf[256];
|
25
|
+
sprintf(buf, "%s", rb_class2name(CLASS_OF(obj)));
|
26
|
+
return rb_str_new2(buf);
|
27
|
+
}
|
28
|
+
|
29
|
+
static VALUE rb_gsl_call_rescue(VALUE obj)
|
30
|
+
{
|
31
|
+
return Qfalse;
|
32
|
+
}
|
33
|
+
|
34
|
+
static VALUE rb_gsl_call_name(VALUE obj)
|
35
|
+
{
|
36
|
+
return rb_funcall(obj, rb_gsl_id_name, 0);
|
37
|
+
}
|
38
|
+
|
39
|
+
static VALUE rb_gsl_call_size(VALUE obj)
|
40
|
+
{
|
41
|
+
return rb_funcall(obj, rb_gsl_id_size, 0);
|
42
|
+
}
|
43
|
+
|
44
|
+
static VALUE rb_gsl_object_info(VALUE obj)
|
45
|
+
{
|
46
|
+
char buf[256];
|
47
|
+
VALUE s;
|
48
|
+
sprintf(buf, "Class: %s\n", rb_class2name(CLASS_OF(obj)));
|
49
|
+
#ifdef RUBY_1_9_LATER
|
50
|
+
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
|
+
s = rb_rescue(rb_gsl_call_name, obj, rb_gsl_call_rescue, obj);
|
55
|
+
if (s) sprintf(buf, "%sType: %s\n", buf, STR2CSTR(s));
|
56
|
+
s = rb_rescue(rb_gsl_call_size, obj, rb_gsl_call_rescue, obj);
|
57
|
+
if (s) sprintf(buf, "%sSize: %d\n", buf, (int) FIX2INT(s));
|
58
|
+
return rb_str_new2(buf);
|
59
|
+
}
|
60
|
+
|
61
|
+
static VALUE rb_gsl_not_implemeted(VALUE obj)
|
62
|
+
{
|
63
|
+
rb_raise(rb_eNotImpError, "%s#dup is not implemented", rb_class2name(CLASS_OF(obj)));
|
64
|
+
return Qnil;
|
65
|
+
}
|
66
|
+
|
67
|
+
void Init_rb_gsl()
|
68
|
+
{
|
69
|
+
VALUE mgsl;
|
70
|
+
|
71
|
+
mgsl = rb_define_module("GSL");
|
72
|
+
cGSL_Object = rb_define_class_under(mgsl, "Object", rb_cObject);
|
73
|
+
rb_define_method(cGSL_Object, "inspect", rb_gsl_object_inspect, 0);
|
74
|
+
rb_define_method(cGSL_Object, "info", rb_gsl_object_info, 0);
|
75
|
+
// Override Object#dup to prevent invalid dup-ing of GSL_Objects.
|
76
|
+
// Subclasses (e.g. GSL::Vector) must provide their own implementation of
|
77
|
+
// #dup if desired.
|
78
|
+
rb_define_method(cGSL_Object, "dup", rb_gsl_not_implemeted, 0);
|
79
|
+
|
80
|
+
rb_gsl_define_intern(mgsl);
|
81
|
+
|
82
|
+
Init_gsl_error(mgsl);
|
83
|
+
|
84
|
+
Init_gsl_math(mgsl);
|
85
|
+
Init_gsl_complex(mgsl);
|
86
|
+
|
87
|
+
Init_gsl_array(mgsl);
|
88
|
+
|
89
|
+
Init_gsl_blas(mgsl);
|
90
|
+
|
91
|
+
Init_gsl_sort(mgsl);
|
92
|
+
|
93
|
+
Init_gsl_poly(mgsl); /* this must be called after the Vector class defined */
|
94
|
+
Init_gsl_poly_int(mgsl);
|
95
|
+
Init_gsl_poly2(mgsl);
|
96
|
+
Init_gsl_rational(mgsl);
|
97
|
+
|
98
|
+
Init_gsl_sf(mgsl);
|
99
|
+
|
100
|
+
Init_gsl_linalg(mgsl); /* Init_gsl_linalg_complex() is called in Init_gsl_linalg() */
|
101
|
+
|
102
|
+
Init_gsl_eigen(mgsl);
|
103
|
+
|
104
|
+
Init_gsl_fft(mgsl);
|
105
|
+
Init_gsl_signal(mgsl);
|
106
|
+
Init_gsl_function(mgsl);
|
107
|
+
Init_gsl_integration(mgsl);
|
108
|
+
|
109
|
+
Init_gsl_rng(mgsl);
|
110
|
+
Init_gsl_qrng(mgsl);
|
111
|
+
Init_gsl_ran(mgsl);
|
112
|
+
#ifdef GSL_1_4_LATER
|
113
|
+
Init_gsl_cdf(mgsl);
|
114
|
+
#endif
|
115
|
+
Init_gsl_stats(mgsl);
|
116
|
+
|
117
|
+
Init_gsl_histogram(mgsl);
|
118
|
+
Init_gsl_histogram2d(mgsl);
|
119
|
+
Init_gsl_histogram3d(mgsl);
|
120
|
+
Init_gsl_ntuple(mgsl);
|
121
|
+
Init_gsl_monte(mgsl);
|
122
|
+
Init_gsl_siman(mgsl);
|
123
|
+
|
124
|
+
Init_gsl_odeiv(mgsl);
|
125
|
+
Init_gsl_interp(mgsl);
|
126
|
+
Init_gsl_spline(mgsl);
|
127
|
+
Init_gsl_diff(mgsl);
|
128
|
+
#ifdef GSL_1_4_9_LATER
|
129
|
+
Init_gsl_deriv(mgsl);
|
130
|
+
#endif
|
131
|
+
|
132
|
+
Init_gsl_cheb(mgsl);
|
133
|
+
Init_gsl_sum(mgsl);
|
134
|
+
Init_gsl_dht(mgsl);
|
135
|
+
|
136
|
+
Init_gsl_root(mgsl);
|
137
|
+
Init_gsl_multiroot(mgsl);
|
138
|
+
Init_gsl_min(mgsl);
|
139
|
+
Init_gsl_multimin(mgsl);
|
140
|
+
Init_gsl_fit(mgsl);
|
141
|
+
Init_gsl_multifit(mgsl);
|
142
|
+
|
143
|
+
Init_gsl_const(mgsl);
|
144
|
+
|
145
|
+
Init_gsl_ieee(mgsl);
|
146
|
+
|
147
|
+
#ifdef HAVE_NARRAY_H
|
148
|
+
Init_gsl_narray(mgsl);
|
149
|
+
#endif
|
150
|
+
|
151
|
+
Init_wavelet(mgsl);
|
152
|
+
|
153
|
+
rb_gsl_define_const(mgsl);
|
154
|
+
|
155
|
+
#ifdef HAVE_TENSOR_TENSOR_H
|
156
|
+
Init_tensor_init(mgsl);
|
157
|
+
Init_tensor_int_init(mgsl);
|
158
|
+
#endif
|
159
|
+
|
160
|
+
Init_gsl_graph(mgsl);
|
161
|
+
Init_gsl_dirac(mgsl);
|
162
|
+
|
163
|
+
#ifdef HAVE_TAMU_ANOVA_TAMU_ANOVA_H
|
164
|
+
Init_tamu_anova(mgsl);
|
165
|
+
#endif
|
166
|
+
|
167
|
+
#ifdef HAVE_OOL_OOL_VERSION_H
|
168
|
+
Init_ool(mgsl);
|
169
|
+
#endif
|
170
|
+
|
171
|
+
#ifdef HAVE_JACOBI_H
|
172
|
+
Init_jacobi(mgsl);
|
173
|
+
#endif
|
174
|
+
|
175
|
+
#ifdef HAVE_GSL_GSL_CQP_H
|
176
|
+
Init_cqp(mgsl);
|
177
|
+
#endif
|
178
|
+
|
179
|
+
Init_fresnel(mgsl);
|
180
|
+
|
181
|
+
#ifdef GSL_1_9_LATER
|
182
|
+
Init_bspline(mgsl);
|
183
|
+
#endif
|
184
|
+
|
185
|
+
#ifdef HAVE_ALF_ALF_H
|
186
|
+
Init_alf(mgsl);
|
187
|
+
#endif
|
188
|
+
|
189
|
+
Init_geometry(mgsl);
|
190
|
+
|
191
|
+
#ifdef GSL_1_14_LATER
|
192
|
+
Init_multiset(mgsl);
|
193
|
+
#endif
|
194
|
+
|
195
|
+
rb_gsl_define_methods(mgsl);
|
196
|
+
}
|
197
|
+
|
198
|
+
/**********/
|
199
|
+
|
200
|
+
static void rb_gsl_define_intern(VALUE module)
|
201
|
+
{
|
202
|
+
rb_gsl_id_beg = rb_intern("begin");
|
203
|
+
rb_gsl_id_end = rb_intern("end");
|
204
|
+
rb_gsl_id_excl = rb_intern("exclude_end?");
|
205
|
+
rb_gsl_id_to_a = rb_intern("to_a");
|
206
|
+
rb_gsl_id_name = rb_intern("name");
|
207
|
+
rb_gsl_id_size = rb_intern("size");
|
208
|
+
}
|
209
|
+
|
210
|
+
static void rb_gsl_define_const(VALUE module)
|
211
|
+
{
|
212
|
+
rb_define_const(module, "MODE_DEFAULT", INT2FIX(GSL_MODE_DEFAULT));
|
213
|
+
rb_define_const(module, "PREC_DOUBLE", INT2FIX(GSL_PREC_DOUBLE));
|
214
|
+
rb_define_const(module, "PREC_SINGLE", INT2FIX(GSL_PREC_SINGLE));
|
215
|
+
rb_define_const(module, "PREC_APPROX", INT2FIX(GSL_PREC_APPROX));
|
216
|
+
#ifdef GSL_VERSION
|
217
|
+
rb_define_const(module, "VERSION", rb_str_new2(GSL_VERSION));
|
218
|
+
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
|
+
|
225
|
+
rb_define_const(module, "DBL_EPSILON", rb_float_new(GSL_DBL_EPSILON));
|
226
|
+
rb_define_const(module, "FLT_EPSILON", rb_float_new(GSL_FLT_EPSILON));
|
227
|
+
rb_define_const(module, "MACH_EPS", rb_float_new(GSL_MACH_EPS));
|
228
|
+
rb_define_const(module, "SQRT_DBL_EPSILON", rb_float_new(GSL_SQRT_DBL_EPSILON));
|
229
|
+
rb_define_const(module, "ROOT3_DBL_EPSILON", rb_float_new(GSL_ROOT3_DBL_EPSILON));
|
230
|
+
rb_define_const(module, "ROOT4_DBL_EPSILON", rb_float_new(GSL_ROOT4_DBL_EPSILON));
|
231
|
+
rb_define_const(module, "ROOT5_DBL_EPSILON", rb_float_new(GSL_ROOT5_DBL_EPSILON));
|
232
|
+
rb_define_const(module, "ROOT6_DBL_EPSILON", rb_float_new(GSL_ROOT6_DBL_EPSILON));
|
233
|
+
rb_define_const(module, "LOG_DBL_EPSILON", rb_float_new(GSL_LOG_DBL_EPSILON));
|
234
|
+
|
235
|
+
rb_define_const(module, "DBL_MAX", rb_float_new(GSL_DBL_MAX));
|
236
|
+
rb_define_const(module, "SQRT_DBL_MAX", rb_float_new(GSL_SQRT_DBL_MAX));
|
237
|
+
rb_define_const(module, "ROOT3_DBL_MAX", rb_float_new(GSL_ROOT3_DBL_MAX));
|
238
|
+
rb_define_const(module, "ROOT4_DBL_MAX", rb_float_new(GSL_ROOT4_DBL_MAX));
|
239
|
+
rb_define_const(module, "ROOT5_DBL_MAX", rb_float_new(GSL_ROOT5_DBL_MAX));
|
240
|
+
rb_define_const(module, "ROOT6_DBL_MAX", rb_float_new(GSL_ROOT6_DBL_MAX));
|
241
|
+
rb_define_const(module, "LOG_DBL_MAX", rb_float_new(GSL_LOG_DBL_MAX));
|
242
|
+
|
243
|
+
rb_define_const(module, "DBL_MIN", rb_float_new(GSL_DBL_MIN));
|
244
|
+
rb_define_const(module, "SQRT_DBL_MIN", rb_float_new(GSL_SQRT_DBL_MIN));
|
245
|
+
rb_define_const(module, "ROOT3_DBL_MIN", rb_float_new(GSL_ROOT3_DBL_MIN));
|
246
|
+
rb_define_const(module, "ROOT4_DBL_MIN", rb_float_new(GSL_ROOT4_DBL_MIN));
|
247
|
+
rb_define_const(module, "ROOT5_DBL_MIN", rb_float_new(GSL_ROOT5_DBL_MIN));
|
248
|
+
rb_define_const(module, "ROOT6_DBL_MIN", rb_float_new(GSL_ROOT6_DBL_MIN));
|
249
|
+
rb_define_const(module, "LOG_DBL_MIN", rb_float_new(GSL_LOG_DBL_MIN));
|
250
|
+
|
251
|
+
#ifdef GSL_1_14_LATER
|
252
|
+
rb_define_const(module, "MAJOR_VERSION", INT2FIX(GSL_MAJOR_VERSION));
|
253
|
+
rb_define_const(module, "MINOR_VERSION", INT2FIX(GSL_MINOR_VERSION));
|
254
|
+
#endif
|
255
|
+
|
256
|
+
}
|
257
|
+
|
258
|
+
static VALUE rb_gsl_have_tensor(VALUE module)
|
259
|
+
{
|
260
|
+
#ifdef HAVE_TENSOR_TENSOR_H
|
261
|
+
return Qtrue;
|
262
|
+
#else
|
263
|
+
return Qfalse;
|
264
|
+
#endif
|
265
|
+
}
|
266
|
+
|
267
|
+
static VALUE rb_gsl_have_narray(VALUE module)
|
268
|
+
{
|
269
|
+
#ifdef HAVE_NARRAY_H
|
270
|
+
return Qtrue;
|
271
|
+
#else
|
272
|
+
return Qfalse;
|
273
|
+
#endif
|
274
|
+
}
|
275
|
+
|
276
|
+
static void rb_gsl_define_methods(VALUE module)
|
277
|
+
{
|
278
|
+
rb_define_singleton_method(module, "have_tensor?", rb_gsl_have_tensor, 0);
|
279
|
+
rb_define_singleton_method(module, "have_narray?", rb_gsl_have_narray, 0);
|
280
|
+
}
|
data/ext/gsl_narray.c
ADDED
@@ -0,0 +1,804 @@
|
|
1
|
+
/*
|
2
|
+
narray.c
|
3
|
+
|
4
|
+
Written by Yoshiki Tsunesada Dec/2001
|
5
|
+
Modified by Seiya Nishizawa 14/Apr/2004
|
6
|
+
*/
|
7
|
+
|
8
|
+
#include "rb_gsl_config.h"
|
9
|
+
#ifdef HAVE_NARRAY_H
|
10
|
+
#include "rb_gsl_array.h"
|
11
|
+
#include "narray.h"
|
12
|
+
#include "rb_gsl_with_narray.h"
|
13
|
+
|
14
|
+
static VALUE rb_gsl_na_to_gsl_matrix_method(VALUE nna);
|
15
|
+
static VALUE rb_gsl_na_to_gsl_matrix_int_method(VALUE nna);
|
16
|
+
static VALUE rb_gsl_na_to_gsl_vector_int_method(VALUE na);
|
17
|
+
static VALUE rb_gsl_vector_int_to_na(VALUE obj);
|
18
|
+
static VALUE rb_gsl_na_to_gsl_vector_int(VALUE obj, VALUE na);
|
19
|
+
|
20
|
+
/* GSL::Vector -> NArray */
|
21
|
+
|
22
|
+
static VALUE rb_gsl_vector_to_narray(VALUE obj, VALUE klass)
|
23
|
+
{
|
24
|
+
gsl_vector *v = NULL;
|
25
|
+
VALUE nary;
|
26
|
+
int shape[1];
|
27
|
+
Data_Get_Struct(obj, gsl_vector, v);
|
28
|
+
shape[0] = v->size;
|
29
|
+
nary = na_make_object(NA_DFLOAT, 1, shape, klass);
|
30
|
+
if (v->stride == 1) {
|
31
|
+
memcpy(NA_PTR_TYPE(nary,double*), v->data, shape[0]*sizeof(double));
|
32
|
+
} else {
|
33
|
+
int i;
|
34
|
+
for(i=0; i < v->size; i++) {
|
35
|
+
(NA_PTR_TYPE(nary,double*))[i] = gsl_vector_get(v, i);
|
36
|
+
}
|
37
|
+
}
|
38
|
+
return nary;
|
39
|
+
}
|
40
|
+
|
41
|
+
static VALUE rb_gsl_vector_complex_to_narray(VALUE obj, VALUE klass)
|
42
|
+
{
|
43
|
+
gsl_vector_complex *v = NULL;
|
44
|
+
VALUE nary;
|
45
|
+
int shape[1];
|
46
|
+
Data_Get_Struct(obj, gsl_vector_complex, v);
|
47
|
+
shape[0] = v->size;
|
48
|
+
nary = na_make_object(NA_DCOMPLEX, 1, shape, klass);
|
49
|
+
if (v->stride == 1) {
|
50
|
+
memcpy(NA_PTR_TYPE(nary,double*), v->data, shape[0]*2*sizeof(double));
|
51
|
+
} else {
|
52
|
+
int i;
|
53
|
+
for(i=0; i < 2*v->size; i++) {
|
54
|
+
(NA_PTR_TYPE(nary,gsl_complex*))[i] = gsl_vector_complex_get(v, i);
|
55
|
+
}
|
56
|
+
}
|
57
|
+
return nary;
|
58
|
+
}
|
59
|
+
|
60
|
+
static VALUE rb_gsl_vector_to_na(VALUE obj)
|
61
|
+
{
|
62
|
+
VALUE na = Qnil;
|
63
|
+
|
64
|
+
if(VECTOR_P(obj))
|
65
|
+
na = rb_gsl_vector_to_narray(obj, cNArray);
|
66
|
+
else if(VECTOR_COMPLEX_P(obj))
|
67
|
+
na = rb_gsl_vector_complex_to_narray(obj, cNArray);
|
68
|
+
else
|
69
|
+
rb_raise(rb_eRuntimeError, "unexpected type '%s'",
|
70
|
+
rb_obj_classname(obj));
|
71
|
+
|
72
|
+
return na;
|
73
|
+
}
|
74
|
+
|
75
|
+
static VALUE rb_gsl_vector_complex_to_na(VALUE obj)
|
76
|
+
{
|
77
|
+
return rb_gsl_vector_complex_to_narray(obj, cNArray);
|
78
|
+
}
|
79
|
+
|
80
|
+
static VALUE rb_gsl_vector_to_nvector(VALUE obj)
|
81
|
+
{
|
82
|
+
return rb_gsl_vector_to_narray(obj, cNVector);
|
83
|
+
}
|
84
|
+
|
85
|
+
static VALUE rb_gsl_vector_complex_to_nvector(VALUE obj)
|
86
|
+
{
|
87
|
+
return rb_gsl_vector_complex_to_narray(obj, cNVector);
|
88
|
+
}
|
89
|
+
|
90
|
+
/* GSL::Vector -> NArray view */
|
91
|
+
|
92
|
+
static struct NARRAY* rb_gsl_na_view_alloc(int rank, int total, int type)
|
93
|
+
{
|
94
|
+
struct NARRAY *na;
|
95
|
+
na = (struct NARRAY*) malloc(sizeof(struct NARRAY));
|
96
|
+
na->rank = rank;
|
97
|
+
na->total = total;
|
98
|
+
na->type = type;
|
99
|
+
// TODO Set na->ref to a one element NArray of type NAObject that contains
|
100
|
+
// the GSL::Vector being referenced.
|
101
|
+
na->ref = Qtrue; /* to initialize */
|
102
|
+
na->shape = (int *) malloc(sizeof(int)*rank);
|
103
|
+
return na;
|
104
|
+
}
|
105
|
+
|
106
|
+
static void rb_gsl_na_view_free(struct NARRAY *na)
|
107
|
+
{
|
108
|
+
free((int *) na->shape);
|
109
|
+
free((struct NARRAY *) na);
|
110
|
+
}
|
111
|
+
|
112
|
+
static VALUE rb_gsl_vector_to_narray_ref(VALUE obj, VALUE klass)
|
113
|
+
{
|
114
|
+
gsl_vector *v = NULL;
|
115
|
+
gsl_vector_complex *vc = NULL;
|
116
|
+
gsl_vector_int *vi = NULL;
|
117
|
+
VALUE nary;
|
118
|
+
struct NARRAY *na;
|
119
|
+
if (VECTOR_P(obj)) {
|
120
|
+
Data_Get_Struct(obj, gsl_vector, v);
|
121
|
+
if (v->stride != 1) {
|
122
|
+
rb_raise(rb_eRuntimeError, "Cannot make a reference obj: stride!=1");
|
123
|
+
}
|
124
|
+
na = rb_gsl_na_view_alloc(1, v->size, NA_DFLOAT);
|
125
|
+
na->shape[0] = v->size;
|
126
|
+
na->ptr = (char *) v->data;
|
127
|
+
} else if (VECTOR_INT_P(obj)) {
|
128
|
+
Data_Get_Struct(obj, gsl_vector_int, vi);
|
129
|
+
if (vi->stride != 1) {
|
130
|
+
rb_raise(rb_eRuntimeError, "Cannot make a reference obj: stride!=1");
|
131
|
+
}
|
132
|
+
na = rb_gsl_na_view_alloc(1, vi->size, NA_LINT);
|
133
|
+
na->shape[0] = vi->size;
|
134
|
+
na->ptr = (char *) vi->data;
|
135
|
+
} else if (VECTOR_COMPLEX_P(obj)) {
|
136
|
+
Data_Get_Struct(obj, gsl_vector_complex, vc);
|
137
|
+
if (vc->stride != 1) {
|
138
|
+
rb_raise(rb_eRuntimeError, "Cannot make a reference obj: stride!=1");
|
139
|
+
}
|
140
|
+
na = rb_gsl_na_view_alloc(1, vc->size, NA_DCOMPLEX);
|
141
|
+
na->shape[0] = vc->size;
|
142
|
+
na->ptr = (char *) vc->data;
|
143
|
+
} else {
|
144
|
+
rb_raise(rb_eRuntimeError, "cannot convert %s to NArray reference object",
|
145
|
+
rb_obj_classname(obj));
|
146
|
+
}
|
147
|
+
nary = Data_Wrap_Struct(klass, 0, rb_gsl_na_view_free, na);
|
148
|
+
return nary;
|
149
|
+
}
|
150
|
+
|
151
|
+
static VALUE rb_gsl_vector_to_na_ref(VALUE obj)
|
152
|
+
{
|
153
|
+
return rb_gsl_vector_to_narray_ref(obj, cNArray);
|
154
|
+
}
|
155
|
+
|
156
|
+
static VALUE rb_gsl_vector_to_nvector_ref(VALUE obj)
|
157
|
+
{
|
158
|
+
return rb_gsl_vector_to_narray_ref(obj, cNVector);
|
159
|
+
}
|
160
|
+
|
161
|
+
static VALUE rb_gsl_vector_int_to_narray(VALUE obj, VALUE klass)
|
162
|
+
{
|
163
|
+
gsl_vector_int *v = NULL;
|
164
|
+
VALUE nary;
|
165
|
+
int shape[1];
|
166
|
+
Data_Get_Struct(obj, gsl_vector_int, v);
|
167
|
+
shape[0] = v->size;
|
168
|
+
nary = na_make_object(NA_LINT, 1, shape, klass);
|
169
|
+
if (v->stride == 1) {
|
170
|
+
memcpy(NA_PTR_TYPE(nary,int*), v->data, shape[0]*sizeof(int));
|
171
|
+
} else {
|
172
|
+
int i;
|
173
|
+
for(i=0; i < v->size; i++) {
|
174
|
+
(NA_PTR_TYPE(nary,int*))[i] = gsl_vector_int_get(v, i);
|
175
|
+
}
|
176
|
+
}
|
177
|
+
return nary;
|
178
|
+
}
|
179
|
+
|
180
|
+
static VALUE rb_gsl_vector_int_to_na(VALUE obj)
|
181
|
+
{
|
182
|
+
return rb_gsl_vector_int_to_narray(obj, cNArray);
|
183
|
+
}
|
184
|
+
|
185
|
+
static VALUE rb_gsl_vector_int_to_nvector(VALUE obj)
|
186
|
+
{
|
187
|
+
return rb_gsl_vector_int_to_narray(obj, cNVector);
|
188
|
+
}
|
189
|
+
|
190
|
+
/* singleton method */
|
191
|
+
static VALUE rb_gsl_na_to_gsl_vector(VALUE obj, VALUE na)
|
192
|
+
{
|
193
|
+
return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free,
|
194
|
+
na_to_gv(na));
|
195
|
+
}
|
196
|
+
|
197
|
+
static VALUE rb_gsl_na_to_gsl_vector_view(VALUE obj, VALUE na)
|
198
|
+
{
|
199
|
+
return Data_Wrap_Struct(cgsl_vector_view, 0, gsl_vector_view_free,
|
200
|
+
na_to_gv_view(na));
|
201
|
+
}
|
202
|
+
|
203
|
+
static VALUE rb_gsl_na_to_gsl_vector_complex(VALUE obj, VALUE na)
|
204
|
+
{
|
205
|
+
return Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free,
|
206
|
+
na_to_gv_complex(na));
|
207
|
+
}
|
208
|
+
|
209
|
+
static VALUE rb_gsl_na_to_gsl_vector_complex_view(VALUE obj, VALUE na)
|
210
|
+
{
|
211
|
+
return Data_Wrap_Struct(cgsl_vector_complex_view, 0, gsl_vector_complex_view_free,
|
212
|
+
na_to_gv_complex_view(na));
|
213
|
+
}
|
214
|
+
|
215
|
+
static VALUE rb_gsl_na_to_gsl_vector_int(VALUE obj, VALUE na)
|
216
|
+
{
|
217
|
+
return Data_Wrap_Struct(cgsl_vector_int, 0, gsl_vector_int_free,
|
218
|
+
na_to_gv_int(na));
|
219
|
+
}
|
220
|
+
|
221
|
+
static VALUE rb_gsl_na_to_gsl_vector_int_view(VALUE obj, VALUE na)
|
222
|
+
{
|
223
|
+
return Data_Wrap_Struct(cgsl_vector_int_view, 0, rb_gsl_vector_int_view_free,
|
224
|
+
na_to_gv_int_view(na));
|
225
|
+
}
|
226
|
+
|
227
|
+
static VALUE rb_gsl_na_to_gsl_vector_method(VALUE na)
|
228
|
+
{
|
229
|
+
VALUE v;
|
230
|
+
|
231
|
+
if(NA_TYPE(na) == NA_SCOMPLEX || NA_TYPE(na) == NA_DCOMPLEX)
|
232
|
+
v = Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free,
|
233
|
+
na_to_gv_complex(na));
|
234
|
+
else
|
235
|
+
v = Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free,
|
236
|
+
na_to_gv(na));
|
237
|
+
|
238
|
+
return v;
|
239
|
+
}
|
240
|
+
|
241
|
+
VALUE rb_gsl_na_to_gsl_vector_view_method(VALUE na)
|
242
|
+
{
|
243
|
+
VALUE v;
|
244
|
+
|
245
|
+
if(NA_TYPE(na) == NA_SCOMPLEX || NA_TYPE(na) == NA_DCOMPLEX)
|
246
|
+
v = Data_Wrap_Struct(cgsl_vector_complex_view, 0, gsl_vector_complex_view_free,
|
247
|
+
na_to_gv_complex_view(na));
|
248
|
+
else
|
249
|
+
v = Data_Wrap_Struct(cgsl_vector_view, 0, gsl_vector_view_free,
|
250
|
+
na_to_gv_view(na));
|
251
|
+
|
252
|
+
return v;
|
253
|
+
}
|
254
|
+
|
255
|
+
static VALUE rb_gsl_na_to_gsl_vector_int_method(VALUE na)
|
256
|
+
{
|
257
|
+
return Data_Wrap_Struct(cgsl_vector_int, 0, gsl_vector_int_free,
|
258
|
+
na_to_gv_int(na));
|
259
|
+
}
|
260
|
+
|
261
|
+
static VALUE rb_gsl_na_to_gsl_vector_int_view_method(VALUE na)
|
262
|
+
{
|
263
|
+
return Data_Wrap_Struct(cgsl_vector_int_view, 0, rb_gsl_vector_int_view_free,
|
264
|
+
na_to_gv_int_view(na));
|
265
|
+
}
|
266
|
+
|
267
|
+
gsl_vector* na_to_gv(VALUE na)
|
268
|
+
{
|
269
|
+
gsl_vector *v = NULL;
|
270
|
+
VALUE nary = na;
|
271
|
+
v = gsl_vector_alloc(NA_TOTAL(na));
|
272
|
+
if(NA_TYPE(na) != NA_DFLOAT) {
|
273
|
+
nary = na_change_type(na, NA_DFLOAT);
|
274
|
+
}
|
275
|
+
memcpy(v->data, NA_PTR_TYPE(nary,double*), v->size*sizeof(double));
|
276
|
+
return v;
|
277
|
+
}
|
278
|
+
|
279
|
+
gsl_vector_view* na_to_gv_view(VALUE na)
|
280
|
+
{
|
281
|
+
gsl_vector_view *v = NULL;
|
282
|
+
|
283
|
+
// Raise exception if na's type is not NA_DFLOAT.
|
284
|
+
if(NA_TYPE(na) != NA_DFLOAT)
|
285
|
+
rb_raise(rb_eTypeError, "GSL::Vector::View requires NArray be DFLOAT");
|
286
|
+
|
287
|
+
v = gsl_vector_view_alloc();
|
288
|
+
v->vector.data = NA_PTR_TYPE(na,double*);
|
289
|
+
v->vector.size = NA_TOTAL(na);
|
290
|
+
v->vector.stride = 1;
|
291
|
+
v->vector.owner = 0;
|
292
|
+
return v;
|
293
|
+
}
|
294
|
+
|
295
|
+
gsl_vector_complex* na_to_gv_complex(VALUE na)
|
296
|
+
{
|
297
|
+
gsl_vector_complex *v = NULL;
|
298
|
+
VALUE nary = na;
|
299
|
+
v = gsl_vector_complex_alloc(NA_TOTAL(na));
|
300
|
+
if(NA_TYPE(na) != NA_DCOMPLEX) {
|
301
|
+
nary = na_change_type(na, NA_DCOMPLEX);
|
302
|
+
}
|
303
|
+
memcpy(v->data, NA_PTR_TYPE(nary,gsl_complex*), v->size*sizeof(gsl_complex));
|
304
|
+
return v;
|
305
|
+
}
|
306
|
+
|
307
|
+
gsl_vector_complex_view* na_to_gv_complex_view(VALUE na)
|
308
|
+
{
|
309
|
+
gsl_vector_complex_view *v = NULL;
|
310
|
+
|
311
|
+
// Raise exception if na's type is not NA_DCOMPLEX
|
312
|
+
if(NA_TYPE(na) != NA_DCOMPLEX)
|
313
|
+
rb_raise(rb_eTypeError, "GSL::Vector::Complex::View requires NArray be DCOMPLEX");
|
314
|
+
|
315
|
+
v = gsl_vector_complex_view_alloc();
|
316
|
+
v->vector.data = NA_PTR_TYPE(na,double*);
|
317
|
+
v->vector.size = NA_TOTAL(na);
|
318
|
+
v->vector.stride = 1;
|
319
|
+
v->vector.owner = 0;
|
320
|
+
return v;
|
321
|
+
}
|
322
|
+
|
323
|
+
gsl_vector_int* na_to_gv_int(VALUE na)
|
324
|
+
{
|
325
|
+
gsl_vector_int *v = NULL;
|
326
|
+
VALUE nary = na;
|
327
|
+
v = gsl_vector_int_alloc(NA_TOTAL(na));
|
328
|
+
if(NA_TYPE(na) != NA_LINT) {
|
329
|
+
nary = na_change_type(na, NA_LINT);
|
330
|
+
}
|
331
|
+
memcpy(v->data, NA_PTR_TYPE(nary,int*), v->size*sizeof(int));
|
332
|
+
return v;
|
333
|
+
}
|
334
|
+
|
335
|
+
gsl_vector_int_view* na_to_gv_int_view(VALUE na)
|
336
|
+
{
|
337
|
+
gsl_vector_int_view *v = NULL;
|
338
|
+
|
339
|
+
// Raise exception if na's type is not NA_LINT
|
340
|
+
if(NA_TYPE(na) != NA_LINT)
|
341
|
+
rb_raise(rb_eTypeError, "GSL::Vector::Int::View requires NArray be LINT");
|
342
|
+
v = rb_gsl_vector_int_view_alloc(NA_TOTAL(na));
|
343
|
+
v->vector.data = NA_PTR_TYPE(na,int*);
|
344
|
+
v->vector.size = NA_TOTAL(na);
|
345
|
+
v->vector.stride = 1;
|
346
|
+
v->vector.owner = 0;
|
347
|
+
return v;
|
348
|
+
}
|
349
|
+
|
350
|
+
static VALUE rb_gsl_matrix_to_narray(VALUE obj, VALUE klass)
|
351
|
+
{
|
352
|
+
gsl_matrix *m = NULL;
|
353
|
+
VALUE nary;
|
354
|
+
int shape[2];
|
355
|
+
size_t i;
|
356
|
+
Data_Get_Struct(obj, gsl_matrix, m);
|
357
|
+
shape[0] = m->size2;
|
358
|
+
shape[1] = m->size1;
|
359
|
+
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),
|
362
|
+
shape[0]*sizeof(double));
|
363
|
+
}
|
364
|
+
return nary;
|
365
|
+
}
|
366
|
+
|
367
|
+
static VALUE rb_gsl_matrix_to_na(VALUE obj, VALUE klass)
|
368
|
+
{
|
369
|
+
return rb_gsl_matrix_to_narray(obj, cNArray);
|
370
|
+
}
|
371
|
+
|
372
|
+
static VALUE rb_gsl_matrix_to_nmatrix(VALUE obj, VALUE klass)
|
373
|
+
{
|
374
|
+
return rb_gsl_matrix_to_narray(obj, cNMatrix);
|
375
|
+
}
|
376
|
+
|
377
|
+
static VALUE rb_gsl_matrix_int_to_narray(VALUE obj, VALUE klass)
|
378
|
+
{
|
379
|
+
gsl_matrix_int *m = NULL;
|
380
|
+
VALUE nary;
|
381
|
+
int shape[2];
|
382
|
+
size_t i;
|
383
|
+
Data_Get_Struct(obj, gsl_matrix_int, m);
|
384
|
+
shape[0] = m->size2;
|
385
|
+
shape[1] = m->size1;
|
386
|
+
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),
|
389
|
+
shape[0]*sizeof(int));
|
390
|
+
}
|
391
|
+
return nary;
|
392
|
+
}
|
393
|
+
|
394
|
+
static VALUE rb_gsl_matrix_int_to_na(VALUE obj)
|
395
|
+
{
|
396
|
+
return rb_gsl_matrix_int_to_narray(obj, cNArray);
|
397
|
+
}
|
398
|
+
|
399
|
+
static VALUE rb_gsl_matrix_int_to_nmatrix(VALUE obj)
|
400
|
+
{
|
401
|
+
return rb_gsl_matrix_int_to_narray(obj, cNMatrix);
|
402
|
+
}
|
403
|
+
|
404
|
+
static VALUE rb_gsl_matrix_to_narray_ref(VALUE obj, VALUE klass)
|
405
|
+
{
|
406
|
+
gsl_matrix *m = NULL;
|
407
|
+
VALUE nary;
|
408
|
+
struct NARRAY *na;
|
409
|
+
Data_Get_Struct(obj, gsl_matrix, m);
|
410
|
+
if (m->tda != m->size2) {
|
411
|
+
rb_raise(rb_eRuntimeError, "Cannot make a reference obj: non-contiguous");
|
412
|
+
}
|
413
|
+
na = rb_gsl_na_view_alloc(2, m->size2 * m->size1, NA_DFLOAT);
|
414
|
+
na->shape[0] = m->size2;
|
415
|
+
na->shape[1] = m->size1;
|
416
|
+
na->ptr = (char *) m->data;
|
417
|
+
nary = Data_Wrap_Struct(klass, 0, rb_gsl_na_view_free, na);
|
418
|
+
return nary;
|
419
|
+
}
|
420
|
+
|
421
|
+
static VALUE rb_gsl_matrix_to_na_ref(VALUE obj)
|
422
|
+
{
|
423
|
+
return rb_gsl_matrix_to_narray_ref(obj, cNArray);
|
424
|
+
}
|
425
|
+
|
426
|
+
static VALUE rb_gsl_matrix_to_nmatrix_ref(VALUE obj)
|
427
|
+
{
|
428
|
+
return rb_gsl_matrix_to_narray_ref(obj, cNMatrix);
|
429
|
+
}
|
430
|
+
|
431
|
+
static VALUE rb_gsl_matrix_int_to_narray_ref(VALUE obj, VALUE klass)
|
432
|
+
{
|
433
|
+
gsl_matrix_int *m = NULL;
|
434
|
+
VALUE nary;
|
435
|
+
struct NARRAY *na;
|
436
|
+
Data_Get_Struct(obj, gsl_matrix_int, m);
|
437
|
+
if (m->tda != m->size2) {
|
438
|
+
rb_raise(rb_eRuntimeError, "Cannot make a reference obj: non-contiguous");
|
439
|
+
}
|
440
|
+
na = rb_gsl_na_view_alloc(2, m->size2 * m->size1, NA_LINT);
|
441
|
+
na->shape[0] = m->size2;
|
442
|
+
na->shape[1] = m->size1;
|
443
|
+
na->ptr = (char *) m->data;
|
444
|
+
nary = Data_Wrap_Struct(klass, 0, rb_gsl_na_view_free, na);
|
445
|
+
return nary;
|
446
|
+
}
|
447
|
+
|
448
|
+
static VALUE rb_gsl_matrix_int_to_na_ref(VALUE obj)
|
449
|
+
{
|
450
|
+
return rb_gsl_matrix_int_to_narray_ref(obj, cNArray);
|
451
|
+
}
|
452
|
+
|
453
|
+
static VALUE rb_gsl_matrix_int_to_nmatrix_ref(VALUE obj)
|
454
|
+
{
|
455
|
+
return rb_gsl_matrix_int_to_narray_ref(obj, cNMatrix);
|
456
|
+
}
|
457
|
+
|
458
|
+
/* NArray -> GSL::Matrix */
|
459
|
+
VALUE rb_gsl_na_to_gsl_matrix(VALUE obj, VALUE nna)
|
460
|
+
{
|
461
|
+
gsl_matrix *m = NULL;
|
462
|
+
m = na_to_gm(nna);
|
463
|
+
return Data_Wrap_Struct(cgsl_matrix, 0, gsl_matrix_free, m);
|
464
|
+
}
|
465
|
+
|
466
|
+
VALUE rb_gsl_na_to_gsl_matrix_view(VALUE obj, VALUE nna)
|
467
|
+
{
|
468
|
+
gsl_matrix_view *m = NULL;
|
469
|
+
m = na_to_gm_view(nna);
|
470
|
+
return Data_Wrap_Struct(cgsl_matrix_view, 0, gsl_matrix_view_free, m);
|
471
|
+
}
|
472
|
+
|
473
|
+
VALUE rb_gsl_na_to_gsl_matrix_int(VALUE obj, VALUE nna)
|
474
|
+
{
|
475
|
+
gsl_matrix_int *m = NULL;
|
476
|
+
m = na_to_gm_int(nna);
|
477
|
+
return Data_Wrap_Struct(cgsl_matrix_int, 0, gsl_matrix_int_free, m);
|
478
|
+
}
|
479
|
+
|
480
|
+
VALUE rb_gsl_na_to_gsl_matrix_int_view(VALUE obj, VALUE nna)
|
481
|
+
{
|
482
|
+
gsl_matrix_int_view *m = NULL;
|
483
|
+
m = na_to_gm_int_view(nna);
|
484
|
+
return Data_Wrap_Struct(cgsl_matrix_int_view, 0, rb_gsl_matrix_int_view_free, m);
|
485
|
+
}
|
486
|
+
|
487
|
+
static VALUE rb_gsl_na_to_gsl_matrix_method(VALUE nna)
|
488
|
+
{
|
489
|
+
gsl_matrix *m = NULL;
|
490
|
+
m = na_to_gm(nna);
|
491
|
+
return Data_Wrap_Struct(cgsl_matrix, 0, gsl_matrix_free, m);
|
492
|
+
}
|
493
|
+
|
494
|
+
static VALUE rb_gsl_na_to_gsl_matrix_view_method(VALUE nna)
|
495
|
+
{
|
496
|
+
gsl_matrix_view *m = NULL;
|
497
|
+
m = na_to_gm_view(nna);
|
498
|
+
return Data_Wrap_Struct(cgsl_matrix_view, 0, gsl_matrix_view_free, m);
|
499
|
+
}
|
500
|
+
|
501
|
+
static VALUE rb_gsl_na_to_gsl_matrix_int_method(VALUE nna)
|
502
|
+
{
|
503
|
+
gsl_matrix_int *m = NULL;
|
504
|
+
m = na_to_gm_int(nna);
|
505
|
+
return Data_Wrap_Struct(cgsl_matrix_int, 0, gsl_matrix_int_free, m);
|
506
|
+
}
|
507
|
+
|
508
|
+
static VALUE rb_gsl_na_to_gsl_matrix_int_view_method(VALUE nna)
|
509
|
+
{
|
510
|
+
gsl_matrix_int_view *m = NULL;
|
511
|
+
m = na_to_gm_int_view(nna);
|
512
|
+
return Data_Wrap_Struct(cgsl_matrix_int_view, 0, rb_gsl_matrix_int_view_free, m);
|
513
|
+
}
|
514
|
+
|
515
|
+
gsl_matrix* na_to_gm(VALUE nna)
|
516
|
+
{
|
517
|
+
gsl_matrix *m = NULL;
|
518
|
+
VALUE ary2;
|
519
|
+
struct NARRAY *na = NULL;
|
520
|
+
GetNArray(nna, na);
|
521
|
+
m = gsl_matrix_alloc(na->shape[1], na->shape[0]);
|
522
|
+
ary2 = na_change_type(nna, NA_DFLOAT);
|
523
|
+
memcpy(m->data, NA_PTR_TYPE(ary2,double*), m->size1*m->size2*sizeof(double));
|
524
|
+
return m;
|
525
|
+
}
|
526
|
+
|
527
|
+
gsl_matrix_view* na_to_gm_view(VALUE nna)
|
528
|
+
{
|
529
|
+
gsl_matrix_view *m = NULL;
|
530
|
+
VALUE ary2;
|
531
|
+
struct NARRAY *na = NULL;
|
532
|
+
|
533
|
+
// Raise exception if nna's type is not NA_DFLOAT
|
534
|
+
if(NA_TYPE(nna) != NA_DFLOAT)
|
535
|
+
rb_raise(rb_eTypeError, "GSL::Matrix::View requires NArray be DFLOAT");
|
536
|
+
GetNArray(nna, na);
|
537
|
+
m = gsl_matrix_view_alloc();
|
538
|
+
ary2 = na_change_type(nna, NA_DFLOAT);
|
539
|
+
m->matrix.data = NA_PTR_TYPE(ary2,double*);
|
540
|
+
m->matrix.size1 = na->shape[1];
|
541
|
+
m->matrix.size2 = na->shape[0];
|
542
|
+
m->matrix.tda = m->matrix.size2;
|
543
|
+
m->matrix.owner = 0;
|
544
|
+
return m;
|
545
|
+
}
|
546
|
+
|
547
|
+
gsl_matrix_int* na_to_gm_int(VALUE nna)
|
548
|
+
{
|
549
|
+
gsl_matrix_int *m = NULL;
|
550
|
+
VALUE ary2;
|
551
|
+
struct NARRAY *na = NULL;
|
552
|
+
GetNArray(nna, na);
|
553
|
+
m = gsl_matrix_int_alloc(na->shape[1], na->shape[0]);
|
554
|
+
ary2 = na_change_type(nna, NA_LINT);
|
555
|
+
memcpy(m->data, NA_PTR_TYPE(ary2,int*), m->size1*m->size2*sizeof(int));
|
556
|
+
return m;
|
557
|
+
}
|
558
|
+
|
559
|
+
gsl_matrix_int_view* na_to_gm_int_view(VALUE nna)
|
560
|
+
{
|
561
|
+
gsl_matrix_int_view *m = NULL;
|
562
|
+
VALUE ary2;
|
563
|
+
struct NARRAY *na = NULL;
|
564
|
+
|
565
|
+
// Raise exception if nna's type is not NA_LINT
|
566
|
+
if(NA_TYPE(nna) != NA_LINT)
|
567
|
+
rb_raise(rb_eTypeError, "GSL::Matrix::Int::View requires NArray be LINT");
|
568
|
+
GetNArray(nna, na);
|
569
|
+
m = rb_gsl_matrix_int_view_alloc(na->shape[1], na->shape[0]);
|
570
|
+
ary2 = na_change_type(nna, NA_LINT);
|
571
|
+
m->matrix.data = NA_PTR_TYPE(ary2,int*);
|
572
|
+
m->matrix.size1 = na->shape[1];
|
573
|
+
m->matrix.size2 = na->shape[0];
|
574
|
+
m->matrix.tda = m->matrix.size2;
|
575
|
+
m->matrix.owner = 0;
|
576
|
+
return m;
|
577
|
+
}
|
578
|
+
|
579
|
+
#ifdef HAVE_NARRAY_H
|
580
|
+
#include "narray.h"
|
581
|
+
#include <gsl/gsl_histogram.h>
|
582
|
+
EXTERN VALUE cgsl_histogram;
|
583
|
+
static VALUE rb_gsl_narray_histogram(int argc, VALUE *argv, VALUE obj)
|
584
|
+
{
|
585
|
+
double *ptr, *ptr_range;
|
586
|
+
gsl_histogram *h;
|
587
|
+
gsl_vector *ranges;
|
588
|
+
gsl_vector_view v;
|
589
|
+
double min, max;
|
590
|
+
size_t i, n, size, stride;
|
591
|
+
ptr = get_vector_ptr(obj, &stride, &size);
|
592
|
+
v.vector.data = ptr;
|
593
|
+
v.vector.size = size;
|
594
|
+
v.vector.size = stride;
|
595
|
+
switch (argc) {
|
596
|
+
case 1:
|
597
|
+
if (rb_obj_is_kind_of(argv[0], rb_cRange))
|
598
|
+
argv[0] = rb_gsl_range2ary(argv[0]);
|
599
|
+
switch (TYPE(argv[0])) {
|
600
|
+
case T_FIXNUM:
|
601
|
+
n = NUM2INT(argv[0]);
|
602
|
+
min = gsl_vector_min(&v.vector) - 4*GSL_DBL_EPSILON;
|
603
|
+
max = gsl_vector_max(&v.vector) + 4*GSL_DBL_EPSILON;
|
604
|
+
h = gsl_histogram_alloc(n);
|
605
|
+
gsl_histogram_set_ranges_uniform(h, min, max);
|
606
|
+
break;
|
607
|
+
case T_ARRAY:
|
608
|
+
// n = RARRAY(argv[0])->len - 1;
|
609
|
+
n = RARRAY_LEN(argv[0]) - 1;
|
610
|
+
h = gsl_histogram_alloc(n);
|
611
|
+
for (i = 0; i <= n; i++) h->range[i] = NUM2DBL(rb_ary_entry(argv[0], i));
|
612
|
+
break;
|
613
|
+
default:
|
614
|
+
if (VECTOR_P(argv[0])) {
|
615
|
+
Data_Get_Struct(argv[0], gsl_vector, ranges);
|
616
|
+
n = ranges->size - 1;
|
617
|
+
h = gsl_histogram_alloc(n);
|
618
|
+
gsl_histogram_set_ranges(h, ranges->data, ranges->size);
|
619
|
+
} else if (NA_IsNArray(argv[0])) {
|
620
|
+
ptr_range = get_vector_ptr(argv[0], &stride, &n);
|
621
|
+
h = gsl_histogram_alloc(n);
|
622
|
+
gsl_histogram_set_ranges(h, ptr_range, n);
|
623
|
+
}
|
624
|
+
break;
|
625
|
+
}
|
626
|
+
break;
|
627
|
+
case 2:
|
628
|
+
n = NUM2INT(argv[0]);
|
629
|
+
switch (TYPE(argv[1])) {
|
630
|
+
case T_ARRAY:
|
631
|
+
min = NUM2DBL(rb_ary_entry(argv[1], 0));
|
632
|
+
max = NUM2DBL(rb_ary_entry(argv[1], 1));
|
633
|
+
break;
|
634
|
+
default:
|
635
|
+
rb_raise(rb_eTypeError, "wrong argument type %s (Array expected)",
|
636
|
+
rb_class2name(CLASS_OF(argv[1])));
|
637
|
+
break;
|
638
|
+
}
|
639
|
+
h = gsl_histogram_alloc(n);
|
640
|
+
gsl_histogram_set_ranges_uniform(h, min, max);
|
641
|
+
break;
|
642
|
+
case 3:
|
643
|
+
n = NUM2INT(argv[0]);
|
644
|
+
min = NUM2DBL(argv[1]); max = NUM2DBL(argv[2]);
|
645
|
+
h = gsl_histogram_alloc(n);
|
646
|
+
gsl_histogram_set_ranges_uniform(h, min, max);
|
647
|
+
break;
|
648
|
+
default:
|
649
|
+
rb_raise(rb_eArgError, "wrong number of arguments %d", argc);
|
650
|
+
break;
|
651
|
+
}
|
652
|
+
for (i = 0; i < size; i++)
|
653
|
+
gsl_histogram_increment(h, ptr[i*stride]);
|
654
|
+
return Data_Wrap_Struct(cgsl_histogram, 0, gsl_histogram_free, h);
|
655
|
+
}
|
656
|
+
#endif
|
657
|
+
|
658
|
+
/*void rb_gsl_with_narray_define_methods()*/
|
659
|
+
void Init_gsl_narray(VALUE module)
|
660
|
+
{
|
661
|
+
rb_define_method(cgsl_vector, "to_na", rb_gsl_vector_to_na, 0);
|
662
|
+
rb_define_alias(cgsl_vector, "to_narray", "to_na");
|
663
|
+
rb_define_method(cgsl_vector, "to_na2", rb_gsl_vector_to_na_ref, 0);
|
664
|
+
rb_define_alias(cgsl_vector, "to_narray_ref", "to_na2");
|
665
|
+
rb_define_alias(cgsl_vector, "to_na_ref", "to_na2");
|
666
|
+
|
667
|
+
rb_define_method(cgsl_vector, "to_nv", rb_gsl_vector_to_nvector, 0);
|
668
|
+
rb_define_alias(cgsl_vector, "to_nvector", "to_nv");
|
669
|
+
rb_define_method(cgsl_vector, "to_nv_ref", rb_gsl_vector_to_nvector_ref, 0);
|
670
|
+
rb_define_alias(cgsl_vector, "to_nvector_ref", "to_nv_ref");
|
671
|
+
|
672
|
+
rb_define_singleton_method(cgsl_vector, "to_gslv", rb_gsl_na_to_gsl_vector, 1);
|
673
|
+
rb_define_singleton_method(cgsl_vector, "to_gv", rb_gsl_na_to_gsl_vector, 1);
|
674
|
+
|
675
|
+
rb_define_singleton_method(cgsl_vector, "na_to_gslv", rb_gsl_na_to_gsl_vector, 1);
|
676
|
+
rb_define_singleton_method(cgsl_vector, "na_to_gv", rb_gsl_na_to_gsl_vector, 1);
|
677
|
+
rb_define_singleton_method(cgsl_vector, "to_gslv_view", rb_gsl_na_to_gsl_vector_view, 1);
|
678
|
+
|
679
|
+
rb_define_singleton_method(cgsl_vector, "to_gv_view", rb_gsl_na_to_gsl_vector_view, 1);
|
680
|
+
|
681
|
+
rb_define_singleton_method(cgsl_vector, "na_to_gslv_view", rb_gsl_na_to_gsl_vector_view, 1);
|
682
|
+
rb_define_singleton_method(cgsl_vector, "na_to_gv_view", rb_gsl_na_to_gsl_vector_view, 1);
|
683
|
+
|
684
|
+
rb_define_method(cNArray, "to_gv", rb_gsl_na_to_gsl_vector_method, 0);
|
685
|
+
rb_define_alias(cNArray, "to_gslv", "to_gv");
|
686
|
+
rb_define_method(cNArray, "to_gv_view", rb_gsl_na_to_gsl_vector_view_method, 0);
|
687
|
+
rb_define_alias(cNArray, "to_gslv_view", "to_gv_view");
|
688
|
+
rb_define_alias(cNArray, "to_gv2", "to_gv_view");
|
689
|
+
rb_define_alias(cNArray, "to_gv_ref", "to_gv_view");
|
690
|
+
/*****/
|
691
|
+
rb_define_method(cgsl_vector_complex, "to_na", rb_gsl_vector_complex_to_na, 0);
|
692
|
+
rb_define_alias(cgsl_vector_complex, "to_narray", "to_na");
|
693
|
+
|
694
|
+
rb_define_method(cgsl_vector_complex, "to_na2", rb_gsl_vector_to_na_ref, 0);
|
695
|
+
rb_define_alias(cgsl_vector_complex, "to_narray_ref", "to_na2");
|
696
|
+
rb_define_alias(cgsl_vector_complex, "to_na_ref", "to_na2");
|
697
|
+
|
698
|
+
rb_define_method(cgsl_vector_complex, "to_nv", rb_gsl_vector_complex_to_nvector, 0);
|
699
|
+
rb_define_alias(cgsl_vector_complex, "to_nvector", "to_nv");
|
700
|
+
|
701
|
+
rb_define_method(cgsl_vector_complex, "to_nv2", rb_gsl_vector_to_nvector_ref, 0);
|
702
|
+
rb_define_alias(cgsl_vector_complex, "to_nv_ref", "to_nv2");
|
703
|
+
rb_define_alias(cgsl_vector_complex, "to_nvector_ref", "to_nv2");
|
704
|
+
|
705
|
+
rb_define_singleton_method(cgsl_vector_complex, "to_gslv", rb_gsl_na_to_gsl_vector_complex, 1);
|
706
|
+
rb_define_singleton_method(cgsl_vector_complex, "to_gv", rb_gsl_na_to_gsl_vector_complex, 1);
|
707
|
+
rb_define_singleton_method(cgsl_vector_complex, "na_to_gslv", rb_gsl_na_to_gsl_vector_complex, 1);
|
708
|
+
rb_define_singleton_method(cgsl_vector_complex, "na_to_gv", rb_gsl_na_to_gsl_vector_complex, 1);
|
709
|
+
|
710
|
+
rb_define_singleton_method(cgsl_vector_complex, "to_gslv_view", rb_gsl_na_to_gsl_vector_complex_view, 1);
|
711
|
+
rb_define_singleton_method(cgsl_vector_complex, "to_gv_view", rb_gsl_na_to_gsl_vector_complex_view, 1);
|
712
|
+
rb_define_singleton_method(cgsl_vector_complex, "na_to_gslv_view", rb_gsl_na_to_gsl_vector_complex_view, 1);
|
713
|
+
rb_define_singleton_method(cgsl_vector_complex, "na_to_gv_view", rb_gsl_na_to_gsl_vector_complex_view, 1);
|
714
|
+
|
715
|
+
/*****/
|
716
|
+
rb_define_method(cgsl_vector_int, "to_na", rb_gsl_vector_int_to_na, 0);
|
717
|
+
rb_define_alias(cgsl_vector_int, "to_narray", "to_na");
|
718
|
+
rb_define_method(cgsl_vector_int, "to_nv", rb_gsl_vector_int_to_nvector, 0);
|
719
|
+
rb_define_alias(cgsl_vector_int, "to_nvector", "to_nv");
|
720
|
+
rb_define_method(cgsl_vector_int, "to_na2", rb_gsl_vector_to_na_ref, 0);
|
721
|
+
rb_define_alias(cgsl_vector_int, "to_na_ref", "to_na2");
|
722
|
+
rb_define_alias(cgsl_vector_int, "to_narray_ref", "to_na2");
|
723
|
+
rb_define_method(cgsl_vector_int, "to_nv_ref", rb_gsl_vector_to_nvector_ref, 0);
|
724
|
+
rb_define_alias(cgsl_vector_int, "to_nvector_ref", "to_nv_ref");
|
725
|
+
|
726
|
+
rb_define_singleton_method(cgsl_vector_int, "to_gslv", rb_gsl_na_to_gsl_vector_int, 1);
|
727
|
+
rb_define_singleton_method(cgsl_vector_int, "to_gv", rb_gsl_na_to_gsl_vector_int, 1);
|
728
|
+
|
729
|
+
rb_define_singleton_method(cgsl_vector_int, "na_to_gslv", rb_gsl_na_to_gsl_vector_int, 1);
|
730
|
+
rb_define_singleton_method(cgsl_vector_int, "na_to_gv", rb_gsl_na_to_gsl_vector_int, 1);
|
731
|
+
|
732
|
+
rb_define_singleton_method(cgsl_vector_int, "to_gslv_view", rb_gsl_na_to_gsl_vector_int_view, 1);
|
733
|
+
rb_define_singleton_method(cgsl_vector_int, "to_gv_view", rb_gsl_na_to_gsl_vector_int_view, 1);
|
734
|
+
|
735
|
+
rb_define_singleton_method(cgsl_vector_int, "na_to_gslv_view", rb_gsl_na_to_gsl_vector_int_view, 1);
|
736
|
+
rb_define_singleton_method(cgsl_vector_int, "na_to_gv_view", rb_gsl_na_to_gsl_vector_int_view, 1);
|
737
|
+
|
738
|
+
rb_define_method(cNArray, "to_gv_int", rb_gsl_na_to_gsl_vector_int_method, 0);
|
739
|
+
rb_define_alias(cNArray, "to_gslv_int", "to_gv_int");
|
740
|
+
rb_define_method(cNArray, "to_gv_int_view", rb_gsl_na_to_gsl_vector_int_view_method, 0);
|
741
|
+
rb_define_alias(cNArray, "to_gslv_int_view", "to_gv_int_view");
|
742
|
+
/*****/
|
743
|
+
|
744
|
+
rb_define_method(cgsl_matrix, "to_na", rb_gsl_matrix_to_na, 0);
|
745
|
+
rb_define_alias(cgsl_matrix, "to_narray", "to_na");
|
746
|
+
rb_define_method(cgsl_matrix, "to_nm", rb_gsl_matrix_to_nmatrix, 0);
|
747
|
+
rb_define_alias(cgsl_matrix, "to_nmatrix", "to_nm");
|
748
|
+
rb_define_method(cgsl_matrix, "to_na2", rb_gsl_matrix_to_na_ref, 0);
|
749
|
+
rb_define_alias(cgsl_matrix, "to_na_ref", "to_na2");
|
750
|
+
rb_define_alias(cgsl_matrix, "to_narray_ref", "to_na2");
|
751
|
+
rb_define_method(cgsl_matrix, "to_nm_ref", rb_gsl_matrix_to_nmatrix_ref, 0);
|
752
|
+
rb_define_alias(cgsl_matrix, "to_nmatrix_ref", "to_nm_ref");
|
753
|
+
|
754
|
+
rb_define_singleton_method(cgsl_matrix, "to_gslm", rb_gsl_na_to_gsl_matrix, 1);
|
755
|
+
rb_define_singleton_method(cgsl_matrix, "to_gm", rb_gsl_na_to_gsl_matrix, 1);
|
756
|
+
|
757
|
+
rb_define_singleton_method(cgsl_matrix, "na_to_gslm", rb_gsl_na_to_gsl_matrix, 1);
|
758
|
+
rb_define_singleton_method(cgsl_matrix, "na_to_gm", rb_gsl_na_to_gsl_matrix, 1);
|
759
|
+
|
760
|
+
rb_define_singleton_method(cgsl_matrix, "to_gslm_view", rb_gsl_na_to_gsl_matrix_view, 1);
|
761
|
+
rb_define_singleton_method(cgsl_matrix, "to_gm_view", rb_gsl_na_to_gsl_matrix_view, 1);
|
762
|
+
|
763
|
+
rb_define_singleton_method(cgsl_matrix, "na_to_gslm_view", rb_gsl_na_to_gsl_matrix_view, 1);
|
764
|
+
rb_define_singleton_method(cgsl_matrix, "na_to_gm_view", rb_gsl_na_to_gsl_matrix_view, 1);
|
765
|
+
|
766
|
+
rb_define_method(cNArray, "to_gslm", rb_gsl_na_to_gsl_matrix_method, 0);
|
767
|
+
rb_define_alias(cNArray, "to_gm", "to_gslm");
|
768
|
+
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");
|
770
|
+
|
771
|
+
/*****/
|
772
|
+
// TODO Complex matrix
|
773
|
+
|
774
|
+
/*****/
|
775
|
+
rb_define_method(cgsl_matrix_int, "to_na", rb_gsl_matrix_int_to_na, 0);
|
776
|
+
rb_define_alias(cgsl_matrix_int, "to_narray", "to_na");
|
777
|
+
rb_define_method(cgsl_matrix_int, "to_nm", rb_gsl_matrix_int_to_nmatrix, 0);
|
778
|
+
rb_define_alias(cgsl_matrix_int, "to_nmatrix", "to_nm");
|
779
|
+
|
780
|
+
rb_define_method(cgsl_matrix_int, "to_na2", rb_gsl_matrix_int_to_na_ref, 0);
|
781
|
+
rb_define_alias(cgsl_matrix_int, "to_na_ref", "to_na2");
|
782
|
+
rb_define_alias(cgsl_matrix_int, "to_narray_ref", "to_na2");
|
783
|
+
rb_define_method(cgsl_matrix_int, "to_nm_ref", rb_gsl_matrix_int_to_nmatrix_ref, 0);
|
784
|
+
rb_define_alias(cgsl_matrix_int, "to_nmatrix_ref", "to_nm_ref");
|
785
|
+
|
786
|
+
rb_define_singleton_method(cgsl_matrix_int, "to_gslm", rb_gsl_na_to_gsl_matrix_int, 1);
|
787
|
+
rb_define_singleton_method(cgsl_matrix_int, "to_gm", rb_gsl_na_to_gsl_matrix_int, 1);
|
788
|
+
rb_define_singleton_method(cgsl_matrix_int, "na_to_gslm", rb_gsl_na_to_gsl_matrix_int, 1);
|
789
|
+
rb_define_singleton_method(cgsl_matrix_int, "na_to_gm", rb_gsl_na_to_gsl_matrix_int, 1);
|
790
|
+
|
791
|
+
rb_define_singleton_method(cgsl_matrix_int, "to_gslm_view", rb_gsl_na_to_gsl_matrix_int_view, 1);
|
792
|
+
rb_define_singleton_method(cgsl_matrix_int, "to_gm_view", rb_gsl_na_to_gsl_matrix_int_view, 1);
|
793
|
+
rb_define_singleton_method(cgsl_matrix_int, "na_to_gslm_view", rb_gsl_na_to_gsl_matrix_int_view, 1);
|
794
|
+
rb_define_singleton_method(cgsl_matrix_int, "na_to_gm_view", rb_gsl_na_to_gsl_matrix_int_view, 1);
|
795
|
+
|
796
|
+
rb_define_method(cNArray, "to_gm_int", rb_gsl_na_to_gsl_matrix_int_method, 0);
|
797
|
+
rb_define_alias(cNArray, "to_gslm_int", "to_gm_int");
|
798
|
+
rb_define_method(cNArray, "to_gm_int_view", rb_gsl_na_to_gsl_matrix_int_view_method, 0);
|
799
|
+
rb_define_alias(cNArray, "to_gslm_int_view", "to_gm_int_view");
|
800
|
+
|
801
|
+
rb_define_method(cNArray, "histogram", rb_gsl_narray_histogram, -1);
|
802
|
+
}
|
803
|
+
|
804
|
+
#endif
|