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
data/ext/gsl_native/complex.c
DELETED
@@ -1,1002 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
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; without even the implied warranty of
|
10
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
11
|
-
*/
|
12
|
-
|
13
|
-
#include "include/rb_gsl_complex.h"
|
14
|
-
#include "include/rb_gsl_array.h"
|
15
|
-
|
16
|
-
VALUE cgsl_complex;
|
17
|
-
|
18
|
-
// Set real/imag components of gsl_complex from Ruby object.
|
19
|
-
// If z is NULL, it is as if it pointed to a temporary (0+0i) value,
|
20
|
-
// otherwise the gsl_complex pointed to z is modified.
|
21
|
-
// Returns the resulting gsl_complex value in both cases.
|
22
|
-
//
|
23
|
-
// NOTE: This function does not always set both components of *z, so if *z is
|
24
|
-
// non-null, it should be initialized before calling this function.
|
25
|
-
gsl_complex rb_gsl_obj_to_gsl_complex(VALUE obj, gsl_complex *z)
|
26
|
-
{
|
27
|
-
VALUE vre, vim;
|
28
|
-
gsl_complex tmp, *zz;
|
29
|
-
|
30
|
-
if(!z) {
|
31
|
-
z = &tmp;
|
32
|
-
GSL_SET_COMPLEX(z, 0.0, 0.0);
|
33
|
-
}
|
34
|
-
if(obj == Qnil) {
|
35
|
-
return *z;
|
36
|
-
}
|
37
|
-
switch(TYPE(obj)) {
|
38
|
-
case T_ARRAY:
|
39
|
-
vre = rb_ary_entry(obj,0);
|
40
|
-
vim = rb_ary_entry(obj,1);
|
41
|
-
if (!NIL_P(vre)) GSL_SET_REAL(z, NUM2DBL(vre));
|
42
|
-
if (!NIL_P(vim)) GSL_SET_IMAG(z, NUM2DBL(vim));
|
43
|
-
break;
|
44
|
-
case T_FLOAT:
|
45
|
-
case T_FIXNUM:
|
46
|
-
case T_BIGNUM:
|
47
|
-
*z = gsl_complex_rect(NUM2DBL(obj), 0.0);
|
48
|
-
break;
|
49
|
-
default:
|
50
|
-
if (rb_obj_is_kind_of(obj, cgsl_complex)) {
|
51
|
-
Data_Get_Struct(obj, gsl_complex, zz);
|
52
|
-
*z = *zz;
|
53
|
-
} else {
|
54
|
-
rb_raise(rb_eTypeError,
|
55
|
-
"wrong type %s, (nil, Array, Float, Integer, or GSL::Complex expected)",
|
56
|
-
rb_class2name(CLASS_OF(obj)));
|
57
|
-
}
|
58
|
-
break;
|
59
|
-
}
|
60
|
-
return *z;
|
61
|
-
}
|
62
|
-
|
63
|
-
static VALUE rb_gsl_complex_new(int argc, VALUE *argv, VALUE klass)
|
64
|
-
{
|
65
|
-
gsl_complex *c = NULL;
|
66
|
-
VALUE obj;
|
67
|
-
obj = Data_Make_Struct(klass, gsl_complex, 0, free, c);
|
68
|
-
switch (argc) {
|
69
|
-
case 1:
|
70
|
-
switch (TYPE(argv[0])) {
|
71
|
-
case T_ARRAY:
|
72
|
-
*c = ary2complex(argv[0]);
|
73
|
-
break;
|
74
|
-
case T_FLOAT:
|
75
|
-
case T_FIXNUM:
|
76
|
-
case T_BIGNUM:
|
77
|
-
Need_Float(argv[0]);
|
78
|
-
*c = gsl_complex_rect(NUM2DBL(argv[0]), 0.0);
|
79
|
-
break;
|
80
|
-
default:
|
81
|
-
rb_raise(rb_eTypeError, "wrong argument type %s",
|
82
|
-
rb_class2name(CLASS_OF(argv[0])));
|
83
|
-
}
|
84
|
-
break;
|
85
|
-
case 2:
|
86
|
-
Need_Float(argv[0]); Need_Float(argv[1]);
|
87
|
-
*c = gsl_complex_rect(NUM2DBL(argv[0]), NUM2DBL(argv[1]));
|
88
|
-
break;
|
89
|
-
default:
|
90
|
-
rb_raise(rb_eArgError, "wrong number of arguments (%d for 1 or 2)", argc);
|
91
|
-
}
|
92
|
-
return obj;
|
93
|
-
}
|
94
|
-
|
95
|
-
gsl_complex* make_complex(double re, double im)
|
96
|
-
{
|
97
|
-
gsl_complex *c = NULL;
|
98
|
-
c = ALLOC(gsl_complex);
|
99
|
-
*c = gsl_complex_rect(re, im);
|
100
|
-
return c;
|
101
|
-
}
|
102
|
-
|
103
|
-
static VALUE rb_gsl_complex_polar(VALUE klass, VALUE r, VALUE theta)
|
104
|
-
{
|
105
|
-
VALUE obj;
|
106
|
-
gsl_complex *c = NULL;
|
107
|
-
Need_Float(r); Need_Float(theta);
|
108
|
-
obj = Data_Make_Struct(klass, gsl_complex, 0, free, c);
|
109
|
-
*c = gsl_complex_polar(NUM2DBL(r), NUM2DBL(theta));
|
110
|
-
return obj;
|
111
|
-
}
|
112
|
-
|
113
|
-
static VALUE rb_gsl_complex_get(VALUE obj, VALUE ii)
|
114
|
-
{
|
115
|
-
gsl_complex *c = NULL;
|
116
|
-
int i;
|
117
|
-
CHECK_FIXNUM(ii);
|
118
|
-
Data_Get_Struct(obj, gsl_complex, c);
|
119
|
-
i = FIX2INT(ii);
|
120
|
-
switch (i) {
|
121
|
-
case 0:
|
122
|
-
return rb_float_new(GSL_REAL(*c));
|
123
|
-
break;
|
124
|
-
case 1:
|
125
|
-
return rb_float_new(GSL_IMAG(*c));
|
126
|
-
break;
|
127
|
-
default:
|
128
|
-
rb_raise(rb_eArgError, "wrong argument (%d for 0 or 1)", i);
|
129
|
-
break;
|
130
|
-
}
|
131
|
-
return Qnil;
|
132
|
-
}
|
133
|
-
|
134
|
-
static VALUE rb_gsl_complex_real(VALUE obj)
|
135
|
-
{
|
136
|
-
gsl_complex *c = NULL;
|
137
|
-
Data_Get_Struct(obj, gsl_complex, c);
|
138
|
-
return rb_float_new(GSL_REAL(*c));
|
139
|
-
}
|
140
|
-
|
141
|
-
static VALUE rb_gsl_complex_imag(VALUE obj)
|
142
|
-
{
|
143
|
-
gsl_complex *c = NULL;
|
144
|
-
Data_Get_Struct(obj, gsl_complex, c);
|
145
|
-
return rb_float_new(GSL_IMAG(*c));
|
146
|
-
}
|
147
|
-
|
148
|
-
static VALUE rb_gsl_complex_print(VALUE obj)
|
149
|
-
{
|
150
|
-
gsl_complex *c = NULL;
|
151
|
-
Data_Get_Struct(obj, gsl_complex, c);
|
152
|
-
fprintf(stdout, "[%4.3e %4.3e] \n", GSL_REAL(*c), GSL_IMAG(*c));
|
153
|
-
return obj;
|
154
|
-
}
|
155
|
-
|
156
|
-
static VALUE rb_gsl_complex_printf(VALUE obj, VALUE s)
|
157
|
-
{
|
158
|
-
gsl_complex *c = NULL;
|
159
|
-
char tmp[32], format[64];
|
160
|
-
Check_Type(s, T_STRING);
|
161
|
-
Data_Get_Struct(obj, gsl_complex, c);
|
162
|
-
strcpy(tmp, STR2CSTR(s));
|
163
|
-
sprintf(format, "%s %s\n", tmp, tmp);
|
164
|
-
fprintf(stdout, format, GSL_REAL(*c), GSL_IMAG(*c));
|
165
|
-
return obj;
|
166
|
-
}
|
167
|
-
|
168
|
-
static VALUE rb_gsl_complex_return_double(double (*func)(gsl_complex), VALUE obj);
|
169
|
-
static VALUE rb_gsl_complex_return_double(double (*func)(gsl_complex), VALUE obj)
|
170
|
-
{
|
171
|
-
gsl_complex *c = NULL;
|
172
|
-
Data_Get_Struct(obj, gsl_complex, c);
|
173
|
-
return rb_float_new((*func)(*c));
|
174
|
-
}
|
175
|
-
|
176
|
-
static VALUE rb_gsl_complex_arg(VALUE obj)
|
177
|
-
{
|
178
|
-
return rb_gsl_complex_return_double(gsl_complex_arg, obj);
|
179
|
-
}
|
180
|
-
|
181
|
-
static VALUE rb_gsl_complex_abs(VALUE obj)
|
182
|
-
{
|
183
|
-
return rb_gsl_complex_return_double(gsl_complex_abs, obj);
|
184
|
-
}
|
185
|
-
|
186
|
-
static VALUE rb_gsl_complex_abs2(VALUE obj)
|
187
|
-
{
|
188
|
-
return rb_gsl_complex_return_double(gsl_complex_abs2, obj);
|
189
|
-
}
|
190
|
-
|
191
|
-
static VALUE rb_gsl_complex_logabs(VALUE obj)
|
192
|
-
{
|
193
|
-
return rb_gsl_complex_return_double(gsl_complex_logabs, obj);
|
194
|
-
}
|
195
|
-
|
196
|
-
static VALUE rb_gsl_complex_arithmetics2(gsl_complex (*func)(gsl_complex, double),
|
197
|
-
VALUE obj, VALUE xx);
|
198
|
-
|
199
|
-
static VALUE rb_gsl_complex_arithmetics2(gsl_complex (*func)(gsl_complex, double),
|
200
|
-
VALUE obj, VALUE xx)
|
201
|
-
{
|
202
|
-
gsl_complex *a = NULL, *c = NULL, tmp;
|
203
|
-
VALUE obj2;
|
204
|
-
double x;
|
205
|
-
Need_Float(xx);
|
206
|
-
Data_Get_Struct(obj, gsl_complex, a);
|
207
|
-
x = NUM2DBL(xx);
|
208
|
-
tmp = (*func)(*a, x);
|
209
|
-
obj2 = Data_Make_Struct(cgsl_complex, gsl_complex, 0, free, c);
|
210
|
-
*c = tmp;
|
211
|
-
return obj2;
|
212
|
-
}
|
213
|
-
|
214
|
-
static VALUE rb_gsl_complex_add_real(VALUE obj, VALUE xx)
|
215
|
-
{
|
216
|
-
return rb_gsl_complex_arithmetics2(gsl_complex_add_real, obj, xx);
|
217
|
-
}
|
218
|
-
|
219
|
-
static VALUE rb_gsl_complex_sub_real(VALUE obj, VALUE xx)
|
220
|
-
{
|
221
|
-
return rb_gsl_complex_arithmetics2(gsl_complex_sub_real, obj, xx);
|
222
|
-
}
|
223
|
-
|
224
|
-
static VALUE rb_gsl_complex_mul_real(VALUE obj, VALUE xx)
|
225
|
-
{
|
226
|
-
return rb_gsl_complex_arithmetics2(gsl_complex_mul_real, obj, xx);
|
227
|
-
}
|
228
|
-
|
229
|
-
static VALUE rb_gsl_complex_div_real(VALUE obj, VALUE xx)
|
230
|
-
{
|
231
|
-
return rb_gsl_complex_arithmetics2(gsl_complex_div_real, obj, xx);
|
232
|
-
}
|
233
|
-
|
234
|
-
static VALUE rb_gsl_complex_add_imag(VALUE obj, VALUE xx)
|
235
|
-
{
|
236
|
-
return rb_gsl_complex_arithmetics2(gsl_complex_add_imag, obj, xx);
|
237
|
-
}
|
238
|
-
|
239
|
-
static VALUE rb_gsl_complex_sub_imag(VALUE obj, VALUE xx)
|
240
|
-
{
|
241
|
-
return rb_gsl_complex_arithmetics2(gsl_complex_sub_imag, obj, xx);
|
242
|
-
}
|
243
|
-
|
244
|
-
static VALUE rb_gsl_complex_mul_imag(VALUE obj, VALUE xx)
|
245
|
-
{
|
246
|
-
return rb_gsl_complex_arithmetics2(gsl_complex_mul_imag, obj, xx);
|
247
|
-
}
|
248
|
-
|
249
|
-
static VALUE rb_gsl_complex_div_imag(VALUE obj, VALUE xx)
|
250
|
-
{
|
251
|
-
return rb_gsl_complex_arithmetics2(gsl_complex_div_imag, obj, xx);
|
252
|
-
}
|
253
|
-
|
254
|
-
static VALUE rb_gsl_complex_operate(gsl_complex (*func)(gsl_complex), VALUE obj);
|
255
|
-
static VALUE rb_gsl_complex_operate2(gsl_complex (*func)(gsl_complex), int argc, VALUE *argv, VALUE obj);
|
256
|
-
|
257
|
-
static VALUE rb_gsl_complex_operate(gsl_complex (*func)(gsl_complex), VALUE obj)
|
258
|
-
{
|
259
|
-
gsl_complex *c = NULL, *cnew = NULL;
|
260
|
-
Data_Get_Struct(obj, gsl_complex, c);
|
261
|
-
cnew = ALLOC(gsl_complex);
|
262
|
-
*cnew = (*func)(*c);
|
263
|
-
return Data_Wrap_Struct(cgsl_complex, 0, free, cnew);
|
264
|
-
}
|
265
|
-
|
266
|
-
static VALUE rb_gsl_complex_operate2(gsl_complex (*func)(gsl_complex), int argc, VALUE *argv, VALUE obj)
|
267
|
-
{
|
268
|
-
gsl_complex *c = NULL, *cnew = NULL, tmp;
|
269
|
-
gsl_vector_complex *v, *vnew;
|
270
|
-
gsl_matrix_complex *m, *mnew;
|
271
|
-
size_t i, j;
|
272
|
-
switch (TYPE(obj)) {
|
273
|
-
case T_MODULE:
|
274
|
-
case T_CLASS:
|
275
|
-
case T_OBJECT:
|
276
|
-
switch (argc) {
|
277
|
-
case 1:
|
278
|
-
switch (TYPE(argv[0])) {
|
279
|
-
case T_ARRAY:
|
280
|
-
tmp = ary2complex(argv[0]);
|
281
|
-
c = &tmp;
|
282
|
-
break;
|
283
|
-
default:
|
284
|
-
if (VECTOR_COMPLEX_P(argv[0])) {
|
285
|
-
Data_Get_Struct(argv[0], gsl_vector_complex, v);
|
286
|
-
vnew = gsl_vector_complex_alloc(v->size);
|
287
|
-
for (i = 0; i < v->size; i++) {
|
288
|
-
c = GSL_COMPLEX_AT(v, i);
|
289
|
-
gsl_vector_complex_set(vnew, i, (*func)(*c));
|
290
|
-
}
|
291
|
-
return Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_free, vnew);
|
292
|
-
} else if (MATRIX_COMPLEX_P(obj)) {
|
293
|
-
Data_Get_Struct(obj, gsl_matrix_complex, m);
|
294
|
-
mnew = gsl_matrix_complex_alloc(m->size1, m->size2);
|
295
|
-
for (i = 0; i < m->size1; i++) {
|
296
|
-
for (j = 0; j < m->size2; j++) {
|
297
|
-
gsl_matrix_complex_set(mnew, i, j,
|
298
|
-
(*func)(gsl_matrix_complex_get(m, i, j)));
|
299
|
-
}
|
300
|
-
}
|
301
|
-
return Data_Wrap_Struct(cgsl_matrix_complex, 0, gsl_matrix_complex_free, mnew);
|
302
|
-
} else {
|
303
|
-
CHECK_COMPLEX(argv[0]);
|
304
|
-
Data_Get_Struct(argv[0], gsl_complex, c);
|
305
|
-
}
|
306
|
-
break;
|
307
|
-
}
|
308
|
-
break;
|
309
|
-
case 2:
|
310
|
-
c = &tmp;
|
311
|
-
GSL_SET_REAL(c, NUM2DBL(argv[0]));
|
312
|
-
GSL_SET_IMAG(c, NUM2DBL(argv[1]));
|
313
|
-
break;
|
314
|
-
default:
|
315
|
-
rb_raise(rb_eArgError, "wrong number of arguments (%d for 1 or 2)", argc);
|
316
|
-
break;
|
317
|
-
}
|
318
|
-
break;
|
319
|
-
default:
|
320
|
-
Data_Get_Struct(obj, gsl_complex, c);
|
321
|
-
break;
|
322
|
-
}
|
323
|
-
cnew = ALLOC(gsl_complex);
|
324
|
-
*cnew = (*func)(*c);
|
325
|
-
return Data_Wrap_Struct(cgsl_complex, 0, free, cnew);
|
326
|
-
}
|
327
|
-
|
328
|
-
static VALUE rb_gsl_complex_conjugate(VALUE obj)
|
329
|
-
{
|
330
|
-
return rb_gsl_complex_operate(gsl_complex_conjugate, obj);
|
331
|
-
}
|
332
|
-
|
333
|
-
static VALUE rb_gsl_complex_inverse(VALUE obj)
|
334
|
-
{
|
335
|
-
return rb_gsl_complex_operate(gsl_complex_inverse, obj);
|
336
|
-
}
|
337
|
-
|
338
|
-
static VALUE rb_gsl_complex_negative(VALUE obj)
|
339
|
-
{
|
340
|
-
return rb_gsl_complex_operate(gsl_complex_negative, obj);
|
341
|
-
}
|
342
|
-
|
343
|
-
/* singleton */
|
344
|
-
static VALUE rb_gsl_complex_sqrt_real(VALUE obj, VALUE x)
|
345
|
-
{
|
346
|
-
gsl_complex *cnew = NULL, tmp;
|
347
|
-
Need_Float(x);
|
348
|
-
tmp = gsl_complex_sqrt_real(NUM2DBL(x));
|
349
|
-
cnew = ALLOC(gsl_complex);
|
350
|
-
*cnew = tmp;
|
351
|
-
return Data_Wrap_Struct(cgsl_complex, 0, free, cnew);
|
352
|
-
}
|
353
|
-
|
354
|
-
static VALUE rb_gsl_complex_sqrt(int argc, VALUE *argv, VALUE obj)
|
355
|
-
{
|
356
|
-
gsl_complex *z, tmp;
|
357
|
-
switch (TYPE(obj)) {
|
358
|
-
case T_MODULE: case T_CLASS: case T_OBJECT:
|
359
|
-
switch (argc) {
|
360
|
-
case 1:
|
361
|
-
switch (TYPE(argv[0])) {
|
362
|
-
case T_FIXNUM: case T_FLOAT:
|
363
|
-
return rb_gsl_complex_sqrt_real(obj, argv[0]);
|
364
|
-
break;
|
365
|
-
case T_ARRAY:
|
366
|
-
tmp = ary2complex(argv[0]);
|
367
|
-
z = ALLOC(gsl_complex);
|
368
|
-
*z = gsl_complex_sqrt(tmp);
|
369
|
-
return Data_Wrap_Struct(cgsl_complex, 0, free, z);
|
370
|
-
break;
|
371
|
-
default:
|
372
|
-
CHECK_COMPLEX(argv[0]);
|
373
|
-
Data_Get_Struct(argv[0], gsl_complex, z);
|
374
|
-
tmp = *z;
|
375
|
-
z = ALLOC(gsl_complex);
|
376
|
-
*z = gsl_complex_sqrt(tmp);
|
377
|
-
return Data_Wrap_Struct(cgsl_complex, 0, free, z);
|
378
|
-
break;
|
379
|
-
}
|
380
|
-
break;
|
381
|
-
case 2:
|
382
|
-
z = ALLOC(gsl_complex);
|
383
|
-
GSL_SET_REAL(&tmp, NUM2DBL(argv[0]));
|
384
|
-
GSL_SET_IMAG(&tmp, NUM2DBL(argv[1]));
|
385
|
-
*z = gsl_complex_sqrt(tmp);
|
386
|
-
return Data_Wrap_Struct(cgsl_complex, 0, free, z);
|
387
|
-
break;
|
388
|
-
default:
|
389
|
-
rb_raise(rb_eArgError, "wrong number of arguments (%d for 1 or 2)", argc);
|
390
|
-
break;
|
391
|
-
}
|
392
|
-
break;
|
393
|
-
default:
|
394
|
-
return rb_gsl_complex_operate2(gsl_complex_sqrt, argc, argv, obj);
|
395
|
-
break;
|
396
|
-
}
|
397
|
-
}
|
398
|
-
|
399
|
-
VALUE rb_gsl_complex_pow(int argc, VALUE *argv, VALUE obj)
|
400
|
-
{
|
401
|
-
gsl_complex *c = NULL, *a = NULL, *cnew = NULL, tmpc, tmpa;
|
402
|
-
gsl_vector_complex *v, *vnew;
|
403
|
-
gsl_matrix_complex *m, *mnew;
|
404
|
-
size_t i, j;
|
405
|
-
switch (TYPE(obj)) {
|
406
|
-
case T_MODULE:
|
407
|
-
case T_CLASS:
|
408
|
-
case T_OBJECT:
|
409
|
-
if (argc != 2)
|
410
|
-
rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)", argc);
|
411
|
-
switch (TYPE(argv[1])) {
|
412
|
-
case T_ARRAY:
|
413
|
-
tmpa = ary2complex(argv[1]);
|
414
|
-
a = &tmpa;
|
415
|
-
break;
|
416
|
-
case T_FLOAT: case T_FIXNUM:
|
417
|
-
return rb_gsl_complex_pow_real(argc, argv, obj);
|
418
|
-
break;
|
419
|
-
default:
|
420
|
-
CHECK_COMPLEX(argv[1]);
|
421
|
-
Data_Get_Struct(argv[1], gsl_complex, a);
|
422
|
-
break;
|
423
|
-
}
|
424
|
-
|
425
|
-
switch (TYPE(argv[0])) {
|
426
|
-
case T_ARRAY:
|
427
|
-
tmpc = ary2complex(argv[0]);
|
428
|
-
c = &tmpc;
|
429
|
-
break;
|
430
|
-
default:
|
431
|
-
if (VECTOR_COMPLEX_P(argv[0])) {
|
432
|
-
Data_Get_Struct(argv[0], gsl_vector_complex, v);
|
433
|
-
vnew = gsl_vector_complex_alloc(v->size);
|
434
|
-
for (i = 0; i < v->size; i++) {
|
435
|
-
c = GSL_COMPLEX_AT(v, i);
|
436
|
-
gsl_vector_complex_set(vnew, i, gsl_complex_pow(*c, *a));
|
437
|
-
}
|
438
|
-
return Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free, vnew);
|
439
|
-
}
|
440
|
-
if (MATRIX_COMPLEX_P(argv[0])) {
|
441
|
-
Data_Get_Struct(argv[0], gsl_matrix_complex, m);
|
442
|
-
mnew = gsl_matrix_complex_alloc(m->size1, m->size2);
|
443
|
-
for (i = 0; i < m->size1; i++) {
|
444
|
-
for (j = 0; j < m->size2; j++) {
|
445
|
-
c = gsl_matrix_complex_ptr(m, i, j);
|
446
|
-
gsl_matrix_complex_set(mnew, i, j, gsl_complex_pow(*c, *a));
|
447
|
-
}
|
448
|
-
}
|
449
|
-
return Data_Wrap_Struct(cgsl_matrix_complex, 0, gsl_matrix_complex_free, mnew);
|
450
|
-
}
|
451
|
-
CHECK_COMPLEX(argv[0]);
|
452
|
-
Data_Get_Struct(argv[0], gsl_complex, c);
|
453
|
-
break;
|
454
|
-
}
|
455
|
-
|
456
|
-
break;
|
457
|
-
default:
|
458
|
-
if (argc != 1)
|
459
|
-
rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)", argc);
|
460
|
-
CHECK_COMPLEX(obj);
|
461
|
-
Data_Get_Struct(obj, gsl_complex, c);
|
462
|
-
switch (TYPE(argv[0])) {
|
463
|
-
case T_ARRAY:
|
464
|
-
tmpa = ary2complex(argv[0]);
|
465
|
-
a = &tmpa;
|
466
|
-
break;
|
467
|
-
case T_FLOAT: case T_FIXNUM:
|
468
|
-
return rb_gsl_complex_pow_real(argc, argv, obj);
|
469
|
-
break;
|
470
|
-
default:
|
471
|
-
CHECK_COMPLEX(argv[0]);
|
472
|
-
Data_Get_Struct(argv[0], gsl_complex, a);
|
473
|
-
break;
|
474
|
-
}
|
475
|
-
break;
|
476
|
-
}
|
477
|
-
cnew = ALLOC(gsl_complex);
|
478
|
-
*cnew = gsl_complex_pow(*c, *a);
|
479
|
-
return Data_Wrap_Struct(cgsl_complex, 0, free, cnew);
|
480
|
-
}
|
481
|
-
|
482
|
-
VALUE rb_gsl_complex_pow_real(int argc, VALUE *argv, VALUE obj)
|
483
|
-
{
|
484
|
-
double a = 1;
|
485
|
-
gsl_complex *c = NULL, *cnew = NULL, tmpc;
|
486
|
-
gsl_vector_complex *v, *vnew;
|
487
|
-
gsl_matrix_complex *m, *mnew;
|
488
|
-
size_t i, j;
|
489
|
-
switch (TYPE(obj)) {
|
490
|
-
case T_MODULE:
|
491
|
-
case T_CLASS:
|
492
|
-
case T_OBJECT:
|
493
|
-
if (argc != 2)
|
494
|
-
rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)", argc);
|
495
|
-
switch (TYPE(argv[0])) {
|
496
|
-
case T_ARRAY:
|
497
|
-
tmpc = ary2complex(argv[0]);
|
498
|
-
c = &tmpc;
|
499
|
-
a = NUM2DBL(argv[1]);
|
500
|
-
break;
|
501
|
-
default:
|
502
|
-
if (VECTOR_COMPLEX_P(argv[0])) {
|
503
|
-
Data_Get_Struct(argv[0], gsl_vector_complex, v);
|
504
|
-
vnew = gsl_vector_complex_alloc(v->size);
|
505
|
-
a = NUM2DBL(argv[1]);
|
506
|
-
for (i = 0; i < v->size; i++) {
|
507
|
-
c = GSL_COMPLEX_AT(v, i);
|
508
|
-
tmpc = gsl_complex_pow_real(*c, a);
|
509
|
-
gsl_vector_complex_set(vnew, i, tmpc);
|
510
|
-
}
|
511
|
-
return Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_free, vnew);
|
512
|
-
}
|
513
|
-
if (MATRIX_COMPLEX_P(argv[0])) {
|
514
|
-
Data_Get_Struct(argv[0], gsl_matrix_complex, m);
|
515
|
-
mnew = gsl_matrix_complex_alloc(m->size1, m->size2);
|
516
|
-
for (i = 0; i < m->size1; i++) {
|
517
|
-
for (j = 0; j < m->size2; j++) {
|
518
|
-
tmpc = gsl_complex_pow_real(gsl_matrix_complex_get(m, i, j), a);
|
519
|
-
gsl_matrix_complex_set(mnew, i, j, tmpc);
|
520
|
-
}
|
521
|
-
}
|
522
|
-
return Data_Wrap_Struct(cgsl_matrix_complex, 0, gsl_matrix_complex_free, mnew);
|
523
|
-
}
|
524
|
-
CHECK_COMPLEX(argv[0]);
|
525
|
-
Data_Get_Struct(argv[0], gsl_complex, c);
|
526
|
-
break;
|
527
|
-
}
|
528
|
-
Need_Float(argv[1]);
|
529
|
-
a = NUM2DBL(argv[1]);
|
530
|
-
break;
|
531
|
-
default:
|
532
|
-
if (argc != 1)
|
533
|
-
rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)", argc);
|
534
|
-
CHECK_COMPLEX(obj);
|
535
|
-
Need_Float(argv[0]);
|
536
|
-
Data_Get_Struct(obj, gsl_complex, c);
|
537
|
-
a = NUM2DBL(argv[0]);
|
538
|
-
break;
|
539
|
-
}
|
540
|
-
cnew = ALLOC(gsl_complex);
|
541
|
-
*cnew = gsl_complex_pow_real(*c, a);
|
542
|
-
return Data_Wrap_Struct(cgsl_complex, 0, free, cnew);
|
543
|
-
}
|
544
|
-
|
545
|
-
static VALUE rb_gsl_complex_exp(int argc, VALUE *argv, VALUE obj)
|
546
|
-
{
|
547
|
-
return rb_gsl_complex_operate2(gsl_complex_exp, argc, argv, obj);
|
548
|
-
}
|
549
|
-
|
550
|
-
static VALUE rb_gsl_complex_log(int argc, VALUE *argv, VALUE obj)
|
551
|
-
{
|
552
|
-
return rb_gsl_complex_operate2(gsl_complex_log, argc, argv, obj);
|
553
|
-
}
|
554
|
-
|
555
|
-
static VALUE rb_gsl_complex_log10(int argc, VALUE *argv, VALUE obj)
|
556
|
-
{
|
557
|
-
return rb_gsl_complex_operate2(gsl_complex_log10, argc, argv, obj);
|
558
|
-
}
|
559
|
-
|
560
|
-
static VALUE rb_gsl_complex_log_b(int argc, VALUE *argv, VALUE obj)
|
561
|
-
{
|
562
|
-
gsl_complex *c = NULL, *a = NULL, *cnew = NULL, tmpc, tmpa;
|
563
|
-
switch (TYPE(obj)) {
|
564
|
-
case T_MODULE:
|
565
|
-
case T_CLASS:
|
566
|
-
case T_OBJECT:
|
567
|
-
if (argc != 2)
|
568
|
-
rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)", argc);
|
569
|
-
switch (TYPE(argv[1])) {
|
570
|
-
case T_ARRAY:
|
571
|
-
tmpa = ary2complex(argv[1]);
|
572
|
-
a = &tmpa;
|
573
|
-
break;
|
574
|
-
default:
|
575
|
-
CHECK_COMPLEX(argv[1]);
|
576
|
-
Data_Get_Struct(argv[1], gsl_complex, a);
|
577
|
-
break;
|
578
|
-
}
|
579
|
-
|
580
|
-
switch (TYPE(argv[0])) {
|
581
|
-
case T_ARRAY:
|
582
|
-
tmpc = ary2complex(argv[0]);
|
583
|
-
c = &tmpc;
|
584
|
-
break;
|
585
|
-
default:
|
586
|
-
CHECK_COMPLEX(argv[0]);
|
587
|
-
Data_Get_Struct(argv[0], gsl_complex, c);
|
588
|
-
break;
|
589
|
-
}
|
590
|
-
|
591
|
-
break;
|
592
|
-
default:
|
593
|
-
if (argc != 1)
|
594
|
-
rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)", argc);
|
595
|
-
CHECK_COMPLEX(obj);
|
596
|
-
Data_Get_Struct(obj, gsl_complex, c);
|
597
|
-
switch (TYPE(argv[0])) {
|
598
|
-
case T_ARRAY:
|
599
|
-
tmpa = ary2complex(argv[0]);
|
600
|
-
a = &tmpa;
|
601
|
-
break;
|
602
|
-
default:
|
603
|
-
CHECK_COMPLEX(argv[0]);
|
604
|
-
Data_Get_Struct(argv[0], gsl_complex, a);
|
605
|
-
break;
|
606
|
-
}
|
607
|
-
break;
|
608
|
-
}
|
609
|
-
cnew = ALLOC(gsl_complex);
|
610
|
-
*cnew = gsl_complex_log_b(*c, *a);
|
611
|
-
return Data_Wrap_Struct(cgsl_complex, 0, free, cnew);
|
612
|
-
}
|
613
|
-
|
614
|
-
static VALUE rb_gsl_complex_sin(int argc, VALUE *argv, VALUE obj)
|
615
|
-
{
|
616
|
-
return rb_gsl_complex_operate2(gsl_complex_sin, argc, argv, obj);
|
617
|
-
}
|
618
|
-
|
619
|
-
static VALUE rb_gsl_complex_cos(int argc, VALUE *argv, VALUE obj)
|
620
|
-
{
|
621
|
-
return rb_gsl_complex_operate2(gsl_complex_cos, argc, argv, obj);
|
622
|
-
}
|
623
|
-
|
624
|
-
static VALUE rb_gsl_complex_tan(int argc, VALUE *argv, VALUE obj)
|
625
|
-
{
|
626
|
-
return rb_gsl_complex_operate2(gsl_complex_tan, argc, argv, obj);
|
627
|
-
}
|
628
|
-
|
629
|
-
static VALUE rb_gsl_complex_sec(int argc, VALUE *argv, VALUE obj)
|
630
|
-
{
|
631
|
-
return rb_gsl_complex_operate2(gsl_complex_sec, argc, argv, obj);
|
632
|
-
}
|
633
|
-
|
634
|
-
static VALUE rb_gsl_complex_csc(int argc, VALUE *argv, VALUE obj)
|
635
|
-
{
|
636
|
-
return rb_gsl_complex_operate2(gsl_complex_csc, argc, argv, obj);
|
637
|
-
}
|
638
|
-
|
639
|
-
static VALUE rb_gsl_complex_cot(int argc, VALUE *argv, VALUE obj)
|
640
|
-
{
|
641
|
-
return rb_gsl_complex_operate2(gsl_complex_cot, argc, argv, obj);
|
642
|
-
}
|
643
|
-
|
644
|
-
/*****/
|
645
|
-
static VALUE rb_gsl_complex_arcsin(int argc, VALUE *argv, VALUE obj)
|
646
|
-
{
|
647
|
-
return rb_gsl_complex_operate2(gsl_complex_arcsin, argc, argv, obj);
|
648
|
-
}
|
649
|
-
|
650
|
-
static VALUE rb_gsl_complex_arcsin_real(VALUE obj, VALUE xx)
|
651
|
-
{
|
652
|
-
gsl_complex tmp, *cnew = NULL;
|
653
|
-
double x;
|
654
|
-
Need_Float(xx);
|
655
|
-
x = NUM2DBL(xx);
|
656
|
-
tmp = gsl_complex_arcsin_real(x);
|
657
|
-
cnew = ALLOC(gsl_complex);
|
658
|
-
*cnew = tmp;
|
659
|
-
return Data_Wrap_Struct(cgsl_complex, 0, free, cnew);
|
660
|
-
}
|
661
|
-
|
662
|
-
static VALUE rb_gsl_complex_arccos(int argc, VALUE *argv, VALUE obj)
|
663
|
-
{
|
664
|
-
return rb_gsl_complex_operate2(gsl_complex_arccos, argc, argv, obj);
|
665
|
-
}
|
666
|
-
|
667
|
-
static VALUE rb_gsl_complex_arccos_real(VALUE obj, VALUE xx)
|
668
|
-
{
|
669
|
-
gsl_complex tmp, *cnew = NULL;
|
670
|
-
double x;
|
671
|
-
Need_Float(xx);
|
672
|
-
x = NUM2DBL(xx);
|
673
|
-
tmp = gsl_complex_arccos_real(x);
|
674
|
-
cnew = ALLOC(gsl_complex);
|
675
|
-
*cnew = tmp;
|
676
|
-
return Data_Wrap_Struct(cgsl_complex, 0, free, cnew);
|
677
|
-
}
|
678
|
-
|
679
|
-
static VALUE rb_gsl_complex_arctan(int argc, VALUE *argv, VALUE obj)
|
680
|
-
{
|
681
|
-
return rb_gsl_complex_operate2(gsl_complex_arctan, argc, argv, obj);
|
682
|
-
}
|
683
|
-
|
684
|
-
static VALUE rb_gsl_complex_arcsec(int argc, VALUE *argv, VALUE obj)
|
685
|
-
{
|
686
|
-
return rb_gsl_complex_operate2(gsl_complex_arcsec, argc, argv, obj);
|
687
|
-
}
|
688
|
-
|
689
|
-
static VALUE rb_gsl_complex_arcsec_real(VALUE obj, VALUE xx)
|
690
|
-
{
|
691
|
-
gsl_complex tmp, *cnew = NULL;
|
692
|
-
double x;
|
693
|
-
Need_Float(xx);
|
694
|
-
x = NUM2DBL(xx);
|
695
|
-
tmp = gsl_complex_arcsec_real(x);
|
696
|
-
cnew = ALLOC(gsl_complex);
|
697
|
-
*cnew = tmp;
|
698
|
-
return Data_Wrap_Struct(cgsl_complex, 0, free, cnew);
|
699
|
-
}
|
700
|
-
|
701
|
-
static VALUE rb_gsl_complex_arccsc(int argc, VALUE *argv, VALUE obj)
|
702
|
-
{
|
703
|
-
return rb_gsl_complex_operate2(gsl_complex_arccsc, argc, argv, obj);
|
704
|
-
}
|
705
|
-
|
706
|
-
static VALUE rb_gsl_complex_arccsc_real(VALUE obj, VALUE xx)
|
707
|
-
{
|
708
|
-
gsl_complex tmp, *cnew = NULL;
|
709
|
-
double x;
|
710
|
-
Need_Float(xx);
|
711
|
-
x = NUM2DBL(xx);
|
712
|
-
tmp = gsl_complex_arccsc_real(x);
|
713
|
-
cnew = ALLOC(gsl_complex);
|
714
|
-
*cnew = tmp;
|
715
|
-
return Data_Wrap_Struct(cgsl_complex, 0, free, cnew);
|
716
|
-
}
|
717
|
-
|
718
|
-
static VALUE rb_gsl_complex_arccot(int argc, VALUE *argv, VALUE obj)
|
719
|
-
{
|
720
|
-
return rb_gsl_complex_operate2(gsl_complex_arccot, argc, argv, obj);
|
721
|
-
}
|
722
|
-
|
723
|
-
static VALUE rb_gsl_complex_sinh(int argc, VALUE *argv, VALUE obj)
|
724
|
-
{
|
725
|
-
return rb_gsl_complex_operate2(gsl_complex_sinh, argc, argv, obj);
|
726
|
-
}
|
727
|
-
|
728
|
-
static VALUE rb_gsl_complex_cosh(int argc, VALUE *argv, VALUE obj)
|
729
|
-
{
|
730
|
-
return rb_gsl_complex_operate2(gsl_complex_cosh, argc, argv, obj);
|
731
|
-
}
|
732
|
-
|
733
|
-
static VALUE rb_gsl_complex_tanh(int argc, VALUE *argv, VALUE obj)
|
734
|
-
{
|
735
|
-
return rb_gsl_complex_operate2(gsl_complex_tanh, argc, argv, obj);
|
736
|
-
}
|
737
|
-
|
738
|
-
static VALUE rb_gsl_complex_sech(int argc, VALUE *argv, VALUE obj)
|
739
|
-
{
|
740
|
-
return rb_gsl_complex_operate2(gsl_complex_sech, argc, argv, obj);
|
741
|
-
}
|
742
|
-
|
743
|
-
static VALUE rb_gsl_complex_csch(int argc, VALUE *argv, VALUE obj)
|
744
|
-
{
|
745
|
-
return rb_gsl_complex_operate2(gsl_complex_csch, argc, argv, obj);
|
746
|
-
}
|
747
|
-
|
748
|
-
static VALUE rb_gsl_complex_coth(int argc, VALUE *argv, VALUE obj)
|
749
|
-
{
|
750
|
-
return rb_gsl_complex_operate2(gsl_complex_coth, argc, argv, obj);
|
751
|
-
}
|
752
|
-
|
753
|
-
static VALUE rb_gsl_complex_arcsinh(int argc, VALUE *argv, VALUE obj)
|
754
|
-
{
|
755
|
-
return rb_gsl_complex_operate2(gsl_complex_arcsinh, argc, argv, obj);
|
756
|
-
}
|
757
|
-
|
758
|
-
static VALUE rb_gsl_complex_arccosh_real(VALUE obj, VALUE xx)
|
759
|
-
{
|
760
|
-
gsl_complex tmp, *cnew = NULL;
|
761
|
-
double x;
|
762
|
-
Need_Float(xx);
|
763
|
-
x = NUM2DBL(xx);
|
764
|
-
tmp = gsl_complex_arccosh_real(x);
|
765
|
-
cnew = ALLOC(gsl_complex);
|
766
|
-
*cnew = tmp;
|
767
|
-
return Data_Wrap_Struct(cgsl_complex, 0, free, cnew);
|
768
|
-
}
|
769
|
-
|
770
|
-
static VALUE rb_gsl_complex_arccosh(int argc, VALUE *argv, VALUE obj)
|
771
|
-
{
|
772
|
-
return rb_gsl_complex_operate2(gsl_complex_arccosh, argc, argv, obj);
|
773
|
-
}
|
774
|
-
|
775
|
-
static VALUE rb_gsl_complex_arctanh(int argc, VALUE *argv, VALUE obj)
|
776
|
-
{
|
777
|
-
return rb_gsl_complex_operate2(gsl_complex_arctanh, argc, argv, obj);
|
778
|
-
}
|
779
|
-
|
780
|
-
static VALUE rb_gsl_complex_arctanh_real(VALUE obj, VALUE xx)
|
781
|
-
{
|
782
|
-
gsl_complex tmp, *cnew = NULL;
|
783
|
-
double x;
|
784
|
-
Need_Float(xx);
|
785
|
-
x = NUM2DBL(xx);
|
786
|
-
tmp = gsl_complex_arctanh_real(x);
|
787
|
-
cnew = ALLOC(gsl_complex);
|
788
|
-
*cnew = tmp;
|
789
|
-
return Data_Wrap_Struct(cgsl_complex, 0, free, cnew);
|
790
|
-
}
|
791
|
-
|
792
|
-
static VALUE rb_gsl_complex_arcsech(int argc, VALUE *argv, VALUE obj)
|
793
|
-
{
|
794
|
-
return rb_gsl_complex_operate2(gsl_complex_arcsech, argc, argv, obj);
|
795
|
-
}
|
796
|
-
|
797
|
-
static VALUE rb_gsl_complex_arccsch(int argc, VALUE *argv, VALUE obj)
|
798
|
-
{
|
799
|
-
return rb_gsl_complex_operate2(gsl_complex_arccsch, argc, argv, obj);
|
800
|
-
}
|
801
|
-
|
802
|
-
static VALUE rb_gsl_complex_arccoth(int argc, VALUE *argv, VALUE obj)
|
803
|
-
{
|
804
|
-
return rb_gsl_complex_operate2(gsl_complex_arccoth, argc, argv, obj);
|
805
|
-
}
|
806
|
-
|
807
|
-
int rbgsl_complex_equal(const gsl_complex *z1, const gsl_complex *z2,
|
808
|
-
double eps)
|
809
|
-
{
|
810
|
-
if (gsl_fcmp(z1->dat[0], z2->dat[0], eps) != 0) return 0;
|
811
|
-
if (gsl_fcmp(z1->dat[1], z2->dat[1], eps) != 0) return 0;
|
812
|
-
return 1;
|
813
|
-
}
|
814
|
-
|
815
|
-
int rbgsl_complex_zero(const gsl_complex *z1)
|
816
|
-
{
|
817
|
-
if (z1->dat[0] != 0.0) return 0;
|
818
|
-
if (z1->dat[1] != 0.0) return 0;
|
819
|
-
return 1;
|
820
|
-
}
|
821
|
-
|
822
|
-
static VALUE rb_gsl_complex_equal(int argc, VALUE *argv, VALUE obj)
|
823
|
-
{
|
824
|
-
gsl_complex *z1 = NULL, *z2 = NULL;
|
825
|
-
double eps = 1e-8;
|
826
|
-
|
827
|
-
switch (argc) {
|
828
|
-
case 1:
|
829
|
-
CHECK_COMPLEX(argv[0]);
|
830
|
-
Data_Get_Struct(argv[0], gsl_complex, z2);
|
831
|
-
break;
|
832
|
-
case 2:
|
833
|
-
CHECK_COMPLEX(argv[0]);
|
834
|
-
Data_Get_Struct(argv[0], gsl_complex, z2);
|
835
|
-
eps = NUM2DBL(argv[1]);
|
836
|
-
break;
|
837
|
-
default:
|
838
|
-
rb_raise(rb_eArgError, "Wrong number of argumsnts (%d for 1 or 2)", argc);
|
839
|
-
}
|
840
|
-
Data_Get_Struct(obj, gsl_complex, z1);
|
841
|
-
if (rbgsl_complex_equal(z1, z2, eps)) return Qtrue;
|
842
|
-
else return Qfalse;
|
843
|
-
}
|
844
|
-
|
845
|
-
static VALUE rb_gsl_complex_zero(VALUE obj)
|
846
|
-
{
|
847
|
-
gsl_complex *z = NULL;
|
848
|
-
Data_Get_Struct(obj, gsl_complex, z);
|
849
|
-
if (rbgsl_complex_zero(z)) return Qtrue;
|
850
|
-
else return Qfalse;
|
851
|
-
}
|
852
|
-
|
853
|
-
static VALUE rb_gsl_complex_to_s(VALUE obj)
|
854
|
-
{
|
855
|
-
char buf[256];
|
856
|
-
gsl_complex *z;
|
857
|
-
Data_Get_Struct(obj, gsl_complex, z);
|
858
|
-
sprintf(buf, "[ %4.3e %4.3e ]", GSL_REAL(*z), GSL_IMAG(*z));
|
859
|
-
return rb_str_new2(buf);
|
860
|
-
}
|
861
|
-
|
862
|
-
static VALUE rb_gsl_complex_inspect(VALUE obj)
|
863
|
-
{
|
864
|
-
char buf[256];
|
865
|
-
VALUE str;
|
866
|
-
sprintf(buf, "%s\n", rb_class2name(CLASS_OF(obj)));
|
867
|
-
str = rb_str_new2(buf);
|
868
|
-
return rb_str_concat(str, rb_gsl_complex_to_s(obj));
|
869
|
-
}
|
870
|
-
|
871
|
-
void Init_gsl_complex(VALUE module)
|
872
|
-
{
|
873
|
-
cgsl_complex = rb_define_class_under(module, "Complex", rb_cNumeric);
|
874
|
-
rb_define_singleton_method(cgsl_complex, "alloc", rb_gsl_complex_new, -1);
|
875
|
-
rb_define_singleton_method(cgsl_complex, "rect", rb_gsl_complex_new, -1);
|
876
|
-
rb_define_singleton_method(cgsl_complex, "[]", rb_gsl_complex_new, -1);
|
877
|
-
rb_define_singleton_method(cgsl_complex, "polar", rb_gsl_complex_polar, 2);
|
878
|
-
|
879
|
-
rb_define_method(cgsl_complex, "equal?", rb_gsl_complex_equal, -1);
|
880
|
-
rb_define_alias(cgsl_complex, "==", "equal?");
|
881
|
-
rb_define_method(cgsl_complex, "zero?", rb_gsl_complex_zero, 0);
|
882
|
-
|
883
|
-
rb_define_method(cgsl_complex, "get", rb_gsl_complex_get, 1);
|
884
|
-
rb_define_alias(cgsl_complex, "[]", "get");
|
885
|
-
rb_define_method(cgsl_complex, "real", rb_gsl_complex_real, 0);
|
886
|
-
rb_define_alias(cgsl_complex, "re", "real");
|
887
|
-
rb_define_alias(cgsl_complex, "REAL", "real");
|
888
|
-
rb_define_method(cgsl_complex, "imag", rb_gsl_complex_imag, 0);
|
889
|
-
rb_define_alias(cgsl_complex, "im", "imag");
|
890
|
-
rb_define_alias(cgsl_complex, "IMAG", "imag");
|
891
|
-
rb_define_method(cgsl_complex, "print", rb_gsl_complex_print, 0);
|
892
|
-
rb_define_method(cgsl_complex, "printf", rb_gsl_complex_printf, 1);
|
893
|
-
rb_define_alias(cgsl_complex, "show", "print");
|
894
|
-
|
895
|
-
rb_define_method(cgsl_complex, "arg", rb_gsl_complex_arg, 0);
|
896
|
-
rb_define_alias(cgsl_complex, "angle", "arg");
|
897
|
-
rb_define_alias(cgsl_complex, "phase", "arg");
|
898
|
-
rb_define_method(cgsl_complex, "abs", rb_gsl_complex_abs, 0);
|
899
|
-
rb_define_alias(cgsl_complex, "amp", "abs");
|
900
|
-
rb_define_alias(cgsl_complex, "mag", "abs");
|
901
|
-
rb_define_method(cgsl_complex, "abs2", rb_gsl_complex_abs2, 0);
|
902
|
-
rb_define_method(cgsl_complex, "logabs", rb_gsl_complex_logabs, 0);
|
903
|
-
|
904
|
-
rb_define_method(cgsl_complex, "add_real", rb_gsl_complex_add_real, 1);
|
905
|
-
rb_define_method(cgsl_complex, "sub_real", rb_gsl_complex_sub_real, 1);
|
906
|
-
rb_define_method(cgsl_complex, "mul_real", rb_gsl_complex_mul_real, 1);
|
907
|
-
rb_define_method(cgsl_complex, "div_real", rb_gsl_complex_div_real, 1);
|
908
|
-
rb_define_method(cgsl_complex, "add_imag", rb_gsl_complex_add_imag, 1);
|
909
|
-
rb_define_method(cgsl_complex, "sub_imag", rb_gsl_complex_sub_imag, 1);
|
910
|
-
rb_define_method(cgsl_complex, "mul_imag", rb_gsl_complex_mul_imag, 1);
|
911
|
-
rb_define_method(cgsl_complex, "div_imag", rb_gsl_complex_div_imag, 1);
|
912
|
-
|
913
|
-
rb_define_method(cgsl_complex, "conjugate", rb_gsl_complex_conjugate, 0);
|
914
|
-
rb_define_alias(cgsl_complex, "conj", "conjugate");
|
915
|
-
rb_define_method(cgsl_complex, "inverse", rb_gsl_complex_inverse, 0);
|
916
|
-
rb_define_method(cgsl_complex, "negative", rb_gsl_complex_negative, 0);
|
917
|
-
|
918
|
-
rb_define_singleton_method(cgsl_complex, "sqrt", rb_gsl_complex_sqrt, -1);
|
919
|
-
rb_define_singleton_method(cgsl_complex, "sqrt_real", rb_gsl_complex_sqrt_real, 1);
|
920
|
-
rb_define_singleton_method(cgsl_complex, "pow", rb_gsl_complex_pow, -1);
|
921
|
-
rb_define_singleton_method(cgsl_complex, "pow_real", rb_gsl_complex_pow_real, -1);
|
922
|
-
|
923
|
-
rb_define_singleton_method(cgsl_complex, "exp", rb_gsl_complex_exp, -1);
|
924
|
-
rb_define_singleton_method(cgsl_complex, "log", rb_gsl_complex_log, -1);
|
925
|
-
rb_define_singleton_method(cgsl_complex, "log10", rb_gsl_complex_log10, -1);
|
926
|
-
rb_define_singleton_method(cgsl_complex, "log_b", rb_gsl_complex_log_b, -1);
|
927
|
-
|
928
|
-
rb_define_singleton_method(cgsl_complex, "sin", rb_gsl_complex_sin, -1);
|
929
|
-
rb_define_singleton_method(cgsl_complex, "cos", rb_gsl_complex_cos, -1);
|
930
|
-
rb_define_singleton_method(cgsl_complex, "tan", rb_gsl_complex_tan, -1);
|
931
|
-
rb_define_singleton_method(cgsl_complex, "sec", rb_gsl_complex_sec, -1);
|
932
|
-
rb_define_singleton_method(cgsl_complex, "csc", rb_gsl_complex_csc, -1);
|
933
|
-
rb_define_singleton_method(cgsl_complex, "cot", rb_gsl_complex_cot, -1);
|
934
|
-
|
935
|
-
rb_define_singleton_method(cgsl_complex, "arcsin", rb_gsl_complex_arcsin, -1);
|
936
|
-
rb_define_singleton_method(cgsl_complex, "arcsin_real", rb_gsl_complex_arcsin_real, 1);
|
937
|
-
rb_define_singleton_method(cgsl_complex, "arccos", rb_gsl_complex_arccos, -1);
|
938
|
-
rb_define_singleton_method(cgsl_complex, "arccos_real", rb_gsl_complex_arccos_real, 1);
|
939
|
-
rb_define_singleton_method(cgsl_complex, "arctan", rb_gsl_complex_arctan, -1);
|
940
|
-
rb_define_singleton_method(cgsl_complex, "arcsec", rb_gsl_complex_arcsec, -1);
|
941
|
-
rb_define_singleton_method(cgsl_complex, "arcsec_real", rb_gsl_complex_arcsec_real, 1);
|
942
|
-
rb_define_singleton_method(cgsl_complex, "arccsc", rb_gsl_complex_arccsc, -1);
|
943
|
-
rb_define_singleton_method(cgsl_complex, "arccsc_real", rb_gsl_complex_arccsc_real, 1);
|
944
|
-
rb_define_singleton_method(cgsl_complex, "arccot", rb_gsl_complex_arccot, -1);
|
945
|
-
|
946
|
-
rb_define_singleton_method(cgsl_complex, "sinh", rb_gsl_complex_sinh, -1);
|
947
|
-
rb_define_singleton_method(cgsl_complex, "cosh", rb_gsl_complex_cosh, -1);
|
948
|
-
rb_define_singleton_method(cgsl_complex, "tanh", rb_gsl_complex_tanh, -1);
|
949
|
-
rb_define_singleton_method(cgsl_complex, "sech", rb_gsl_complex_sech, -1);
|
950
|
-
rb_define_singleton_method(cgsl_complex, "csch", rb_gsl_complex_csch, -1);
|
951
|
-
rb_define_singleton_method(cgsl_complex, "coth", rb_gsl_complex_coth, -1);
|
952
|
-
|
953
|
-
rb_define_singleton_method(cgsl_complex, "arcsinh", rb_gsl_complex_arcsinh, -1);
|
954
|
-
rb_define_singleton_method(cgsl_complex, "arccosh", rb_gsl_complex_arccosh, -1);
|
955
|
-
rb_define_singleton_method(cgsl_complex, "arccosh_real", rb_gsl_complex_arccosh_real, 1);
|
956
|
-
rb_define_singleton_method(cgsl_complex, "arctanh", rb_gsl_complex_arctanh, -1);
|
957
|
-
rb_define_singleton_method(cgsl_complex, "arctanh_real", rb_gsl_complex_arctanh_real, 1);
|
958
|
-
rb_define_singleton_method(cgsl_complex, "arcsech", rb_gsl_complex_arcsech, -1);
|
959
|
-
rb_define_singleton_method(cgsl_complex, "arccsch", rb_gsl_complex_arccsch, -1);
|
960
|
-
rb_define_singleton_method(cgsl_complex, "arccoth", rb_gsl_complex_arccoth, -1);
|
961
|
-
|
962
|
-
/***/
|
963
|
-
|
964
|
-
rb_define_method(cgsl_complex, "pow", rb_gsl_complex_pow, -1);
|
965
|
-
rb_define_method(cgsl_complex, "pow_real", rb_gsl_complex_pow_real, -1);
|
966
|
-
|
967
|
-
rb_define_method(cgsl_complex, "exp", rb_gsl_complex_exp, -1);
|
968
|
-
rb_define_method(cgsl_complex, "log", rb_gsl_complex_log, -1);
|
969
|
-
rb_define_method(cgsl_complex, "log10", rb_gsl_complex_log10, -1);
|
970
|
-
rb_define_method(cgsl_complex, "log_b", rb_gsl_complex_log_b, -1);
|
971
|
-
|
972
|
-
rb_define_method(cgsl_complex, "sin", rb_gsl_complex_sin, -1);
|
973
|
-
rb_define_method(cgsl_complex, "cos", rb_gsl_complex_cos, -1);
|
974
|
-
rb_define_method(cgsl_complex, "tan", rb_gsl_complex_tan, -1);
|
975
|
-
rb_define_method(cgsl_complex, "sec", rb_gsl_complex_sec, -1);
|
976
|
-
rb_define_method(cgsl_complex, "csc", rb_gsl_complex_csc, -1);
|
977
|
-
rb_define_method(cgsl_complex, "cot", rb_gsl_complex_cot, -1);
|
978
|
-
|
979
|
-
rb_define_method(cgsl_complex, "arcsin", rb_gsl_complex_arcsin, -1);
|
980
|
-
rb_define_method(cgsl_complex, "arccos", rb_gsl_complex_arccos, -1);
|
981
|
-
rb_define_method(cgsl_complex, "arctan", rb_gsl_complex_arctan, -1);
|
982
|
-
rb_define_method(cgsl_complex, "arcsec", rb_gsl_complex_arcsec, -1);
|
983
|
-
rb_define_method(cgsl_complex, "arccsc", rb_gsl_complex_arccsc, -1);
|
984
|
-
rb_define_method(cgsl_complex, "arccot", rb_gsl_complex_arccot, -1);
|
985
|
-
|
986
|
-
rb_define_method(cgsl_complex, "sinh", rb_gsl_complex_sinh, -1);
|
987
|
-
rb_define_method(cgsl_complex, "cosh", rb_gsl_complex_cosh, -1);
|
988
|
-
rb_define_method(cgsl_complex, "tanh", rb_gsl_complex_tanh, -1);
|
989
|
-
rb_define_method(cgsl_complex, "sech", rb_gsl_complex_sech, -1);
|
990
|
-
rb_define_method(cgsl_complex, "csch", rb_gsl_complex_csch, -1);
|
991
|
-
rb_define_method(cgsl_complex, "coth", rb_gsl_complex_coth, -1);
|
992
|
-
|
993
|
-
rb_define_method(cgsl_complex, "arcsinh", rb_gsl_complex_arcsinh, -1);
|
994
|
-
rb_define_method(cgsl_complex, "arccosh", rb_gsl_complex_arccosh, -1);
|
995
|
-
rb_define_method(cgsl_complex, "arctanh", rb_gsl_complex_arctanh, -1);
|
996
|
-
rb_define_method(cgsl_complex, "arcsech", rb_gsl_complex_arcsech, -1);
|
997
|
-
rb_define_method(cgsl_complex, "arccsch", rb_gsl_complex_arccsch, -1);
|
998
|
-
rb_define_method(cgsl_complex, "arccoth", rb_gsl_complex_arccoth, -1);
|
999
|
-
|
1000
|
-
rb_define_method(cgsl_complex, "to_s", rb_gsl_complex_to_s, 0);
|
1001
|
-
rb_define_method(cgsl_complex, "inspect", rb_gsl_complex_inspect, 0);
|
1002
|
-
}
|