rb-gsl 1.16.0.4 → 1.16.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +12 -0
- data/.travis.yml +24 -0
- data/AUTHORS +6 -0
- data/COPYING +341 -339
- data/ChangeLog +608 -587
- data/Gemfile +4 -0
- data/README.md +77 -0
- data/Rakefile +14 -33
- data/THANKS +1 -1
- data/examples/blas/blas.rb +1 -1
- data/examples/bspline.rb +3 -3
- data/examples/complex/functions.rb +4 -4
- data/examples/complex/mul.rb +1 -1
- data/examples/const/physconst.rb +4 -4
- data/examples/const/travel.rb +4 -4
- data/examples/eigen/nonsymmv.rb +1 -1
- data/examples/eigen/qhoscillator.rb +3 -3
- data/examples/fft/radix2.rb +1 -1
- data/examples/fft/real-halfcomplex.rb +3 -3
- data/examples/fft/real-halfcomplex2.rb +3 -3
- data/examples/fit/expfit.rb +1 -1
- data/examples/fit/multifit.rb +1 -1
- data/examples/fit/ndlinear.rb +44 -44
- data/examples/fit/nonlinearfit.rb +1 -1
- data/examples/fit/wlinear.rb +3 -3
- data/examples/function/function.rb +1 -1
- data/examples/function/min.rb +1 -1
- data/examples/function/synchrotron.rb +2 -2
- data/examples/gallery/koch.rb +1 -1
- data/examples/histogram/cauchy.rb +2 -2
- data/examples/histogram/exponential.rb +1 -1
- data/examples/histogram/histo3d.rb +1 -1
- data/examples/histogram/histogram-pdf.rb +2 -2
- data/examples/histogram/xexp.rb +1 -1
- data/examples/integration/ahmed.rb +2 -2
- data/examples/integration/cosmology.rb +7 -7
- data/examples/integration/friedmann.rb +4 -4
- data/examples/integration/qng.rb +1 -1
- data/examples/interp/demo.rb +2 -2
- data/examples/linalg/LQ_solve.rb +1 -1
- data/examples/linalg/LU.rb +1 -1
- data/examples/linalg/LU2.rb +1 -1
- data/examples/linalg/LU_narray.rb +1 -1
- data/examples/linalg/PTLQ.rb +1 -1
- data/examples/linalg/QRPT.rb +1 -1
- data/examples/linalg/chol.rb +1 -1
- data/examples/linalg/chol_narray.rb +1 -1
- data/examples/linalg/complex.rb +1 -1
- data/examples/math/elementary.rb +1 -1
- data/examples/math/functions.rb +1 -1
- data/examples/math/inf_nan.rb +1 -1
- data/examples/math/minmax.rb +1 -1
- data/examples/math/power.rb +1 -1
- data/examples/math/test.rb +1 -1
- data/examples/min.rb +1 -1
- data/examples/multimin/bundle.rb +1 -1
- data/examples/multimin/cqp.rb +17 -17
- data/examples/multiroot/fsolver3.rb +1 -1
- data/examples/odeiv/binarysystem.rb +12 -12
- data/examples/odeiv/demo.rb +3 -3
- data/examples/odeiv/frei1.rb +7 -7
- data/examples/odeiv/frei2.rb +4 -4
- data/examples/odeiv/oscillator.rb +1 -1
- data/examples/odeiv/sedov.rb +3 -3
- data/examples/odeiv/whitedwarf.rb +11 -11
- data/examples/permutation/ex1.rb +2 -2
- data/examples/permutation/permutation.rb +1 -1
- data/examples/poly/demo.rb +1 -1
- data/examples/random/diffusion.rb +1 -1
- data/examples/random/generator.rb +2 -2
- data/examples/random/randomwalk.rb +3 -3
- data/examples/random/rng.rb +1 -1
- data/examples/roots/bisection.rb +1 -1
- data/examples/roots/brent.rb +1 -1
- data/examples/roots/demo.rb +1 -1
- data/examples/roots/newton.rb +2 -2
- data/examples/roots/recombination.gp +0 -1
- data/examples/sf/hyperg.rb +1 -1
- data/examples/sf/sphbessel.rb +1 -1
- data/examples/sort/sort.rb +1 -1
- data/examples/tamu_anova.rb +4 -4
- data/examples/vector/add.rb +1 -1
- data/examples/vector/decimate.rb +1 -1
- data/examples/vector/gnuplot.rb +8 -8
- data/examples/vector/vector.rb +2 -2
- data/examples/wavelet/wavelet1.rb +1 -1
- data/ext/{gsl → gsl_native}/alf.c +9 -9
- data/ext/{gsl → gsl_native}/array.c +64 -151
- data/ext/{gsl → gsl_native}/array_complex.c +61 -63
- data/ext/{gsl → gsl_native}/blas.c +0 -0
- data/ext/{gsl → gsl_native}/blas1.c +32 -32
- data/ext/{gsl → gsl_native}/blas2.c +54 -58
- data/ext/{gsl → gsl_native}/blas3.c +54 -54
- data/ext/{gsl → gsl_native}/block.c +3 -6
- data/ext/{gsl/block_source.c → gsl_native/block_source.h} +109 -111
- data/ext/gsl_native/bspline.c +122 -0
- data/ext/{gsl → gsl_native}/bundle.c +0 -0
- data/ext/{gsl → gsl_native}/cdf.c +76 -88
- data/ext/{gsl → gsl_native}/cheb.c +74 -85
- data/ext/{gsl → gsl_native}/combination.c +9 -16
- data/ext/{gsl → gsl_native}/common.c +7 -37
- data/ext/{gsl → gsl_native}/complex.c +113 -115
- data/ext/gsl_native/const.c +331 -0
- data/ext/{gsl → gsl_native}/const_additional.c +12 -33
- data/ext/gsl_native/cqp.c +283 -0
- data/ext/{gsl → gsl_native}/deriv.c +22 -30
- data/ext/{gsl → gsl_native}/dht.c +20 -28
- data/ext/{gsl → gsl_native}/diff.c +23 -25
- data/ext/{gsl → gsl_native}/dirac.c +44 -45
- data/ext/{gsl → gsl_native}/eigen.c +1031 -1082
- data/ext/{gsl → gsl_native}/error.c +13 -13
- data/ext/{gsl → gsl_native}/extconf.rb +5 -13
- data/ext/{gsl → gsl_native}/fft.c +192 -198
- data/ext/{gsl → gsl_native}/fit.c +16 -16
- data/ext/gsl_native/fresnel.c +312 -0
- data/ext/{gsl → gsl_native}/function.c +29 -35
- data/ext/{gsl → gsl_native}/geometry.c +15 -15
- data/ext/{gsl → gsl_native}/graph.c +37 -87
- data/ext/{gsl → gsl_native}/gsl.c +10 -23
- data/ext/{gsl → gsl_native}/gsl_narray.c +15 -24
- data/ext/{gsl → gsl_native}/histogram.c +123 -150
- data/ext/{gsl → gsl_native}/histogram2d.c +71 -96
- data/ext/{gsl → gsl_native}/histogram3d.c +72 -72
- data/ext/{gsl → gsl_native}/histogram3d_source.c +195 -196
- data/ext/{gsl → gsl_native}/histogram_find.c +31 -33
- data/ext/{gsl → gsl_native}/histogram_oper.c +43 -52
- data/ext/{gsl → gsl_native}/ieee.c +7 -15
- data/ext/{gsl → gsl_native}/include/rb_gsl.h +0 -7
- data/ext/{gsl → gsl_native}/include/rb_gsl_array.h +15 -25
- data/ext/{gsl → gsl_native}/include/rb_gsl_cheb.h +0 -0
- data/ext/{gsl → gsl_native}/include/rb_gsl_common.h +44 -52
- data/ext/{gsl → gsl_native}/include/rb_gsl_complex.h +0 -0
- data/ext/{gsl → gsl_native}/include/rb_gsl_const.h +0 -5
- data/ext/{gsl → gsl_native}/include/rb_gsl_dirac.h +0 -0
- data/ext/{gsl → gsl_native}/include/rb_gsl_eigen.h +0 -0
- data/ext/{gsl → gsl_native}/include/rb_gsl_fft.h +0 -3
- data/ext/{gsl → gsl_native}/include/rb_gsl_fit.h +0 -0
- data/ext/{gsl → gsl_native}/include/rb_gsl_function.h +0 -0
- data/ext/{gsl → gsl_native}/include/rb_gsl_graph.h +2 -2
- data/ext/{gsl → gsl_native}/include/rb_gsl_histogram.h +8 -8
- data/ext/{gsl → gsl_native}/include/rb_gsl_histogram3d.h +50 -50
- data/ext/{gsl → gsl_native}/include/rb_gsl_integration.h +0 -0
- data/ext/{gsl → gsl_native}/include/rb_gsl_interp.h +0 -0
- data/ext/{gsl → gsl_native}/include/rb_gsl_linalg.h +0 -1
- data/ext/{gsl → gsl_native}/include/rb_gsl_math.h +0 -4
- data/ext/{gsl → gsl_native}/include/rb_gsl_odeiv.h +0 -0
- data/ext/{gsl → gsl_native}/include/rb_gsl_poly.h +3 -3
- data/ext/{gsl → gsl_native}/include/rb_gsl_rational.h +1 -1
- data/ext/{gsl → gsl_native}/include/rb_gsl_rng.h +0 -0
- data/ext/{gsl → gsl_native}/include/rb_gsl_root.h +0 -0
- data/ext/{gsl → gsl_native}/include/rb_gsl_sf.h +39 -43
- data/ext/{gsl → gsl_native}/include/rb_gsl_statistics.h +0 -0
- data/ext/{gsl → gsl_native}/include/rb_gsl_tensor.h +0 -0
- data/ext/{gsl → gsl_native}/include/rb_gsl_with_narray.h +0 -0
- data/ext/{gsl → gsl_native}/include/templates_off.h +0 -0
- data/ext/{gsl → gsl_native}/include/templates_on.h +1 -1
- data/ext/{gsl → gsl_native}/integration.c +160 -183
- data/ext/{gsl → gsl_native}/interp.c +23 -31
- data/ext/gsl_native/jacobi.c +733 -0
- data/ext/{gsl → gsl_native}/linalg.c +448 -576
- data/ext/{gsl → gsl_native}/linalg_complex.c +84 -98
- data/ext/{gsl → gsl_native}/math.c +45 -63
- data/ext/{gsl → gsl_native}/matrix.c +4 -6
- data/ext/{gsl → gsl_native}/matrix_complex.c +111 -114
- data/ext/{gsl → gsl_native}/matrix_double.c +74 -77
- data/ext/{gsl → gsl_native}/matrix_int.c +49 -50
- data/ext/{gsl/matrix_source.c → gsl_native/matrix_source.h} +280 -302
- data/ext/{gsl → gsl_native}/min.c +43 -74
- data/ext/{gsl → gsl_native}/monte.c +45 -59
- data/ext/{gsl → gsl_native}/multifit.c +138 -147
- data/ext/{gsl → gsl_native}/multimin.c +55 -83
- data/ext/{gsl → gsl_native}/multimin_fsdf.c +15 -15
- data/ext/{gsl → gsl_native}/multiroots.c +61 -64
- data/ext/{gsl → gsl_native}/multiset.c +3 -7
- data/ext/{gsl → gsl_native}/ndlinear.c +320 -321
- data/ext/{gsl → gsl_native}/nmf.c +11 -11
- data/ext/{gsl → gsl_native}/nmf_wrap.c +1 -1
- data/ext/{gsl → gsl_native}/ntuple.c +13 -13
- data/ext/{gsl → gsl_native}/odeiv.c +95 -106
- data/ext/gsl_native/ool.c +879 -0
- data/ext/{gsl → gsl_native}/permutation.c +36 -34
- data/ext/{gsl → gsl_native}/poly.c +2 -5
- data/ext/{gsl → gsl_native}/poly2.c +6 -6
- data/ext/{gsl/poly_source.c → gsl_native/poly_source.h} +232 -275
- data/ext/{gsl → gsl_native}/qrng.c +6 -17
- data/ext/{gsl → gsl_native}/randist.c +218 -243
- data/ext/{gsl → gsl_native}/rational.c +9 -9
- data/ext/{gsl → gsl_native}/rng.c +29 -45
- data/ext/{gsl → gsl_native}/root.c +43 -43
- data/ext/{gsl → gsl_native}/sf.c +163 -197
- data/ext/{gsl → gsl_native}/sf_airy.c +0 -0
- data/ext/{gsl → gsl_native}/sf_bessel.c +6 -6
- data/ext/{gsl → gsl_native}/sf_clausen.c +0 -0
- data/ext/{gsl → gsl_native}/sf_coulomb.c +39 -39
- data/ext/{gsl → gsl_native}/sf_coupling.c +29 -29
- data/ext/{gsl → gsl_native}/sf_dawson.c +0 -0
- data/ext/{gsl → gsl_native}/sf_debye.c +0 -9
- data/ext/{gsl → gsl_native}/sf_dilog.c +0 -0
- data/ext/{gsl → gsl_native}/sf_elementary.c +2 -2
- data/ext/{gsl → gsl_native}/sf_ellint.c +42 -42
- data/ext/{gsl → gsl_native}/sf_elljac.c +2 -2
- data/ext/{gsl → gsl_native}/sf_erfc.c +0 -4
- data/ext/{gsl → gsl_native}/sf_exp.c +2 -2
- data/ext/{gsl → gsl_native}/sf_expint.c +1 -11
- data/ext/{gsl → gsl_native}/sf_fermi_dirac.c +0 -0
- data/ext/{gsl → gsl_native}/sf_gamma.c +1 -5
- data/ext/{gsl → gsl_native}/sf_gegenbauer.c +0 -0
- data/ext/{gsl → gsl_native}/sf_hyperg.c +0 -0
- data/ext/{gsl → gsl_native}/sf_laguerre.c +3 -3
- data/ext/{gsl → gsl_native}/sf_lambert.c +0 -0
- data/ext/{gsl → gsl_native}/sf_legendre.c +0 -0
- data/ext/{gsl → gsl_native}/sf_log.c +3 -3
- data/ext/gsl_native/sf_mathieu.c +235 -0
- data/ext/{gsl → gsl_native}/sf_power.c +0 -0
- data/ext/{gsl → gsl_native}/sf_psi.c +2 -11
- data/ext/{gsl → gsl_native}/sf_synchrotron.c +0 -0
- data/ext/{gsl → gsl_native}/sf_transport.c +0 -0
- data/ext/{gsl → gsl_native}/sf_trigonometric.c +3 -3
- data/ext/{gsl → gsl_native}/sf_zeta.c +0 -4
- data/ext/{gsl → gsl_native}/signal.c +60 -64
- data/ext/{gsl → gsl_native}/siman.c +36 -40
- data/ext/{gsl → gsl_native}/sort.c +3 -4
- data/ext/{gsl → gsl_native}/spline.c +25 -43
- data/ext/{gsl → gsl_native}/stats.c +102 -115
- data/ext/{gsl → gsl_native}/sum.c +32 -32
- data/ext/{gsl → gsl_native}/tamu_anova.c +0 -0
- data/ext/{gsl → gsl_native}/tensor.c +2 -4
- data/ext/{gsl/tensor_source.c → gsl_native/tensor_source.h} +144 -144
- data/ext/{gsl → gsl_native}/vector.c +2 -4
- data/ext/{gsl → gsl_native}/vector_complex.c +165 -171
- data/ext/{gsl → gsl_native}/vector_double.c +167 -174
- data/ext/{gsl → gsl_native}/vector_int.c +23 -25
- data/ext/{gsl/vector_source.c → gsl_native/vector_source.h} +400 -414
- data/ext/{gsl → gsl_native}/wavelet.c +215 -236
- data/lib/gsl.rb +1 -7
- data/lib/gsl/gnuplot.rb +2 -2
- data/lib/gsl/version.rb +1 -3
- data/rb-gsl.gemspec +29 -0
- data/rdoc/blas.rdoc +3 -3
- data/rdoc/bspline.rdoc +7 -7
- data/rdoc/cheb.rdoc +8 -8
- data/rdoc/cholesky_complex.rdoc +1 -1
- data/rdoc/combi.rdoc +9 -9
- data/rdoc/complex.rdoc +11 -11
- data/rdoc/const.rdoc +20 -20
- data/rdoc/dht.rdoc +6 -6
- data/rdoc/diff.rdoc +6 -6
- data/rdoc/ehandling.rdoc +3 -3
- data/rdoc/eigen.rdoc +11 -11
- data/rdoc/fft.rdoc +26 -26
- data/rdoc/fit.rdoc +18 -18
- data/rdoc/graph.rdoc +2 -2
- data/rdoc/hist.rdoc +16 -16
- data/rdoc/hist2d.rdoc +4 -4
- data/rdoc/hist3d.rdoc +3 -3
- data/rdoc/integration.rdoc +16 -16
- data/rdoc/interp.rdoc +11 -11
- data/rdoc/intro.rdoc +3 -3
- data/rdoc/linalg.rdoc +20 -20
- data/rdoc/linalg_complex.rdoc +1 -1
- data/rdoc/math.rdoc +13 -13
- data/rdoc/matrix.rdoc +22 -22
- data/rdoc/min.rdoc +9 -9
- data/rdoc/monte.rdoc +3 -3
- data/rdoc/multimin.rdoc +12 -12
- data/rdoc/multiroot.rdoc +12 -12
- data/rdoc/narray.rdoc +9 -9
- data/rdoc/ndlinear.rdoc +4 -4
- data/rdoc/nonlinearfit.rdoc +17 -17
- data/rdoc/ntuple.rdoc +5 -5
- data/rdoc/odeiv.rdoc +12 -12
- data/rdoc/perm.rdoc +11 -11
- data/rdoc/poly.rdoc +17 -17
- data/rdoc/qrng.rdoc +9 -9
- data/rdoc/randist.rdoc +10 -10
- data/rdoc/ref.rdoc +49 -49
- data/rdoc/rng.rdoc +9 -9
- data/rdoc/roots.rdoc +12 -12
- data/rdoc/sf.rdoc +35 -35
- data/rdoc/siman.rdoc +3 -3
- data/rdoc/sort.rdoc +6 -6
- data/rdoc/start.rdoc +2 -2
- data/rdoc/stats.rdoc +13 -13
- data/rdoc/sum.rdoc +4 -4
- data/rdoc/tensor.rdoc +3 -3
- data/rdoc/tut.rdoc +1 -1
- data/rdoc/use.rdoc +3 -3
- data/rdoc/vector.rdoc +28 -28
- data/rdoc/vector_complex.rdoc +6 -6
- data/rdoc/wavelet.rdoc +8 -8
- data/test/gsl/blas_test.rb +1 -1
- data/test/gsl/index_test.rb +61 -0
- data/test/gsl/matrix_test.rb +21 -0
- data/uncrustify.cfg +1693 -0
- metadata +212 -243
- data/README +0 -28
- data/ext/gsl/bspline.c +0 -130
- data/ext/gsl/const.c +0 -672
- data/ext/gsl/cqp.c +0 -283
- data/ext/gsl/fcmp.c +0 -64
- data/ext/gsl/fresnel.c +0 -312
- data/ext/gsl/jacobi.c +0 -739
- data/ext/gsl/ool.c +0 -879
- data/ext/gsl/oper_complex_source.c +0 -251
- data/ext/gsl/sf_mathieu.c +0 -238
- data/rdoc/index.rdoc +0 -50
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# Ruby/GSL, a Ruby interface to GSL (GNU Scientific library)
|
2
|
+
|
3
|
+
Permission is granted to copy, distribute and/or modify this document under
|
4
|
+
the terms of the GNU Free Documentation License.
|
5
|
+
|
6
|
+
## Description
|
7
|
+
|
8
|
+
Ruby/GSL is a Ruby interface to the [GNU Scientific Library](https://gnu.org/software/gsl/)
|
9
|
+
(GSL), for numerical computing with [Ruby](http://www.ruby-lang.org/).
|
10
|
+
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
Ruby/GSL may be installed as a Ruby Gem by simply running
|
15
|
+
|
16
|
+
gem install rb-gsl
|
17
|
+
|
18
|
+
Note that the GSL libraries must already be installed before Ruby/GSL
|
19
|
+
can be installed:
|
20
|
+
|
21
|
+
Debian/Ubuntu: +libgsl0-dev+
|
22
|
+
Fedora/SuSE: +gsl-devel+
|
23
|
+
Gentoo: +sci-libs/gsl+
|
24
|
+
OS X: <tt>brew install gsl</tt>
|
25
|
+
|
26
|
+
It is recommended to install the [GNU plotutils](https://gnu.org/software/plotutils/plotutils.html)
|
27
|
+
package. Some of the example scripts in the +examples/+ directory use the
|
28
|
+
+graph+ utility included in the package to plot the results. Windows cygwin
|
29
|
+
binaries of <tt>GNU plotutils</tt> and related packages are available
|
30
|
+
[here](http://gnuwin32.sourceforge.net/packages/plotutils.htm).
|
31
|
+
|
32
|
+
|
33
|
+
## Reference
|
34
|
+
|
35
|
+
The [Ruby/GSL reference manual](link:rdoc/ref_rdoc.html) follows and borrows
|
36
|
+
large parts of the GSL reference manual.
|
37
|
+
|
38
|
+
|
39
|
+
## Examples
|
40
|
+
|
41
|
+
See scripts in +examples/+ and +test/+ directories.
|
42
|
+
|
43
|
+
|
44
|
+
## Related Projects
|
45
|
+
|
46
|
+
* [ruby-gsl](http://ruby-gsl.sourceforge.net/): Another Ruby binding,
|
47
|
+
developed by Arno Erpenbeck.
|
48
|
+
|
49
|
+
|
50
|
+
## Licence
|
51
|
+
|
52
|
+
Ruby/GSL is free software: you can redistribute it and/or modify it
|
53
|
+
under the terms of the GNU General Public License.
|
54
|
+
This library is distributed in the hope that it will be useful, but
|
55
|
+
WITHOUT ANY WARRANTY.
|
56
|
+
|
57
|
+
|
58
|
+
## Bug Reports
|
59
|
+
|
60
|
+
Any bug reports are welcome. If you encounter bugs in Ruby/GSL, please
|
61
|
+
report them on GitHub(https://github.com/SciRuby/rb-gsl/issues).
|
62
|
+
|
63
|
+
|
64
|
+
## Links
|
65
|
+
|
66
|
+
Documentation: https://sciruby.github.com/rb-gsl
|
67
|
+
Source code: https://github.com/SciRuby/rb-gsl
|
68
|
+
RubyGem: https://rubygems.org/gems/rb-gsl
|
69
|
+
Bug tracker: https://github.com/SciRuby/rb-gsl/issues
|
70
|
+
Travis CI: https://travis-ci.org/SciRuby/rb-gsl
|
71
|
+
|
72
|
+
|
73
|
+
## Authors
|
74
|
+
|
75
|
+
* Yoshiki Tsunesada <y-tsunesada at mm dot em-net dot ne dot jp> (July, 2004)
|
76
|
+
* David MacMahon <davidm@astro.berkeley.edu> (November, 2010)
|
77
|
+
* Jens Wille <mailto:jens.wille@gmail.com> (November, 2013)
|
data/Rakefile
CHANGED
@@ -1,39 +1,20 @@
|
|
1
1
|
require File.expand_path(%q{../lib/gsl/version}, __FILE__)
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'rubygems/package_task'
|
5
|
+
require 'rake/extensiontask'
|
6
|
+
require 'rake/testtask'
|
5
7
|
|
6
|
-
|
8
|
+
Bundler::GemHelper.install_tasks
|
7
9
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
:description => %Q{Ruby/GSL is a Ruby interface to the GNU Scientific Library, for numerical computing with Ruby #{note}},
|
14
|
-
:authors => ['Yoshiki Tsunesada', 'David MacMahon', 'Jens Wille'],
|
15
|
-
:email => %q{jens.wille@gmail.com},
|
16
|
-
:license => %q{GPL-2.0},
|
17
|
-
:homepage => :blackwinter,
|
18
|
-
:dependencies => [['narray', '>= 0.5.9']],
|
19
|
-
:requirements => ['GSL (http://www.gnu.org/software/gsl/)'],
|
20
|
-
|
21
|
-
:extra_files => FileList['examples/**/*', 'rdoc/*'].to_a,
|
10
|
+
Rake::TestTask.new do |t|
|
11
|
+
t.libs << 'test'
|
12
|
+
t.libs << 'test/gsl'
|
13
|
+
t.test_files = FileList['test/*.rb', 'test/gsl/*.rb']
|
14
|
+
end
|
22
15
|
|
23
|
-
|
16
|
+
spec = eval(IO.read('rb-gsl.gemspec'))
|
17
|
+
Gem::PackageTask.new(spec).define
|
18
|
+
Rake::ExtensionTask.new(:gsl_native, spec)
|
24
19
|
|
25
|
-
|
26
|
-
},
|
27
|
-
:rdoc => {
|
28
|
-
:title => 'Ruby/GSL{version: (v%s)}',
|
29
|
-
:rdoc_files => FileList['rdoc/*'].to_a,
|
30
|
-
:main => 'index.rdoc',
|
31
|
-
:root => 'rdoc'
|
32
|
-
},
|
33
|
-
:test => {
|
34
|
-
:libs => %w[lib test]
|
35
|
-
}
|
36
|
-
}}
|
37
|
-
rescue LoadError => err
|
38
|
-
warn "Please install the `hen' gem. (#{err})"
|
39
|
-
end
|
20
|
+
task :default => [:compile, :test]
|
data/THANKS
CHANGED
data/examples/blas/blas.rb
CHANGED
data/examples/bspline.rb
CHANGED
@@ -19,15 +19,15 @@ w = GSL::Vector.alloc(N)
|
|
19
19
|
for i in 0...N do
|
20
20
|
xi = (15.0/(N-1)/1)*i
|
21
21
|
yi = Math::cos(xi)*Math::exp(-0.1*xi)
|
22
|
-
|
22
|
+
|
23
23
|
sigma = 0.1
|
24
24
|
dy = GSL::Ran.gaussian(r, sigma)
|
25
25
|
yi += dy
|
26
|
-
|
26
|
+
|
27
27
|
x[i] = xi
|
28
28
|
y[i] = yi
|
29
29
|
w[i] = sigma
|
30
|
-
|
30
|
+
|
31
31
|
# printf("%f %f\n", xi, yi)
|
32
32
|
end
|
33
33
|
|
@@ -26,8 +26,8 @@ p f.log == z
|
|
26
26
|
p z.pow(f) # [1.931e-02 1.752e-02], verified with Octave result
|
27
27
|
|
28
28
|
# The results below are verified with the Octave results
|
29
|
-
p GSL::Complex.sin(z)
|
30
|
-
p GSL::Complex.cos(z)
|
29
|
+
p GSL::Complex.sin(z)
|
30
|
+
p GSL::Complex.cos(z)
|
31
31
|
p GSL::Complex.tan(z)
|
32
32
|
p GSL::Complex.sec(z)
|
33
33
|
p GSL::Complex.csc(z)
|
@@ -43,8 +43,8 @@ p GSL::Complex.arccsc(z)
|
|
43
43
|
p GSL::Complex.arccsc_real(2)
|
44
44
|
p GSL::Complex.arccot(z)
|
45
45
|
|
46
|
-
p GSL::Complex.sinh(z)
|
47
|
-
p GSL::Complex.cosh(z)
|
46
|
+
p GSL::Complex.sinh(z)
|
47
|
+
p GSL::Complex.cosh(z)
|
48
48
|
p GSL::Complex.tanh(z)
|
49
49
|
p GSL::Complex.sech(z)
|
50
50
|
p GSL::Complex.csch(z)
|
data/examples/complex/mul.rb
CHANGED
data/examples/const/physconst.rb
CHANGED
@@ -42,7 +42,7 @@ MENU[2] = ["", "ASTRONOMICAL_UNIT", "GRAVITATIONAL_CONSTANT",
|
|
42
42
|
MENU[3] = ["", "ELECTRON_CHARGE", "ELECTRON_VOLT", "UNIFIED_ATOMIC_MASS",
|
43
43
|
"MASS_ELECTRON", "MASS_MUON", "MASS_PROTON", "MASS_NEUTRON",
|
44
44
|
"FINE_STRUCTURE", "RYDBERG", "BOHR_RADIUS", "ANGSTROM",
|
45
|
-
"BARN", "BOHR_MAGNETON", "NUCLEAR_MAGNETON",
|
45
|
+
"BARN", "BOHR_MAGNETON", "NUCLEAR_MAGNETON",
|
46
46
|
"ELECTRON_MAGNETIC_MOMENT", "PROTON_MAGNETIC_MOMENT",
|
47
47
|
"THOMSON_CROSS_SECTION"]
|
48
48
|
|
@@ -56,10 +56,10 @@ MENU[9] = ["", "POUND_MASS", "OUNCE_MASS", "TON", "METRIC_TON", "UK_TON",
|
|
56
56
|
"TROY_OUNCE", "CARAT", "GRAM_FORCE", "POUND_FORCE",
|
57
57
|
"KILOPOUND_FORCE", "POUNDAL"]
|
58
58
|
MENU[10] = ["", "CALORIE", "BTU", "THERM", "HORSEPOWER"]
|
59
|
-
MENU[11] = ["", "BAR", "STD_ATMOSPHERE", "TORR", "METER_OF_MERCURY",
|
59
|
+
MENU[11] = ["", "BAR", "STD_ATMOSPHERE", "TORR", "METER_OF_MERCURY",
|
60
60
|
"INCH_OF_MERCURY", "INCH_OF_WATER", "PSI"]
|
61
61
|
MENU[12] = ["", "POISE", "STOKES"]
|
62
|
-
MENU[13] = ["", "STILB", "LUMEN", "LUX", "PHOT", "FOOTCANDLE",
|
62
|
+
MENU[13] = ["", "STILB", "LUMEN", "LUX", "PHOT", "FOOTCANDLE",
|
63
63
|
"LAMBERT", "FOOTLAMBERT"]
|
64
64
|
MENU[14] = ["", "CURIE", "ROENTGEN", "RAD"]
|
65
65
|
MENU[15] = ["", "NEWTON", "DYNE", "JOULE", "ERG"]
|
@@ -96,7 +96,7 @@ def show_submenu(ind, w)
|
|
96
96
|
w.setpos(i+=1, 1)
|
97
97
|
str = " ? ['m' to menu]: "
|
98
98
|
w.addstr(str)
|
99
|
-
w.setpos(i, str.size+1)
|
99
|
+
w.setpos(i, str.size+1)
|
100
100
|
w.box('|', '-')
|
101
101
|
w.refresh
|
102
102
|
end
|
data/examples/const/travel.rb
CHANGED
@@ -8,8 +8,8 @@ c = SPEED_OF_LIGHT;
|
|
8
8
|
au = ASTRONOMICAL_UNIT;
|
9
9
|
minutes = MINUTE;
|
10
10
|
|
11
|
-
# distance stored in meters
|
12
|
-
r_earth = 1.00 * au;
|
11
|
+
# distance stored in meters
|
12
|
+
r_earth = 1.00 * au;
|
13
13
|
r_mars = 1.52 * au;
|
14
14
|
|
15
15
|
t_min = (r_mars - r_earth) / c;
|
@@ -30,8 +30,8 @@ c = SPEED_OF_LIGHT;
|
|
30
30
|
au = ASTRONOMICAL_UNIT;
|
31
31
|
minutes = MINUTE;
|
32
32
|
|
33
|
-
# distance stored in meters
|
34
|
-
r_earth = 1.00 * au;
|
33
|
+
# distance stored in meters
|
34
|
+
r_earth = 1.00 * au;
|
35
35
|
r_mars = 1.52 * au;
|
36
36
|
|
37
37
|
t_min = (r_mars - r_earth) / c;
|
data/examples/eigen/nonsymmv.rb
CHANGED
@@ -61,13 +61,13 @@ end
|
|
61
61
|
# The differences with Tabelle 5.1 are from NMAX and dx.
|
62
62
|
# If we use NMAX=512 and dx=0.02, we obtain the same results (but much slower).
|
63
63
|
STDERR.puts(" Eigen values:")
|
64
|
-
STDERR.printf(" %2s Exact %5s %10s | %2s Exact %5s %10s\n",
|
64
|
+
STDERR.printf(" %2s Exact %5s %10s | %2s Exact %5s %10s\n",
|
65
65
|
"n", "E", "err\(\%\)", "n", "E", "err\(\%\)")
|
66
66
|
STDERR.print(" -----------------------------------------------------\n")
|
67
67
|
for n1 in 0..6 do
|
68
68
|
exact1 = n1 + 0.5
|
69
69
|
exact2 = n1 + 7 + 0.5
|
70
|
-
STDERR.printf(" %2d %4.1f %8.5f %+7.5f | %2d %4.1f %8.5f %+7.5f\n",
|
70
|
+
STDERR.printf(" %2d %4.1f %8.5f %+7.5f | %2d %4.1f %8.5f %+7.5f\n",
|
71
71
|
n1, exact1, eval[n1], (exact1 - eval[n1])/exact1*100,
|
72
72
|
n1+7, exact2, eval[n1+7], (exact2-eval[n1+7])/exact2*100)
|
73
73
|
end
|
@@ -75,7 +75,7 @@ STDERR.flush
|
|
75
75
|
|
76
76
|
# Eigen vectors of n = 0, 1, 2, 10. See p217 "Abb 5.3"
|
77
77
|
c = Math::sqrt(1.0/dx)
|
78
|
-
vec0 = evec.col(0).scale(c)
|
78
|
+
vec0 = evec.col(0).scale(c)
|
79
79
|
vec1 = evec.col(1).scale(c)
|
80
80
|
vec2 = evec.col(2).scale(c)
|
81
81
|
vec10 = evec.col(10).scale(c)
|
data/examples/fft/radix2.rb
CHANGED
@@ -11,7 +11,7 @@ end
|
|
11
11
|
|
12
12
|
rtable = GSL::FFT::RealWavetable.alloc(n)
|
13
13
|
rwork = GSL::FFT::RealWorkspace.alloc(n)
|
14
|
-
|
14
|
+
|
15
15
|
#ffted = data.real_transform(rtable, rwork)
|
16
16
|
#ffted = data.real_transform(rtable)
|
17
17
|
#ffted = data.real_transform(rwork)
|
@@ -22,9 +22,9 @@ ffted = data.real_transform()
|
|
22
22
|
for i in 11...n do
|
23
23
|
ffted[i] = 0.0
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
hctable = GSL::FFT::HalfComplexWavetable.alloc(n)
|
27
|
-
|
27
|
+
|
28
28
|
#data2 = ffted.halfcomplex_inverse(hctable, rwork)
|
29
29
|
#data2 = ffted.halfcomplex_inverse()
|
30
30
|
#data2 = ffted.ifft
|
@@ -12,15 +12,15 @@ org = data.clone
|
|
12
12
|
|
13
13
|
rtable = GSL::FFT::RealWavetable.alloc(n)
|
14
14
|
rwork = GSL::FFT::RealWorkspace.alloc(n)
|
15
|
-
|
15
|
+
|
16
16
|
data.real_transform!(rtable, rwork)
|
17
17
|
|
18
18
|
for i in 11...n do
|
19
19
|
data[i] = 0.0
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
hctable = GSL::FFT::HalfComplexWavetable.alloc(n)
|
23
|
-
|
23
|
+
|
24
24
|
#data.halfcomplex_inverse!(hctable, rwork)
|
25
25
|
#data.halfcomplex_inverse!()
|
26
26
|
#data.ifft!
|
data/examples/fit/expfit.rb
CHANGED
data/examples/fit/multifit.rb
CHANGED
data/examples/fit/ndlinear.rb
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
require("gsl")
|
3
3
|
|
4
4
|
unless GSL::MultiFit.const_defined?("Ndlinear")
|
5
|
-
|
6
|
-
|
5
|
+
puts("The extension library NDLINEAR is not installed.")
|
6
|
+
exit()
|
7
7
|
end
|
8
8
|
|
9
9
|
N_DIM = 3
|
@@ -13,33 +13,33 @@ N_SUM_PHI = 9
|
|
13
13
|
R_MAX = 3.0
|
14
14
|
|
15
15
|
def psi_real_exact(k, l, m, r, theta, phi)
|
16
|
-
rr = GSL::pow(r, l)*Math::exp(-r*r)*GSL::Sf::laguerre_n(k, l + 0.5, 2 * r * r)
|
16
|
+
rr = GSL::pow(r, l)*Math::exp(-r*r)*GSL::Sf::laguerre_n(k, l + 0.5, 2 * r * r)
|
17
17
|
|
18
|
-
|
18
|
+
tt = GSL::Sf::legendre_sphPlm(l, m, Math::cos(theta))
|
19
19
|
|
20
|
-
|
20
|
+
pp = Math::cos(m*phi)
|
21
21
|
|
22
|
-
|
22
|
+
rr*tt*pp
|
23
23
|
end
|
24
24
|
|
25
25
|
basis_r = Proc.new { |r, y, params|
|
26
|
-
|
26
|
+
params.eval(r, y)
|
27
27
|
}
|
28
28
|
|
29
29
|
basis_theta = Proc.new { |theta, y, params|
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
for i in 0...N_SUM_THETA do
|
31
|
+
y[i] = GSL::Sf::legendre_Pl(i, Math::cos(theta));
|
32
|
+
end
|
33
33
|
}
|
34
34
|
|
35
35
|
basis_phi = Proc.new { |phi, y, params|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
36
|
+
for i in 0...N_SUM_PHI do
|
37
|
+
if i%2 == 0
|
38
|
+
y[i] = Math::cos(i*0.5*phi)
|
39
|
+
else
|
40
|
+
y[i] = Math::sin((i+1.0)*0.5*phi)
|
41
|
+
end
|
42
|
+
end
|
43
43
|
}
|
44
44
|
|
45
45
|
|
@@ -67,19 +67,19 @@ data = GSL::Vector.alloc(NDATA)
|
|
67
67
|
|
68
68
|
for i in 0...NDATA do
|
69
69
|
|
70
|
-
|
71
|
-
|
72
|
-
|
70
|
+
r = rng.uniform()*R_MAX
|
71
|
+
theta = rng.uniform()*Math::PI
|
72
|
+
phi = rng.uniform()*2*Math::PI
|
73
73
|
|
74
|
-
|
74
|
+
psi = psi_real_exact(k, l, m, r, theta, phi)
|
75
75
|
|
76
|
-
|
76
|
+
dpsi = rng.gaussian(0.05*psi)
|
77
77
|
|
78
|
-
|
79
|
-
|
80
|
-
|
78
|
+
vars[i,0] = r
|
79
|
+
vars[i,1] = theta
|
80
|
+
vars[i,2] = phi
|
81
81
|
|
82
|
-
|
82
|
+
data[i] = psi + dpsi
|
83
83
|
end
|
84
84
|
|
85
85
|
#GSL::MultiFit::Ndlinear::design(vars, X, ndlinear)
|
@@ -99,18 +99,18 @@ x = GSL::Vector.alloc(N_DIM)
|
|
99
99
|
|
100
100
|
r = 0.01
|
101
101
|
while r < R_MAX do
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
102
|
+
theta = 0.0
|
103
|
+
while theta < Math::PI do
|
104
|
+
phi = 0.0
|
105
|
+
while phi < 2*Math::PI do
|
106
|
+
dV = r*r*Math::sin(theta)*dr*dtheta*dphi
|
107
|
+
x[0] = r
|
108
|
+
x[1] = theta
|
109
|
+
x[2] = phi
|
110
|
+
|
111
|
+
psi_model, err = GSL::MultiFit::Ndlinear.calc(x, coeffs, cov, ndlinear)
|
112
|
+
psi = psi_real_exact(k, l, m, r, theta, phi)
|
113
|
+
err = psi_model - psi
|
114
114
|
eps_rms += err * err * dV;
|
115
115
|
volume += dV;
|
116
116
|
|
@@ -118,13 +118,13 @@ while r < R_MAX do
|
|
118
118
|
printf("%e %e %e %e\n", r, theta, psi, psi_model)
|
119
119
|
end
|
120
120
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
121
|
+
phi += dphi
|
122
|
+
end
|
123
|
+
theta += dtheta
|
124
|
+
end
|
125
|
+
printf("\n");
|
126
126
|
|
127
|
-
|
127
|
+
r += dr
|
128
128
|
end
|
129
129
|
|
130
130
|
eps_rms /= volume
|