rb-gsl 1.16.0.5 → 1.16.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
@@ -1,245 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
array_complex.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 "include/rb_gsl_complex.h"
|
13
|
-
#include "include/rb_gsl_array.h"
|
14
|
-
|
15
|
-
enum {
|
16
|
-
GSL_COMPLEX_ADD,
|
17
|
-
GSL_COMPLEX_SUB,
|
18
|
-
GSL_COMPLEX_MUL,
|
19
|
-
GSL_COMPLEX_DIV,
|
20
|
-
};
|
21
|
-
|
22
|
-
static VALUE rb_gsl_complex_arithmetics5(int flag, VALUE obj, VALUE bb);
|
23
|
-
|
24
|
-
static VALUE rb_gsl_complex_arithmetics5(int flag, VALUE obj, VALUE bb)
|
25
|
-
{
|
26
|
-
gsl_complex *a = NULL, *b = NULL, *c = NULL, tmp, tmp2;
|
27
|
-
gsl_matrix *m = NULL;
|
28
|
-
gsl_matrix_complex *cm = NULL, *cmself = NULL;
|
29
|
-
gsl_vector *v = NULL;
|
30
|
-
gsl_vector_complex *cv = NULL, *cvnew = NULL;
|
31
|
-
gsl_complex (*func1)(gsl_complex, gsl_complex);
|
32
|
-
// local variables "func2" iand "func3" declared and set, but never used
|
33
|
-
//int (*func2)(gsl_matrix_complex*, const gsl_matrix_complex*);
|
34
|
-
//int (*func3)(gsl_matrix_complex*, const gsl_complex);
|
35
|
-
int flagcm = 0;
|
36
|
-
switch (flag) {
|
37
|
-
case GSL_COMPLEX_ADD:
|
38
|
-
func1 = gsl_complex_add;
|
39
|
-
//func2 = gsl_matrix_complex_add;
|
40
|
-
//func3 = gsl_matrix_complex_add_constant;
|
41
|
-
break;
|
42
|
-
case GSL_COMPLEX_SUB:
|
43
|
-
func1 = gsl_complex_sub;
|
44
|
-
//func2 = gsl_matrix_complex_sub;
|
45
|
-
//func3 = gsl_matrix_complex_add_constant;
|
46
|
-
break;
|
47
|
-
case GSL_COMPLEX_MUL:
|
48
|
-
func1 = gsl_complex_mul;
|
49
|
-
//func2 = gsl_matrix_complex_mul_elements;
|
50
|
-
//func3 = gsl_matrix_complex_scale;
|
51
|
-
break;
|
52
|
-
case GSL_COMPLEX_DIV:
|
53
|
-
func1 = gsl_complex_div;
|
54
|
-
//func2 = gsl_matrix_complex_div_elements;
|
55
|
-
//func3 = gsl_matrix_complex_scale;
|
56
|
-
break;
|
57
|
-
default:
|
58
|
-
rb_raise(rb_eRuntimeError, "undefined operation");
|
59
|
-
}
|
60
|
-
|
61
|
-
CHECK_COMPLEX(obj);
|
62
|
-
Data_Get_Struct(obj, gsl_complex, a);
|
63
|
-
switch (TYPE(bb)) {
|
64
|
-
case T_FLOAT:
|
65
|
-
case T_FIXNUM:
|
66
|
-
case T_BIGNUM:
|
67
|
-
tmp2 = gsl_complex_rect(NUM2DBL(bb), 0.0);
|
68
|
-
b = &tmp2;
|
69
|
-
tmp = (*func1)(*a, *b);
|
70
|
-
switch (flag) {
|
71
|
-
case GSL_COMPLEX_ADD:
|
72
|
-
case GSL_COMPLEX_SUB:
|
73
|
-
case GSL_COMPLEX_MUL:
|
74
|
-
case GSL_COMPLEX_DIV:
|
75
|
-
c = ALLOC(gsl_complex);
|
76
|
-
*c = tmp;
|
77
|
-
return Data_Wrap_Struct(cgsl_complex, 0, free, c);
|
78
|
-
break;
|
79
|
-
}
|
80
|
-
break;
|
81
|
-
default:
|
82
|
-
if (COMPLEX_P(bb)) {
|
83
|
-
Data_Get_Struct(bb, gsl_complex, b);
|
84
|
-
tmp = (*func1)(*a, *b);
|
85
|
-
switch (flag) {
|
86
|
-
case GSL_COMPLEX_ADD:
|
87
|
-
case GSL_COMPLEX_SUB:
|
88
|
-
case GSL_COMPLEX_MUL:
|
89
|
-
case GSL_COMPLEX_DIV:
|
90
|
-
c = ALLOC(gsl_complex);
|
91
|
-
*c = tmp;
|
92
|
-
return Data_Wrap_Struct(cgsl_complex, 0, free, c);
|
93
|
-
break;
|
94
|
-
}
|
95
|
-
} else {
|
96
|
-
if (VECTOR_P(bb)) {
|
97
|
-
Data_Get_Struct(bb, gsl_vector, v);
|
98
|
-
cv = vector_to_complex(v);
|
99
|
-
cvnew = gsl_vector_complex_alloc(v->size);
|
100
|
-
if (cvnew == NULL) rb_raise(rb_eNoMemError, "gsl_vector_complex_alloc failed");
|
101
|
-
gsl_vector_complex_set_all(cvnew, *a);
|
102
|
-
switch (flag) {
|
103
|
-
case GSL_COMPLEX_ADD:
|
104
|
-
gsl_vector_complex_add(cvnew, cv);
|
105
|
-
break;
|
106
|
-
case GSL_COMPLEX_SUB:
|
107
|
-
gsl_vector_complex_sub(cvnew, cv);
|
108
|
-
break;
|
109
|
-
case GSL_COMPLEX_MUL:
|
110
|
-
gsl_vector_complex_mul(cvnew, cv);
|
111
|
-
break;
|
112
|
-
case GSL_COMPLEX_DIV:
|
113
|
-
gsl_vector_complex_add(cvnew, cv);
|
114
|
-
break;
|
115
|
-
}
|
116
|
-
gsl_vector_complex_free(cv);
|
117
|
-
return Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, cvnew);
|
118
|
-
}
|
119
|
-
if (VECTOR_COMPLEX_P(bb)) {
|
120
|
-
Data_Get_Struct(bb, gsl_vector_complex, cv);
|
121
|
-
cvnew = gsl_vector_complex_alloc(v->size);
|
122
|
-
if (cvnew == NULL) rb_raise(rb_eNoMemError, "gsl_vector_complex_alloc failed");
|
123
|
-
gsl_vector_complex_set_all(cvnew, *a);
|
124
|
-
switch (flag) {
|
125
|
-
case GSL_COMPLEX_ADD:
|
126
|
-
gsl_vector_complex_add(cvnew, cv);
|
127
|
-
break;
|
128
|
-
case GSL_COMPLEX_SUB:
|
129
|
-
gsl_vector_complex_sub(cvnew, cv);
|
130
|
-
break;
|
131
|
-
case GSL_COMPLEX_MUL:
|
132
|
-
gsl_vector_complex_mul(cvnew, cv);
|
133
|
-
break;
|
134
|
-
case GSL_COMPLEX_DIV:
|
135
|
-
gsl_vector_complex_add(cvnew, cv);
|
136
|
-
break;
|
137
|
-
}
|
138
|
-
return Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, cvnew);
|
139
|
-
}
|
140
|
-
if (MATRIX_P(bb)) {
|
141
|
-
Data_Get_Struct(bb, gsl_matrix, m);
|
142
|
-
cm = matrix_to_complex(m);
|
143
|
-
flagcm = 1;
|
144
|
-
} else if (MATRIX_COMPLEX_P(bb)) {
|
145
|
-
Data_Get_Struct(bb, gsl_matrix_complex, cm);
|
146
|
-
} else {
|
147
|
-
rb_raise(rb_eTypeError, "wrong argument type %s", rb_class2name(CLASS_OF(bb)));
|
148
|
-
}
|
149
|
-
cmself = gsl_matrix_complex_alloc(m->size1, m->size2);
|
150
|
-
if (cmself == NULL) rb_raise(rb_eNoMemError, "gsl_matrix_complex_alloc failed");
|
151
|
-
gsl_matrix_complex_set_all(cmself, *a);
|
152
|
-
switch (flag) {
|
153
|
-
case GSL_COMPLEX_ADD:
|
154
|
-
gsl_matrix_complex_add(cmself, cm);
|
155
|
-
break;
|
156
|
-
case GSL_COMPLEX_SUB:
|
157
|
-
gsl_matrix_complex_sub(cmself, cm);
|
158
|
-
break;
|
159
|
-
case GSL_COMPLEX_MUL:
|
160
|
-
gsl_matrix_complex_mul_elements(cmself, cm);
|
161
|
-
break;
|
162
|
-
case GSL_COMPLEX_DIV:
|
163
|
-
gsl_matrix_complex_div_elements(cmself, cm);
|
164
|
-
break;
|
165
|
-
}
|
166
|
-
if (flagcm == 1) gsl_matrix_complex_free(cm);
|
167
|
-
return Data_Wrap_Struct(cgsl_matrix_complex, 0, gsl_matrix_complex_free, cmself);
|
168
|
-
}
|
169
|
-
}
|
170
|
-
/* never reach here */
|
171
|
-
return Qnil;
|
172
|
-
}
|
173
|
-
|
174
|
-
static VALUE rb_gsl_complex_add(VALUE obj, VALUE bb)
|
175
|
-
{
|
176
|
-
return rb_gsl_complex_arithmetics5(GSL_COMPLEX_ADD, obj, bb);
|
177
|
-
}
|
178
|
-
|
179
|
-
static VALUE rb_gsl_complex_sub(VALUE obj, VALUE bb)
|
180
|
-
{
|
181
|
-
return rb_gsl_complex_arithmetics5(GSL_COMPLEX_SUB, obj, bb);
|
182
|
-
}
|
183
|
-
|
184
|
-
static VALUE rb_gsl_complex_mul(VALUE obj, VALUE bb)
|
185
|
-
{
|
186
|
-
return rb_gsl_complex_arithmetics5(GSL_COMPLEX_MUL, obj, bb);
|
187
|
-
}
|
188
|
-
|
189
|
-
static VALUE rb_gsl_complex_div(VALUE obj, VALUE bb)
|
190
|
-
{
|
191
|
-
return rb_gsl_complex_arithmetics5(GSL_COMPLEX_DIV, obj, bb);
|
192
|
-
}
|
193
|
-
|
194
|
-
static VALUE rb_gsl_complex_coerce(VALUE obj, VALUE other)
|
195
|
-
{
|
196
|
-
gsl_complex *c = NULL;
|
197
|
-
gsl_matrix *m = NULL;
|
198
|
-
gsl_matrix_complex *cmnew = NULL, *cmself = NULL;
|
199
|
-
VALUE vcmself, vcmnew;
|
200
|
-
double x;
|
201
|
-
switch (TYPE(other)) {
|
202
|
-
case T_FLOAT: case T_FIXNUM: case T_BIGNUM:
|
203
|
-
x = NUM2DBL(other);
|
204
|
-
c = ALLOC(gsl_complex);
|
205
|
-
*c = gsl_complex_rect(x, 0.0);
|
206
|
-
return rb_ary_new3(2, Data_Wrap_Struct(cgsl_complex, 0, free, c),
|
207
|
-
obj);
|
208
|
-
break;
|
209
|
-
default:
|
210
|
-
if (MATRIX_P(other)) {
|
211
|
-
Data_Get_Struct(other, gsl_matrix, m);
|
212
|
-
cmnew = matrix_to_complex(m);
|
213
|
-
vcmnew = Data_Wrap_Struct(cgsl_matrix_complex, 0, gsl_matrix_complex_free, cmnew);
|
214
|
-
cmself = gsl_matrix_complex_alloc(m->size1, m->size2);
|
215
|
-
if (cmself == NULL) rb_raise(rb_eNoMemError, "gsl_matrix_complex_alloc failed");
|
216
|
-
Data_Get_Struct(obj, gsl_complex, c);
|
217
|
-
gsl_matrix_complex_set_all(cmself, *c);
|
218
|
-
vcmself = Data_Wrap_Struct(cgsl_matrix_complex, 0, gsl_matrix_complex_free, cmself);
|
219
|
-
return rb_ary_new3(2, vcmself, vcmnew);
|
220
|
-
}
|
221
|
-
if (MATRIX_COMPLEX_P(other)) {
|
222
|
-
Data_Get_Struct(other, gsl_matrix_complex, cmnew);
|
223
|
-
cmself = gsl_matrix_complex_alloc(cmnew->size1, cmnew->size2);
|
224
|
-
if (cmself == NULL) rb_raise(rb_eNoMemError, "gsl_matrix_complex_alloc failed");
|
225
|
-
vcmself = Data_Wrap_Struct(cgsl_matrix_complex, 0, gsl_matrix_complex_free, cmself);
|
226
|
-
return rb_ary_new3(2, vcmself, other);
|
227
|
-
} else {
|
228
|
-
rb_raise(rb_eTypeError, "cannot coerce to GSL::Complex");
|
229
|
-
}
|
230
|
-
}
|
231
|
-
}
|
232
|
-
|
233
|
-
void Init_gsl_array_complex(VALUE mgsl)
|
234
|
-
{
|
235
|
-
rb_define_method(cgsl_complex, "coerce", rb_gsl_complex_coerce, 1);
|
236
|
-
|
237
|
-
rb_define_method(cgsl_complex, "add", rb_gsl_complex_add, 1);
|
238
|
-
rb_define_alias(cgsl_complex, "+", "add");
|
239
|
-
rb_define_method(cgsl_complex, "sub", rb_gsl_complex_sub, 1);
|
240
|
-
rb_define_alias(cgsl_complex, "-", "sub");
|
241
|
-
rb_define_method(cgsl_complex, "mul", rb_gsl_complex_mul, 1);
|
242
|
-
rb_define_alias(cgsl_complex, "*", "mul");
|
243
|
-
rb_define_method(cgsl_complex, "div", rb_gsl_complex_div, 1);
|
244
|
-
rb_define_alias(cgsl_complex, "/", "div");
|
245
|
-
}
|
data/ext/gsl_native/blas.c
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
blas.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 <gsl/gsl_blas.h>
|
13
|
-
#include "include/rb_gsl_common.h"
|
14
|
-
#include "include/rb_gsl_array.h"
|
15
|
-
|
16
|
-
void Init_gsl_blas1(VALUE module);
|
17
|
-
void Init_gsl_blas2(VALUE module);
|
18
|
-
void Init_gsl_blas3(VALUE module);
|
19
|
-
|
20
|
-
void Init_gsl_blas(VALUE module)
|
21
|
-
{
|
22
|
-
VALUE mgsl_blas;
|
23
|
-
mgsl_blas = rb_define_module_under(module, "Blas");
|
24
|
-
|
25
|
-
Init_gsl_blas1(mgsl_blas);
|
26
|
-
Init_gsl_blas2(mgsl_blas);
|
27
|
-
Init_gsl_blas3(mgsl_blas);
|
28
|
-
}
|
data/ext/gsl_native/blas1.c
DELETED
@@ -1,733 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
blas1.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 <gsl/gsl_blas.h>
|
13
|
-
#include "include/rb_gsl_complex.h"
|
14
|
-
#include "include/rb_gsl_array.h"
|
15
|
-
#include "include/rb_gsl_common.h"
|
16
|
-
|
17
|
-
static int get_vector1(int argc, VALUE *argv, VALUE obj, gsl_vector **x);
|
18
|
-
static int get_vector_complex1(int argc, VALUE *argv, VALUE obj, gsl_vector_complex **x);
|
19
|
-
static int get_vector2(int argc, VALUE *argv, VALUE obj,
|
20
|
-
gsl_vector **x, gsl_vector **y);
|
21
|
-
static int get_vector_complex2(int argc, VALUE *argv, VALUE obj,
|
22
|
-
gsl_vector_complex **x, gsl_vector_complex **y);
|
23
|
-
|
24
|
-
static int get_vector1(int argc, VALUE *argv, VALUE obj, gsl_vector **x)
|
25
|
-
{
|
26
|
-
int flag = 0;
|
27
|
-
switch (TYPE(obj)) {
|
28
|
-
case T_MODULE:
|
29
|
-
case T_CLASS:
|
30
|
-
case T_OBJECT:
|
31
|
-
if (argc != 1) rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)",
|
32
|
-
argc);
|
33
|
-
Data_Get_Vector(argv[0], (*x));
|
34
|
-
break;
|
35
|
-
default:
|
36
|
-
Data_Get_Vector(obj, (*x));
|
37
|
-
flag = 1;
|
38
|
-
break;
|
39
|
-
}
|
40
|
-
return flag;
|
41
|
-
}
|
42
|
-
|
43
|
-
static int get_vector_complex1(int argc, VALUE *argv, VALUE obj, gsl_vector_complex **x)
|
44
|
-
{
|
45
|
-
int flag = 0;
|
46
|
-
switch (TYPE(obj)) {
|
47
|
-
case T_MODULE:
|
48
|
-
case T_CLASS:
|
49
|
-
case T_OBJECT:
|
50
|
-
if (argc != 1) rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)",
|
51
|
-
argc);
|
52
|
-
CHECK_VECTOR_COMPLEX(argv[0]);
|
53
|
-
Data_Get_Struct(argv[0], gsl_vector_complex, (*x));
|
54
|
-
break;
|
55
|
-
default:
|
56
|
-
Data_Get_Struct(obj, gsl_vector_complex, (*x));
|
57
|
-
flag = 1;
|
58
|
-
break;
|
59
|
-
}
|
60
|
-
return flag;
|
61
|
-
}
|
62
|
-
|
63
|
-
static int get_vector2(int argc, VALUE *argv, VALUE obj,
|
64
|
-
gsl_vector **x, gsl_vector **y)
|
65
|
-
{
|
66
|
-
int flag = 0;
|
67
|
-
switch (TYPE(obj)) {
|
68
|
-
case T_MODULE:
|
69
|
-
case T_CLASS:
|
70
|
-
case T_OBJECT:
|
71
|
-
if (argc != 2) rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)",
|
72
|
-
argc);
|
73
|
-
Data_Get_Vector(argv[0], (*x));
|
74
|
-
Data_Get_Vector(argv[1], (*y));
|
75
|
-
break;
|
76
|
-
default:
|
77
|
-
if (argc != 1) rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)",
|
78
|
-
argc);
|
79
|
-
Data_Get_Vector(obj, (*x));
|
80
|
-
Data_Get_Vector(argv[0], (*y));
|
81
|
-
flag = 1;
|
82
|
-
break;
|
83
|
-
}
|
84
|
-
return flag;
|
85
|
-
}
|
86
|
-
|
87
|
-
|
88
|
-
static int get_vector_complex2(int argc, VALUE *argv, VALUE obj,
|
89
|
-
gsl_vector_complex **x, gsl_vector_complex **y)
|
90
|
-
{
|
91
|
-
int flag = 0;
|
92
|
-
switch (TYPE(obj)) {
|
93
|
-
case T_MODULE:
|
94
|
-
case T_CLASS:
|
95
|
-
case T_OBJECT:
|
96
|
-
if (argc != 2) rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)",
|
97
|
-
argc);
|
98
|
-
CHECK_VECTOR_COMPLEX(argv[0]);
|
99
|
-
CHECK_VECTOR_COMPLEX(argv[1]);
|
100
|
-
Data_Get_Struct(argv[0], gsl_vector_complex, (*x));
|
101
|
-
Data_Get_Struct(argv[1], gsl_vector_complex, (*y));
|
102
|
-
break;
|
103
|
-
default:
|
104
|
-
if (argc != 1) rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)",
|
105
|
-
argc);
|
106
|
-
CHECK_VECTOR_COMPLEX(argv[0]);
|
107
|
-
Data_Get_Struct(obj, gsl_vector_complex, (*x));
|
108
|
-
Data_Get_Struct(argv[0], gsl_vector_complex, (*y));
|
109
|
-
flag = 1;
|
110
|
-
break;
|
111
|
-
}
|
112
|
-
return flag;
|
113
|
-
}
|
114
|
-
|
115
|
-
static VALUE rb_gsl_blas_ddot(int argc, VALUE *argv, VALUE obj)
|
116
|
-
{
|
117
|
-
double r;
|
118
|
-
// local variable "status" declared and set, but never used
|
119
|
-
//int status;
|
120
|
-
gsl_vector *x = NULL, *y = NULL;
|
121
|
-
get_vector2(argc, argv, obj, &x, &y);
|
122
|
-
/*status =*/ gsl_blas_ddot(x, y, &r);
|
123
|
-
return rb_float_new(r);
|
124
|
-
}
|
125
|
-
|
126
|
-
static VALUE rb_gsl_blas_zdotu(int argc, VALUE *argv, VALUE obj)
|
127
|
-
{
|
128
|
-
gsl_complex *r;
|
129
|
-
// local variable "status" declared and set, but never used
|
130
|
-
//int status;
|
131
|
-
gsl_vector_complex *x = NULL, *y = NULL;
|
132
|
-
get_vector_complex2(argc, argv, obj, &x, &y);
|
133
|
-
r = ALLOC(gsl_complex);
|
134
|
-
/*status =*/ gsl_blas_zdotu(x, y, r);
|
135
|
-
return Data_Wrap_Struct(cgsl_complex, 0, free, r);
|
136
|
-
}
|
137
|
-
|
138
|
-
static VALUE rb_gsl_blas_zdotc(int argc, VALUE *argv, VALUE obj)
|
139
|
-
{
|
140
|
-
gsl_complex *r;
|
141
|
-
// local variable "status" declared and set, but never used
|
142
|
-
//int status;
|
143
|
-
gsl_vector_complex *x = NULL, *y = NULL;
|
144
|
-
get_vector_complex2(argc, argv, obj, &x, &y);
|
145
|
-
r = ALLOC(gsl_complex);
|
146
|
-
/*status =*/ gsl_blas_zdotc(x, y, r);
|
147
|
-
return Data_Wrap_Struct(cgsl_complex, 0, free, r);
|
148
|
-
}
|
149
|
-
|
150
|
-
static VALUE rb_gsl_blas_dnrm2(int argc, VALUE *argv, VALUE obj)
|
151
|
-
{
|
152
|
-
gsl_vector *x = NULL;
|
153
|
-
get_vector1(argc, argv, obj, &x);
|
154
|
-
return rb_float_new(gsl_blas_dnrm2(x));
|
155
|
-
}
|
156
|
-
|
157
|
-
static VALUE rb_gsl_blas_dnrm(int argc, VALUE *argv, VALUE obj)
|
158
|
-
{
|
159
|
-
gsl_vector *x = NULL;
|
160
|
-
double a;
|
161
|
-
get_vector1(argc, argv, obj, &x);
|
162
|
-
a = gsl_blas_dnrm2(x);
|
163
|
-
return rb_float_new(a*a);
|
164
|
-
}
|
165
|
-
|
166
|
-
static VALUE rb_gsl_blas_dznrm2(int argc, VALUE *argv, VALUE obj)
|
167
|
-
{
|
168
|
-
gsl_vector_complex *x = NULL;
|
169
|
-
get_vector_complex1(argc, argv, obj, &x);
|
170
|
-
return rb_float_new(gsl_blas_dznrm2(x));
|
171
|
-
}
|
172
|
-
|
173
|
-
static VALUE rb_gsl_blas_dasum(int argc, VALUE *argv, VALUE obj)
|
174
|
-
{
|
175
|
-
gsl_vector *x = NULL;
|
176
|
-
get_vector1(argc, argv, obj, &x);
|
177
|
-
return rb_float_new(gsl_blas_dasum(x));
|
178
|
-
}
|
179
|
-
|
180
|
-
static VALUE rb_gsl_blas_dzasum(int argc, VALUE *argv, VALUE obj)
|
181
|
-
{
|
182
|
-
gsl_vector_complex *x = NULL;
|
183
|
-
get_vector_complex1(argc, argv, obj, &x);
|
184
|
-
return rb_float_new(gsl_blas_dzasum(x));
|
185
|
-
}
|
186
|
-
|
187
|
-
static VALUE rb_gsl_blas_idamax(int argc, VALUE *argv, VALUE obj)
|
188
|
-
{
|
189
|
-
gsl_vector *x = NULL;
|
190
|
-
get_vector1(argc, argv, obj, &x);
|
191
|
-
return INT2FIX(gsl_blas_idamax(x));
|
192
|
-
}
|
193
|
-
|
194
|
-
static VALUE rb_gsl_blas_izamax(int argc, VALUE *argv, VALUE obj)
|
195
|
-
{
|
196
|
-
gsl_vector_complex *x = NULL;
|
197
|
-
get_vector_complex1(argc, argv, obj, &x);
|
198
|
-
return INT2FIX(gsl_blas_izamax(x));
|
199
|
-
}
|
200
|
-
|
201
|
-
static VALUE rb_gsl_blas_dswap(int argc, VALUE *argv, VALUE obj)
|
202
|
-
{
|
203
|
-
gsl_vector *x = NULL, *y = NULL;
|
204
|
-
get_vector2(argc, argv, obj, &x, &y);
|
205
|
-
return INT2FIX(gsl_blas_dswap(x, y));
|
206
|
-
}
|
207
|
-
|
208
|
-
static VALUE rb_gsl_blas_zswap(int argc, VALUE *argv, VALUE obj)
|
209
|
-
{
|
210
|
-
gsl_vector_complex *x = NULL, *y = NULL;
|
211
|
-
get_vector_complex2(argc, argv, obj, &x, &y);
|
212
|
-
return INT2FIX(gsl_blas_zswap(x, y));
|
213
|
-
}
|
214
|
-
|
215
|
-
static VALUE rb_gsl_blas_dcopy(int argc, VALUE *argv, VALUE obj)
|
216
|
-
{
|
217
|
-
gsl_vector *x = NULL, *y = NULL;
|
218
|
-
get_vector2(argc, argv, obj, &x, &y);
|
219
|
-
return INT2FIX(gsl_blas_dcopy(x, y));
|
220
|
-
}
|
221
|
-
|
222
|
-
static VALUE rb_gsl_blas_zcopy(int argc, VALUE *argv, VALUE obj)
|
223
|
-
{
|
224
|
-
gsl_vector_complex *x = NULL, *y = NULL;
|
225
|
-
get_vector_complex2(argc, argv, obj, &x, &y);
|
226
|
-
return INT2FIX(gsl_blas_zcopy(x, y));
|
227
|
-
}
|
228
|
-
|
229
|
-
static VALUE rb_gsl_blas_daxpy(int argc, VALUE *argv, VALUE obj)
|
230
|
-
{
|
231
|
-
double a;
|
232
|
-
gsl_vector *x = NULL, *y = NULL;
|
233
|
-
switch (TYPE(obj)) {
|
234
|
-
case T_MODULE:
|
235
|
-
case T_CLASS:
|
236
|
-
case T_OBJECT:
|
237
|
-
get_vector2(argc-1, argv+1, obj, &x, &y);
|
238
|
-
Need_Float(argv[0]);
|
239
|
-
// a = RFLOAT(argv[0])->value;
|
240
|
-
a = NUM2DBL(argv[0]);
|
241
|
-
break;
|
242
|
-
default:
|
243
|
-
Data_Get_Struct(obj, gsl_vector, x);
|
244
|
-
if (argc != 2) rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)",
|
245
|
-
argc);
|
246
|
-
Need_Float(argv[0]);
|
247
|
-
// a = RFLOAT(argv[0])->value;
|
248
|
-
a = NUM2DBL(argv[0]);
|
249
|
-
Data_Get_Vector(argv[1], y);
|
250
|
-
break;
|
251
|
-
}
|
252
|
-
gsl_blas_daxpy(a, x, y);
|
253
|
-
return argv[argc-1];
|
254
|
-
}
|
255
|
-
|
256
|
-
static VALUE rb_gsl_blas_daxpy2(int argc, VALUE *argv, VALUE obj)
|
257
|
-
{
|
258
|
-
double a;
|
259
|
-
gsl_vector *x = NULL, *y = NULL, *y2 = NULL;
|
260
|
-
switch (TYPE(obj)) {
|
261
|
-
case T_MODULE:
|
262
|
-
case T_CLASS:
|
263
|
-
case T_OBJECT:
|
264
|
-
get_vector2(argc-1, argv+1, obj, &x, &y);
|
265
|
-
Need_Float(argv[0]);
|
266
|
-
// a = RFLOAT(argv[0])->value;
|
267
|
-
a = NUM2DBL(argv[0]);
|
268
|
-
break;
|
269
|
-
default:
|
270
|
-
Data_Get_Struct(obj, gsl_vector, x);
|
271
|
-
if (argc != 2) rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)",
|
272
|
-
argc);
|
273
|
-
Need_Float(argv[0]);
|
274
|
-
CHECK_VECTOR(argv[1]);
|
275
|
-
// a = RFLOAT(argv[0])->value;
|
276
|
-
a = NUM2DBL(argv[0]);
|
277
|
-
Data_Get_Struct(argv[1], gsl_vector, y);
|
278
|
-
break;
|
279
|
-
}
|
280
|
-
y2 = gsl_vector_alloc(y->size);
|
281
|
-
gsl_vector_memcpy(y2, y);
|
282
|
-
gsl_blas_daxpy(a, x, y2);
|
283
|
-
return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, y2);
|
284
|
-
}
|
285
|
-
|
286
|
-
static VALUE rb_gsl_blas_zaxpy(int argc, VALUE *argv, VALUE obj)
|
287
|
-
{
|
288
|
-
gsl_complex *a = NULL;
|
289
|
-
gsl_vector_complex *x = NULL, *y = NULL;
|
290
|
-
switch (TYPE(obj)) {
|
291
|
-
case T_MODULE:
|
292
|
-
case T_CLASS:
|
293
|
-
case T_OBJECT:
|
294
|
-
CHECK_COMPLEX(argv[0]);
|
295
|
-
Data_Get_Struct(argv[0], gsl_complex, a);
|
296
|
-
get_vector_complex2(argc-1, argv+1, obj, &x, &y);
|
297
|
-
break;
|
298
|
-
default:
|
299
|
-
Data_Get_Struct(obj, gsl_vector_complex, x);
|
300
|
-
if (argc != 2) rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)",
|
301
|
-
argc);
|
302
|
-
CHECK_COMPLEX(argv[0]);
|
303
|
-
CHECK_VECTOR_COMPLEX(argv[1]);
|
304
|
-
Data_Get_Struct(argv[0], gsl_complex, a);
|
305
|
-
Data_Get_Struct(argv[1], gsl_vector_complex, y);
|
306
|
-
break;
|
307
|
-
}
|
308
|
-
|
309
|
-
gsl_blas_zaxpy(*a, x, y);
|
310
|
-
return argv[argc-1];
|
311
|
-
}
|
312
|
-
|
313
|
-
static VALUE rb_gsl_blas_zaxpy2(int argc, VALUE *argv, VALUE obj)
|
314
|
-
{
|
315
|
-
gsl_complex *a = NULL;
|
316
|
-
gsl_vector_complex *x = NULL, *y = NULL, *y2 = NULL;
|
317
|
-
switch (TYPE(obj)) {
|
318
|
-
case T_MODULE:
|
319
|
-
case T_CLASS:
|
320
|
-
case T_OBJECT:
|
321
|
-
get_vector_complex2(argc-1, argv+1, obj, &x, &y);
|
322
|
-
CHECK_COMPLEX(argv[0]);
|
323
|
-
Data_Get_Struct(argv[0], gsl_complex, a);
|
324
|
-
break;
|
325
|
-
default:
|
326
|
-
Data_Get_Struct(obj, gsl_vector_complex, x);
|
327
|
-
if (argc != 2) rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)",
|
328
|
-
argc);
|
329
|
-
CHECK_COMPLEX(argv[0]);
|
330
|
-
CHECK_VECTOR_COMPLEX(argv[1]);
|
331
|
-
Data_Get_Struct(argv[0], gsl_complex, a);
|
332
|
-
Data_Get_Struct(argv[1], gsl_vector_complex, y);
|
333
|
-
break;
|
334
|
-
}
|
335
|
-
y2 = gsl_vector_complex_alloc(y->size);
|
336
|
-
gsl_vector_complex_memcpy(y2, y);
|
337
|
-
gsl_blas_zaxpy(*a, x, y2);
|
338
|
-
return Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, y2);
|
339
|
-
}
|
340
|
-
|
341
|
-
static VALUE rb_gsl_blas_dscal(int argc, VALUE *argv, VALUE obj)
|
342
|
-
{
|
343
|
-
double a;
|
344
|
-
gsl_vector *x = NULL;
|
345
|
-
switch (TYPE(obj)) {
|
346
|
-
case T_MODULE:
|
347
|
-
case T_CLASS:
|
348
|
-
case T_OBJECT:
|
349
|
-
if (argc != 2) rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)",
|
350
|
-
argc);
|
351
|
-
Need_Float(argv[0]);
|
352
|
-
CHECK_VECTOR(argv[1]);
|
353
|
-
// a = RFLOAT(argv[0])->value;
|
354
|
-
a = NUM2DBL(argv[0]);
|
355
|
-
Data_Get_Struct(argv[1], gsl_vector, x);
|
356
|
-
gsl_blas_dscal(a, x);
|
357
|
-
return argv[1];
|
358
|
-
break;
|
359
|
-
default:
|
360
|
-
if (argc != 1) rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)",
|
361
|
-
argc);
|
362
|
-
Need_Float(argv[0]);
|
363
|
-
// a = RFLOAT(argv[0])->value;
|
364
|
-
a = NUM2DBL(argv[0]);
|
365
|
-
Data_Get_Struct(obj, gsl_vector, x);
|
366
|
-
gsl_blas_dscal(a, x);
|
367
|
-
return obj;
|
368
|
-
break;
|
369
|
-
}
|
370
|
-
return Qnil; /* never reach here */
|
371
|
-
}
|
372
|
-
|
373
|
-
static VALUE rb_gsl_blas_dscal2(int argc, VALUE *argv, VALUE obj)
|
374
|
-
{
|
375
|
-
double a;
|
376
|
-
gsl_vector *x = NULL, *xnew = NULL;
|
377
|
-
switch (TYPE(obj)) {
|
378
|
-
case T_MODULE:
|
379
|
-
case T_CLASS:
|
380
|
-
case T_OBJECT:
|
381
|
-
if (argc != 2) rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)",
|
382
|
-
argc);
|
383
|
-
Need_Float(argv[0]);
|
384
|
-
CHECK_VECTOR(argv[1]);
|
385
|
-
a = NUM2DBL(argv[0]);
|
386
|
-
Data_Get_Struct(argv[1], gsl_vector, x);
|
387
|
-
break;
|
388
|
-
default:
|
389
|
-
Data_Get_Struct(obj, gsl_vector, x);
|
390
|
-
if (argc != 1) rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)",
|
391
|
-
argc);
|
392
|
-
Need_Float(argv[0]);
|
393
|
-
a = NUM2DBL(argv[0]);
|
394
|
-
break;
|
395
|
-
}
|
396
|
-
xnew = gsl_vector_alloc(x->size);
|
397
|
-
gsl_vector_memcpy(xnew, x);
|
398
|
-
gsl_blas_dscal(a, xnew);
|
399
|
-
return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, xnew);
|
400
|
-
}
|
401
|
-
|
402
|
-
static VALUE rb_gsl_blas_zdscal(int argc, VALUE *argv, VALUE obj)
|
403
|
-
{
|
404
|
-
double a;
|
405
|
-
gsl_vector_complex *x = NULL;
|
406
|
-
switch (TYPE(obj)) {
|
407
|
-
case T_MODULE:
|
408
|
-
case T_CLASS:
|
409
|
-
case T_OBJECT:
|
410
|
-
if (argc != 2) rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)",
|
411
|
-
argc);
|
412
|
-
Need_Float(argv[0]);
|
413
|
-
CHECK_VECTOR_COMPLEX(argv[1]);
|
414
|
-
// a = RFLOAT(argv[0])->value;
|
415
|
-
a = NUM2DBL(argv[0]);
|
416
|
-
Data_Get_Struct(argv[1], gsl_vector_complex, x);
|
417
|
-
gsl_blas_zdscal(a, x);
|
418
|
-
return argv[1];
|
419
|
-
break;
|
420
|
-
default:
|
421
|
-
Data_Get_Struct(obj, gsl_vector_complex, x);
|
422
|
-
if (argc != 1) rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)",
|
423
|
-
argc);
|
424
|
-
Need_Float(argv[0]);
|
425
|
-
a = NUM2DBL(argv[0]);
|
426
|
-
gsl_blas_zdscal(a, x);
|
427
|
-
return obj;
|
428
|
-
break;
|
429
|
-
}
|
430
|
-
}
|
431
|
-
|
432
|
-
static VALUE rb_gsl_blas_zdscal2(int argc, VALUE *argv, VALUE obj)
|
433
|
-
{
|
434
|
-
double a;
|
435
|
-
gsl_vector_complex *x = NULL, *xnew = NULL;
|
436
|
-
switch (TYPE(obj)) {
|
437
|
-
case T_MODULE:
|
438
|
-
case T_CLASS:
|
439
|
-
case T_OBJECT:
|
440
|
-
if (argc != 2) rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)",
|
441
|
-
argc);
|
442
|
-
Need_Float(argv[0]);
|
443
|
-
CHECK_VECTOR_COMPLEX(argv[1]);
|
444
|
-
a = NUM2DBL(argv[0]);
|
445
|
-
Data_Get_Struct(argv[1], gsl_vector_complex, x);
|
446
|
-
break;
|
447
|
-
default:
|
448
|
-
Data_Get_Struct(obj, gsl_vector_complex, x);
|
449
|
-
if (argc != 1) rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)",
|
450
|
-
argc);
|
451
|
-
Need_Float(argv[0]);
|
452
|
-
a = NUM2DBL(argv[0]);
|
453
|
-
break;
|
454
|
-
}
|
455
|
-
xnew = gsl_vector_complex_alloc(x->size);
|
456
|
-
gsl_vector_complex_memcpy(xnew, x);
|
457
|
-
gsl_blas_zdscal(a, xnew);
|
458
|
-
return Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, xnew);
|
459
|
-
}
|
460
|
-
|
461
|
-
static VALUE rb_gsl_blas_zscal(int argc, VALUE *argv, VALUE obj)
|
462
|
-
{
|
463
|
-
gsl_complex *a = NULL;
|
464
|
-
gsl_vector_complex *x = NULL;
|
465
|
-
CHECK_COMPLEX(argv[0]);
|
466
|
-
switch (TYPE(obj)) {
|
467
|
-
case T_MODULE:
|
468
|
-
case T_CLASS:
|
469
|
-
case T_OBJECT:
|
470
|
-
if (argc != 2) rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)",
|
471
|
-
argc);
|
472
|
-
CHECK_VECTOR_COMPLEX(argv[1]);
|
473
|
-
Data_Get_Struct(argv[0], gsl_complex, a);
|
474
|
-
Data_Get_Struct(argv[1], gsl_vector_complex, x);
|
475
|
-
gsl_blas_zscal(*a, x);
|
476
|
-
return argv[1];
|
477
|
-
break;
|
478
|
-
default:
|
479
|
-
if (argc != 1) rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)",
|
480
|
-
argc);
|
481
|
-
Data_Get_Struct(obj, gsl_vector_complex, x);
|
482
|
-
Data_Get_Struct(argv[0], gsl_complex, a);
|
483
|
-
gsl_blas_zscal(*a, x);
|
484
|
-
return obj;
|
485
|
-
break;
|
486
|
-
}
|
487
|
-
}
|
488
|
-
|
489
|
-
static VALUE rb_gsl_blas_zscal2(int argc, VALUE *argv, VALUE obj)
|
490
|
-
{
|
491
|
-
gsl_complex *a = NULL;
|
492
|
-
gsl_vector_complex *x = NULL, *xnew = NULL;
|
493
|
-
CHECK_COMPLEX(argv[0]);
|
494
|
-
switch (TYPE(obj)) {
|
495
|
-
case T_MODULE:
|
496
|
-
case T_CLASS:
|
497
|
-
case T_OBJECT:
|
498
|
-
if (argc != 2) rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)",
|
499
|
-
argc);
|
500
|
-
CHECK_VECTOR_COMPLEX(argv[1]);
|
501
|
-
Data_Get_Struct(argv[0], gsl_complex, a);
|
502
|
-
Data_Get_Struct(argv[1], gsl_vector_complex, x);
|
503
|
-
break;
|
504
|
-
default:
|
505
|
-
if (argc != 1) rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)",
|
506
|
-
argc);
|
507
|
-
Data_Get_Struct(obj, gsl_vector_complex, x);
|
508
|
-
Data_Get_Struct(argv[0], gsl_complex, a);
|
509
|
-
break;
|
510
|
-
}
|
511
|
-
xnew = gsl_vector_complex_alloc(x->size);
|
512
|
-
gsl_vector_complex_memcpy(xnew, x);
|
513
|
-
gsl_blas_zscal(*a, xnew);
|
514
|
-
return Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, xnew);
|
515
|
-
}
|
516
|
-
|
517
|
-
static VALUE rb_gsl_blas_drot(VALUE obj, VALUE xx, VALUE yy, VALUE cc, VALUE ss)
|
518
|
-
{
|
519
|
-
gsl_vector *x = NULL, *y = NULL;
|
520
|
-
double c, s;
|
521
|
-
CHECK_VECTOR(xx);
|
522
|
-
CHECK_VECTOR(yy);
|
523
|
-
Need_Float(cc);
|
524
|
-
Need_Float(ss);
|
525
|
-
Data_Get_Struct(xx, gsl_vector, x);
|
526
|
-
Data_Get_Struct(yy, gsl_vector, y);
|
527
|
-
c = NUM2DBL(cc);
|
528
|
-
s = NUM2DBL(ss);
|
529
|
-
gsl_blas_drot(x, y, c, s);
|
530
|
-
return rb_ary_new3(2, xx, yy);
|
531
|
-
}
|
532
|
-
|
533
|
-
static VALUE rb_gsl_blas_drot2(VALUE obj, VALUE xx, VALUE yy, VALUE cc, VALUE ss)
|
534
|
-
{
|
535
|
-
gsl_vector *x = NULL, *y = NULL, *xnew = NULL, *ynew = NULL;
|
536
|
-
double c, s;
|
537
|
-
CHECK_VECTOR(xx);
|
538
|
-
CHECK_VECTOR(yy);
|
539
|
-
Need_Float(cc);
|
540
|
-
Need_Float(ss);
|
541
|
-
Data_Get_Struct(xx, gsl_vector, x);
|
542
|
-
Data_Get_Struct(yy, gsl_vector, y);
|
543
|
-
c = NUM2DBL(cc);
|
544
|
-
s = NUM2DBL(ss);
|
545
|
-
xnew = gsl_vector_alloc(x->size);
|
546
|
-
ynew = gsl_vector_alloc(y->size);
|
547
|
-
gsl_vector_memcpy(xnew, x);
|
548
|
-
gsl_vector_memcpy(ynew, y);
|
549
|
-
gsl_blas_drot(xnew, ynew, c, s);
|
550
|
-
return rb_ary_new3(2, Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, xnew),
|
551
|
-
Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, ynew));
|
552
|
-
}
|
553
|
-
|
554
|
-
static VALUE rb_gsl_blas_drotm(VALUE obj, VALUE xx, VALUE yy, VALUE PP)
|
555
|
-
{
|
556
|
-
gsl_vector *x = NULL, *y = NULL, *p = NULL;
|
557
|
-
int flag = 0, i;
|
558
|
-
CHECK_VECTOR(xx);
|
559
|
-
CHECK_VECTOR(yy);
|
560
|
-
Data_Get_Struct(xx, gsl_vector, x);
|
561
|
-
Data_Get_Struct(yy, gsl_vector, y);
|
562
|
-
if (rb_obj_is_kind_of(PP, cgsl_vector)) {
|
563
|
-
Data_Get_Struct(PP, gsl_vector, p);
|
564
|
-
} else {
|
565
|
-
if (TYPE(PP) != T_ARRAY) rb_raise(rb_eTypeError, "wrong argument type %s (Array of Vector expected", rb_class2name(CLASS_OF(PP)));
|
566
|
-
// p = gsl_vector_alloc(RARRAY(PP)->len);
|
567
|
-
p = gsl_vector_alloc(RARRAY_LEN(PP));
|
568
|
-
for (i = 0; i < RARRAY_LEN(PP); i++) {
|
569
|
-
gsl_vector_set(p, i, rb_ary_entry(PP, i));
|
570
|
-
}
|
571
|
-
flag = 1;
|
572
|
-
}
|
573
|
-
gsl_blas_drotm(x, y, p->data);
|
574
|
-
if (flag == 1) gsl_vector_free(p);
|
575
|
-
return rb_ary_new3(2, xx, yy);
|
576
|
-
}
|
577
|
-
|
578
|
-
static VALUE rb_gsl_blas_drotm2(VALUE obj, VALUE xx, VALUE yy, VALUE PP)
|
579
|
-
{
|
580
|
-
gsl_vector *x = NULL, *y = NULL, *p = NULL, *xnew = NULL, *ynew = NULL;
|
581
|
-
int flag = 0, i;
|
582
|
-
CHECK_VECTOR(xx);
|
583
|
-
CHECK_VECTOR(yy);
|
584
|
-
Data_Get_Struct(xx, gsl_vector, x);
|
585
|
-
Data_Get_Struct(yy, gsl_vector, y);
|
586
|
-
if (rb_obj_is_kind_of(PP, cgsl_vector)) {
|
587
|
-
Data_Get_Struct(PP, gsl_vector, p);
|
588
|
-
} else {
|
589
|
-
if (TYPE(PP) != T_ARRAY) rb_raise(rb_eTypeError, "wrong argument type %s (Array of Vector expected", rb_class2name(CLASS_OF(PP)));
|
590
|
-
// p = gsl_vector_alloc(RARRAY(PP)->len);
|
591
|
-
p = gsl_vector_alloc(RARRAY_LEN(PP));
|
592
|
-
for (i = 0; i < RARRAY_LEN(PP); i++) {
|
593
|
-
gsl_vector_set(p, i, rb_ary_entry(PP, i));
|
594
|
-
}
|
595
|
-
flag = 1;
|
596
|
-
}
|
597
|
-
xnew = gsl_vector_alloc(x->size);
|
598
|
-
ynew = gsl_vector_alloc(y->size);
|
599
|
-
gsl_vector_memcpy(xnew, x);
|
600
|
-
gsl_vector_memcpy(ynew, y);
|
601
|
-
gsl_blas_drotm(xnew, ynew, p->data);
|
602
|
-
if (flag == 1) gsl_vector_free(p);
|
603
|
-
return rb_ary_new3(2, Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, xnew),
|
604
|
-
Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, ynew));
|
605
|
-
}
|
606
|
-
|
607
|
-
void Init_gsl_blas1(VALUE module)
|
608
|
-
{
|
609
|
-
rb_define_module_function(module, "ddot", rb_gsl_blas_ddot, -1);
|
610
|
-
rb_define_method(cgsl_vector, "blas_ddot", rb_gsl_blas_ddot, -1);
|
611
|
-
rb_define_alias(cgsl_vector, "ddot", "blas_ddot");
|
612
|
-
/* rb_define_alias(cgsl_vector, "dot", "blas_ddot");*/
|
613
|
-
|
614
|
-
rb_define_module_function(module, "zdotu", rb_gsl_blas_zdotu, -1);
|
615
|
-
rb_define_method(cgsl_vector_complex, "blas_zdotu", rb_gsl_blas_zdotu, -1);
|
616
|
-
rb_define_alias(cgsl_vector_complex, "zdotu", "blas_zdotu");
|
617
|
-
rb_define_alias(cgsl_vector_complex, "dotu", "blas_zdotu");
|
618
|
-
|
619
|
-
rb_define_module_function(module, "zdotc", rb_gsl_blas_zdotc, -1);
|
620
|
-
rb_define_method(cgsl_vector_complex, "blas_zdotc", rb_gsl_blas_zdotc, -1);
|
621
|
-
rb_define_alias(cgsl_vector_complex, "zdotc", "blas_zdotc");
|
622
|
-
rb_define_alias(cgsl_vector_complex, "dotc", "blas_zdotc");
|
623
|
-
|
624
|
-
rb_define_module_function(module, "dnrm2", rb_gsl_blas_dnrm2, -1);
|
625
|
-
rb_define_method(cgsl_vector, "blas_dnrm2", rb_gsl_blas_dnrm2, -1);
|
626
|
-
rb_define_alias(cgsl_vector, "dnrm2", "blas_dnrm2");
|
627
|
-
rb_define_alias(cgsl_vector, "nrm2", "blas_dnrm2");
|
628
|
-
rb_define_alias(cgsl_vector, "norm", "blas_dnrm2");
|
629
|
-
|
630
|
-
rb_define_module_function(module, "dnrm", rb_gsl_blas_dnrm, -1);
|
631
|
-
rb_define_method(cgsl_vector, "blas_dnrm", rb_gsl_blas_dnrm, -1);
|
632
|
-
rb_define_alias(cgsl_vector, "dnrm", "blas_dnrm");
|
633
|
-
rb_define_alias(cgsl_vector, "nrm", "blas_dnrm");
|
634
|
-
rb_define_alias(cgsl_vector, "sumsq", "blas_dnrm");
|
635
|
-
|
636
|
-
rb_define_module_function(module, "dznrm2", rb_gsl_blas_dznrm2, -1);
|
637
|
-
rb_define_method(cgsl_vector_complex, "blas_dznrm2", rb_gsl_blas_dznrm2, -1);
|
638
|
-
rb_define_alias(cgsl_vector_complex, "dznrm2", "blas_dznrm2");
|
639
|
-
rb_define_alias(cgsl_vector_complex, "nrm2", "blas_dznrm2");
|
640
|
-
|
641
|
-
rb_define_module_function(module, "dasum", rb_gsl_blas_dasum, -1);
|
642
|
-
rb_define_method(cgsl_vector, "blas_dasum", rb_gsl_blas_dasum, -1);
|
643
|
-
rb_define_alias(cgsl_vector, "dasum", "blas_dasum");
|
644
|
-
rb_define_alias(cgsl_vector, "asum", "blas_dasum");
|
645
|
-
|
646
|
-
rb_define_module_function(module, "dzasum", rb_gsl_blas_dzasum, -1);
|
647
|
-
rb_define_method(cgsl_vector_complex, "blas_dzasum", rb_gsl_blas_dzasum, -1);
|
648
|
-
rb_define_alias(cgsl_vector_complex, "dzasum", "blas_dzasum");
|
649
|
-
rb_define_alias(cgsl_vector_complex, "asum", "blas_dzasum");
|
650
|
-
|
651
|
-
rb_define_module_function(module, "idamax", rb_gsl_blas_idamax, -1);
|
652
|
-
rb_define_method(cgsl_vector, "blas_idamax", rb_gsl_blas_idamax, -1);
|
653
|
-
rb_define_alias(cgsl_vector, "idamax", "blas_idamax");
|
654
|
-
|
655
|
-
rb_define_module_function(module, "izamax", rb_gsl_blas_izamax, -1);
|
656
|
-
rb_define_method(cgsl_vector_complex, "blas_izamax", rb_gsl_blas_izamax, -1);
|
657
|
-
rb_define_alias(cgsl_vector_complex, "izamax", "blas_izamax");
|
658
|
-
|
659
|
-
rb_define_module_function(module, "dswap", rb_gsl_blas_dswap, -1);
|
660
|
-
rb_define_method(cgsl_vector, "blas_dswap", rb_gsl_blas_dswap, -1);
|
661
|
-
rb_define_alias(cgsl_vector, "dswap", "blas_dswap");
|
662
|
-
rb_define_alias(cgsl_vector, "swap", "blas_dswap");
|
663
|
-
|
664
|
-
rb_define_module_function(module, "zswap", rb_gsl_blas_zswap, -1);
|
665
|
-
rb_define_method(cgsl_vector_complex, "blas_zswap", rb_gsl_blas_zswap, -1);
|
666
|
-
rb_define_alias(cgsl_vector_complex, "zswap", "blas_zswap");
|
667
|
-
rb_define_alias(cgsl_vector_complex, "swap", "blas_zswap");
|
668
|
-
|
669
|
-
rb_define_module_function(module, "dcopy", rb_gsl_blas_dcopy, -1);
|
670
|
-
rb_define_method(cgsl_vector, "blas_dcopy", rb_gsl_blas_dcopy, -1);
|
671
|
-
rb_define_alias(cgsl_vector, "dcopy", "blas_dcopy");
|
672
|
-
rb_define_alias(cgsl_vector, "copy", "blas_dcopy");
|
673
|
-
|
674
|
-
rb_define_module_function(module, "zcopy", rb_gsl_blas_zcopy, -1);
|
675
|
-
rb_define_method(cgsl_vector_complex, "blas_zcopy", rb_gsl_blas_zcopy, -1);
|
676
|
-
rb_define_alias(cgsl_vector_complex, "zcopy", "blas_zcopy");
|
677
|
-
rb_define_alias(cgsl_vector_complex, "copy", "blas_zcopy");
|
678
|
-
|
679
|
-
rb_define_module_function(module, "daxpy!", rb_gsl_blas_daxpy, -1);
|
680
|
-
rb_define_method(cgsl_vector, "blas_daxpy!", rb_gsl_blas_daxpy, -1);
|
681
|
-
rb_define_alias(cgsl_vector, "daxpy!", "blas_daxpy!");
|
682
|
-
rb_define_alias(cgsl_vector, "axpy!", "blas_daxpy!");
|
683
|
-
|
684
|
-
rb_define_module_function(module, "daxpy", rb_gsl_blas_daxpy2, -1);
|
685
|
-
rb_define_method(cgsl_vector, "blas_daxpy", rb_gsl_blas_daxpy2, -1);
|
686
|
-
rb_define_alias(cgsl_vector, "daxpy", "blas_daxpy");
|
687
|
-
rb_define_alias(cgsl_vector, "axpy", "blas_daxpy");
|
688
|
-
|
689
|
-
rb_define_module_function(module, "zaxpy!", rb_gsl_blas_zaxpy, -1);
|
690
|
-
rb_define_method(cgsl_vector_complex, "blas_zaxpy!", rb_gsl_blas_zaxpy, -1);
|
691
|
-
rb_define_alias(cgsl_vector_complex, "zaxpy!", "blas_zaxpy!");
|
692
|
-
rb_define_alias(cgsl_vector_complex, "axpy!", "blas_zaxpy!");
|
693
|
-
|
694
|
-
rb_define_module_function(module, "zaxpy", rb_gsl_blas_zaxpy2, -1);
|
695
|
-
rb_define_method(cgsl_vector_complex, "blas_zaxpy", rb_gsl_blas_zaxpy2, -1);
|
696
|
-
rb_define_alias(cgsl_vector_complex, "zaxpy", "blas_zaxpy");
|
697
|
-
rb_define_alias(cgsl_vector_complex, "axpy", "blas_zaxpy");
|
698
|
-
|
699
|
-
rb_define_module_function(module, "dscal!", rb_gsl_blas_dscal, -1);
|
700
|
-
rb_define_method(cgsl_vector, "blas_dscal!", rb_gsl_blas_dscal, -1);
|
701
|
-
rb_define_alias(cgsl_vector, "dscal!", "blas_dscal!");
|
702
|
-
rb_define_alias(cgsl_vector, "scal!", "blas_dscal!");
|
703
|
-
|
704
|
-
rb_define_module_function(module, "dscal", rb_gsl_blas_dscal2, -1);
|
705
|
-
rb_define_method(cgsl_vector, "blas_dscal", rb_gsl_blas_dscal2, -1);
|
706
|
-
rb_define_alias(cgsl_vector, "dscal", "blas_dscal");
|
707
|
-
rb_define_alias(cgsl_vector, "scal", "blas_dscal");
|
708
|
-
|
709
|
-
rb_define_module_function(module, "zdscal!", rb_gsl_blas_zdscal, -1);
|
710
|
-
rb_define_method(cgsl_vector_complex, "blas_zdscal!", rb_gsl_blas_zdscal, -1);
|
711
|
-
rb_define_alias(cgsl_vector_complex, "zdscal!", "blas_zdscal!");
|
712
|
-
rb_define_alias(cgsl_vector_complex, "scal!", "blas_zdscal!");
|
713
|
-
|
714
|
-
rb_define_module_function(module, "zdscal", rb_gsl_blas_zdscal2, -1);
|
715
|
-
rb_define_method(cgsl_vector_complex, "blas_zdscal", rb_gsl_blas_zdscal2, -1);
|
716
|
-
rb_define_alias(cgsl_vector_complex, "zdscal", "blas_zdscal");
|
717
|
-
rb_define_alias(cgsl_vector_complex, "scal", "blas_zdscal");
|
718
|
-
|
719
|
-
rb_define_module_function(module, "zscal!", rb_gsl_blas_zscal, -1);
|
720
|
-
rb_define_method(cgsl_vector_complex, "blas_zscal!", rb_gsl_blas_zscal, -1);
|
721
|
-
rb_define_alias(cgsl_vector_complex, "zscal!", "blas_zscal!");
|
722
|
-
|
723
|
-
rb_define_module_function(module, "zscal2", rb_gsl_blas_zscal2, -1);
|
724
|
-
rb_define_method(cgsl_vector_complex, "blas_zscal2", rb_gsl_blas_zscal2, -1);
|
725
|
-
rb_define_alias(cgsl_vector_complex, "zscal2", "blas_zscal2");
|
726
|
-
rb_define_alias(cgsl_vector_complex, "scal2", "blas_zscal2");
|
727
|
-
|
728
|
-
rb_define_module_function(module, "drot!", rb_gsl_blas_drot, 4);
|
729
|
-
rb_define_module_function(module, "drot", rb_gsl_blas_drot2, 4);
|
730
|
-
|
731
|
-
rb_define_module_function(module, "drotm!", rb_gsl_blas_drotm, 3);
|
732
|
-
rb_define_module_function(module, "drotm", rb_gsl_blas_drotm2, 3);
|
733
|
-
}
|