rb-gsl 1.16.0.5 → 1.16.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/rb-gsl.gemspec +5 -10
- metadata +10 -713
- data/.gitignore +0 -12
- data/.travis.yml +0 -24
- data/AUTHORS +0 -12
- data/COPYING +0 -341
- data/ChangeLog +0 -621
- data/Gemfile +0 -4
- data/README.md +0 -77
- data/Rakefile +0 -20
- data/THANKS +0 -17
- data/examples/alf/alf.gp +0 -15
- data/examples/alf/alf.rb +0 -32
- data/examples/blas/blas.rb +0 -13
- data/examples/blas/dnrm2.rb +0 -16
- data/examples/blas/level1.rb +0 -81
- data/examples/blas/level2.rb +0 -11
- data/examples/blas/level3.rb +0 -12
- data/examples/bspline.rb +0 -57
- data/examples/cdf.rb +0 -16
- data/examples/cheb.rb +0 -21
- data/examples/combination.rb +0 -23
- data/examples/complex/RC-lpf.rb +0 -47
- data/examples/complex/add.rb +0 -36
- data/examples/complex/coerce.rb +0 -14
- data/examples/complex/complex.rb +0 -25
- data/examples/complex/fpmi.rb +0 -70
- data/examples/complex/functions.rb +0 -77
- data/examples/complex/michelson.rb +0 -36
- data/examples/complex/mul.rb +0 -28
- data/examples/complex/oscillator.rb +0 -17
- data/examples/complex/set.rb +0 -37
- data/examples/const/physconst.rb +0 -151
- data/examples/const/travel.rb +0 -45
- data/examples/deriv/demo.rb +0 -13
- data/examples/deriv/deriv.rb +0 -36
- data/examples/deriv/diff.rb +0 -35
- data/examples/dht.rb +0 -42
- data/examples/dirac.rb +0 -56
- data/examples/eigen/eigen.rb +0 -34
- data/examples/eigen/herm.rb +0 -22
- data/examples/eigen/narray.rb +0 -9
- data/examples/eigen/nonsymm.rb +0 -37
- data/examples/eigen/nonsymmv.rb +0 -43
- data/examples/eigen/qhoscillator.gp +0 -35
- data/examples/eigen/qhoscillator.rb +0 -90
- data/examples/eigen/vander.rb +0 -41
- data/examples/fft/fft.rb +0 -17
- data/examples/fft/fft2.rb +0 -17
- data/examples/fft/forward.rb +0 -25
- data/examples/fft/forward2.rb +0 -26
- data/examples/fft/radix2.rb +0 -18
- data/examples/fft/real-halfcomplex.rb +0 -33
- data/examples/fft/real-halfcomplex2.rb +0 -30
- data/examples/fft/realradix2.rb +0 -19
- data/examples/fft/sunspot.dat +0 -256
- data/examples/fft/sunspot.rb +0 -16
- data/examples/fit/expdata.dat +0 -20
- data/examples/fit/expfit.rb +0 -31
- data/examples/fit/gaussfit.rb +0 -29
- data/examples/fit/gaussian_2peaks.rb +0 -34
- data/examples/fit/hillfit.rb +0 -40
- data/examples/fit/lognormal.rb +0 -26
- data/examples/fit/lorentzfit.rb +0 -22
- data/examples/fit/multifit.rb +0 -72
- data/examples/fit/ndlinear.rb +0 -133
- data/examples/fit/nonlinearfit.rb +0 -89
- data/examples/fit/plot.gp +0 -36
- data/examples/fit/polyfit.rb +0 -9
- data/examples/fit/powerfit.rb +0 -21
- data/examples/fit/sigmoidfit.rb +0 -40
- data/examples/fit/sinfit.rb +0 -22
- data/examples/fit/wlinear.rb +0 -46
- data/examples/fresnel.rb +0 -11
- data/examples/function/function.rb +0 -36
- data/examples/function/log.rb +0 -7
- data/examples/function/min.rb +0 -33
- data/examples/function/sin.rb +0 -10
- data/examples/function/synchrotron.rb +0 -18
- data/examples/gallery/butterfly.rb +0 -7
- data/examples/gallery/cayley.rb +0 -12
- data/examples/gallery/cornu.rb +0 -23
- data/examples/gallery/eight.rb +0 -11
- data/examples/gallery/koch.rb +0 -40
- data/examples/gallery/lemniscate.rb +0 -11
- data/examples/gallery/polar.rb +0 -11
- data/examples/gallery/rgplot/cossin.rb +0 -35
- data/examples/gallery/rgplot/rgplot.replaced +0 -0
- data/examples/gallery/rgplot/roesller.rb +0 -55
- data/examples/gallery/roesller.rb +0 -39
- data/examples/gallery/scarabaeus.rb +0 -14
- data/examples/histogram/cauchy.rb +0 -27
- data/examples/histogram/cauchy.sh +0 -2
- data/examples/histogram/exponential.rb +0 -19
- data/examples/histogram/gauss.rb +0 -16
- data/examples/histogram/gsl-histogram.rb +0 -40
- data/examples/histogram/histo2d.rb +0 -31
- data/examples/histogram/histo3d.rb +0 -34
- data/examples/histogram/histogram-pdf.rb +0 -27
- data/examples/histogram/histogram.rb +0 -26
- data/examples/histogram/integral.rb +0 -28
- data/examples/histogram/poisson.rb +0 -27
- data/examples/histogram/power.rb +0 -25
- data/examples/histogram/rebin.rb +0 -17
- data/examples/histogram/smp.dat +0 -5
- data/examples/histogram/xexp.rb +0 -21
- data/examples/integration/ahmed.rb +0 -21
- data/examples/integration/cosmology.rb +0 -75
- data/examples/integration/friedmann.gp +0 -16
- data/examples/integration/friedmann.rb +0 -35
- data/examples/integration/gamma-zeta.rb +0 -35
- data/examples/integration/integration.rb +0 -22
- data/examples/integration/qag.rb +0 -8
- data/examples/integration/qag2.rb +0 -14
- data/examples/integration/qag3.rb +0 -8
- data/examples/integration/qagi.rb +0 -28
- data/examples/integration/qagi2.rb +0 -49
- data/examples/integration/qagiu.rb +0 -29
- data/examples/integration/qagp.rb +0 -20
- data/examples/integration/qags.rb +0 -14
- data/examples/integration/qawc.rb +0 -18
- data/examples/integration/qawf.rb +0 -41
- data/examples/integration/qawo.rb +0 -29
- data/examples/integration/qaws.rb +0 -30
- data/examples/integration/qng.rb +0 -17
- data/examples/interp/demo.gp +0 -20
- data/examples/interp/demo.rb +0 -45
- data/examples/interp/interp.rb +0 -37
- data/examples/interp/points +0 -10
- data/examples/interp/spline.rb +0 -20
- data/examples/jacobi/deriv.rb +0 -40
- data/examples/jacobi/integrate.rb +0 -34
- data/examples/jacobi/interp.rb +0 -43
- data/examples/jacobi/jacobi.rb +0 -11
- data/examples/linalg/HH.rb +0 -15
- data/examples/linalg/HH_narray.rb +0 -13
- data/examples/linalg/LQ_solve.rb +0 -73
- data/examples/linalg/LU.rb +0 -84
- data/examples/linalg/LU2.rb +0 -31
- data/examples/linalg/LU_narray.rb +0 -24
- data/examples/linalg/PTLQ.rb +0 -47
- data/examples/linalg/QR.rb +0 -18
- data/examples/linalg/QRPT.rb +0 -47
- data/examples/linalg/QR_solve.rb +0 -78
- data/examples/linalg/QR_solve_narray.rb +0 -13
- data/examples/linalg/SV.rb +0 -16
- data/examples/linalg/SV_narray.rb +0 -12
- data/examples/linalg/SV_solve.rb +0 -49
- data/examples/linalg/chol.rb +0 -29
- data/examples/linalg/chol_narray.rb +0 -15
- data/examples/linalg/complex.rb +0 -57
- data/examples/linalg/invert_narray.rb +0 -10
- data/examples/math/const.rb +0 -67
- data/examples/math/elementary.rb +0 -35
- data/examples/math/functions.rb +0 -41
- data/examples/math/inf_nan.rb +0 -34
- data/examples/math/minmax.rb +0 -22
- data/examples/math/power.rb +0 -18
- data/examples/math/test.rb +0 -31
- data/examples/matrix/a.dat +0 -0
- data/examples/matrix/add.rb +0 -45
- data/examples/matrix/b.dat +0 -4
- data/examples/matrix/cat.rb +0 -31
- data/examples/matrix/colvectors.rb +0 -24
- data/examples/matrix/complex.rb +0 -41
- data/examples/matrix/det.rb +0 -29
- data/examples/matrix/diagonal.rb +0 -23
- data/examples/matrix/get_all.rb +0 -159
- data/examples/matrix/hilbert.rb +0 -31
- data/examples/matrix/iterator.rb +0 -19
- data/examples/matrix/matrix.rb +0 -57
- data/examples/matrix/minmax.rb +0 -53
- data/examples/matrix/mul.rb +0 -39
- data/examples/matrix/rand.rb +0 -20
- data/examples/matrix/read.rb +0 -29
- data/examples/matrix/rowcol.rb +0 -47
- data/examples/matrix/set.rb +0 -41
- data/examples/matrix/set_all.rb +0 -100
- data/examples/matrix/view.rb +0 -32
- data/examples/matrix/view_all.rb +0 -148
- data/examples/matrix/write.rb +0 -23
- data/examples/min.rb +0 -29
- data/examples/monte/miser.rb +0 -47
- data/examples/monte/monte.rb +0 -47
- data/examples/monte/plain.rb +0 -47
- data/examples/monte/vegas.rb +0 -46
- data/examples/multimin/bundle.rb +0 -66
- data/examples/multimin/cqp.rb +0 -109
- data/examples/multimin/fdfminimizer.rb +0 -40
- data/examples/multimin/fminimizer.rb +0 -41
- data/examples/multiroot/demo.rb +0 -36
- data/examples/multiroot/fdfsolver.rb +0 -50
- data/examples/multiroot/fsolver.rb +0 -33
- data/examples/multiroot/fsolver2.rb +0 -32
- data/examples/multiroot/fsolver3.rb +0 -26
- data/examples/narray/histogram.rb +0 -14
- data/examples/narray/mandel.rb +0 -27
- data/examples/narray/narray.rb +0 -28
- data/examples/narray/narray2.rb +0 -44
- data/examples/narray/sf.rb +0 -26
- data/examples/ntuple/create.rb +0 -17
- data/examples/ntuple/project.rb +0 -31
- data/examples/odeiv/binarysystem.gp +0 -23
- data/examples/odeiv/binarysystem.rb +0 -104
- data/examples/odeiv/demo.gp +0 -24
- data/examples/odeiv/demo.rb +0 -69
- data/examples/odeiv/demo2.gp +0 -26
- data/examples/odeiv/duffing.rb +0 -45
- data/examples/odeiv/frei1.rb +0 -109
- data/examples/odeiv/frei2.rb +0 -76
- data/examples/odeiv/legendre.rb +0 -52
- data/examples/odeiv/odeiv.rb +0 -32
- data/examples/odeiv/odeiv2.rb +0 -45
- data/examples/odeiv/oscillator.rb +0 -42
- data/examples/odeiv/sedov.rb +0 -97
- data/examples/odeiv/whitedwarf.gp +0 -40
- data/examples/odeiv/whitedwarf.rb +0 -158
- data/examples/ool/conmin.rb +0 -100
- data/examples/ool/gencan.rb +0 -99
- data/examples/ool/pgrad.rb +0 -100
- data/examples/ool/spg.rb +0 -100
- data/examples/pdf/bernoulli.rb +0 -5
- data/examples/pdf/beta.rb +0 -7
- data/examples/pdf/binomiral.rb +0 -10
- data/examples/pdf/cauchy.rb +0 -6
- data/examples/pdf/chisq.rb +0 -8
- data/examples/pdf/exponential.rb +0 -7
- data/examples/pdf/exppow.rb +0 -6
- data/examples/pdf/fdist.rb +0 -7
- data/examples/pdf/flat.rb +0 -7
- data/examples/pdf/gamma.rb +0 -8
- data/examples/pdf/gauss-tail.rb +0 -5
- data/examples/pdf/gauss.rb +0 -6
- data/examples/pdf/geometric.rb +0 -5
- data/examples/pdf/gumbel.rb +0 -6
- data/examples/pdf/hypergeometric.rb +0 -11
- data/examples/pdf/landau.rb +0 -5
- data/examples/pdf/laplace.rb +0 -7
- data/examples/pdf/logarithmic.rb +0 -5
- data/examples/pdf/logistic.rb +0 -6
- data/examples/pdf/lognormal.rb +0 -6
- data/examples/pdf/neg-binomiral.rb +0 -10
- data/examples/pdf/pareto.rb +0 -7
- data/examples/pdf/pascal.rb +0 -10
- data/examples/pdf/poisson.rb +0 -5
- data/examples/pdf/rayleigh-tail.rb +0 -6
- data/examples/pdf/rayleigh.rb +0 -6
- data/examples/pdf/tdist.rb +0 -6
- data/examples/pdf/weibull.rb +0 -8
- data/examples/permutation/ex1.rb +0 -22
- data/examples/permutation/permutation.rb +0 -16
- data/examples/poly/bell.rb +0 -6
- data/examples/poly/bessel.rb +0 -6
- data/examples/poly/cheb.rb +0 -6
- data/examples/poly/cheb_II.rb +0 -6
- data/examples/poly/cubic.rb +0 -9
- data/examples/poly/demo.rb +0 -20
- data/examples/poly/eval.rb +0 -28
- data/examples/poly/eval_derivs.rb +0 -14
- data/examples/poly/fit.rb +0 -21
- data/examples/poly/hermite.rb +0 -6
- data/examples/poly/poly.rb +0 -13
- data/examples/poly/quadratic.rb +0 -25
- data/examples/random/diffusion.rb +0 -34
- data/examples/random/gaussian.rb +0 -9
- data/examples/random/generator.rb +0 -27
- data/examples/random/hdsobol.rb +0 -21
- data/examples/random/poisson.rb +0 -9
- data/examples/random/qrng.rb +0 -19
- data/examples/random/randomwalk.rb +0 -37
- data/examples/random/randomwalk2d.rb +0 -19
- data/examples/random/rayleigh.rb +0 -36
- data/examples/random/rng.rb +0 -33
- data/examples/random/rngextra.rb +0 -14
- data/examples/roots/bisection.rb +0 -25
- data/examples/roots/brent.rb +0 -43
- data/examples/roots/demo.rb +0 -30
- data/examples/roots/newton.rb +0 -46
- data/examples/roots/recombination.gp +0 -11
- data/examples/roots/recombination.rb +0 -61
- data/examples/roots/steffenson.rb +0 -48
- data/examples/sf/ShiChi.rb +0 -6
- data/examples/sf/SiCi.rb +0 -6
- data/examples/sf/airy_Ai.rb +0 -8
- data/examples/sf/airy_Bi.rb +0 -8
- data/examples/sf/bessel_IK.rb +0 -12
- data/examples/sf/bessel_JY.rb +0 -13
- data/examples/sf/beta_inc.rb +0 -9
- data/examples/sf/clausen.rb +0 -6
- data/examples/sf/dawson.rb +0 -5
- data/examples/sf/debye.rb +0 -9
- data/examples/sf/dilog.rb +0 -6
- data/examples/sf/ellint.rb +0 -6
- data/examples/sf/expint.rb +0 -8
- data/examples/sf/fermi.rb +0 -10
- data/examples/sf/gamma_inc_P.rb +0 -9
- data/examples/sf/gegenbauer.rb +0 -8
- data/examples/sf/hyperg.rb +0 -7
- data/examples/sf/laguerre.rb +0 -19
- data/examples/sf/lambertW.rb +0 -5
- data/examples/sf/legendre_P.rb +0 -10
- data/examples/sf/lngamma.rb +0 -5
- data/examples/sf/psi.rb +0 -54
- data/examples/sf/sphbessel.gp +0 -27
- data/examples/sf/sphbessel.rb +0 -30
- data/examples/sf/synchrotron.rb +0 -5
- data/examples/sf/transport.rb +0 -10
- data/examples/sf/zetam1.rb +0 -5
- data/examples/siman.rb +0 -44
- data/examples/sort/heapsort.rb +0 -23
- data/examples/sort/heapsort_vector_complex.rb +0 -21
- data/examples/sort/sort.rb +0 -23
- data/examples/sort/sort2.rb +0 -16
- data/examples/stats/mean.rb +0 -17
- data/examples/stats/statistics.rb +0 -18
- data/examples/stats/test.rb +0 -9
- data/examples/sum.rb +0 -34
- data/examples/tamu_anova.rb +0 -18
- data/examples/vector/a.dat +0 -0
- data/examples/vector/add.rb +0 -56
- data/examples/vector/b.dat +0 -4
- data/examples/vector/c.dat +0 -3
- data/examples/vector/collect.rb +0 -26
- data/examples/vector/compare.rb +0 -28
- data/examples/vector/complex.rb +0 -51
- data/examples/vector/complex_get_all.rb +0 -85
- data/examples/vector/complex_set_all.rb +0 -131
- data/examples/vector/complex_view_all.rb +0 -77
- data/examples/vector/connect.rb +0 -22
- data/examples/vector/decimate.rb +0 -38
- data/examples/vector/diff.rb +0 -31
- data/examples/vector/filescan.rb +0 -17
- data/examples/vector/floor.rb +0 -23
- data/examples/vector/get_all.rb +0 -82
- data/examples/vector/gnuplot.rb +0 -38
- data/examples/vector/graph.rb +0 -28
- data/examples/vector/histogram.rb +0 -22
- data/examples/vector/linspace.rb +0 -24
- data/examples/vector/log.rb +0 -17
- data/examples/vector/logic.rb +0 -33
- data/examples/vector/logspace.rb +0 -25
- data/examples/vector/minmax.rb +0 -47
- data/examples/vector/mul.rb +0 -49
- data/examples/vector/narray.rb +0 -46
- data/examples/vector/read.rb +0 -29
- data/examples/vector/set.rb +0 -35
- data/examples/vector/set_all.rb +0 -121
- data/examples/vector/smpv.dat +0 -15
- data/examples/vector/test.rb +0 -43
- data/examples/vector/test_gslblock.rb +0 -58
- data/examples/vector/vector.rb +0 -110
- data/examples/vector/view.rb +0 -35
- data/examples/vector/view_all.rb +0 -73
- data/examples/vector/where.rb +0 -29
- data/examples/vector/write.rb +0 -24
- data/examples/vector/zip.rb +0 -34
- data/examples/wavelet/ecg.dat +0 -256
- data/examples/wavelet/wavelet1.rb +0 -50
- data/ext/gsl_native/alf.c +0 -206
- data/ext/gsl_native/array.c +0 -553
- data/ext/gsl_native/array_complex.c +0 -245
- data/ext/gsl_native/blas.c +0 -28
- data/ext/gsl_native/blas1.c +0 -733
- data/ext/gsl_native/blas2.c +0 -1088
- data/ext/gsl_native/blas3.c +0 -880
- data/ext/gsl_native/block.c +0 -40
- data/ext/gsl_native/block_source.h +0 -885
- data/ext/gsl_native/bspline.c +0 -122
- data/ext/gsl_native/bundle.c +0 -3
- data/ext/gsl_native/cdf.c +0 -740
- data/ext/gsl_native/cheb.c +0 -531
- data/ext/gsl_native/combination.c +0 -275
- data/ext/gsl_native/common.c +0 -293
- data/ext/gsl_native/complex.c +0 -1002
- data/ext/gsl_native/const.c +0 -331
- data/ext/gsl_native/const_additional.c +0 -99
- data/ext/gsl_native/cqp.c +0 -283
- data/ext/gsl_native/deriv.c +0 -187
- data/ext/gsl_native/dht.c +0 -353
- data/ext/gsl_native/diff.c +0 -164
- data/ext/gsl_native/dirac.c +0 -388
- data/ext/gsl_native/eigen.c +0 -2322
- data/ext/gsl_native/error.c +0 -193
- data/ext/gsl_native/extconf.rb +0 -118
- data/ext/gsl_native/fft.c +0 -1095
- data/ext/gsl_native/fit.c +0 -204
- data/ext/gsl_native/fresnel.c +0 -312
- data/ext/gsl_native/function.c +0 -518
- data/ext/gsl_native/geometry.c +0 -139
- data/ext/gsl_native/graph.c +0 -1590
- data/ext/gsl_native/gsl.c +0 -259
- data/ext/gsl_native/gsl_narray.c +0 -794
- data/ext/gsl_native/histogram.c +0 -1964
- data/ext/gsl_native/histogram2d.c +0 -1042
- data/ext/gsl_native/histogram3d.c +0 -884
- data/ext/gsl_native/histogram3d_source.c +0 -749
- data/ext/gsl_native/histogram_find.c +0 -99
- data/ext/gsl_native/histogram_oper.c +0 -150
- data/ext/gsl_native/ieee.c +0 -88
- data/ext/gsl_native/include/rb_gsl.h +0 -136
- data/ext/gsl_native/include/rb_gsl_array.h +0 -214
- data/ext/gsl_native/include/rb_gsl_cheb.h +0 -19
- data/ext/gsl_native/include/rb_gsl_common.h +0 -348
- data/ext/gsl_native/include/rb_gsl_complex.h +0 -25
- data/ext/gsl_native/include/rb_gsl_const.h +0 -23
- data/ext/gsl_native/include/rb_gsl_dirac.h +0 -6
- data/ext/gsl_native/include/rb_gsl_eigen.h +0 -17
- data/ext/gsl_native/include/rb_gsl_fft.h +0 -49
- data/ext/gsl_native/include/rb_gsl_fit.h +0 -23
- data/ext/gsl_native/include/rb_gsl_function.h +0 -23
- data/ext/gsl_native/include/rb_gsl_graph.h +0 -68
- data/ext/gsl_native/include/rb_gsl_histogram.h +0 -63
- data/ext/gsl_native/include/rb_gsl_histogram3d.h +0 -97
- data/ext/gsl_native/include/rb_gsl_integration.h +0 -17
- data/ext/gsl_native/include/rb_gsl_interp.h +0 -41
- data/ext/gsl_native/include/rb_gsl_linalg.h +0 -21
- data/ext/gsl_native/include/rb_gsl_math.h +0 -20
- data/ext/gsl_native/include/rb_gsl_odeiv.h +0 -18
- data/ext/gsl_native/include/rb_gsl_poly.h +0 -67
- data/ext/gsl_native/include/rb_gsl_rational.h +0 -30
- data/ext/gsl_native/include/rb_gsl_rng.h +0 -20
- data/ext/gsl_native/include/rb_gsl_root.h +0 -22
- data/ext/gsl_native/include/rb_gsl_sf.h +0 -110
- data/ext/gsl_native/include/rb_gsl_statistics.h +0 -17
- data/ext/gsl_native/include/rb_gsl_tensor.h +0 -43
- data/ext/gsl_native/include/rb_gsl_with_narray.h +0 -31
- data/ext/gsl_native/include/templates_off.h +0 -87
- data/ext/gsl_native/include/templates_on.h +0 -241
- data/ext/gsl_native/integration.c +0 -1154
- data/ext/gsl_native/interp.c +0 -499
- data/ext/gsl_native/jacobi.c +0 -733
- data/ext/gsl_native/linalg.c +0 -3915
- data/ext/gsl_native/linalg_complex.c +0 -726
- data/ext/gsl_native/math.c +0 -706
- data/ext/gsl_native/matrix.c +0 -36
- data/ext/gsl_native/matrix_complex.c +0 -1733
- data/ext/gsl_native/matrix_double.c +0 -557
- data/ext/gsl_native/matrix_int.c +0 -255
- data/ext/gsl_native/matrix_source.h +0 -2708
- data/ext/gsl_native/min.c +0 -219
- data/ext/gsl_native/monte.c +0 -978
- data/ext/gsl_native/multifit.c +0 -1862
- data/ext/gsl_native/multimin.c +0 -778
- data/ext/gsl_native/multimin_fsdf.c +0 -156
- data/ext/gsl_native/multiroots.c +0 -952
- data/ext/gsl_native/multiset.c +0 -210
- data/ext/gsl_native/ndlinear.c +0 -320
- data/ext/gsl_native/nmf.c +0 -171
- data/ext/gsl_native/nmf_wrap.c +0 -75
- data/ext/gsl_native/ntuple.c +0 -469
- data/ext/gsl_native/odeiv.c +0 -947
- data/ext/gsl_native/ool.c +0 -879
- data/ext/gsl_native/permutation.c +0 -598
- data/ext/gsl_native/poly.c +0 -39
- data/ext/gsl_native/poly2.c +0 -265
- data/ext/gsl_native/poly_source.h +0 -1871
- data/ext/gsl_native/qrng.c +0 -160
- data/ext/gsl_native/randist.c +0 -1848
- data/ext/gsl_native/rational.c +0 -480
- data/ext/gsl_native/rng.c +0 -595
- data/ext/gsl_native/root.c +0 -407
- data/ext/gsl_native/sf.c +0 -1446
- data/ext/gsl_native/sf_airy.c +0 -200
- data/ext/gsl_native/sf_bessel.c +0 -871
- data/ext/gsl_native/sf_clausen.c +0 -28
- data/ext/gsl_native/sf_coulomb.c +0 -206
- data/ext/gsl_native/sf_coupling.c +0 -121
- data/ext/gsl_native/sf_dawson.c +0 -29
- data/ext/gsl_native/sf_debye.c +0 -148
- data/ext/gsl_native/sf_dilog.c +0 -43
- data/ext/gsl_native/sf_elementary.c +0 -46
- data/ext/gsl_native/sf_ellint.c +0 -206
- data/ext/gsl_native/sf_elljac.c +0 -30
- data/ext/gsl_native/sf_erfc.c +0 -89
- data/ext/gsl_native/sf_exp.c +0 -169
- data/ext/gsl_native/sf_expint.c +0 -201
- data/ext/gsl_native/sf_fermi_dirac.c +0 -148
- data/ext/gsl_native/sf_gamma.c +0 -343
- data/ext/gsl_native/sf_gegenbauer.c +0 -97
- data/ext/gsl_native/sf_hyperg.c +0 -203
- data/ext/gsl_native/sf_laguerre.c +0 -113
- data/ext/gsl_native/sf_lambert.c +0 -47
- data/ext/gsl_native/sf_legendre.c +0 -368
- data/ext/gsl_native/sf_log.c +0 -105
- data/ext/gsl_native/sf_mathieu.c +0 -235
- data/ext/gsl_native/sf_power.c +0 -47
- data/ext/gsl_native/sf_psi.c +0 -89
- data/ext/gsl_native/sf_synchrotron.c +0 -48
- data/ext/gsl_native/sf_transport.c +0 -76
- data/ext/gsl_native/sf_trigonometric.c +0 -210
- data/ext/gsl_native/sf_zeta.c +0 -115
- data/ext/gsl_native/signal.c +0 -303
- data/ext/gsl_native/siman.c +0 -713
- data/ext/gsl_native/sort.c +0 -207
- data/ext/gsl_native/spline.c +0 -377
- data/ext/gsl_native/stats.c +0 -787
- data/ext/gsl_native/sum.c +0 -168
- data/ext/gsl_native/tamu_anova.c +0 -56
- data/ext/gsl_native/tensor.c +0 -35
- data/ext/gsl_native/tensor_source.h +0 -1122
- data/ext/gsl_native/vector.c +0 -35
- data/ext/gsl_native/vector_complex.c +0 -2241
- data/ext/gsl_native/vector_double.c +0 -1433
- data/ext/gsl_native/vector_int.c +0 -202
- data/ext/gsl_native/vector_source.h +0 -3321
- data/ext/gsl_native/wavelet.c +0 -923
- data/lib/gsl.rb +0 -8
- data/lib/gsl/gnuplot.rb +0 -41
- data/lib/gsl/oper.rb +0 -43
- data/lib/gsl/version.rb +0 -3
- data/lib/ool.rb +0 -22
- data/lib/ool/conmin.rb +0 -30
- data/lib/rbgsl.rb +0 -1
- data/rdoc/alf.rdoc +0 -77
- data/rdoc/blas.rdoc +0 -269
- data/rdoc/bspline.rdoc +0 -42
- data/rdoc/changes.rdoc +0 -159
- data/rdoc/cheb.rdoc +0 -99
- data/rdoc/cholesky_complex.rdoc +0 -46
- data/rdoc/combi.rdoc +0 -125
- data/rdoc/complex.rdoc +0 -210
- data/rdoc/const.rdoc +0 -546
- data/rdoc/dht.rdoc +0 -122
- data/rdoc/diff.rdoc +0 -133
- data/rdoc/ehandling.rdoc +0 -50
- data/rdoc/eigen.rdoc +0 -401
- data/rdoc/fft.rdoc +0 -535
- data/rdoc/fit.rdoc +0 -284
- data/rdoc/function.rdoc +0 -94
- data/rdoc/graph.rdoc +0 -137
- data/rdoc/hist.rdoc +0 -409
- data/rdoc/hist2d.rdoc +0 -279
- data/rdoc/hist3d.rdoc +0 -112
- data/rdoc/integration.rdoc +0 -398
- data/rdoc/interp.rdoc +0 -231
- data/rdoc/intro.rdoc +0 -27
- data/rdoc/linalg.rdoc +0 -681
- data/rdoc/linalg_complex.rdoc +0 -88
- data/rdoc/math.rdoc +0 -276
- data/rdoc/matrix.rdoc +0 -1093
- data/rdoc/min.rdoc +0 -189
- data/rdoc/monte.rdoc +0 -234
- data/rdoc/multimin.rdoc +0 -312
- data/rdoc/multiroot.rdoc +0 -293
- data/rdoc/narray.rdoc +0 -177
- data/rdoc/ndlinear.rdoc +0 -250
- data/rdoc/nonlinearfit.rdoc +0 -348
- data/rdoc/ntuple.rdoc +0 -88
- data/rdoc/odeiv.rdoc +0 -378
- data/rdoc/perm.rdoc +0 -221
- data/rdoc/poly.rdoc +0 -335
- data/rdoc/qrng.rdoc +0 -90
- data/rdoc/randist.rdoc +0 -233
- data/rdoc/ref.rdoc +0 -93
- data/rdoc/rng.rdoc +0 -203
- data/rdoc/roots.rdoc +0 -305
- data/rdoc/sf.rdoc +0 -1622
- data/rdoc/siman.rdoc +0 -89
- data/rdoc/sort.rdoc +0 -94
- data/rdoc/start.rdoc +0 -16
- data/rdoc/stats.rdoc +0 -219
- data/rdoc/sum.rdoc +0 -65
- data/rdoc/tensor.rdoc +0 -251
- data/rdoc/tut.rdoc +0 -5
- data/rdoc/use.rdoc +0 -177
- data/rdoc/vector.rdoc +0 -1243
- data/rdoc/vector_complex.rdoc +0 -347
- data/rdoc/wavelet.rdoc +0 -218
- data/test/gsl/blas_test.rb +0 -79
- data/test/gsl/bspline_test.rb +0 -63
- data/test/gsl/cdf_test.rb +0 -1512
- data/test/gsl/cheb_test.rb +0 -80
- data/test/gsl/combination_test.rb +0 -100
- data/test/gsl/complex_test.rb +0 -20
- data/test/gsl/const_test.rb +0 -29
- data/test/gsl/deriv_test.rb +0 -62
- data/test/gsl/dht_test.rb +0 -79
- data/test/gsl/diff_test.rb +0 -53
- data/test/gsl/eigen_test.rb +0 -563
- data/test/gsl/err_test.rb +0 -23
- data/test/gsl/fit_test.rb +0 -101
- data/test/gsl/histo_test.rb +0 -14
- data/test/gsl/index_test.rb +0 -61
- data/test/gsl/integration_test.rb +0 -274
- data/test/gsl/interp_test.rb +0 -27
- data/test/gsl/linalg_test.rb +0 -463
- data/test/gsl/matrix_nmf_test.rb +0 -37
- data/test/gsl/matrix_test.rb +0 -98
- data/test/gsl/min_test.rb +0 -89
- data/test/gsl/monte_test.rb +0 -77
- data/test/gsl/multifit_test.rb +0 -753
- data/test/gsl/multimin_test.rb +0 -157
- data/test/gsl/multiroot_test.rb +0 -135
- data/test/gsl/multiset_test.rb +0 -52
- data/test/gsl/odeiv_test.rb +0 -275
- data/test/gsl/oper_test.rb +0 -98
- data/test/gsl/poly_test.rb +0 -338
- data/test/gsl/qrng_test.rb +0 -94
- data/test/gsl/quartic_test.rb +0 -28
- data/test/gsl/randist_test.rb +0 -122
- data/test/gsl/rng_test.rb +0 -303
- data/test/gsl/roots_test.rb +0 -78
- data/test/gsl/sf_test.rb +0 -2079
- data/test/gsl/stats_test.rb +0 -122
- data/test/gsl/sum_test.rb +0 -69
- data/test/gsl/tensor_test.rb +0 -396
- data/test/gsl/vector_test.rb +0 -223
- data/test/gsl/wavelet_test.rb +0 -130
- data/test/gsl_test.rb +0 -321
- data/test/test_helper.rb +0 -42
- data/uncrustify.cfg +0 -1693
data/ext/gsl_native/odeiv.c
DELETED
@@ -1,947 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
odeiv.c
|
3
|
-
Ruby/GSL: Ruby extension library for GSL (GNU Scientific Library)
|
4
|
-
(C) Copyright 2004 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 "include/rb_gsl_odeiv.h"
|
13
|
-
#include "include/rb_gsl_array.h"
|
14
|
-
#include "include/rb_gsl_function.h"
|
15
|
-
|
16
|
-
#ifndef CHECK_SYSTEM
|
17
|
-
#define CHECK_SYSTEM(x) if(CLASS_OF(x)!=cgsl_odeiv_system) \
|
18
|
-
rb_raise(rb_eTypeError, \
|
19
|
-
"wrong argument type %s (GSL::Odeiv::System expected)", \
|
20
|
-
rb_class2name(CLASS_OF(x)));
|
21
|
-
#endif
|
22
|
-
|
23
|
-
#ifndef CHECK_STEP
|
24
|
-
#define CHECK_STEP(x) if(CLASS_OF(x)!=cgsl_odeiv_step) \
|
25
|
-
rb_raise(rb_eTypeError, \
|
26
|
-
"wrong argument type %s (GSL::Odeiv::Step expected)", \
|
27
|
-
rb_class2name(CLASS_OF(x)));
|
28
|
-
#endif
|
29
|
-
|
30
|
-
#ifndef CHECK_CONTROL
|
31
|
-
#define CHECK_CONTROL(x) if(CLASS_OF(x)!=cgsl_odeiv_control) \
|
32
|
-
rb_raise(rb_eTypeError, \
|
33
|
-
"wrong argument type %s (GSL::Odeiv::Control expected)", \
|
34
|
-
rb_class2name(CLASS_OF(x)));
|
35
|
-
#endif
|
36
|
-
|
37
|
-
#ifndef CHECK_EVOLVE
|
38
|
-
#define CHECK_EVOLVE(x) if(CLASS_OF(x)!=cgsl_odeiv_evolve) \
|
39
|
-
rb_raise(rb_eTypeError, \
|
40
|
-
"wrong argument type %s (GSL::Odeiv::Evolve expected)", \
|
41
|
-
rb_class2name(CLASS_OF(x)));
|
42
|
-
#endif
|
43
|
-
|
44
|
-
#ifndef CHECK_SOLVER
|
45
|
-
#define CHECK_SOLVER(x) if(CLASS_OF(x)!=cgsl_odeiv_solver) \
|
46
|
-
rb_raise(rb_eTypeError, \
|
47
|
-
"wrong argument type %s (GSL::Odeiv::Solver expected)", \
|
48
|
-
rb_class2name(CLASS_OF(x)));
|
49
|
-
#endif
|
50
|
-
|
51
|
-
static VALUE cgsl_odeiv_system;
|
52
|
-
static VALUE cgsl_odeiv_step;
|
53
|
-
static VALUE cgsl_odeiv_control;
|
54
|
-
static VALUE cgsl_odeiv_evolve;
|
55
|
-
static VALUE cgsl_odeiv_solver;
|
56
|
-
|
57
|
-
enum {
|
58
|
-
GSL_ODEIV_STEP_RK2,
|
59
|
-
GSL_ODEIV_STEP_RK4,
|
60
|
-
GSL_ODEIV_STEP_RKF45,
|
61
|
-
GSL_ODEIV_STEP_RKCK,
|
62
|
-
GSL_ODEIV_STEP_RK8PD,
|
63
|
-
GSL_ODEIV_STEP_RK2IMP,
|
64
|
-
GSL_ODEIV_STEP_RK4IMP,
|
65
|
-
GSL_ODEIV_STEP_BSIMP,
|
66
|
-
GSL_ODEIV_STEP_GEAR1,
|
67
|
-
GSL_ODEIV_STEP_GEAR2,
|
68
|
-
GSL_ODEIV_STEP_RK2SIMP,
|
69
|
-
};
|
70
|
-
|
71
|
-
typedef struct __rb_gsl_odeiv_evolve {
|
72
|
-
gsl_odeiv_evolve *e;
|
73
|
-
gsl_odeiv_control *c;
|
74
|
-
gsl_odeiv_step *s;
|
75
|
-
gsl_odeiv_system *sys;
|
76
|
-
} gsl_odeiv_solver;
|
77
|
-
|
78
|
-
static int calc_func(double t, const double y[], double dydt[], void *data);
|
79
|
-
static int calc_jac(double t, const double y[], double *dfdy, double dfdt[], void *data);
|
80
|
-
|
81
|
-
static int calc_func(double t, const double y[], double dydt[], void *data)
|
82
|
-
{
|
83
|
-
VALUE ary, params, proc;
|
84
|
-
// local variable "result" declared and set, but never used
|
85
|
-
//VALUE result;
|
86
|
-
VALUE vy, vdydt;
|
87
|
-
gsl_vector_view ytmp, dydttmp;
|
88
|
-
size_t dim;
|
89
|
-
|
90
|
-
ary = (VALUE) data;
|
91
|
-
proc = rb_ary_entry(ary, 0);
|
92
|
-
dim = FIX2INT(rb_ary_entry(ary, 2));
|
93
|
-
params = rb_ary_entry(ary, 3);
|
94
|
-
|
95
|
-
ytmp.vector.data = (double *) y;
|
96
|
-
ytmp.vector.stride = 1;
|
97
|
-
ytmp.vector.size = dim;
|
98
|
-
dydttmp.vector.data = dydt;
|
99
|
-
dydttmp.vector.stride = 1;
|
100
|
-
dydttmp.vector.size = dim;
|
101
|
-
vy = Data_Wrap_Struct(cgsl_vector_view_ro, 0, NULL, &ytmp);
|
102
|
-
vdydt = Data_Wrap_Struct(cgsl_vector_view, 0, NULL, &dydttmp);
|
103
|
-
|
104
|
-
if (NIL_P(params)) /*result =*/ rb_funcall((VALUE) proc, RBGSL_ID_call, 3, rb_float_new(t),
|
105
|
-
vy, vdydt);
|
106
|
-
else /*result =*/ rb_funcall((VALUE) proc, RBGSL_ID_call, 4, rb_float_new(t), vy, vdydt, params);
|
107
|
-
return GSL_SUCCESS;
|
108
|
-
}
|
109
|
-
|
110
|
-
static int calc_jac(double t, const double y[], double *dfdy, double dfdt[], void *data)
|
111
|
-
{
|
112
|
-
VALUE params, proc, ary;
|
113
|
-
VALUE vdfdt;
|
114
|
-
// local variable "result" declared and set, but never used
|
115
|
-
//VALUE result;
|
116
|
-
VALUE vy, vmjac;
|
117
|
-
gsl_vector_view ytmp, dfdttmp;
|
118
|
-
gsl_matrix_view mv;
|
119
|
-
size_t dim;
|
120
|
-
|
121
|
-
ary = (VALUE) data;
|
122
|
-
proc = rb_ary_entry(ary, 1);
|
123
|
-
if (NIL_P(proc)) rb_raise(rb_eRuntimeError, "df function not given");
|
124
|
-
dim = FIX2INT(rb_ary_entry(ary, 2));
|
125
|
-
params = rb_ary_entry(ary, 3);
|
126
|
-
|
127
|
-
ytmp.vector.data = (double *) y;
|
128
|
-
ytmp.vector.size = dim;
|
129
|
-
ytmp.vector.stride = 1;
|
130
|
-
dfdttmp.vector.data = dfdt;
|
131
|
-
dfdttmp.vector.size = dim;
|
132
|
-
dfdttmp.vector.stride = 1;
|
133
|
-
mv = gsl_matrix_view_array(dfdy, dim, dim);
|
134
|
-
vy = Data_Wrap_Struct(cgsl_vector_view_ro, 0, NULL, &ytmp);
|
135
|
-
vmjac = Data_Wrap_Struct(cgsl_matrix_view, 0, NULL, &mv);
|
136
|
-
vdfdt = Data_Wrap_Struct(cgsl_vector_view, 0, NULL, &dfdttmp);
|
137
|
-
if (NIL_P(params)) /*result =*/ rb_funcall((VALUE) proc, RBGSL_ID_call, 4, rb_float_new(t),
|
138
|
-
vy, vmjac, vdfdt);
|
139
|
-
else /*result =*/ rb_funcall((VALUE) proc, RBGSL_ID_call, 5, rb_float_new(t),
|
140
|
-
vy, vmjac, vdfdt, params);
|
141
|
-
return GSL_SUCCESS;
|
142
|
-
}
|
143
|
-
|
144
|
-
static void gsl_odeiv_system_mark(gsl_odeiv_system *sys);
|
145
|
-
static void gsl_odeiv_system_mark(gsl_odeiv_system *sys)
|
146
|
-
{
|
147
|
-
rb_gc_mark((VALUE) sys->params);
|
148
|
-
}
|
149
|
-
|
150
|
-
static gsl_odeiv_system* make_sys(int argc, VALUE *argv);
|
151
|
-
static void set_sys(int argc, VALUE *argv, gsl_odeiv_system *sys);
|
152
|
-
static VALUE rb_gsl_odeiv_system_new(int argc, VALUE *argv, VALUE klass)
|
153
|
-
{
|
154
|
-
VALUE obj;
|
155
|
-
gsl_odeiv_system *sys = NULL;
|
156
|
-
sys = make_sys(argc, argv);
|
157
|
-
obj = Data_Wrap_Struct(klass, gsl_odeiv_system_mark, free, sys);
|
158
|
-
return obj;
|
159
|
-
}
|
160
|
-
|
161
|
-
static VALUE rb_gsl_odeiv_system_set(int argc, VALUE *argv, VALUE obj)
|
162
|
-
{
|
163
|
-
gsl_odeiv_system *sys = NULL;
|
164
|
-
Data_Get_Struct(obj, gsl_odeiv_system, sys);
|
165
|
-
set_sys(argc, argv, sys);
|
166
|
-
return obj;
|
167
|
-
}
|
168
|
-
|
169
|
-
static gsl_odeiv_system* make_sys(int argc, VALUE *argv)
|
170
|
-
{
|
171
|
-
gsl_odeiv_system *sys = NULL;
|
172
|
-
sys = ALLOC(gsl_odeiv_system);
|
173
|
-
sys->function = &calc_func;
|
174
|
-
sys->jacobian = &calc_jac;
|
175
|
-
sys->params = NULL;
|
176
|
-
set_sys(argc, argv, sys);
|
177
|
-
return sys;
|
178
|
-
}
|
179
|
-
|
180
|
-
static void set_sys(int argc, VALUE *argv, gsl_odeiv_system *sys)
|
181
|
-
{
|
182
|
-
size_t dimension;
|
183
|
-
VALUE ary, vjac, dim;
|
184
|
-
VALUE vparams;
|
185
|
-
int itmp;
|
186
|
-
size_t i, j;
|
187
|
-
|
188
|
-
if (argc < 2) rb_raise(rb_eArgError, "too few arguments");
|
189
|
-
CHECK_PROC(argv[0]);
|
190
|
-
|
191
|
-
if (sys == NULL) {
|
192
|
-
sys = ALLOC(gsl_odeiv_system);
|
193
|
-
sys->function = &calc_func;
|
194
|
-
sys->jacobian = &calc_jac;
|
195
|
-
}
|
196
|
-
if (sys->params == NULL) {
|
197
|
-
ary = rb_ary_new2(4);
|
198
|
-
/* (VALUE) sys->params = ary;*/
|
199
|
-
sys->params = (void *) ary;
|
200
|
-
} else {
|
201
|
-
ary = (VALUE) sys->params;
|
202
|
-
}
|
203
|
-
rb_ary_store(ary, 1, Qnil); /* function to calc J */
|
204
|
-
rb_ary_store(ary, 3, Qnil); /* parameters */
|
205
|
-
|
206
|
-
itmp = 1;
|
207
|
-
if (rb_obj_is_kind_of(argv[1], rb_cProc)) {
|
208
|
-
vjac = argv[1];
|
209
|
-
itmp = 2;
|
210
|
-
} else {
|
211
|
-
vjac = Qnil;
|
212
|
-
}
|
213
|
-
if ((dim = argv[itmp++]) == Qnil) dim = argv[itmp++];
|
214
|
-
switch (argc - itmp) {
|
215
|
-
case 0:
|
216
|
-
vparams = Qnil;
|
217
|
-
break;
|
218
|
-
case 1:
|
219
|
-
vparams = argv[itmp];
|
220
|
-
break;
|
221
|
-
default:
|
222
|
-
vparams = rb_ary_new2(argc-itmp);
|
223
|
-
for (i = itmp, j = 0; (int) i < argc; i++, j++) rb_ary_store(vparams, j, argv[i]);
|
224
|
-
}
|
225
|
-
dimension = FIX2INT(dim);
|
226
|
-
sys->dimension = dimension;
|
227
|
-
rb_ary_store(ary, 0, argv[0]);
|
228
|
-
rb_ary_store(ary, 1, vjac);
|
229
|
-
rb_ary_store(ary, 2, dim);
|
230
|
-
rb_ary_store(ary, 3, vparams);
|
231
|
-
}
|
232
|
-
|
233
|
-
static VALUE rb_gsl_odeiv_system_set_params(int argc, VALUE *argv, VALUE obj);
|
234
|
-
static VALUE rb_gsl_odeiv_system_set_params(int argc, VALUE *argv, VALUE obj)
|
235
|
-
{
|
236
|
-
VALUE vparams, ary;
|
237
|
-
gsl_odeiv_system *sys = NULL;
|
238
|
-
size_t i;
|
239
|
-
Data_Get_Struct(obj, gsl_odeiv_system, sys);
|
240
|
-
|
241
|
-
ary = (VALUE) sys->params;
|
242
|
-
switch (argc) {
|
243
|
-
case 0:
|
244
|
-
vparams = Qnil;
|
245
|
-
break;
|
246
|
-
case 1:
|
247
|
-
vparams = argv[0];
|
248
|
-
break;
|
249
|
-
default:
|
250
|
-
vparams = rb_ary_new2(argc);
|
251
|
-
for (i = 0; (int) i < argc; i++) rb_ary_store(vparams, i, argv[i]);
|
252
|
-
}
|
253
|
-
// rb_ary_delete_at(ary, 3);
|
254
|
-
rb_ary_store(ary, 3, vparams);
|
255
|
-
return obj;
|
256
|
-
}
|
257
|
-
|
258
|
-
static VALUE rb_gsl_odeiv_system_params(VALUE obj)
|
259
|
-
{
|
260
|
-
VALUE ary;
|
261
|
-
gsl_odeiv_system *sys = NULL;
|
262
|
-
Data_Get_Struct(obj, gsl_odeiv_system, sys);
|
263
|
-
ary = (VALUE) sys->params;
|
264
|
-
return rb_ary_entry(ary, 3);
|
265
|
-
}
|
266
|
-
|
267
|
-
static VALUE rb_gsl_odeiv_system_function(VALUE obj)
|
268
|
-
{
|
269
|
-
VALUE ary;
|
270
|
-
gsl_odeiv_system *sys = NULL;
|
271
|
-
Data_Get_Struct(obj, gsl_odeiv_system, sys);
|
272
|
-
ary = (VALUE) sys->params;
|
273
|
-
return rb_ary_entry(ary, 0);
|
274
|
-
}
|
275
|
-
|
276
|
-
static VALUE rb_gsl_odeiv_system_jacobian(VALUE obj)
|
277
|
-
{
|
278
|
-
VALUE ary;
|
279
|
-
gsl_odeiv_system *sys = NULL;
|
280
|
-
Data_Get_Struct(obj, gsl_odeiv_system, sys);
|
281
|
-
ary = (VALUE) sys->params;
|
282
|
-
return rb_ary_entry(ary, 1);
|
283
|
-
}
|
284
|
-
|
285
|
-
static VALUE rb_gsl_odeiv_system_dimension(VALUE obj)
|
286
|
-
{
|
287
|
-
gsl_odeiv_system *sys = NULL;
|
288
|
-
Data_Get_Struct(obj, gsl_odeiv_system, sys);
|
289
|
-
return INT2FIX(sys->dimension);
|
290
|
-
}
|
291
|
-
|
292
|
-
static const gsl_odeiv_step_type* rb_gsl_odeiv_step_type_get(VALUE tt);
|
293
|
-
|
294
|
-
static gsl_odeiv_step* make_step(VALUE tt, VALUE dim);
|
295
|
-
static VALUE rb_gsl_odeiv_step_new(int argc, VALUE *argv, VALUE klass)
|
296
|
-
{
|
297
|
-
VALUE obj;
|
298
|
-
gsl_odeiv_step *s = NULL;
|
299
|
-
switch (argc) {
|
300
|
-
case 1:
|
301
|
-
CHECK_FIXNUM(argv[0]);
|
302
|
-
s = make_step(INT2FIX(GSL_ODEIV_STEP_RKF45), argv[0]);
|
303
|
-
break;
|
304
|
-
case 2:
|
305
|
-
CHECK_FIXNUM(argv[1]);
|
306
|
-
s = make_step(argv[0], argv[1]);
|
307
|
-
break;
|
308
|
-
default:
|
309
|
-
rb_raise(rb_eArgError, "wrong number of arguments (%d for 1 or 2)", argc);
|
310
|
-
}
|
311
|
-
obj = Data_Wrap_Struct(klass, 0, gsl_odeiv_step_free, s);
|
312
|
-
return obj;
|
313
|
-
}
|
314
|
-
|
315
|
-
static gsl_odeiv_step* make_step(VALUE tt, VALUE dim)
|
316
|
-
{
|
317
|
-
const gsl_odeiv_step_type *T;
|
318
|
-
T = rb_gsl_odeiv_step_type_get(tt);
|
319
|
-
return gsl_odeiv_step_alloc(T, FIX2INT(dim));
|
320
|
-
}
|
321
|
-
|
322
|
-
static const gsl_odeiv_step_type* rb_gsl_odeiv_step_type_get(VALUE tt)
|
323
|
-
{
|
324
|
-
const gsl_odeiv_step_type *T;
|
325
|
-
int type;
|
326
|
-
char name[64];
|
327
|
-
switch (TYPE(tt)) {
|
328
|
-
case T_FIXNUM:
|
329
|
-
type = FIX2INT(tt);
|
330
|
-
switch (type) {
|
331
|
-
case GSL_ODEIV_STEP_RK2: T = gsl_odeiv_step_rk2; break;
|
332
|
-
case GSL_ODEIV_STEP_RK4: T = gsl_odeiv_step_rk4; break;
|
333
|
-
case GSL_ODEIV_STEP_RKF45: T = gsl_odeiv_step_rkf45; break;
|
334
|
-
case GSL_ODEIV_STEP_RKCK: T = gsl_odeiv_step_rkck; break;
|
335
|
-
case GSL_ODEIV_STEP_RK8PD: T = gsl_odeiv_step_rk8pd; break;
|
336
|
-
case GSL_ODEIV_STEP_RK2IMP: T = gsl_odeiv_step_rk2imp; break;
|
337
|
-
case GSL_ODEIV_STEP_RK4IMP: T = gsl_odeiv_step_rk4imp; break;
|
338
|
-
case GSL_ODEIV_STEP_BSIMP: T = gsl_odeiv_step_bsimp; break;
|
339
|
-
case GSL_ODEIV_STEP_GEAR1: T = gsl_odeiv_step_gear1; break;
|
340
|
-
case GSL_ODEIV_STEP_GEAR2: T = gsl_odeiv_step_gear2; break;
|
341
|
-
case GSL_ODEIV_STEP_RK2SIMP: T = gsl_odeiv_step_rk2simp; break;
|
342
|
-
default:
|
343
|
-
rb_raise(rb_eArgError, "wrong argument type (Fixnum expected)");
|
344
|
-
break;
|
345
|
-
}
|
346
|
-
break;
|
347
|
-
case T_STRING:
|
348
|
-
strcpy(name, STR2CSTR(tt));
|
349
|
-
if (str_tail_grep(name, "rk2") == 0) T = gsl_odeiv_step_rk2;
|
350
|
-
else if (str_tail_grep(name, "rk4") == 0) T = gsl_odeiv_step_rk4;
|
351
|
-
else if (str_tail_grep(name, "rkf45") == 0) T = gsl_odeiv_step_rkf45;
|
352
|
-
else if (str_tail_grep(name, "rkck") == 0) T = gsl_odeiv_step_rkck;
|
353
|
-
else if (str_tail_grep(name, "rk8pd") == 0) T = gsl_odeiv_step_rk8pd;
|
354
|
-
else if (str_tail_grep(name, "rk2imp") == 0) T = gsl_odeiv_step_rk2imp;
|
355
|
-
else if (str_tail_grep(name, "rk4imp") == 0) T = gsl_odeiv_step_rk4imp;
|
356
|
-
else if (str_tail_grep(name, "bsimp") == 0) T = gsl_odeiv_step_bsimp;
|
357
|
-
else if (str_tail_grep(name, "gear1") == 0) T = gsl_odeiv_step_gear1;
|
358
|
-
else if (str_tail_grep(name, "gear2") == 0) T = gsl_odeiv_step_gear2;
|
359
|
-
else if (str_tail_grep(name, "rk2simp") == 0) T = gsl_odeiv_step_rk2simp;
|
360
|
-
else {
|
361
|
-
rb_raise(rb_eArgError, "wrong argument type %s", name);
|
362
|
-
}
|
363
|
-
break;
|
364
|
-
default:
|
365
|
-
rb_raise(rb_eArgError, "wrong argument type %s (String or Fixnum expected)",
|
366
|
-
rb_class2name(CLASS_OF(tt)));
|
367
|
-
break;
|
368
|
-
}
|
369
|
-
return T;
|
370
|
-
}
|
371
|
-
|
372
|
-
static VALUE rb_gsl_odeiv_step_reset(VALUE obj)
|
373
|
-
{
|
374
|
-
gsl_odeiv_step *s = NULL;
|
375
|
-
Data_Get_Struct(obj, gsl_odeiv_step, s);
|
376
|
-
return INT2FIX(gsl_odeiv_step_reset(s));
|
377
|
-
}
|
378
|
-
|
379
|
-
static VALUE rb_gsl_odeiv_step_name(VALUE obj)
|
380
|
-
{
|
381
|
-
gsl_odeiv_step *s = NULL;
|
382
|
-
Data_Get_Struct(obj, gsl_odeiv_step, s);
|
383
|
-
return rb_str_new2(gsl_odeiv_step_name(s));
|
384
|
-
}
|
385
|
-
|
386
|
-
static VALUE rb_gsl_odeiv_step_order(VALUE obj)
|
387
|
-
{
|
388
|
-
gsl_odeiv_step *s = NULL;
|
389
|
-
Data_Get_Struct(obj, gsl_odeiv_step, s);
|
390
|
-
return INT2FIX(gsl_odeiv_step_order(s));
|
391
|
-
}
|
392
|
-
|
393
|
-
static VALUE rb_gsl_odeiv_step_dimension(VALUE obj)
|
394
|
-
{
|
395
|
-
gsl_odeiv_step *s = NULL;
|
396
|
-
Data_Get_Struct(obj, gsl_odeiv_step, s);
|
397
|
-
return INT2FIX(s->dimension);
|
398
|
-
}
|
399
|
-
|
400
|
-
static VALUE rb_gsl_odeiv_step_apply(int argc, VALUE *argv, VALUE obj)
|
401
|
-
{
|
402
|
-
gsl_odeiv_step *s = NULL;
|
403
|
-
gsl_odeiv_system *sys = NULL;
|
404
|
-
gsl_vector *y = NULL, *yerr = NULL;
|
405
|
-
gsl_vector *vtmp1 = NULL, *vtmp2 = NULL;
|
406
|
-
double *dydt_in = NULL, *dydt_out = NULL;
|
407
|
-
double t, h;
|
408
|
-
switch (argc) {
|
409
|
-
case 5:
|
410
|
-
break;
|
411
|
-
case 7:
|
412
|
-
if (VECTOR_P(argv[5])) {
|
413
|
-
Data_Get_Struct(argv[5], gsl_vector, vtmp2);
|
414
|
-
if (vtmp2) dydt_out = vtmp2->data;
|
415
|
-
}
|
416
|
-
/* no break */
|
417
|
-
case 6:
|
418
|
-
if (VECTOR_P(argv[4])) {
|
419
|
-
Data_Get_Struct(argv[4], gsl_vector, vtmp1);
|
420
|
-
if (vtmp1) dydt_in = vtmp1->data;
|
421
|
-
}
|
422
|
-
break;
|
423
|
-
default:
|
424
|
-
rb_raise(rb_eArgError, "wrong number of arguments (%d for 5, 6 or 7)", argc);
|
425
|
-
break;
|
426
|
-
}
|
427
|
-
Need_Float(argv[0]); Need_Float(argv[1]);
|
428
|
-
CHECK_VECTOR(argv[2]); CHECK_VECTOR(argv[3]);
|
429
|
-
CHECK_SYSTEM(argv[argc-1]);
|
430
|
-
Data_Get_Struct(obj, gsl_odeiv_step, s);
|
431
|
-
t = NUM2DBL(argv[0]);
|
432
|
-
h = NUM2DBL(argv[1]);
|
433
|
-
Data_Get_Struct(argv[2], gsl_vector, y);
|
434
|
-
Data_Get_Struct(argv[3], gsl_vector, yerr);
|
435
|
-
Data_Get_Struct(argv[argc-1], gsl_odeiv_system, sys);
|
436
|
-
return INT2FIX(gsl_odeiv_step_apply(s, t, h, y->data, yerr->data,
|
437
|
-
dydt_in, dydt_out, sys));
|
438
|
-
}
|
439
|
-
|
440
|
-
static VALUE rb_gsl_odeiv_step_info(VALUE obj)
|
441
|
-
{
|
442
|
-
gsl_odeiv_step *s;
|
443
|
-
char buf[256];
|
444
|
-
Data_Get_Struct(obj, gsl_odeiv_step, s);
|
445
|
-
sprintf(buf, "Class: %s\n", rb_class2name(CLASS_OF(obj)));
|
446
|
-
sprintf(buf, "%sSuperClass: %s\n", buf, rb_class2name(RCLASS_SUPER(CLASS_OF(obj))));
|
447
|
-
sprintf(buf, "%sType: %s\n", buf, gsl_odeiv_step_name(s));
|
448
|
-
sprintf(buf, "%sDimension: %d\n", buf, (int) s->dimension);
|
449
|
-
return rb_str_new2(buf);
|
450
|
-
}
|
451
|
-
|
452
|
-
static gsl_odeiv_control* make_control_standard(VALUE epsabs,
|
453
|
-
VALUE epsrel,
|
454
|
-
VALUE ay, VALUE adydt);
|
455
|
-
static gsl_odeiv_control* make_control_y(VALUE epsabs, VALUE epsrel);
|
456
|
-
static VALUE rb_gsl_odeiv_control_standard_new(VALUE klass, VALUE epsabs,
|
457
|
-
VALUE epsrel,
|
458
|
-
VALUE ay, VALUE adydt)
|
459
|
-
{
|
460
|
-
gsl_odeiv_control *c = NULL;
|
461
|
-
c = make_control_standard(epsabs, epsrel, ay, adydt);
|
462
|
-
return Data_Wrap_Struct(klass, 0, gsl_odeiv_control_free, c);
|
463
|
-
}
|
464
|
-
|
465
|
-
static gsl_odeiv_control* make_control_standard(VALUE epsabs,
|
466
|
-
VALUE epsrel,
|
467
|
-
VALUE ay, VALUE adydt)
|
468
|
-
{
|
469
|
-
Need_Float(epsabs); Need_Float(epsrel);
|
470
|
-
Need_Float(ay); Need_Float(adydt);
|
471
|
-
return gsl_odeiv_control_standard_new(NUM2DBL(epsabs), NUM2DBL(epsrel),
|
472
|
-
NUM2DBL(ay), NUM2DBL(adydt));
|
473
|
-
}
|
474
|
-
|
475
|
-
static gsl_odeiv_control* make_control_y(VALUE epsabs, VALUE epsrel)
|
476
|
-
{
|
477
|
-
Need_Float(epsabs); Need_Float(epsrel);
|
478
|
-
return gsl_odeiv_control_y_new(NUM2DBL(epsabs), NUM2DBL(epsrel));
|
479
|
-
}
|
480
|
-
|
481
|
-
static VALUE rb_gsl_odeiv_control_y_new(VALUE klass, VALUE epsabs,
|
482
|
-
VALUE epsrel)
|
483
|
-
{
|
484
|
-
gsl_odeiv_control *c = NULL;
|
485
|
-
c = make_control_y(epsabs, epsrel);
|
486
|
-
return Data_Wrap_Struct(klass, 0, gsl_odeiv_control_free, c);
|
487
|
-
}
|
488
|
-
|
489
|
-
static VALUE rb_gsl_odeiv_control_yp_new(VALUE klass, VALUE epsabs,
|
490
|
-
VALUE epsrel)
|
491
|
-
{
|
492
|
-
gsl_odeiv_control *c = NULL;
|
493
|
-
Need_Float(epsabs); Need_Float(epsrel);
|
494
|
-
c = gsl_odeiv_control_yp_new(NUM2DBL(epsabs), NUM2DBL(epsrel));
|
495
|
-
return Data_Wrap_Struct(klass, 0, gsl_odeiv_control_free, c);
|
496
|
-
}
|
497
|
-
|
498
|
-
static VALUE rb_gsl_odeiv_control_scaled_new(VALUE klass, VALUE epsabs,
|
499
|
-
VALUE epsrel,
|
500
|
-
VALUE ay, VALUE adydt,
|
501
|
-
VALUE sc, VALUE dd)
|
502
|
-
{
|
503
|
-
gsl_odeiv_control *c = NULL;
|
504
|
-
gsl_vector *v = NULL;
|
505
|
-
Need_Float(epsabs); Need_Float(epsrel);
|
506
|
-
Need_Float(ay); Need_Float(adydt);
|
507
|
-
CHECK_FIXNUM(dd);
|
508
|
-
CHECK_VECTOR(sc);
|
509
|
-
Data_Get_Struct(sc, gsl_vector, v);
|
510
|
-
c = gsl_odeiv_control_scaled_new(NUM2DBL(epsabs), NUM2DBL(epsrel),
|
511
|
-
NUM2DBL(ay), NUM2DBL(adydt), v->data,
|
512
|
-
FIX2INT(dd));
|
513
|
-
return Data_Wrap_Struct(klass, 0, gsl_odeiv_control_free, c);
|
514
|
-
}
|
515
|
-
|
516
|
-
static VALUE rb_gsl_odeiv_control_init(VALUE obj, VALUE epsabs,
|
517
|
-
VALUE epsrel,
|
518
|
-
VALUE ay, VALUE adydt)
|
519
|
-
{
|
520
|
-
gsl_odeiv_control *c = NULL;
|
521
|
-
Need_Float(epsabs); Need_Float(epsrel);
|
522
|
-
Need_Float(ay); Need_Float(adydt);
|
523
|
-
Data_Get_Struct(obj, gsl_odeiv_control, c);
|
524
|
-
gsl_odeiv_control_init(c, NUM2DBL(epsabs), NUM2DBL(epsrel),
|
525
|
-
NUM2DBL(ay), NUM2DBL(adydt));
|
526
|
-
return obj;
|
527
|
-
}
|
528
|
-
|
529
|
-
static VALUE rb_gsl_odeiv_control_name(VALUE obj)
|
530
|
-
{
|
531
|
-
gsl_odeiv_control *c = NULL;
|
532
|
-
Data_Get_Struct(obj, gsl_odeiv_control, c);
|
533
|
-
return rb_str_new2(gsl_odeiv_control_name(c));
|
534
|
-
}
|
535
|
-
|
536
|
-
static VALUE rb_gsl_odeiv_control_hadjust(VALUE obj, VALUE ss, VALUE yy0,
|
537
|
-
VALUE yyerr, VALUE ddydt, VALUE hh)
|
538
|
-
{
|
539
|
-
gsl_odeiv_control *c = NULL;
|
540
|
-
gsl_odeiv_step *s = NULL;
|
541
|
-
gsl_vector *y0 = NULL, *yerr = NULL, *dydt = NULL;
|
542
|
-
double h;
|
543
|
-
int status;
|
544
|
-
CHECK_VECTOR(yy0);
|
545
|
-
CHECK_VECTOR(yyerr);
|
546
|
-
CHECK_VECTOR(ddydt);
|
547
|
-
Data_Get_Struct(obj, gsl_odeiv_control, c);
|
548
|
-
Data_Get_Struct(ss, gsl_odeiv_step, s);
|
549
|
-
Data_Get_Struct(yy0, gsl_vector, y0);
|
550
|
-
Data_Get_Struct(yyerr, gsl_vector, yerr);
|
551
|
-
Data_Get_Struct(ddydt, gsl_vector, dydt);
|
552
|
-
h = NUM2DBL(hh);
|
553
|
-
status = gsl_odeiv_control_hadjust(c, s, y0->data, yerr->data,
|
554
|
-
dydt->data, &h);
|
555
|
-
return rb_ary_new3(2, rb_float_new(h), INT2FIX(status));
|
556
|
-
}
|
557
|
-
|
558
|
-
static gsl_odeiv_evolve* make_evolve(VALUE dim);
|
559
|
-
static VALUE rb_gsl_odeiv_evolve_new(VALUE klass, VALUE dim)
|
560
|
-
{
|
561
|
-
gsl_odeiv_evolve *e = NULL;
|
562
|
-
e = make_evolve(dim);
|
563
|
-
return Data_Wrap_Struct(klass, 0, gsl_odeiv_evolve_free, e);
|
564
|
-
}
|
565
|
-
|
566
|
-
static gsl_odeiv_evolve* make_evolve(VALUE dim)
|
567
|
-
{
|
568
|
-
return gsl_odeiv_evolve_alloc(FIX2INT(dim));
|
569
|
-
}
|
570
|
-
|
571
|
-
static VALUE rb_gsl_odeiv_evolve_reset(VALUE obj)
|
572
|
-
{
|
573
|
-
gsl_odeiv_evolve *e = NULL;
|
574
|
-
Data_Get_Struct(obj, gsl_odeiv_evolve, e);
|
575
|
-
return INT2FIX(gsl_odeiv_evolve_reset(e));
|
576
|
-
}
|
577
|
-
|
578
|
-
static VALUE rb_gsl_odeiv_evolve_count(VALUE obj)
|
579
|
-
{
|
580
|
-
gsl_odeiv_evolve *e = NULL;
|
581
|
-
Data_Get_Struct(obj, gsl_odeiv_evolve, e);
|
582
|
-
return INT2FIX(e->count);
|
583
|
-
}
|
584
|
-
|
585
|
-
static VALUE rb_gsl_odeiv_evolve_dimension(VALUE obj)
|
586
|
-
{
|
587
|
-
gsl_odeiv_evolve *e = NULL;
|
588
|
-
Data_Get_Struct(obj, gsl_odeiv_evolve, e);
|
589
|
-
return INT2FIX(e->dimension);
|
590
|
-
}
|
591
|
-
|
592
|
-
static VALUE rb_gsl_odeiv_evolve_failed_steps(VALUE obj)
|
593
|
-
{
|
594
|
-
gsl_odeiv_evolve *e = NULL;
|
595
|
-
Data_Get_Struct(obj, gsl_odeiv_evolve, e);
|
596
|
-
return INT2FIX(e->failed_steps);
|
597
|
-
}
|
598
|
-
|
599
|
-
static VALUE rb_gsl_odeiv_evolve_last_step(VALUE obj)
|
600
|
-
{
|
601
|
-
gsl_odeiv_evolve *e = NULL;
|
602
|
-
Data_Get_Struct(obj, gsl_odeiv_evolve, e);
|
603
|
-
return rb_float_new(e->last_step);
|
604
|
-
}
|
605
|
-
|
606
|
-
static VALUE rb_gsl_odeiv_evolve_y0(VALUE obj)
|
607
|
-
{
|
608
|
-
gsl_odeiv_evolve *e = NULL;
|
609
|
-
gsl_vector_view *v = NULL;
|
610
|
-
Data_Get_Struct(obj, gsl_odeiv_evolve, e);
|
611
|
-
v = gsl_vector_view_alloc();
|
612
|
-
v->vector.data = e->y0;
|
613
|
-
v->vector.size = e->dimension;
|
614
|
-
v->vector.stride = 1;
|
615
|
-
v->vector.owner = 0;
|
616
|
-
return Data_Wrap_Struct(cgsl_vector_view_ro, 0, gsl_vector_view_free, v);
|
617
|
-
}
|
618
|
-
|
619
|
-
static VALUE rb_gsl_odeiv_evolve_yerr(VALUE obj)
|
620
|
-
{
|
621
|
-
gsl_odeiv_evolve *e = NULL;
|
622
|
-
gsl_vector_view *v = NULL;
|
623
|
-
Data_Get_Struct(obj, gsl_odeiv_evolve, e);
|
624
|
-
v = gsl_vector_view_alloc();
|
625
|
-
v->vector.data = e->yerr;
|
626
|
-
v->vector.size = e->dimension;
|
627
|
-
v->vector.stride = 1;
|
628
|
-
v->vector.owner = 0;
|
629
|
-
return Data_Wrap_Struct(cgsl_vector_view_ro, 0, gsl_vector_view_free, v);
|
630
|
-
}
|
631
|
-
|
632
|
-
static VALUE rb_gsl_odeiv_evolve_apply(VALUE obj, VALUE cc, VALUE ss, VALUE sss,
|
633
|
-
VALUE tt, VALUE tt1, VALUE hh, VALUE yy)
|
634
|
-
{
|
635
|
-
gsl_odeiv_evolve *e = NULL;
|
636
|
-
gsl_odeiv_control *c = NULL;
|
637
|
-
gsl_odeiv_step *s = NULL;
|
638
|
-
gsl_odeiv_system *sys = NULL;
|
639
|
-
gsl_vector *y = NULL;
|
640
|
-
double t, h;
|
641
|
-
int status;
|
642
|
-
CHECK_STEP(ss); CHECK_SYSTEM(sss);
|
643
|
-
CHECK_VECTOR(yy);
|
644
|
-
Data_Get_Struct(obj, gsl_odeiv_evolve, e);
|
645
|
-
if (NIL_P(cc)) {
|
646
|
-
c = NULL;
|
647
|
-
} else {
|
648
|
-
CHECK_CONTROL(cc);
|
649
|
-
Data_Get_Struct(cc, gsl_odeiv_control, c);
|
650
|
-
}
|
651
|
-
Data_Get_Struct(ss, gsl_odeiv_step, s);
|
652
|
-
Data_Get_Struct(sss, gsl_odeiv_system, sys);
|
653
|
-
Data_Get_Struct(yy, gsl_vector, y);
|
654
|
-
/* if (TYPE(tt) != T_FLOAT) rb_raise(rb_eTypeError, "argument 4 Float expected");
|
655
|
-
if (TYPE(hh) != T_FLOAT) rb_raise(rb_eTypeError, "argument 6 Float expected");*/
|
656
|
-
t = NUM2DBL(tt);
|
657
|
-
h = NUM2DBL(hh);
|
658
|
-
status = gsl_odeiv_evolve_apply(e, c, s, sys, &t, NUM2DBL(tt1), &h, y->data);
|
659
|
-
/* RFLOAT(tt)->value = t;
|
660
|
-
RFLOAT(hh)->value = h;*/
|
661
|
-
return rb_ary_new3(3, rb_float_new(t), rb_float_new(h), INT2FIX(status));
|
662
|
-
}
|
663
|
-
|
664
|
-
static void rb_gsl_odeiv_solver_free(gsl_odeiv_solver *gde);
|
665
|
-
static void gsl_odeiv_solver_mark(gsl_odeiv_solver *gos);
|
666
|
-
static VALUE rb_gsl_odeiv_solver_new(int argc, VALUE *argv, VALUE klass)
|
667
|
-
{
|
668
|
-
gsl_odeiv_solver *gos = NULL;
|
669
|
-
VALUE epsabs, epsrel, ay, adydt;
|
670
|
-
VALUE dim;
|
671
|
-
if (argc < 4) rb_raise(rb_eArgError, "too few arguments");
|
672
|
-
Check_Type(argv[1], T_ARRAY);
|
673
|
-
CHECK_PROC(argv[2]);
|
674
|
-
if (rb_obj_is_kind_of(argv[3], rb_cProc) || NIL_P(argv[3])) {
|
675
|
-
dim = argv[4];
|
676
|
-
} else {
|
677
|
-
dim = argv[3];
|
678
|
-
}
|
679
|
-
gos = ALLOC(gsl_odeiv_solver);
|
680
|
-
gos->s = make_step(argv[0], dim);
|
681
|
-
// switch (RARRAY(argv[1])->len) {
|
682
|
-
switch (RARRAY_LEN(argv[1])) {
|
683
|
-
case 2:
|
684
|
-
epsabs = rb_ary_entry(argv[1], 0);
|
685
|
-
epsrel = rb_ary_entry(argv[1], 1);
|
686
|
-
gos->c = make_control_y(epsabs, epsrel);
|
687
|
-
break;
|
688
|
-
case 4:
|
689
|
-
epsabs = rb_ary_entry(argv[1], 0);
|
690
|
-
epsrel = rb_ary_entry(argv[1], 1);
|
691
|
-
ay = rb_ary_entry(argv[1], 2);
|
692
|
-
adydt = rb_ary_entry(argv[1], 3);
|
693
|
-
gos->c = make_control_standard(epsabs, epsrel, ay, adydt);
|
694
|
-
break;
|
695
|
-
default:
|
696
|
-
rb_raise(rb_eArgError, "size of the argument 1 must be 2 or 4");
|
697
|
-
break;
|
698
|
-
}
|
699
|
-
gos->sys = make_sys(argc - 2, argv + 2);
|
700
|
-
gos->e = make_evolve(dim);
|
701
|
-
return Data_Wrap_Struct(klass, gsl_odeiv_solver_mark, rb_gsl_odeiv_solver_free, gos);
|
702
|
-
// return Data_Wrap_Struct(klass, 0, rb_gsl_odeiv_solver_free, gos);
|
703
|
-
}
|
704
|
-
|
705
|
-
static void gsl_odeiv_solver_mark(gsl_odeiv_solver *gos)
|
706
|
-
{
|
707
|
-
rb_gc_mark((VALUE) gos->sys->params);
|
708
|
-
}
|
709
|
-
|
710
|
-
static VALUE rb_gsl_odeiv_solver_evolve(VALUE obj)
|
711
|
-
{
|
712
|
-
gsl_odeiv_solver *gos = NULL;
|
713
|
-
Data_Get_Struct(obj, gsl_odeiv_solver, gos);
|
714
|
-
return Data_Wrap_Struct(cgsl_odeiv_evolve, 0, NULL, gos->e);
|
715
|
-
}
|
716
|
-
|
717
|
-
static VALUE rb_gsl_odeiv_solver_set_evolve(VALUE obj, VALUE ee)
|
718
|
-
{
|
719
|
-
gsl_odeiv_solver *gos = NULL;
|
720
|
-
gsl_odeiv_evolve *e = NULL;
|
721
|
-
CHECK_EVOLVE(ee);
|
722
|
-
Data_Get_Struct(obj, gsl_odeiv_solver, gos);
|
723
|
-
Data_Get_Struct(ee, gsl_odeiv_evolve, e);
|
724
|
-
gos->e = e;
|
725
|
-
return obj;
|
726
|
-
}
|
727
|
-
|
728
|
-
static VALUE rb_gsl_odeiv_solver_step(VALUE obj)
|
729
|
-
{
|
730
|
-
gsl_odeiv_solver *gos = NULL;
|
731
|
-
Data_Get_Struct(obj, gsl_odeiv_solver, gos);
|
732
|
-
return Data_Wrap_Struct(cgsl_odeiv_step, 0, NULL,gos->s);
|
733
|
-
}
|
734
|
-
|
735
|
-
static VALUE rb_gsl_odeiv_solver_set_step(VALUE obj, VALUE ss)
|
736
|
-
{
|
737
|
-
gsl_odeiv_solver *gos = NULL;
|
738
|
-
gsl_odeiv_step *s = NULL;
|
739
|
-
CHECK_STEP(ss);
|
740
|
-
Data_Get_Struct(obj, gsl_odeiv_solver, gos);
|
741
|
-
Data_Get_Struct(ss, gsl_odeiv_step, s);
|
742
|
-
gos->s = s;
|
743
|
-
return obj;
|
744
|
-
}
|
745
|
-
|
746
|
-
static VALUE rb_gsl_odeiv_solver_control(VALUE obj)
|
747
|
-
{
|
748
|
-
gsl_odeiv_solver *gos = NULL;
|
749
|
-
Data_Get_Struct(obj, gsl_odeiv_solver, gos);
|
750
|
-
return Data_Wrap_Struct(cgsl_odeiv_control, 0, NULL, gos->c);
|
751
|
-
}
|
752
|
-
|
753
|
-
static VALUE rb_gsl_odeiv_solver_set_control(VALUE obj, VALUE cc)
|
754
|
-
{
|
755
|
-
gsl_odeiv_solver *gos = NULL;
|
756
|
-
gsl_odeiv_control *c = NULL;
|
757
|
-
CHECK_CONTROL(cc);
|
758
|
-
Data_Get_Struct(obj, gsl_odeiv_solver, gos);
|
759
|
-
Data_Get_Struct(cc, gsl_odeiv_control, c);
|
760
|
-
gos->c = c;
|
761
|
-
return obj;
|
762
|
-
}
|
763
|
-
|
764
|
-
static VALUE rb_gsl_odeiv_solver_sys(VALUE obj)
|
765
|
-
{
|
766
|
-
gsl_odeiv_solver *gos = NULL;
|
767
|
-
Data_Get_Struct(obj, gsl_odeiv_solver, gos);
|
768
|
-
return Data_Wrap_Struct(cgsl_odeiv_system, 0, NULL, gos->sys);
|
769
|
-
}
|
770
|
-
|
771
|
-
static VALUE rb_gsl_odeiv_solver_set_sys(VALUE obj, VALUE ss)
|
772
|
-
{
|
773
|
-
gsl_odeiv_solver *gos = NULL;
|
774
|
-
gsl_odeiv_system *sys = NULL;
|
775
|
-
CHECK_SYSTEM(ss);
|
776
|
-
Data_Get_Struct(obj, gsl_odeiv_solver, gos);
|
777
|
-
Data_Get_Struct(ss, gsl_odeiv_system, sys);
|
778
|
-
gos->sys = sys;
|
779
|
-
return obj;
|
780
|
-
}
|
781
|
-
|
782
|
-
static VALUE rb_gsl_odeiv_solver_apply(VALUE obj, VALUE tt, VALUE tt1, VALUE hh,
|
783
|
-
VALUE yy)
|
784
|
-
{
|
785
|
-
gsl_odeiv_solver *gos = NULL;
|
786
|
-
gsl_vector *y = NULL;
|
787
|
-
double t, h;
|
788
|
-
int status;
|
789
|
-
CHECK_VECTOR(yy);
|
790
|
-
Need_Float(tt1);
|
791
|
-
Data_Get_Struct(obj, gsl_odeiv_solver, gos);
|
792
|
-
Data_Get_Struct(yy, gsl_vector, y);
|
793
|
-
/* if (TYPE(tt) != T_FLOAT) rb_raise(rb_eTypeError, "argument 0 Float expected");
|
794
|
-
if (TYPE(hh) != T_FLOAT) rb_raise(rb_eTypeError, "argument 2 Float expected");*/
|
795
|
-
t = NUM2DBL(tt);
|
796
|
-
h = NUM2DBL(hh);
|
797
|
-
status = gsl_odeiv_evolve_apply(gos->e, gos->c, gos->s,
|
798
|
-
gos->sys, &t, NUM2DBL(tt1), &h, y->data);
|
799
|
-
/* RFLOAT(tt)->value = t;
|
800
|
-
RFLOAT(hh)->value = h;
|
801
|
-
return INT2FIX(status);*/
|
802
|
-
return rb_ary_new3(3, rb_float_new(t), rb_float_new(h), INT2FIX(status));
|
803
|
-
}
|
804
|
-
|
805
|
-
static void rb_gsl_odeiv_solver_free(gsl_odeiv_solver *gos)
|
806
|
-
{
|
807
|
-
free((gsl_odeiv_solver *) gos);
|
808
|
-
}
|
809
|
-
|
810
|
-
static VALUE rb_gsl_odeiv_solver_reset(VALUE obj)
|
811
|
-
{
|
812
|
-
gsl_odeiv_solver *gos = NULL;
|
813
|
-
Data_Get_Struct(obj, gsl_odeiv_solver, gos);
|
814
|
-
gsl_odeiv_step_reset(gos->s);
|
815
|
-
gsl_odeiv_evolve_reset(gos->e);
|
816
|
-
return obj;
|
817
|
-
}
|
818
|
-
|
819
|
-
static VALUE rb_gsl_odeiv_solver_dim(VALUE obj)
|
820
|
-
{
|
821
|
-
gsl_odeiv_solver *gos = NULL;
|
822
|
-
Data_Get_Struct(obj, gsl_odeiv_solver, gos);
|
823
|
-
return INT2FIX(gos->sys->dimension);
|
824
|
-
}
|
825
|
-
|
826
|
-
static VALUE rb_gsl_odeiv_solver_set_params(int argc, VALUE *argv, VALUE obj)
|
827
|
-
{
|
828
|
-
gsl_odeiv_solver *gos = NULL;
|
829
|
-
Data_Get_Struct(obj, gsl_odeiv_solver, gos);
|
830
|
-
rb_gsl_odeiv_system_set_params(argc, argv,
|
831
|
-
Data_Wrap_Struct(cgsl_odeiv_system, 0, NULL, gos->sys));
|
832
|
-
return obj;
|
833
|
-
}
|
834
|
-
|
835
|
-
static VALUE rb_gsl_odeiv_solver_params(VALUE obj)
|
836
|
-
{
|
837
|
-
VALUE ary;
|
838
|
-
gsl_odeiv_solver *solver = NULL;
|
839
|
-
Data_Get_Struct(obj, gsl_odeiv_solver, solver);
|
840
|
-
ary = (VALUE) solver->sys->params;
|
841
|
-
return rb_ary_entry(ary, 3);
|
842
|
-
}
|
843
|
-
|
844
|
-
void Init_gsl_odeiv(VALUE module)
|
845
|
-
{
|
846
|
-
VALUE mgsl_odeiv;
|
847
|
-
mgsl_odeiv = rb_define_module_under(module, "Odeiv");
|
848
|
-
rb_define_const(mgsl_odeiv, "HADJ_DEC", INT2FIX(GSL_ODEIV_HADJ_DEC));
|
849
|
-
rb_define_const(mgsl_odeiv, "HADJ_INC", INT2FIX(GSL_ODEIV_HADJ_INC));
|
850
|
-
rb_define_const(mgsl_odeiv, "HADJ_NIL", INT2FIX(GSL_ODEIV_HADJ_NIL));
|
851
|
-
cgsl_odeiv_step = rb_define_class_under(mgsl_odeiv, "Step",
|
852
|
-
cGSL_Object);
|
853
|
-
rb_define_singleton_method(cgsl_odeiv_step, "alloc", rb_gsl_odeiv_step_new, -1);
|
854
|
-
|
855
|
-
/*****/
|
856
|
-
rb_define_const(cgsl_odeiv_step, "RK2", INT2FIX(GSL_ODEIV_STEP_RK2));
|
857
|
-
rb_define_const(cgsl_odeiv_step, "RK4", INT2FIX(GSL_ODEIV_STEP_RK4));
|
858
|
-
rb_define_const(cgsl_odeiv_step, "RKF45", INT2FIX(GSL_ODEIV_STEP_RKF45));
|
859
|
-
rb_define_const(cgsl_odeiv_step, "RKCK", INT2FIX(GSL_ODEIV_STEP_RKCK));
|
860
|
-
rb_define_const(cgsl_odeiv_step, "RK8PD", INT2FIX(GSL_ODEIV_STEP_RK8PD));
|
861
|
-
rb_define_const(cgsl_odeiv_step, "RK2IMP", INT2FIX(GSL_ODEIV_STEP_RK2IMP));
|
862
|
-
rb_define_const(cgsl_odeiv_step, "RK4IMP", INT2FIX(GSL_ODEIV_STEP_RK4IMP));
|
863
|
-
rb_define_const(cgsl_odeiv_step, "BSIMP", INT2FIX(GSL_ODEIV_STEP_BSIMP));
|
864
|
-
rb_define_const(cgsl_odeiv_step, "GEAR1", INT2FIX(GSL_ODEIV_STEP_GEAR1));
|
865
|
-
rb_define_const(cgsl_odeiv_step, "GEAR2", INT2FIX(GSL_ODEIV_STEP_GEAR2));
|
866
|
-
rb_define_const(cgsl_odeiv_step, "RK2SIMP", INT2FIX(GSL_ODEIV_STEP_RK2SIMP));
|
867
|
-
/*****/
|
868
|
-
|
869
|
-
rb_define_method(cgsl_odeiv_step, "reset", rb_gsl_odeiv_step_reset, 0);
|
870
|
-
rb_define_method(cgsl_odeiv_step, "name", rb_gsl_odeiv_step_name, 0);
|
871
|
-
rb_define_method(cgsl_odeiv_step, "order", rb_gsl_odeiv_step_order, 0);
|
872
|
-
rb_define_method(cgsl_odeiv_step, "dimension", rb_gsl_odeiv_step_dimension, 0);
|
873
|
-
rb_define_alias(cgsl_odeiv_step, "dim", "dimension");
|
874
|
-
rb_define_method(cgsl_odeiv_step, "apply", rb_gsl_odeiv_step_apply, -1);
|
875
|
-
rb_define_method(cgsl_odeiv_step, "info", rb_gsl_odeiv_step_info, 0);
|
876
|
-
|
877
|
-
/****/
|
878
|
-
|
879
|
-
cgsl_odeiv_control = rb_define_class_under(mgsl_odeiv, "Control",
|
880
|
-
cGSL_Object);
|
881
|
-
rb_define_singleton_method(cgsl_odeiv_control, "alloc", rb_gsl_odeiv_control_standard_new, 4);
|
882
|
-
rb_define_singleton_method(cgsl_odeiv_control, "standard_alloc", rb_gsl_odeiv_control_standard_new, 4);
|
883
|
-
rb_define_singleton_method(cgsl_odeiv_control, "y_new", rb_gsl_odeiv_control_y_new, 2);
|
884
|
-
rb_define_singleton_method(cgsl_odeiv_control, "yp_new", rb_gsl_odeiv_control_yp_new, 2);
|
885
|
-
rb_define_singleton_method(cgsl_odeiv_control, "scaled_alloc", rb_gsl_odeiv_control_scaled_new, 5);
|
886
|
-
|
887
|
-
rb_define_method(cgsl_odeiv_control, "init", rb_gsl_odeiv_control_init, 4);
|
888
|
-
rb_define_method(cgsl_odeiv_control, "name", rb_gsl_odeiv_control_name, 0);
|
889
|
-
rb_define_method(cgsl_odeiv_control, "hadjust", rb_gsl_odeiv_control_hadjust, 5);
|
890
|
-
|
891
|
-
/****/
|
892
|
-
cgsl_odeiv_evolve = rb_define_class_under(mgsl_odeiv, "Evolve",
|
893
|
-
cGSL_Object);
|
894
|
-
rb_define_singleton_method(cgsl_odeiv_evolve, "alloc", rb_gsl_odeiv_evolve_new, 1);
|
895
|
-
|
896
|
-
rb_define_method(cgsl_odeiv_evolve, "reset", rb_gsl_odeiv_evolve_reset, 0);
|
897
|
-
rb_define_method(cgsl_odeiv_evolve, "apply", rb_gsl_odeiv_evolve_apply, 7);
|
898
|
-
rb_define_method(cgsl_odeiv_evolve, "count", rb_gsl_odeiv_evolve_count, 0);
|
899
|
-
rb_define_method(cgsl_odeiv_evolve, "dimension", rb_gsl_odeiv_evolve_dimension, 0);
|
900
|
-
rb_define_method(cgsl_odeiv_evolve, "failed_steps", rb_gsl_odeiv_evolve_failed_steps, 0);
|
901
|
-
rb_define_method(cgsl_odeiv_evolve, "last_step", rb_gsl_odeiv_evolve_last_step, 0);
|
902
|
-
rb_define_method(cgsl_odeiv_evolve, "y0", rb_gsl_odeiv_evolve_y0, 0);
|
903
|
-
rb_define_method(cgsl_odeiv_evolve, "yerr", rb_gsl_odeiv_evolve_yerr, 0);
|
904
|
-
/*****/
|
905
|
-
|
906
|
-
cgsl_odeiv_system = rb_define_class_under(mgsl_odeiv, "System",
|
907
|
-
cGSL_Object);
|
908
|
-
rb_define_singleton_method(cgsl_odeiv_system, "alloc", rb_gsl_odeiv_system_new, -1);
|
909
|
-
rb_define_method(cgsl_odeiv_system, "set", rb_gsl_odeiv_system_set, -1);
|
910
|
-
rb_define_method(cgsl_odeiv_system, "set_params",
|
911
|
-
rb_gsl_odeiv_system_set_params, -1);
|
912
|
-
rb_define_method(cgsl_odeiv_system, "params",
|
913
|
-
rb_gsl_odeiv_system_params, 0);
|
914
|
-
rb_define_method(cgsl_odeiv_system, "function",
|
915
|
-
rb_gsl_odeiv_system_function, 0);
|
916
|
-
rb_define_alias(cgsl_odeiv_system, "func", "function");
|
917
|
-
rb_define_method(cgsl_odeiv_system, "jacobian",
|
918
|
-
rb_gsl_odeiv_system_jacobian, 0);
|
919
|
-
rb_define_alias(cgsl_odeiv_system, "jac", "jacobian");
|
920
|
-
rb_define_method(cgsl_odeiv_system, "dimension", rb_gsl_odeiv_system_dimension, 0);
|
921
|
-
rb_define_alias(cgsl_odeiv_system, "dim", "dimension");
|
922
|
-
|
923
|
-
/*****/
|
924
|
-
cgsl_odeiv_solver = rb_define_class_under(mgsl_odeiv, "Solver", cGSL_Object);
|
925
|
-
rb_define_singleton_method(cgsl_odeiv_solver, "alloc", rb_gsl_odeiv_solver_new, -1);
|
926
|
-
rb_define_method(cgsl_odeiv_solver, "step", rb_gsl_odeiv_solver_step, 0);
|
927
|
-
rb_define_method(cgsl_odeiv_solver, "control", rb_gsl_odeiv_solver_control, 0);
|
928
|
-
rb_define_method(cgsl_odeiv_solver, "evolve", rb_gsl_odeiv_solver_evolve, 0);
|
929
|
-
rb_define_method(cgsl_odeiv_solver, "sys", rb_gsl_odeiv_solver_sys, 0);
|
930
|
-
rb_define_method(cgsl_odeiv_solver, "apply", rb_gsl_odeiv_solver_apply, 4);
|
931
|
-
|
932
|
-
rb_define_method(cgsl_odeiv_solver, "set_evolve", rb_gsl_odeiv_solver_set_evolve, 1);
|
933
|
-
rb_define_method(cgsl_odeiv_solver, "set_step", rb_gsl_odeiv_solver_set_step, 1);
|
934
|
-
rb_define_method(cgsl_odeiv_solver, "set_control", rb_gsl_odeiv_solver_set_control, 1);
|
935
|
-
rb_define_method(cgsl_odeiv_solver, "set_system", rb_gsl_odeiv_solver_set_sys, 1);
|
936
|
-
rb_define_method(cgsl_odeiv_solver, "reset", rb_gsl_odeiv_solver_reset, 0);
|
937
|
-
rb_define_method(cgsl_odeiv_solver, "dim", rb_gsl_odeiv_solver_dim, 0);
|
938
|
-
rb_define_alias(cgsl_odeiv_solver, "dimension", "dim");
|
939
|
-
rb_define_method(cgsl_odeiv_solver, "set_params", rb_gsl_odeiv_solver_set_params, -1);
|
940
|
-
rb_define_method(cgsl_odeiv_solver, "params", rb_gsl_odeiv_solver_params, 0);
|
941
|
-
}
|
942
|
-
|
943
|
-
#undef CHECK_SOLVER
|
944
|
-
#undef CHECK_EVOLVE
|
945
|
-
#undef CHECK_CONTROL
|
946
|
-
#undef CHECK_STEP
|
947
|
-
#undef CHECK_SYSTEM
|