gsl 1.12.109 → 1.14.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (511) hide show
  1. data/AUTHORS +6 -0
  2. data/COPYING +339 -0
  3. data/ChangeLog +556 -0
  4. data/{README.rdoc → README} +3 -0
  5. data/Rakefile +54 -10
  6. data/THANKS +17 -0
  7. data/VERSION +1 -2
  8. data/examples/alf/alf.gp +15 -0
  9. data/examples/alf/alf.rb +32 -0
  10. data/examples/blas/blas.rb +13 -0
  11. data/examples/blas/dnrm2.rb +16 -0
  12. data/examples/blas/level1.rb +81 -0
  13. data/examples/blas/level2.rb +11 -0
  14. data/examples/blas/level3.rb +12 -0
  15. data/examples/bspline.rb +57 -0
  16. data/examples/cdf.rb +16 -0
  17. data/examples/cheb.rb +21 -0
  18. data/examples/combination.rb +23 -0
  19. data/examples/complex/RC-lpf.rb +47 -0
  20. data/examples/complex/add.rb +36 -0
  21. data/examples/complex/coerce.rb +14 -0
  22. data/examples/complex/complex.rb +25 -0
  23. data/examples/complex/fpmi.rb +70 -0
  24. data/examples/complex/functions.rb +77 -0
  25. data/examples/complex/michelson.rb +36 -0
  26. data/examples/complex/mul.rb +28 -0
  27. data/examples/complex/oscillator.rb +17 -0
  28. data/examples/complex/set.rb +37 -0
  29. data/examples/const/physconst.rb +151 -0
  30. data/examples/const/travel.rb +45 -0
  31. data/examples/deriv/demo.rb +13 -0
  32. data/examples/deriv/deriv.rb +36 -0
  33. data/examples/deriv/diff.rb +35 -0
  34. data/examples/dht.rb +42 -0
  35. data/examples/dirac.rb +56 -0
  36. data/examples/eigen/eigen.rb +34 -0
  37. data/examples/eigen/herm.rb +22 -0
  38. data/examples/eigen/narray.rb +9 -0
  39. data/examples/eigen/nonsymm.rb +37 -0
  40. data/examples/eigen/nonsymmv.rb +43 -0
  41. data/examples/eigen/qhoscillator.gp +35 -0
  42. data/examples/eigen/qhoscillator.rb +90 -0
  43. data/examples/eigen/vander.rb +41 -0
  44. data/examples/fft/fft.rb +17 -0
  45. data/examples/fft/fft2.rb +17 -0
  46. data/examples/fft/forward.rb +25 -0
  47. data/examples/fft/forward2.rb +26 -0
  48. data/examples/fft/radix2.rb +18 -0
  49. data/examples/fft/real-halfcomplex.rb +33 -0
  50. data/examples/fft/real-halfcomplex2.rb +30 -0
  51. data/examples/fft/realradix2.rb +19 -0
  52. data/examples/fft/sunspot.dat +256 -0
  53. data/examples/fft/sunspot.rb +16 -0
  54. data/examples/fit/expdata.dat +20 -0
  55. data/examples/fit/expfit.rb +31 -0
  56. data/examples/fit/gaussfit.rb +29 -0
  57. data/examples/fit/gaussian_2peaks.rb +34 -0
  58. data/examples/fit/hillfit.rb +40 -0
  59. data/examples/fit/lognormal.rb +26 -0
  60. data/examples/fit/lorentzfit.rb +22 -0
  61. data/examples/fit/multifit.rb +72 -0
  62. data/examples/fit/ndlinear.rb +133 -0
  63. data/examples/fit/nonlinearfit.rb +89 -0
  64. data/examples/fit/plot.gp +36 -0
  65. data/examples/fit/polyfit.rb +9 -0
  66. data/examples/fit/powerfit.rb +21 -0
  67. data/examples/fit/sigmoidfit.rb +40 -0
  68. data/examples/fit/sinfit.rb +22 -0
  69. data/examples/fit/wlinear.rb +46 -0
  70. data/examples/fresnel.rb +11 -0
  71. data/examples/function/function.rb +36 -0
  72. data/examples/function/log.rb +7 -0
  73. data/examples/function/min.rb +33 -0
  74. data/examples/function/sin.rb +10 -0
  75. data/examples/function/synchrotron.rb +18 -0
  76. data/examples/gallery/butterfly.rb +7 -0
  77. data/examples/gallery/cayley.rb +12 -0
  78. data/examples/gallery/cornu.rb +23 -0
  79. data/examples/gallery/eight.rb +11 -0
  80. data/examples/gallery/koch.rb +40 -0
  81. data/examples/gallery/lemniscate.rb +11 -0
  82. data/examples/gallery/polar.rb +11 -0
  83. data/examples/gallery/rgplot/cossin.rb +35 -0
  84. data/examples/gallery/rgplot/rgplot.replaced +0 -0
  85. data/examples/gallery/rgplot/roesller.rb +55 -0
  86. data/examples/gallery/roesller.rb +39 -0
  87. data/examples/gallery/scarabaeus.rb +14 -0
  88. data/examples/histogram/cauchy.rb +27 -0
  89. data/examples/histogram/cauchy.sh +2 -0
  90. data/examples/histogram/exponential.rb +19 -0
  91. data/examples/histogram/gauss.rb +16 -0
  92. data/examples/histogram/gsl-histogram.rb +40 -0
  93. data/examples/histogram/histo2d.rb +31 -0
  94. data/examples/histogram/histo3d.rb +34 -0
  95. data/examples/histogram/histogram-pdf.rb +27 -0
  96. data/examples/histogram/histogram.rb +26 -0
  97. data/examples/histogram/integral.rb +28 -0
  98. data/examples/histogram/poisson.rb +27 -0
  99. data/examples/histogram/power.rb +25 -0
  100. data/examples/histogram/rebin.rb +17 -0
  101. data/examples/histogram/smp.dat +5 -0
  102. data/examples/histogram/xexp.rb +21 -0
  103. data/examples/integration/ahmed.rb +21 -0
  104. data/examples/integration/cosmology.rb +75 -0
  105. data/examples/integration/friedmann.gp +16 -0
  106. data/examples/integration/friedmann.rb +35 -0
  107. data/examples/integration/gamma-zeta.rb +35 -0
  108. data/examples/integration/integration.rb +22 -0
  109. data/examples/integration/qag.rb +8 -0
  110. data/examples/integration/qag2.rb +14 -0
  111. data/examples/integration/qag3.rb +8 -0
  112. data/examples/integration/qagi.rb +28 -0
  113. data/examples/integration/qagi2.rb +49 -0
  114. data/examples/integration/qagiu.rb +29 -0
  115. data/examples/integration/qagp.rb +20 -0
  116. data/examples/integration/qags.rb +14 -0
  117. data/examples/integration/qawc.rb +18 -0
  118. data/examples/integration/qawf.rb +41 -0
  119. data/examples/integration/qawo.rb +29 -0
  120. data/examples/integration/qaws.rb +30 -0
  121. data/examples/integration/qng.rb +17 -0
  122. data/examples/interp/demo.gp +20 -0
  123. data/examples/interp/demo.rb +45 -0
  124. data/examples/interp/interp.rb +37 -0
  125. data/examples/interp/points +10 -0
  126. data/examples/interp/spline.rb +20 -0
  127. data/examples/jacobi/deriv.rb +40 -0
  128. data/examples/jacobi/integrate.rb +34 -0
  129. data/examples/jacobi/interp.rb +43 -0
  130. data/examples/jacobi/jacobi.rb +11 -0
  131. data/examples/linalg/HH.rb +15 -0
  132. data/examples/linalg/HH_narray.rb +13 -0
  133. data/examples/linalg/LQ_solve.rb +73 -0
  134. data/examples/linalg/LU.rb +84 -0
  135. data/examples/linalg/LU2.rb +31 -0
  136. data/examples/linalg/LU_narray.rb +24 -0
  137. data/examples/linalg/PTLQ.rb +47 -0
  138. data/examples/linalg/QR.rb +18 -0
  139. data/examples/linalg/QRPT.rb +47 -0
  140. data/examples/linalg/QR_solve.rb +78 -0
  141. data/examples/linalg/QR_solve_narray.rb +13 -0
  142. data/examples/linalg/SV.rb +16 -0
  143. data/examples/linalg/SV_narray.rb +12 -0
  144. data/examples/linalg/SV_solve.rb +49 -0
  145. data/examples/linalg/chol.rb +29 -0
  146. data/examples/linalg/chol_narray.rb +15 -0
  147. data/examples/linalg/complex.rb +57 -0
  148. data/examples/linalg/invert_narray.rb +10 -0
  149. data/examples/math/const.rb +67 -0
  150. data/examples/math/elementary.rb +35 -0
  151. data/examples/math/functions.rb +41 -0
  152. data/examples/math/inf_nan.rb +34 -0
  153. data/examples/math/minmax.rb +22 -0
  154. data/examples/math/power.rb +18 -0
  155. data/examples/math/test.rb +31 -0
  156. data/examples/matrix/a.dat +0 -0
  157. data/examples/matrix/add.rb +45 -0
  158. data/examples/matrix/b.dat +4 -0
  159. data/examples/matrix/cat.rb +31 -0
  160. data/examples/matrix/colvectors.rb +24 -0
  161. data/examples/matrix/complex.rb +41 -0
  162. data/examples/matrix/det.rb +29 -0
  163. data/examples/matrix/diagonal.rb +23 -0
  164. data/examples/matrix/get_all.rb +159 -0
  165. data/examples/matrix/hilbert.rb +31 -0
  166. data/examples/matrix/iterator.rb +19 -0
  167. data/examples/matrix/matrix.rb +57 -0
  168. data/examples/matrix/minmax.rb +53 -0
  169. data/examples/matrix/mul.rb +39 -0
  170. data/examples/matrix/rand.rb +20 -0
  171. data/examples/matrix/read.rb +29 -0
  172. data/examples/matrix/rowcol.rb +47 -0
  173. data/examples/matrix/set.rb +41 -0
  174. data/examples/matrix/set_all.rb +100 -0
  175. data/examples/matrix/view.rb +32 -0
  176. data/examples/matrix/view_all.rb +148 -0
  177. data/examples/matrix/write.rb +23 -0
  178. data/examples/min.rb +29 -0
  179. data/examples/monte/miser.rb +47 -0
  180. data/examples/monte/monte.rb +47 -0
  181. data/examples/monte/plain.rb +47 -0
  182. data/examples/monte/vegas.rb +46 -0
  183. data/examples/multimin/bundle.rb +66 -0
  184. data/examples/multimin/cqp.rb +109 -0
  185. data/examples/multimin/fdfminimizer.rb +40 -0
  186. data/examples/multimin/fminimizer.rb +41 -0
  187. data/examples/multiroot/demo.rb +36 -0
  188. data/examples/multiroot/fdfsolver.rb +50 -0
  189. data/examples/multiroot/fsolver.rb +33 -0
  190. data/examples/multiroot/fsolver2.rb +32 -0
  191. data/examples/multiroot/fsolver3.rb +26 -0
  192. data/examples/narray/histogram.rb +14 -0
  193. data/examples/narray/mandel.rb +27 -0
  194. data/examples/narray/narray.rb +28 -0
  195. data/examples/narray/narray2.rb +44 -0
  196. data/examples/narray/sf.rb +26 -0
  197. data/examples/ntuple/create.rb +17 -0
  198. data/examples/ntuple/project.rb +31 -0
  199. data/examples/odeiv/binarysystem.gp +23 -0
  200. data/examples/odeiv/binarysystem.rb +104 -0
  201. data/examples/odeiv/demo.gp +24 -0
  202. data/examples/odeiv/demo.rb +69 -0
  203. data/examples/odeiv/demo2.gp +26 -0
  204. data/examples/odeiv/duffing.rb +45 -0
  205. data/examples/odeiv/frei1.rb +109 -0
  206. data/examples/odeiv/frei2.rb +76 -0
  207. data/examples/odeiv/legendre.rb +52 -0
  208. data/examples/odeiv/odeiv.rb +32 -0
  209. data/examples/odeiv/odeiv2.rb +45 -0
  210. data/examples/odeiv/oscillator.rb +42 -0
  211. data/examples/odeiv/sedov.rb +97 -0
  212. data/examples/odeiv/whitedwarf.gp +40 -0
  213. data/examples/odeiv/whitedwarf.rb +158 -0
  214. data/examples/ool/conmin.rb +100 -0
  215. data/examples/ool/gencan.rb +99 -0
  216. data/examples/ool/pgrad.rb +100 -0
  217. data/examples/ool/spg.rb +100 -0
  218. data/examples/pdf/bernoulli.rb +5 -0
  219. data/examples/pdf/beta.rb +7 -0
  220. data/examples/pdf/binomiral.rb +10 -0
  221. data/examples/pdf/cauchy.rb +6 -0
  222. data/examples/pdf/chisq.rb +8 -0
  223. data/examples/pdf/exponential.rb +7 -0
  224. data/examples/pdf/exppow.rb +6 -0
  225. data/examples/pdf/fdist.rb +7 -0
  226. data/examples/pdf/flat.rb +7 -0
  227. data/examples/pdf/gamma.rb +8 -0
  228. data/examples/pdf/gauss-tail.rb +5 -0
  229. data/examples/pdf/gauss.rb +6 -0
  230. data/examples/pdf/geometric.rb +5 -0
  231. data/examples/pdf/gumbel.rb +6 -0
  232. data/examples/pdf/hypergeometric.rb +11 -0
  233. data/examples/pdf/landau.rb +5 -0
  234. data/examples/pdf/laplace.rb +7 -0
  235. data/examples/pdf/logarithmic.rb +5 -0
  236. data/examples/pdf/logistic.rb +6 -0
  237. data/examples/pdf/lognormal.rb +6 -0
  238. data/examples/pdf/neg-binomiral.rb +10 -0
  239. data/examples/pdf/pareto.rb +7 -0
  240. data/examples/pdf/pascal.rb +10 -0
  241. data/examples/pdf/poisson.rb +5 -0
  242. data/examples/pdf/rayleigh-tail.rb +6 -0
  243. data/examples/pdf/rayleigh.rb +6 -0
  244. data/examples/pdf/tdist.rb +6 -0
  245. data/examples/pdf/weibull.rb +8 -0
  246. data/examples/permutation/ex1.rb +22 -0
  247. data/examples/permutation/permutation.rb +16 -0
  248. data/examples/poly/bell.rb +6 -0
  249. data/examples/poly/bessel.rb +6 -0
  250. data/examples/poly/cheb.rb +6 -0
  251. data/examples/poly/cheb_II.rb +6 -0
  252. data/examples/poly/cubic.rb +9 -0
  253. data/examples/poly/demo.rb +20 -0
  254. data/examples/poly/eval.rb +28 -0
  255. data/examples/poly/eval_derivs.rb +14 -0
  256. data/examples/poly/fit.rb +21 -0
  257. data/examples/poly/hermite.rb +6 -0
  258. data/examples/poly/poly.rb +13 -0
  259. data/examples/poly/quadratic.rb +25 -0
  260. data/examples/random/diffusion.rb +34 -0
  261. data/examples/random/gaussian.rb +9 -0
  262. data/examples/random/generator.rb +27 -0
  263. data/examples/random/hdsobol.rb +21 -0
  264. data/examples/random/poisson.rb +9 -0
  265. data/examples/random/qrng.rb +19 -0
  266. data/examples/random/randomwalk.rb +37 -0
  267. data/examples/random/randomwalk2d.rb +19 -0
  268. data/examples/random/rayleigh.rb +36 -0
  269. data/examples/random/rng.rb +33 -0
  270. data/examples/random/rngextra.rb +14 -0
  271. data/examples/roots/bisection.rb +25 -0
  272. data/examples/roots/brent.rb +43 -0
  273. data/examples/roots/demo.rb +30 -0
  274. data/examples/roots/newton.rb +46 -0
  275. data/examples/roots/recombination.gp +12 -0
  276. data/examples/roots/recombination.rb +61 -0
  277. data/examples/roots/steffenson.rb +48 -0
  278. data/examples/sf/ShiChi.rb +6 -0
  279. data/examples/sf/SiCi.rb +6 -0
  280. data/examples/sf/airy_Ai.rb +8 -0
  281. data/examples/sf/airy_Bi.rb +8 -0
  282. data/examples/sf/bessel_IK.rb +12 -0
  283. data/examples/sf/bessel_JY.rb +13 -0
  284. data/examples/sf/beta_inc.rb +9 -0
  285. data/examples/sf/clausen.rb +6 -0
  286. data/examples/sf/dawson.rb +5 -0
  287. data/examples/sf/debye.rb +9 -0
  288. data/examples/sf/dilog.rb +6 -0
  289. data/examples/sf/ellint.rb +6 -0
  290. data/examples/sf/expint.rb +8 -0
  291. data/examples/sf/fermi.rb +10 -0
  292. data/examples/sf/gamma_inc_P.rb +9 -0
  293. data/examples/sf/gegenbauer.rb +8 -0
  294. data/examples/sf/hyperg.rb +7 -0
  295. data/examples/sf/laguerre.rb +19 -0
  296. data/examples/sf/lambertW.rb +5 -0
  297. data/examples/sf/legendre_P.rb +10 -0
  298. data/examples/sf/lngamma.rb +5 -0
  299. data/examples/sf/psi.rb +54 -0
  300. data/examples/sf/sphbessel.gp +27 -0
  301. data/examples/sf/sphbessel.rb +30 -0
  302. data/examples/sf/synchrotron.rb +5 -0
  303. data/examples/sf/transport.rb +10 -0
  304. data/examples/sf/zetam1.rb +5 -0
  305. data/examples/siman.rb +44 -0
  306. data/examples/sort/heapsort.rb +23 -0
  307. data/examples/sort/heapsort_vector_complex.rb +21 -0
  308. data/examples/sort/sort.rb +23 -0
  309. data/examples/sort/sort2.rb +16 -0
  310. data/examples/stats/mean.rb +17 -0
  311. data/examples/stats/statistics.rb +18 -0
  312. data/examples/stats/test.rb +9 -0
  313. data/examples/sum.rb +34 -0
  314. data/examples/tamu_anova.rb +18 -0
  315. data/examples/vector/a.dat +0 -0
  316. data/examples/vector/add.rb +56 -0
  317. data/examples/vector/b.dat +4 -0
  318. data/examples/vector/c.dat +3 -0
  319. data/examples/vector/collect.rb +26 -0
  320. data/examples/vector/compare.rb +28 -0
  321. data/examples/vector/complex.rb +51 -0
  322. data/examples/vector/complex_get_all.rb +85 -0
  323. data/examples/vector/complex_set_all.rb +131 -0
  324. data/examples/vector/complex_view_all.rb +77 -0
  325. data/examples/vector/connect.rb +22 -0
  326. data/examples/vector/decimate.rb +38 -0
  327. data/examples/vector/diff.rb +31 -0
  328. data/examples/vector/filescan.rb +17 -0
  329. data/examples/vector/floor.rb +23 -0
  330. data/examples/vector/get_all.rb +82 -0
  331. data/examples/vector/gnuplot.rb +38 -0
  332. data/examples/vector/graph.rb +28 -0
  333. data/examples/vector/histogram.rb +22 -0
  334. data/examples/vector/linspace.rb +24 -0
  335. data/examples/vector/log.rb +17 -0
  336. data/examples/vector/logic.rb +33 -0
  337. data/examples/vector/logspace.rb +25 -0
  338. data/examples/vector/minmax.rb +47 -0
  339. data/examples/vector/mul.rb +49 -0
  340. data/examples/vector/narray.rb +46 -0
  341. data/examples/vector/read.rb +29 -0
  342. data/examples/vector/set.rb +35 -0
  343. data/examples/vector/set_all.rb +121 -0
  344. data/examples/vector/smpv.dat +15 -0
  345. data/examples/vector/test.rb +43 -0
  346. data/examples/vector/test_gslblock.rb +58 -0
  347. data/examples/vector/vector.rb +110 -0
  348. data/examples/vector/view.rb +35 -0
  349. data/examples/vector/view_all.rb +73 -0
  350. data/examples/vector/where.rb +29 -0
  351. data/examples/vector/write.rb +24 -0
  352. data/examples/vector/zip.rb +34 -0
  353. data/examples/wavelet/ecg.dat +256 -0
  354. data/examples/wavelet/wavelet1.rb +50 -0
  355. data/ext/extconf.rb +9 -0
  356. data/ext/gsl.c +10 -1
  357. data/ext/histogram.c +6 -2
  358. data/ext/integration.c +39 -0
  359. data/ext/matrix_complex.c +1 -1
  360. data/ext/multiset.c +214 -0
  361. data/ext/nmf.c +4 -0
  362. data/ext/nmf_wrap.c +3 -0
  363. data/ext/vector_complex.c +1 -1
  364. data/ext/vector_double.c +3 -3
  365. data/ext/vector_source.c +6 -6
  366. data/include/rb_gsl.h +7 -0
  367. data/include/rb_gsl_common.h +6 -0
  368. data/rdoc/alf.rdoc +77 -0
  369. data/rdoc/blas.rdoc +269 -0
  370. data/rdoc/bspline.rdoc +42 -0
  371. data/rdoc/changes.rdoc +164 -0
  372. data/rdoc/cheb.rdoc +99 -0
  373. data/rdoc/cholesky_complex.rdoc +46 -0
  374. data/rdoc/combi.rdoc +125 -0
  375. data/rdoc/complex.rdoc +210 -0
  376. data/rdoc/const.rdoc +546 -0
  377. data/rdoc/dht.rdoc +122 -0
  378. data/rdoc/diff.rdoc +133 -0
  379. data/rdoc/ehandling.rdoc +50 -0
  380. data/rdoc/eigen.rdoc +401 -0
  381. data/rdoc/fft.rdoc +535 -0
  382. data/rdoc/fit.rdoc +284 -0
  383. data/rdoc/function.rdoc +94 -0
  384. data/rdoc/graph.rdoc +137 -0
  385. data/rdoc/hist.rdoc +409 -0
  386. data/rdoc/hist2d.rdoc +279 -0
  387. data/rdoc/hist3d.rdoc +112 -0
  388. data/rdoc/index.rdoc +62 -0
  389. data/rdoc/integration.rdoc +398 -0
  390. data/rdoc/interp.rdoc +231 -0
  391. data/rdoc/intro.rdoc +27 -0
  392. data/rdoc/linalg.rdoc +681 -0
  393. data/rdoc/linalg_complex.rdoc +88 -0
  394. data/rdoc/math.rdoc +276 -0
  395. data/rdoc/matrix.rdoc +1093 -0
  396. data/rdoc/min.rdoc +189 -0
  397. data/rdoc/monte.rdoc +234 -0
  398. data/rdoc/multimin.rdoc +312 -0
  399. data/rdoc/multiroot.rdoc +293 -0
  400. data/rdoc/narray.rdoc +173 -0
  401. data/rdoc/ndlinear.rdoc +247 -0
  402. data/rdoc/nonlinearfit.rdoc +348 -0
  403. data/rdoc/ntuple.rdoc +88 -0
  404. data/rdoc/odeiv.rdoc +378 -0
  405. data/rdoc/perm.rdoc +221 -0
  406. data/rdoc/poly.rdoc +335 -0
  407. data/rdoc/qrng.rdoc +90 -0
  408. data/rdoc/randist.rdoc +233 -0
  409. data/rdoc/ref.rdoc +93 -0
  410. data/rdoc/rng.rdoc +203 -0
  411. data/rdoc/rngextra.rdoc +11 -0
  412. data/rdoc/roots.rdoc +305 -0
  413. data/rdoc/screenshot.rdoc +40 -0
  414. data/rdoc/sf.rdoc +1622 -0
  415. data/rdoc/siman.rdoc +89 -0
  416. data/rdoc/sort.rdoc +94 -0
  417. data/rdoc/start.rdoc +16 -0
  418. data/rdoc/stats.rdoc +219 -0
  419. data/rdoc/sum.rdoc +65 -0
  420. data/rdoc/tensor.rdoc +251 -0
  421. data/rdoc/tut.rdoc +5 -0
  422. data/rdoc/use.rdoc +177 -0
  423. data/rdoc/vector.rdoc +1243 -0
  424. data/rdoc/vector_complex.rdoc +347 -0
  425. data/rdoc/wavelet.rdoc +218 -0
  426. data/setup.rb +1585 -0
  427. data/tests/blas/amax.rb +14 -0
  428. data/tests/blas/asum.rb +16 -0
  429. data/tests/blas/axpy.rb +25 -0
  430. data/tests/blas/copy.rb +23 -0
  431. data/tests/blas/dot.rb +23 -0
  432. data/tests/bspline.rb +53 -0
  433. data/tests/cdf.rb +1388 -0
  434. data/tests/cheb.rb +112 -0
  435. data/tests/combination.rb +123 -0
  436. data/tests/complex.rb +17 -0
  437. data/tests/const.rb +24 -0
  438. data/tests/deriv.rb +85 -0
  439. data/tests/dht/dht1.rb +17 -0
  440. data/tests/dht/dht2.rb +23 -0
  441. data/tests/dht/dht3.rb +23 -0
  442. data/tests/dht/dht4.rb +23 -0
  443. data/tests/diff.rb +78 -0
  444. data/tests/eigen/eigen.rb +220 -0
  445. data/tests/eigen/gen.rb +105 -0
  446. data/tests/eigen/genherm.rb +66 -0
  447. data/tests/eigen/gensymm.rb +68 -0
  448. data/tests/eigen/nonsymm.rb +53 -0
  449. data/tests/eigen/nonsymmv.rb +53 -0
  450. data/tests/eigen/symm-herm.rb +74 -0
  451. data/tests/err.rb +58 -0
  452. data/tests/fit.rb +124 -0
  453. data/tests/gsl_test.rb +118 -0
  454. data/tests/gsl_test2.rb +107 -0
  455. data/tests/histo.rb +12 -0
  456. data/tests/integration/integration1.rb +72 -0
  457. data/tests/integration/integration2.rb +71 -0
  458. data/tests/integration/integration3.rb +71 -0
  459. data/tests/integration/integration4.rb +71 -0
  460. data/tests/interp.rb +45 -0
  461. data/tests/linalg/HH.rb +64 -0
  462. data/tests/linalg/LU.rb +47 -0
  463. data/tests/linalg/QR.rb +77 -0
  464. data/tests/linalg/SV.rb +24 -0
  465. data/tests/linalg/TDN.rb +116 -0
  466. data/tests/linalg/TDS.rb +122 -0
  467. data/tests/linalg/bidiag.rb +73 -0
  468. data/tests/linalg/cholesky.rb +20 -0
  469. data/tests/linalg/linalg.rb +158 -0
  470. data/tests/matrix/matrix_nmf_test.rb +39 -0
  471. data/tests/matrix/matrix_test.rb +48 -0
  472. data/tests/min.rb +99 -0
  473. data/tests/monte/miser.rb +31 -0
  474. data/tests/monte/vegas.rb +45 -0
  475. data/tests/multifit/test_2dgauss.rb +112 -0
  476. data/tests/multifit/test_brown.rb +90 -0
  477. data/tests/multifit/test_enso.rb +246 -0
  478. data/tests/multifit/test_filip.rb +155 -0
  479. data/tests/multifit/test_gauss.rb +97 -0
  480. data/tests/multifit/test_longley.rb +110 -0
  481. data/tests/multifit/test_multifit.rb +52 -0
  482. data/tests/multimin.rb +139 -0
  483. data/tests/multiroot.rb +131 -0
  484. data/tests/multiset.rb +52 -0
  485. data/tests/odeiv.rb +353 -0
  486. data/tests/poly/poly.rb +242 -0
  487. data/tests/poly/special.rb +65 -0
  488. data/tests/qrng.rb +131 -0
  489. data/tests/quartic.rb +29 -0
  490. data/tests/randist.rb +134 -0
  491. data/tests/rng.rb +305 -0
  492. data/tests/roots.rb +76 -0
  493. data/tests/run-test.sh +17 -0
  494. data/tests/sf/gsl_test_sf.rb +249 -0
  495. data/tests/sf/test_airy.rb +83 -0
  496. data/tests/sf/test_bessel.rb +306 -0
  497. data/tests/sf/test_coulomb.rb +17 -0
  498. data/tests/sf/test_dilog.rb +25 -0
  499. data/tests/sf/test_gamma.rb +209 -0
  500. data/tests/sf/test_hyperg.rb +356 -0
  501. data/tests/sf/test_legendre.rb +227 -0
  502. data/tests/sf/test_mathieu.rb +59 -0
  503. data/tests/sf/test_sf.rb +839 -0
  504. data/tests/stats.rb +174 -0
  505. data/tests/sum.rb +98 -0
  506. data/tests/sys.rb +323 -0
  507. data/tests/tensor.rb +419 -0
  508. data/tests/vector/vector_complex_test.rb +101 -0
  509. data/tests/vector/vector_test.rb +141 -0
  510. data/tests/wavelet.rb +142 -0
  511. metadata +596 -15
@@ -0,0 +1,174 @@
1
+ #!/usr/bin/env ruby
2
+ require("gsl")
3
+ require("gsl_test.rb")
4
+ include GSL::Test
5
+
6
+ lew = GSL::Vector.alloc( -213, -564, -35, -15, 141, 115, -420, -360, 203, -338, -431, 194,
7
+ -220, -513, 154, -125, -559, 92, -21, -579, -52, 99, -543, -175,
8
+ 162, -457, -346, 204, -300, -474, 164, -107, -572, -8, 83, -541,
9
+ -224, 180, -420, -374, 201, -236, -531, 83, 27, -564, -112, 131,
10
+ -507, -254, 199, -311, -495, 143, -46, -579, -90, 136, -472, -338,
11
+ 202, -287, -477, 169, -124, -568, 17, 48, -568, -135, 162, -430,
12
+ -422, 172, -74, -577, -13, 92, -534, -243, 194, -355, -465, 156,
13
+ -81, -578, -64, 139, -449, -384, 193, -198, -538, 110, -44, -577,
14
+ -6, 66, -552, -164, 161, -460, -344, 205, -281, -504, 134, -28,
15
+ -576, -118, 156, -437, -381, 200, -220, -540, 83, 11, -568, -160,
16
+ 172, -414, -408, 188, -125, -572, -32, 139, -492, -321, 205, -262,
17
+ -504, 142, -83, -574, 0, 48, -571, -106, 137, -501, -266, 190,
18
+ -391, -406, 194, -186, -553, 83, -13, -577, -49, 103, -515, -280,
19
+ 201, 300, -506, 131, -45, -578, -80, 138, -462, -361, 201, -211,
20
+ -554, 32, 74, -533, -235, 187, -372, -442, 182, -147, -566, 25,
21
+ 68, -535, -244, 194, -351, -463, 174, -125, -570, 15, 72, -550,
22
+ -190, 172, -424, -385, 198, -218, -536, 96 )
23
+
24
+ expected_mean = -177.435000000000;
25
+ expected_sd = 277.332168044316;
26
+ expected_lag1 = -0.307304800605679;
27
+
28
+ mean = lew.mean()
29
+ sd = lew.sd()
30
+ lag1 = lew.lag1_autocorrelation()
31
+
32
+ GSL::Test::test_rel(mean, expected_mean, 1e-15, "lew gsl_stats_mean") ;
33
+ GSL::Test::test_rel(sd, expected_sd, 1e-15, "lew gsl_stats_sd") ;
34
+ GSL::Test::test_rel(lag1, expected_lag1, 1e-14, "lew autocorrelation") ;
35
+
36
+ rel = 1e-10
37
+
38
+ rawa = GSL::Vector.alloc(0.0421, 0.0941, 0.1064, 0.0242, 0.1331,0.0773, 0.0243, 0.0815, 0.1186, 0.0356,0.0728, 0.0999, 0.0614, 0.0479)
39
+
40
+ rawb = GSL::Vector.alloc(0.1081, 0.0986, 0.1566, 0.1961, 0.1125,
41
+ 0.1942, 0.1079, 0.1021, 0.1583, 0.1673,
42
+ 0.1675, 0.1856, 0.1688, 0.1512)
43
+
44
+ raww = GSL::Vector.alloc(0.0000, 0.0000, 0.0000, 3.000, 0.0000,
45
+ 1.000, 1.000, 1.000, 0.000, 0.5000,
46
+ 7.000, 5.000, 4.000, 0.123)
47
+
48
+ mean = rawa.mean
49
+ expected = 0.0728
50
+ GSL::Test::test_rel(mean, expected, rel, "gsl_stats_mean")
51
+
52
+ var = rawa.variance_with_fixed_mean(mean)
53
+ expected = 0.00113837428571429
54
+ GSL::Test::test_rel(var, expected, rel, "gsl_stats_variance_with_fixed_mean")
55
+
56
+ sd = rawa.sd_with_fixed_mean(mean)
57
+ expected = 0.0337398026922845
58
+ GSL::Test::test_rel(sd, expected, rel, "gsl_stats_sd_with_fixed_mean")
59
+
60
+
61
+
62
+ var = rawb.variance()
63
+ expected = 0.00124956615384615
64
+ GSL::Test::test_rel(var, expected, rel, "gsl_stats_variance")
65
+
66
+ sd = rawa.sd()
67
+ expected = 0.0350134479659107
68
+ GSL::Test::test_rel(sd, expected, rel, "gsl_stats_sd")
69
+
70
+ absdev = rawa.absdev()
71
+ expected = 0.0287571428571429
72
+ GSL::Test::test_rel(absdev, expected, rel, "gsl_stats_absdev")
73
+
74
+ skew = rawa.skew()
75
+ expected = 0.0954642051479004
76
+ GSL::Test::test_rel(skew, expected, rel, "gsl_stats_skew")
77
+
78
+ kurtosis = rawa.kurtosis()
79
+ expected = -1.38583851548909
80
+ GSL::Test::test_rel(kurtosis, expected, rel, "gsl_stats_kurtosis")
81
+
82
+ wmean = rawa.wmean(raww)
83
+ expected = 0.0678111523670601
84
+ GSL::Test::test_rel(wmean, expected, rel, "gsl_stats_wmean")
85
+
86
+ wvariance = rawa.wvariance(raww)
87
+ expected = 0.000769562962860317
88
+ GSL::Test::test_rel(wvariance, expected, rel, "gsl_stats_wvariance")
89
+
90
+ wsd = rawa.wsd(raww)
91
+ expected = 0.0277409978706664
92
+ GSL::Test::test_rel(wsd, expected, rel, "gsl_stats_wsd")
93
+
94
+ wabsdev = rawa.wabsdev(raww)
95
+ expected = 0.0193205027504008
96
+ GSL::Test::test_rel(wabsdev, expected, rel, "gsl_stats_wabsdev")
97
+
98
+ wskew = rawa.wskew(raww)
99
+ expected = -0.373631000307076
100
+ GSL::Test::test_rel(wskew, expected, rel, "gsl_stats_wskew")
101
+
102
+ wkurtosis = rawa.wkurtosis(raww)
103
+ expected = -1.48114233353963
104
+ GSL::Test::test_rel(wkurtosis, expected, rel, "gsl_stats_wkurtosis")
105
+
106
+ c = GSL::Stats::covariance(rawa, rawb)
107
+ expected = -0.000139021538461539
108
+ GSL::Test::test_rel(c, expected, rel, "gsl_stats_covariance")
109
+
110
+ if GSL_VERSION >= "1.9.90"
111
+ r = GSL::Stats::correlation(rawa, rawb)
112
+ expected = -0.112322712666074171
113
+ GSL::Test::test_rel(r, expected, rel, "gsl_stats_correlation")
114
+
115
+ pv = GSL::Stats::pvariance(rawa, rawb)
116
+ expected = 0.00123775384615385
117
+ GSL::Test::test_rel(pv, expected, rel, "gsl_stats_pvariance")
118
+
119
+ t = GSL::Stats::ttest(rawa, rawb)
120
+ expected = -5.67026326985851
121
+ GSL::Test::test_rel(t, expected, rel, "gsl_stats_ttest")
122
+ end
123
+
124
+ expected = 0.1331
125
+ GSL::Test::test_rel(rawa.max, expected, rel, "gsl_stats_max")
126
+
127
+ expected = 0.0242
128
+ GSL::Test::test_rel(rawa.min, expected, rel, "gsl_stats_min")
129
+ min, max = rawa.minmax
130
+ expected = 0.1331
131
+ GSL::Test::test_rel(max, expected, rel, "gsl_stats_minmax: max")
132
+ expected = 0.0242
133
+ GSL::Test::test_rel(min, expected, rel, "gsl_stats_minmax: min")
134
+
135
+ expected = 4
136
+ max_index = rawa.max_index
137
+ GSL::Test::test(max_index != expected, "gsl_stats_max_index")
138
+
139
+ expected = 3
140
+ min_index = rawa.min_index
141
+ GSL::Test::test(min_index != expected, "gsl_stats_min_index")
142
+
143
+ min_index, max_index = rawa.minmax_index
144
+ expected = 4
145
+ GSL::Test::test(max_index != expected, "gsl_stats_minmax_index: max")
146
+
147
+ expected = 3
148
+ GSL::Test::test(min_index != expected, "gsl_stats_minmax_index: min")
149
+
150
+ rawa.sort!
151
+
152
+ median = rawa.median_from_sorted_data()
153
+ expected = 0.07505
154
+ GSL::Test::test_rel(median, expected, rel, "gsl_stats_median_from_sorted_data")
155
+
156
+ median = rawa.subvector(0, rawa.size-1).median_from_sorted_data()
157
+ expected = 0.0728
158
+ GSL::Test::test_rel(median, expected, rel, "gsl_stats_median_from_sorted_data")
159
+
160
+ quantile = rawa.quantile_from_sorted_data(0.0)
161
+ expected = 0.0242
162
+ GSL::Test::test_rel(quantile, expected, rel, "gsl_stats_quantile_from_sorted_data")
163
+
164
+ quantile = rawa.quantile_from_sorted_data(1.0)
165
+ expected = 0.1331
166
+ GSL::Test::test_rel(quantile, expected, rel, "gsl_stats_quantile_from_sorted_data (100)")
167
+
168
+ quantile = rawa.quantile_from_sorted_data(0.5)
169
+ expected = 0.07505
170
+ GSL::Test::test_rel(quantile, expected, rel, "gsl_stats_quantile_from_sorted_data (50even)")
171
+
172
+ quantile = rawa.subvector(0, rawa.size-1).quantile_from_sorted_data(0.5)
173
+ expected = 0.0728
174
+ GSL::Test::test_rel(quantile, expected, rel, "gsl_stats_quantile_from_sorted_data (50odd)")
@@ -0,0 +1,98 @@
1
+ #!/usr/bin/env ruby
2
+ # Ruby/GSL implementation of GSL "sum/test.c"
3
+ require("gsl")
4
+ require("./gsl_test2.rb")
5
+ include GSL::Test
6
+ include Math
7
+
8
+ N = 50
9
+
10
+ def check_trunc(t, expected, desc)
11
+ w = GSL::Sum::Levin_utrunc.alloc(N)
12
+ sum_accel, err, = w.accel(t)
13
+ desc2 = sprintf("trunc result, %s", desc)
14
+ GSL::Test::test_rel(sum_accel, expected, 1e-8, desc2)
15
+ end
16
+
17
+ def check_full(t, expected, desc)
18
+ w = GSL::Sum::Levin_u.alloc(N)
19
+ sum_accel, err_est, = w.accel(t)
20
+ desc2 = sprintf("full result, %s", desc)
21
+ GSL::Test::test_rel(sum_accel, expected, 1e-8, desc2)
22
+
23
+ sd_est = -log10(err_est/sum_accel.abs);
24
+ sd_actual = -log10(GSL::DBL_EPSILON + ((sum_accel - expected)/expected).abs);
25
+ desc2 = sprintf("full significant digits, %s (%g vs %g)",
26
+ desc, sd_est, sd_actual)
27
+ GSL::Test::test((sd_est > sd_actual + 1.0) ? 1 : 0, desc2)
28
+ end
29
+
30
+ GSL::IEEE::env_setup()
31
+
32
+ Zeta_2 = M_PI*M_PI/6.0
33
+ t = GSL::Vector.alloc(N)
34
+ for n in 0...N
35
+ np1 = n + 1.0
36
+ t[n] = 1.0/(np1*np1)
37
+ end
38
+ check_trunc(t, Zeta_2, "zeta(2)")
39
+ check_full(t, Zeta_2, "zeta(2)")
40
+
41
+ x = 10.0
42
+ y = exp(x)
43
+ t[0] = 1.0
44
+ for n in 1...N
45
+ t[n] = t[n-1]*(x/n)
46
+ end
47
+ check_trunc(t, y, "exp(10)");
48
+ check_full(t, y, "exp(10)");
49
+
50
+ x = -10.0
51
+ y = exp(x)
52
+ t[0] = 1.0
53
+ for n in 1...N
54
+ t[n] = t[n-1]*(x/n)
55
+ end
56
+ check_trunc(t, y, "exp(-10)");
57
+ check_full(t, y, "exp(-10)");
58
+
59
+ x = 0.5
60
+ y = -log(1-x)
61
+ t[0] = x
62
+ for n in 1...N
63
+ t[n] = t[n-1]*(x*n)/(n + 1.0)
64
+ end
65
+ check_trunc(t, y, "-log(1/2)")
66
+ check_full(t, y, "-log(1/2)")
67
+
68
+ x = -1.0
69
+ y = -log(1-x)
70
+ t[0] = x
71
+ for n in 1...N
72
+ t[n] = t[n-1]*(x*n)/(n + 1.0)
73
+ end
74
+ check_trunc(t, y, "-log(2)")
75
+ check_full(t, y, "-log(2)")
76
+
77
+ result = 0.192594048773
78
+ t[0] = 3.0 / (M_PI * M_PI)
79
+ for n in 1...N
80
+ t[n] = -t[n - 1] * (4.0 * (n + 1.0) - 1.0) / (M_PI * M_PI)
81
+ end
82
+ check_trunc(t, result, "asymptotic series")
83
+ check_full(t, result, "asymptotic series")
84
+
85
+ result = 0.5772156649015328606065120900824;
86
+ t[0] = 1.0;
87
+ for n in 1...N
88
+ t[n] = 1/(n+1.0) + log(n/(n+1.0))
89
+ end
90
+ check_trunc(t, result, "Euler's constant")
91
+ check_full(t, result, "Euler's constant")
92
+
93
+ result = 0.6048986434216305
94
+ for n in 0...N
95
+ t[n] = (n%2 == 1 ? -1 : 1) * 1.0 /sqrt(n + 1.0)
96
+ end
97
+ check_trunc(t, result, "eta(1/2)")
98
+ check_full(t, result, "eta(1/2)")
@@ -0,0 +1,323 @@
1
+ #!/usr/bin/env ruby
2
+ # Ruby/GSL implementation of GSL "sum/test.c"
3
+ require("gsl")
4
+ require("./gsl_test2.rb")
5
+ include GSL::Test
6
+
7
+ GSL::IEEE::env_setup()
8
+
9
+ y = GSL::expm1(0.0);
10
+ y_expected = 0.0;
11
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::expm1(0.0)");
12
+
13
+ y = GSL::expm1(1e-10);
14
+ y_expected = 1.000000000050000000002e-10;
15
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::expm1(1e-10)");
16
+
17
+ y = GSL::expm1(-1e-10);
18
+ y_expected = -9.999999999500000000017e-11;
19
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::expm1(-1e-10)");
20
+
21
+ y = GSL::expm1(0.1);
22
+ y_expected = 0.1051709180756476248117078264902;
23
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::expm1(0.1)");
24
+
25
+ y = GSL::expm1(-0.1);
26
+ y_expected = -0.09516258196404042683575094055356;
27
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::expm1(-0.1)");
28
+
29
+ y = GSL::expm1(10.0);
30
+ y_expected = 22025.465794806716516957900645284;
31
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::expm1(10.0)");
32
+
33
+ y = GSL::expm1(-10.0);
34
+ y_expected = -0.99995460007023751514846440848444;
35
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::expm1(-10.0)");
36
+
37
+ # Test for log1p
38
+
39
+ y = GSL::log1p(0.0);
40
+ y_expected = 0.0;
41
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::log1p(0.0)");
42
+
43
+ y = GSL::log1p(1e-10);
44
+ y_expected = 9.9999999995000000000333333333308e-11;
45
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::log1p(1e-10)");
46
+
47
+ y = GSL::log1p(0.1);
48
+ y_expected = 0.095310179804324860043952123280765;
49
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::log1p(0.1)");
50
+
51
+ y = GSL::log1p(10.0);
52
+ y_expected = 2.3978952727983705440619435779651;
53
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::log1p(10.0)");
54
+
55
+ # Test for GSL::hypot
56
+
57
+ y = GSL::hypot(0.0, 0.0);
58
+ y_expected = 0.0;
59
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::hypot(0.0, 0.0)");
60
+
61
+ y = GSL::hypot(1e-10, 1e-10);
62
+ y_expected = 1.414213562373095048801688e-10;
63
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::hypot(1e-10, 1e-10)");
64
+
65
+ y = GSL::hypot(1e-38, 1e-38);
66
+ y_expected = 1.414213562373095048801688e-38;
67
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::hypot(1e-38, 1e-38)");
68
+
69
+ y = GSL::hypot(1e-10, -1.0);
70
+ y_expected = 1.000000000000000000005;
71
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::hypot(1e-10, -1)");
72
+
73
+ y = GSL::hypot(-1.0, 1e-10);
74
+ y_expected = 1.000000000000000000005;
75
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::hypot(-1, 1e-10)");
76
+
77
+ #y = GSL::hypot(1e307, 1e301);
78
+ #y_expected = 1.000000000000499999999999e307;
79
+ #GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::hypot(1e307, 1e301)");
80
+
81
+ #y = GSL::hypot(1e301, 1e307);
82
+ #y_expected = 1.000000000000499999999999e307;
83
+ #GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::hypot(1e301, 1e307)");
84
+
85
+ #y = GSL::hypot(1e307, 1e307);
86
+ #y_expected = 1.414213562373095048801688e307;
87
+ #GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::hypot(1e307, 1e307)");
88
+
89
+ y = GSL::acosh(1.0);
90
+ y_expected = 0.0;
91
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::acosh(1.0)");
92
+
93
+ y = GSL::acosh(1.1);
94
+ y_expected = 4.435682543851151891329110663525e-1;
95
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::acosh(1.1)");
96
+
97
+ y = GSL::acosh(10.0);
98
+ y_expected = 2.9932228461263808979126677137742e0;
99
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::acosh(10.0)");
100
+
101
+ y = GSL::acosh(1e10);
102
+ y_expected = 2.3718998110500402149594646668302e1;
103
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::acosh(1e10)");
104
+
105
+ # Test for asinh
106
+
107
+ y = GSL::asinh(0.0);
108
+ y_expected = 0.0;
109
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::asinh(0.0)");
110
+
111
+ y = GSL::asinh(1e-10);
112
+ y_expected = 9.9999999999999999999833333333346e-11;
113
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::asinh(1e-10)");
114
+
115
+ y = GSL::asinh(-1e-10);
116
+ y_expected = -9.9999999999999999999833333333346e-11;
117
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::asinh(1e-10)");
118
+
119
+ y = GSL::asinh(0.1);
120
+ y_expected = 9.983407889920756332730312470477e-2;
121
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::asinh(0.1)");
122
+
123
+ y = GSL::asinh(-0.1);
124
+ y_expected = -9.983407889920756332730312470477e-2;
125
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::asinh(-0.1)");
126
+
127
+ y = GSL::asinh(1.0);
128
+ y_expected = 8.8137358701954302523260932497979e-1;
129
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::asinh(1.0)");
130
+
131
+ y = GSL::asinh(-1.0);
132
+ y_expected = -8.8137358701954302523260932497979e-1;
133
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::asinh(-1.0)");
134
+
135
+ y = GSL::asinh(10.0);
136
+ y_expected = 2.9982229502979697388465955375965e0;
137
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::asinh(10)");
138
+
139
+ y = GSL::asinh(-10.0);
140
+ y_expected = -2.9982229502979697388465955375965e0;
141
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::asinh(-10)");
142
+
143
+ y = GSL::asinh(1e10);
144
+ y_expected = 2.3718998110500402149599646668302e1;
145
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::asinh(1e10)");
146
+
147
+ y = GSL::asinh(-1e10);
148
+ y_expected = -2.3718998110500402149599646668302e1;
149
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::asinh(-1e10)");
150
+
151
+ y = GSL::atanh(0.0);
152
+ y_expected = 0.0;
153
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::atanh(0.0)");
154
+
155
+ y = GSL::atanh(1e-20);
156
+ y_expected = 1e-20;
157
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::atanh(1e-20)");
158
+
159
+ y = GSL::atanh(-1e-20);
160
+ y_expected = -1e-20;
161
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::atanh(-1e-20)");
162
+
163
+ y = GSL::atanh(0.1);
164
+ y_expected = 1.0033534773107558063572655206004e-1;
165
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::atanh(0.1)");
166
+
167
+ y = GSL::atanh(-0.1);
168
+ y_expected = -1.0033534773107558063572655206004e-1;
169
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::atanh(-0.1)");
170
+
171
+ y = GSL::atanh(0.9);
172
+ y_expected = 1.4722194895832202300045137159439e0;
173
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::atanh(0.9)");
174
+
175
+ y = GSL::atanh(-0.9);
176
+ y_expected = -1.4722194895832202300045137159439e0;
177
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::atanh(0.9)");
178
+
179
+ # Test for pow_int
180
+
181
+ y = GSL::pow_2(-3.14);
182
+ y_expected = pow(-3.14, 2.0);
183
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::pow_2(-3.14)");
184
+
185
+ y = GSL::pow_3(-3.14);
186
+ y_expected = pow(-3.14, 3.0);
187
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::pow_3(-3.14)");
188
+
189
+ y = GSL::pow_4(-3.14);
190
+ y_expected = pow(-3.14, 4.0);
191
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::pow_4(-3.14)");
192
+
193
+ y = GSL::pow_5(-3.14);
194
+ y_expected = pow(-3.14, 5.0);
195
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::pow_5(-3.14)");
196
+
197
+ y = GSL::pow_6(-3.14);
198
+ y_expected = pow(-3.14, 6.0);
199
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::pow_6(-3.14)");
200
+
201
+ y = GSL::pow_7(-3.14);
202
+ y_expected = pow(-3.14, 7.0);
203
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::pow_7(-3.14)");
204
+
205
+ y = GSL::pow_8(-3.14);
206
+ y_expected = pow(-3.14, 8.0);
207
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::pow_8(-3.14)");
208
+
209
+ y = GSL::pow_9(-3.14);
210
+ y_expected = pow(-3.14, 9.0);
211
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::pow_9(-3.14)");
212
+
213
+ for n in -9...10
214
+ y = GSL::pow_int(-3.14, n);
215
+ y_expected = pow(-3.14, n);
216
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::pow_n(-3.14,#{n})")
217
+ end
218
+
219
+ # Test for ldexp
220
+
221
+ y = GSL::ldexp(M_PI, -2);
222
+ y_expected = M_PI_4;
223
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::ldexp(pi,-2)");
224
+
225
+ y = GSL::ldexp(1.0, 2);
226
+ y_expected = 4.000000;
227
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::ldexp(1.0,2)");
228
+
229
+ y = GSL::ldexp(0.0, 2);
230
+ y_expected = 0.0;
231
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::ldexp(0.0,2)");
232
+
233
+ # Test for frexp
234
+
235
+ y, e = GSL::frexp(M_PI);
236
+ y_expected = M_PI_4;
237
+ e_expected = 2;
238
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::frexp(pi) fraction");
239
+ GSL::Test::test_int(e, e_expected, "GSL::frexp(pi) exponent");
240
+
241
+ y, e = GSL::frexp(2.0);
242
+ y_expected = 0.5;
243
+ e_expected = 2;
244
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::frexp(2.0) fraction");
245
+ GSL::Test::test_int(e, e_expected, "GSL::frexp(2.0) exponent");
246
+
247
+ y, e = GSL::frexp(1.0 / 4.0);
248
+ y_expected = 0.5;
249
+ e_expected = -1;
250
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::frexp(0.25) fraction");
251
+ GSL::Test::test_int(e, e_expected, "GSL::frexp(0.25) exponent");
252
+
253
+ y, e = GSL::frexp(1.0 / 4.0 - 4.0 * GSL::DBL_EPSILON);
254
+ y_expected = 0.999999999999996447;
255
+ e_expected = -2;
256
+ GSL::Test::test_rel(y, y_expected, 1e-15, "GSL::frexp(0.25-eps) fraction");
257
+ GSL::Test::test_int(e, e_expected, "GSL::frexp(0.25-eps) exponent");
258
+
259
+
260
+ x = M_PI;
261
+ y = 22.0 / 7.0;
262
+
263
+ # test the basic function
264
+
265
+ for i in 0...10
266
+ tol = pow(10, -i);
267
+ res = GSL::fcmp(x, y, tol);
268
+ GSL::Test::test_int(res, -((i >= 4) ? 1 : 0), "GSL::fcmp(#{x},#{y},#{tol})")
269
+ end
270
+
271
+ for i in 0...10
272
+ tol = pow(10, -i);
273
+ res = GSL::fcmp(y, x, tol);
274
+ GSL::Test::test_int(res,(i >= 4) ? 1 : 0, "GSL::fcmp(#{y},#{x},#{tol})")
275
+ end
276
+
277
+ zero = 0.0;
278
+ one = 1.0;
279
+ inf = Math::exp(1.0e10)
280
+ nan = inf / inf;
281
+
282
+ s = GSL::isinf(zero);
283
+ GSL::Test::test_int(s, 0, "GSL::isinf(0)");
284
+
285
+ s = GSL::isinf(one);
286
+ GSL::Test::test_int(s, 0, "GSL::isinf(1)");
287
+
288
+ s = GSL::isinf(inf);
289
+ GSL::Test::test_int(s, 1, "GSL::isinf(inf)");
290
+
291
+ # Commented out 2008/Oct/17 by YT
292
+ # This test fails in (Darwin 9.5.0, gcc4.0.1):
293
+ # gsl_isinf() returns 1 for -inf
294
+ #s = GSL::isinf(-inf);
295
+ #GSL::Test::test_int(s, -1, "GSL::isinf(-inf)");
296
+
297
+ s = GSL::isinf(nan);
298
+ GSL::Test::test_int(s, 0, "GSL::isinf(nan)");
299
+
300
+
301
+ s = GSL::isnan(zero);
302
+ GSL::Test::test_int(s, 0, "GSL::isnan(0)");
303
+
304
+ s = GSL::isnan(one);
305
+ GSL::Test::test_int(s, 0, "GSL::isnan(1)");
306
+ s = GSL::isnan(inf);
307
+ GSL::Test::test_int(s, 0, "GSL::isnan(inf)");
308
+
309
+ s = GSL::isnan(nan);
310
+ GSL::Test::test_int(s, 1, "GSL::isnan(nan)");
311
+
312
+
313
+ s = GSL::finite(zero);
314
+ GSL::Test::test_int(s, 1, "GSL::finite(0)");
315
+
316
+ s = GSL::finite(one);
317
+ GSL::Test::test_int(s, 1, "GSL::finite(1)");
318
+
319
+ s = GSL::finite(inf);
320
+ GSL::Test::test_int(s, 0, "GSL::finite(inf)");
321
+
322
+ s = GSL::finite(nan);
323
+ GSL::Test::test_int(s, 0, "GSL::finite(nan)");