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,88 @@
1
+ #
2
+ # === Complex LU decomposition
3
+ #
4
+ # ---
5
+ # * GSL::Linalg::Complex::LU_decomp!(A)
6
+ # * GSL::Linalg::Complex::LU::decomp!(A)
7
+ # * GSL::Matrix::Complex#LU_decomp!
8
+ # * GSL::Matrix::Complex#LU_decomp!
9
+ #
10
+ # Factorizes the square matrix <tt>A</tt> into the LU decomposition PA = LU,
11
+ # and returns an array, <tt>[perm, signum]</tt>. <tt>A</tt> is changed.
12
+ #
13
+ # ---
14
+ # * GSL::Linalg::Complex::LU_decomp(A)
15
+ # * GSL::Linalg::Complex::LU::decomp(A)
16
+ # * GSL::Matrix::Complex#LU_decomp
17
+ #
18
+ # Factorizes the square matrix <tt>A</tt> into the LU decomposition PA = LU,
19
+ # and returns an array, <tt>[LU, perm, signum]</tt>. <tt>A</tt> is not changed.
20
+ #
21
+ # ---
22
+ # * GSL::Linalg::Complex::LU_solve(A, b)
23
+ # * GSL::Linalg::Complex::LU::solve(A, b)
24
+ # * GSL::Linalg::Complex::LU_solve(A, b)
25
+ # * GSL::Matrix::Complex#LU_solve(b)
26
+ # * GSL::Linalg::Complex::solve(LU, perm, b)
27
+ # * GSL::Linalg::Complex::LU::solve(LU, perm, b)
28
+ # * GSL::Linalg::Complex::LU::LUMatirx#solve(perm, b)
29
+ #
30
+ #
31
+ # ---
32
+ # * GSL::Linalg::Complex::LU_svx(A, x)
33
+ # * GSL::Linalg::Complex::LU::svx(A, x)
34
+ # * GSL::Linalg::Complex::LU_svx(A, x)
35
+ # * GSL::Matrix::Complex#LU_svx(x)
36
+ # * GSL::Linalg::Complex::svx(LU, perm, x)
37
+ # * GSL::Linalg::Complex::LU::svx(LU, perm, x)
38
+ # * GSL::Linalg::Complex::LU::LUMatirx#svx(perm, x)
39
+ #
40
+ #
41
+ # ---
42
+ # * GSL::Linalg::Complex::LU_refine(A, LU, perm, b, x)
43
+ # * GSL::Linalg::Complex::LU_::refine(A, LU, perm, b, x)
44
+ #
45
+ #
46
+ # ---
47
+ # * GSL::Linalg::Complex::LU_invert(A)
48
+ # * GSL::Linalg::Complex::LU::invert(A)
49
+ # * GSL::Linalg::Complex::LU_invert(LU, perm)
50
+ # * GSL::Linalg::Complex::LU::invert(LU, perm)
51
+ # * GSL::Matrix::Complex#LU_invert
52
+ # * GSL::Matrix::Complex#invert
53
+ # * GSL::Linalg::Complex::LU::LUMatrix#invert(perm)
54
+ #
55
+ #
56
+ # ---
57
+ # * GSL::Linalg::Complex::LU_det(A)
58
+ # * GSL::Linalg::Complex::LU::det(A)
59
+ # * GSL::Linalg::Complex::LU_det(LU, signum)
60
+ # * GSL::Linalg::Complex::LU::det(LU, signum)
61
+ # * GSL::Matrix::Complex#LU_det
62
+ # * GSL::Matrix::Complex#det
63
+ # * GSL::Linalg::Complex::LU::LUMatrix#det(signum)
64
+ #
65
+ #
66
+ # ---
67
+ # * GSL::Linalg::Complex::LU_lndet(A)
68
+ # * GSL::Linalg::Complex::LU::lndet(A)
69
+ # * GSL::Linalg::Complex::LU_lndet(LU)
70
+ # * GSL::Linalg::Complex::LU::lndet(LU)
71
+ # * GSL::Matrix::Complex#LU_lndet
72
+ # * GSL::Matrix::Complex#lndet
73
+ # * GSL::Linalg::Complex::LU::LUMatrix#lndet
74
+ #
75
+ #
76
+ # ---
77
+ # * GSL::Linalg::Complex::LU_sgndet(A)
78
+ # * GSL::Linalg::Complex::LU::sgndet(A)
79
+ # * GSL::Linalg::Complex::LU_sgndet(LU, signum)
80
+ # * GSL::Linalg::Complex::LU::sgndet(LU, signum)
81
+ # * GSL::Matrix::Complex#LU_sgndet
82
+ # * GSL::Matrix::Complex#sgndet
83
+ # * GSL::Linalg::Complex::LU::LUMatrix#sgndet(signum)
84
+ #
85
+ #
86
+ # {back}[link:files/rdoc/linalg_rdoc.html]
87
+ #
88
+ #
@@ -0,0 +1,276 @@
1
+ #
2
+ # = Mathematical Functions
3
+ # Contents:
4
+ # 1. {Mathematical Constants}[link:files/rdoc/math_rdoc.html#1]
5
+ # 1. {Infinities and Not-a-number}[link:files/rdoc/math_rdoc.html#2]
6
+ # 1. {Constants}[link:files/rdoc/math_rdoc.html#2.1]
7
+ # 1. {Module functions}[link:files/rdoc/math_rdoc.html#2.2]
8
+ # 1. {Elementary Functions}[link:files/rdoc/math_rdoc.html#3]
9
+ # 1. {Small Integer Powers}[link:files/rdoc/math_rdoc.html#4]
10
+ # 1. {Testing the Sign of Numbers}[link:files/rdoc/math_rdoc.html#5]
11
+ # 1. {Testing for Odd and Even Numbers}[link:files/rdoc/math_rdoc.html#6]
12
+ # 1. {Maximum and Minimum functions}[link:files/rdoc/math_rdoc.html#7]
13
+ # 1. {Approximate Comparison of Floating Point Numbers}[link:files/rdoc/math_rdoc.html#8]
14
+ #
15
+ # == {}[link:index.html"name="1] Mathematical Constants
16
+ # ---
17
+ # * GSL::M_E
18
+ #
19
+ # The base of exponentials, e
20
+ # ---
21
+ # * GSL::M_LOG2E
22
+ #
23
+ # The base-2 logarithm of e, log_2(e)
24
+ # ---
25
+ # * GSL::M_LOG10E
26
+ #
27
+ # The base-10 logarithm of e, log_10(e)
28
+ # ---
29
+ # * GSL::M_SQRT2
30
+ #
31
+ # The square root of two, sqrt(2)
32
+ # ---
33
+ # * GSL::M_SQRT1_2
34
+ #
35
+ # The square root of one-half, sqrt(1/2)
36
+ # ---
37
+ # * GSL::M_SQRT3
38
+ #
39
+ # The square root of three, sqrt(3)
40
+ # ---
41
+ # * GSL::M_PI
42
+ #
43
+ # The constant pi
44
+ # ---
45
+ # * GSL::M_PI_2
46
+ #
47
+ # Pi divided by two
48
+ # ---
49
+ # * GSL::M_PI_4
50
+ #
51
+ # Pi divided by four
52
+ # ---
53
+ # * GSL::M_SQRTPI
54
+ #
55
+ # The square root of pi
56
+ # ---
57
+ # * GSL::M_2_SQRTPI
58
+ #
59
+ # Two divided by the square root of pi
60
+ # ---
61
+ # * GSL::M_1_PI
62
+ #
63
+ # The reciprocal of pi, 1/pi
64
+ # ---
65
+ # * GSL::M_2_PI
66
+ #
67
+ # Twice the reciprocal of pi, 2/pi
68
+ # ---
69
+ # * GSL::M_LN10
70
+ #
71
+ # The natural logarithm of ten, ln(10)
72
+ # ---
73
+ # * GSL::M_LN2
74
+ #
75
+ # The natural logarithm of ten, ln(2)
76
+ # ---
77
+ # * GSL::M_LNPI
78
+ #
79
+ # The natural logarithm of ten, ln(pi)
80
+ # ---
81
+ # * GSL::M_EULER
82
+ #
83
+ # Euler's constant
84
+ #
85
+ # == {}[link:index.html"name="2] Infinities and Not-a-number
86
+ #
87
+ # === {}[link:index.html"name="2.1] Constants
88
+ # ---
89
+ # * GSL::POSINF
90
+ #
91
+ # The IEEE representation of positive infinity,
92
+ # computed from the expression +1.0/0.0.
93
+ # ---
94
+ # * GSL::NEGINF
95
+ #
96
+ # The IEEE representation of negative infinity,
97
+ # computed from the expression -1.0/0.0.
98
+ # ---
99
+ # * GSL::NAN
100
+ #
101
+ # The IEEE representation of the Not-a-Number symbol,
102
+ # computed from the ratio 0.0/0.0.
103
+ #
104
+ # === {}[link:index.html"name="2.2] Module functions
105
+ # ---
106
+ # * GSL::isnan(x)
107
+ #
108
+ # This returns 1 if <tt>x</tt> is not-a-number.
109
+ # ---
110
+ # * GSL::isnan?(x)
111
+ #
112
+ # This returns <tt>true</tt> if <tt>x</tt> is not-a-number, and <tt>false</tt> otherwise.
113
+ # ---
114
+ # * GSL::isinf(x)
115
+ #
116
+ # This returns +1 if <tt>x</tt> is positive infinity,
117
+ # -1 if <tt>x</tt> is negative infinity and 0 otherwise.
118
+ # NOTE: In Darwin9.5.0-gcc4.0.1, this method returns 1 for -inf.
119
+ # ---
120
+ # * GSL::isinf?(x)
121
+ #
122
+ # This returns <tt>true</tt> if <tt>x</tt> is positive or negative infinity,
123
+ # and <tt>false</tt> otherwise.
124
+ # ---
125
+ # * GSL::finite(x)
126
+ #
127
+ # This returns 1 if <tt>x</tt> is a real number,
128
+ # and 0 if it is infinite or not-a-number.
129
+ # ---
130
+ # * GSL::finite?(x)
131
+ #
132
+ # This returns <tt>true</tt> if <tt>x</tt> is a real number,
133
+ # and <tt>false</tt> if it is infinite or not-a-number.
134
+ #
135
+ # == {}[link:index.html"name="3] Elementary Functions
136
+ # ---
137
+ # * GSL::log1p(x)
138
+ #
139
+ # This method computes the value of log(1+x)
140
+ # in a way that is accurate for small <tt>x</tt>. It provides an alternative
141
+ # to the BSD math function log1p(x).
142
+ # ---
143
+ # * GSL::expm1(x)
144
+ #
145
+ # This method computes the value of exp(x)-1
146
+ # in a way that is accurate for small <tt>x</tt>. It provides an alternative
147
+ # to the BSD math function expm1(x).
148
+ # ---
149
+ # * GSL::hypot(x, y)
150
+ #
151
+ # This method computes the value of sqrt{x^2 + y^2} in a way that
152
+ # avoids overflow.
153
+ # ---
154
+ # * GSL::hypot3(x, y, z)
155
+ #
156
+ # Computes the value of sqrt{x^2 + y^2 + z^2} in a way that avoids overflow.
157
+ # ---
158
+ # * GSL::acosh(x)
159
+ #
160
+ # This method computes the value of arccosh(x).
161
+ # ---
162
+ # * GSL::asinh(x)
163
+ #
164
+ # This method computes the value of arcsinh(x).
165
+ # ---
166
+ # * GSL::atanh(x)
167
+ #
168
+ # This method computes the value of arctanh(x).
169
+ #
170
+ # These methods above can take argument <tt>x</tt> of
171
+ # Integer, Float, Array, Vector or Matrix.
172
+ #
173
+ # ---
174
+ # * GSL::ldexp(x)
175
+ #
176
+ # This method computes the value of x * 2^e.
177
+ # ---
178
+ # * GSL::frexp(x)
179
+ #
180
+ # This method splits the number <tt>x</tt> into its normalized fraction
181
+ # f and exponent e, such that x = f * 2^e and 0.5 <= f < 1.
182
+ # The method returns f and the exponent e as an array, [f, e].
183
+ # If <tt>x</tt> is zero, both f and e are set to zero.
184
+ #
185
+ # == {}[link:index.html"name="4] Small Integer Powers
186
+ # ---
187
+ # * GSL::pow_int(x, n)
188
+ #
189
+ # This routine computes the power <tt>x^n</tt> for integer <tt>n</tt>.
190
+ # The power is computed efficiently -- for example, x^8 is computed as
191
+ # ((x^2)^2)^2, requiring only 3 multiplications.
192
+ #
193
+ # ---
194
+ # * GSL::pow_2(x)
195
+ # * GSL::pow_3(x)
196
+ # * GSL::pow_4(x)
197
+ # * GSL::pow_5(x)
198
+ # * GSL::pow_6(x)
199
+ # * GSL::pow_7(x)
200
+ # * GSL::pow_8(x)
201
+ # * GSL::pow_9(x)
202
+ #
203
+ # These methods can be used to compute small integer powers x^2, x^3, etc.
204
+ # efficiently.
205
+ #
206
+ # == {}[link:index.html"name="5] Testing the Sign of Numbers
207
+ # ---
208
+ # * GSL::SIGN(x)
209
+ # * GSL::sign(x)
210
+ #
211
+ # Return the sign of <tt>x</tt>.
212
+ # It is defined as ((x) >= 0 ? 1 : -1).
213
+ # Note that with this definition the sign of zero is positive
214
+ # (regardless of its IEEE sign bit).
215
+ #
216
+ # == {}[link:index.html"name="6] Testing for Odd and Even Numbers
217
+ # ---
218
+ # * GSL::is_odd(n)
219
+ # * GSL::IS_ODD(n)
220
+ #
221
+ # Evaluate to 1 if <tt>n</tt> is odd and 0 if <tt>n</tt> is even.
222
+ # The argument <tt>n</tt> must be of Fixnum type.
223
+ # ---
224
+ # * GSL::is_odd?(n)
225
+ # * GSL::IS_ODD?(n)
226
+ #
227
+ # Return <tt>true</tt> if <tt>n</tt> is odd and <tt>false</tt> if even.
228
+ # ---
229
+ # * GSL::is_even(n)
230
+ # * GSL::IS_EVEN(n)
231
+ #
232
+ # Evaluate to 1 if <tt>n</tt> is even and 0 if <tt>n</tt> is odd.
233
+ # The argument <tt>n</tt> must be of Fixnum type.
234
+ # ---
235
+ # * GSL::is_even?(n)
236
+ # * GSL::IS_even?(n)
237
+ #
238
+ # Return <tt>true</tt> if <tt>n</tt> is even and <tt>false</tt> if odd.
239
+ #
240
+ # == {}[link:index.html"name="7] Maximum and Minimum functions
241
+ # ---
242
+ # * GSL::max(a, b)
243
+ # * GSL::MAX(a, b)
244
+ # * GSL::min(a, b)
245
+ # * GSL::MIN(a, b)
246
+ #
247
+ #
248
+ # == {}[link:index.html"name="8] Approximate Comparison of Floating Point Numbers
249
+ # ---
250
+ # * GSL::fcmp(a, b, epsilon = 1e-10)
251
+ #
252
+ # This method determines whether <tt>x</tt> and <tt>y</tt> are approximately equal to a
253
+ # relative accuracy <tt>epsilon</tt>.
254
+ # ---
255
+ # * GSL::equal?(a, b, epsilon = 1e-10)
256
+ #
257
+ #
258
+ # == {}[link:index.html"name="9] Module Constants
259
+ # ---
260
+ # * GSL::VERSION
261
+ #
262
+ # GSL version
263
+ #
264
+ # ---
265
+ # * GSL::RB_GSL_VERSION
266
+ # * GSL::RUBY_GSL_VERSION
267
+ #
268
+ # Ruby/GSL version
269
+ #
270
+ # {prev}[link:files/rdoc/ehandling_rdoc.html]
271
+ # {next}[link:files/rdoc/complex_rdoc.html]
272
+ #
273
+ # {Reference index}[link:files/rdoc/ref_rdoc.html]
274
+ # {top}[link:files/rdoc/index_rdoc.html]
275
+ #
276
+ #
@@ -0,0 +1,1093 @@
1
+ #
2
+ # = Matrices
3
+ # Contents:
4
+ # 1. {Class methods}[link:files/rdoc/matrix_rdoc.html#1]
5
+ # 1. {Instance methods}[link:files/rdoc/matrix_rdoc.html#2]
6
+ # 1. {Accessing matrix elements}[link:files/rdoc/matrix_rdoc.html#2.1]
7
+ # 1. {Initializing matrix elements}[link:files/rdoc/matrix_rdoc.html#2.2]
8
+ # 1. {IO}[link:files/rdoc/matrix_rdoc.html#2.3]
9
+ # 1. {Matrix views}[link:files/rdoc/matrix_rdoc.html#2.4]
10
+ # 1. {Creating row and column views}[link:files/rdoc/matrix_rdoc.html#2.5]
11
+ # 1. {Iterators}[link:files/rdoc/matrix_rdoc.html#2.6]
12
+ # 1. {Copying matrices}[link:files/rdoc/matrix_rdoc.html#2.7]
13
+ # 1. {Copying rows and columns}[link:files/rdoc/matrix_rdoc.html#2.8]
14
+ # 1. {Exchanging rows and columns}[link:files/rdoc/matrix_rdoc.html#2.9]
15
+ # 1. {Matrix operations}[link:files/rdoc/matrix_rdoc.html#2.10]
16
+ # 1. {Finding maximum and minimum elements of matrices}[link:files/rdoc/matrix_rdoc.html#2.11]
17
+ # 1. {Matrix properties}[link:files/rdoc/matrix_rdoc.html#2.12]
18
+ # 1. {NArray}[link:files/rdoc/matrix_rdoc.html#3]
19
+ # 1. {Special matrices}[link:files/rdoc/matrix_rdoc.html#4]
20
+ #
21
+ # == {}[link:index.html"name="1] Class methods
22
+ #
23
+ # ---
24
+ # * GSL::Matrix.alloc(n)
25
+ # * GSL::Matrix.alloc(size1, size2)
26
+ # * GSL::Matrix.alloc(array)
27
+ # * GSL::Matrix.alloc(arrays)
28
+ # * GSL::Matrix.alloc( ... )
29
+ # * GSL::Matrix[ ... ]
30
+ #
31
+ # These methods create a <tt>GSL::Matrix</tt> object.
32
+ #
33
+ # 1. From arrays
34
+ # >> m = GSL::Matrix[[1, 2, 3], [4, 5, 6], [7, 8, 9]]
35
+ # => GSL::Matrix
36
+ # [ 1.000e+00 2.000e+00 3.000e+00
37
+ # 4.000e+00 5.000e+00 6.000e+00
38
+ # 7.000e+00 8.000e+00 9.000e+00 ]
39
+ #
40
+ # 1. With an array and rows&cols,
41
+ # m = GSL::Matrix.alloc([1, 2, 3, 4, 5, 6, 7, 8, 9], 3, 3)
42
+ #
43
+ # 1. With Range objects,
44
+ # >> m = GSL::Matrix.alloc(1..3, 4..6, 7..9)
45
+ # [ 1.000e+00 2.000e+00 3.000e+00
46
+ # 4.000e+00 5.000e+00 6.000e+00
47
+ # 7.000e+00 8.000e+00 9.000e+00 ]
48
+ # >> m2 = GSL::Matrix[1..6, 2, 3]
49
+ # [ 1.000e+00 2.000e+00 3.000e+00
50
+ # 4.000e+00 5.000e+00 6.000e+00 ]
51
+ #
52
+ # ---
53
+ # * GSL::Matrix.eye(n)
54
+ # * GSL::Matrix.eye(n1, n2)
55
+ #
56
+ # Examples:
57
+ # >> m = GSL::Matrix::Int.eye(3)
58
+ # => GSL::Matrix::Int
59
+ # [ 1 0 0
60
+ # 0 1 0
61
+ # 0 0 1 ]
62
+ # >> m = GSL::Matrix::Int.eye(2, 4)
63
+ # => GSL::Matrix::Int
64
+ # [ 1 0 0 0
65
+ # 0 1 0 0 ]
66
+ #
67
+ # ---
68
+ # * GSL::Matrix.identity(n)
69
+ # * GSL::Matrix.scalar(n)
70
+ # * GSL::Matrix.unit(n)
71
+ # * GSL::Matrix.I(n)
72
+ #
73
+ # Create diagonal matrices of dimensions n*n, of values 1.0.
74
+ #
75
+ # ---
76
+ # * GSL::Matrix.diagonal(a, b, c, ...)
77
+ # * GSL::Matrix.diagonal(Ary)
78
+ # * GSL::Matrix.diagonal(Range)
79
+ # * GSL::Matrix.diagonal(Vector)
80
+ #
81
+ # Creates a diagonal matrix of given elements.
82
+ #
83
+ # Example:
84
+ # >> GSL::Matrix::Int.diagonal(1..4)
85
+ # => GSL::Matrix::Int
86
+ # [ 1 0 0 0
87
+ # 0 2 0 0
88
+ # 0 0 3 0
89
+ # 0 0 0 4 ]
90
+ # >> GSL::Matrix::Int.diagonal(2, 5, 3)
91
+ # => GSL::Matrix::Int
92
+ # [ 2 0 0
93
+ # 0 5 0
94
+ # 0 0 3 ]
95
+ #
96
+ # ---
97
+ # * GSL::Matrix.ones(n)
98
+ # * GSL::Matrix.ones(n1, n2)
99
+ #
100
+ # Create a matrix of all the elements 1.
101
+ #
102
+ # ---
103
+ # * GSL::Matrix.zeros(n)
104
+ # * GSL::Matrix.zeros(n1, n2)
105
+ #
106
+ # Create a matrix of all the elements 1.
107
+ #
108
+ # ---
109
+ # * GSL::Matrix.indgen(n1, n2, start=0, step=1)
110
+ #
111
+ # Example:
112
+ #
113
+ # >> m = GSL::Matrix::Int.indgen(3, 5)
114
+ # => GSL::Matrix::Int
115
+ # [ 0 1 2 3 4
116
+ # 5 6 7 8 9
117
+ # 10 11 12 13 14 ]
118
+ # >> m = GSL::Matrix::Int.indgen(3, 5, 2)
119
+ # => GSL::Matrix::Int
120
+ # [ 2 3 4 5 6
121
+ # 7 8 9 10 11
122
+ # 12 13 14 15 16 ]
123
+ # >> m = GSL::Matrix.indgen(2, 3, 4.5, 6.7)
124
+ # => GSL::Matrix
125
+ # [ 4.500e+00 1.120e+01 1.790e+01
126
+ # 2.460e+01 3.130e+01 3.800e+01 ]
127
+ #
128
+ # === {}[link:index.html"name="1.1] NOTE:
129
+ # Matrix dimensions are limited within the range of Fixnum.
130
+ # For 32-bit CPU, the maximum of matrix dimension is 2^30 ~ 1e9.
131
+ #
132
+ # == {}[link:index.html"name="2] Instance Methods
133
+ # === {}[link:index.html"name="2.1] Accessing matrix elements
134
+ #
135
+ # ---
136
+ # * GSL::Matrix#size1
137
+ #
138
+ # Returns the number of rows of matrix <tt>self</tt>.
139
+ # ---
140
+ # * GSL::Matrix#size2
141
+ #
142
+ # Returns the number of columns of matrix <tt>self</tt>.
143
+ # ---
144
+ # * GSL::Matrix#shape
145
+ #
146
+ # Returns the number of rows and columns as an array.
147
+ #
148
+ # Ex:
149
+ #
150
+ # >> m.size1
151
+ # => 3
152
+ # >> m.size2
153
+ # => 5
154
+ # >> m.shape
155
+ # => [3, 5]
156
+ #
157
+ # ---
158
+ # * GSL::Matrix#set(args, val)
159
+ # * GSL::Matrix#[args]=val
160
+ #
161
+ # If <tt>args</tt> is empty and <tt>val</tt> is an Array (i.e. called with just a
162
+ # single Array argument), the Array's elements are taken as row contents.
163
+ # Each given row must have exactly the same number of elements as the Matrix
164
+ # has columns, but the number of rows given need not match the Matrix's row
165
+ # count. Extra given rows are ignored, while Matrix rows beyond those given
166
+ # are not affected. Otherwise, if <tt>args</tt> is empty, behaves as
167
+ # <tt>#set_all(<tt>val</tt>)</tt>.
168
+ #
169
+ # If <tt>args</tt> is an Array and val is not, the first two elements of
170
+ # <tt>args</tt> must be Fixnums which specify the row and column of the element
171
+ # that will be set to the value of <tt>val</tt>. This special case exists to
172
+ # allow values returned by Matrix#max_index and Matrix#min_index to be used
173
+ # as indexes.
174
+ #
175
+ # If <tt>args</tt> are two <tt>Fixnums</tt>, <tt>i</tt> and <tt>j</tt>, this method
176
+ # sets the <tt>(i,j)</tt>-th element of the matrix <tt>self</tt> to <tt>val</tt>.
177
+ #
178
+ # If <tt>args</tt> is a single <tt>Fixnum</tt>, <tt>i</tt>, this method sets the
179
+ # element at row <tt>i</tt>/<tt>size2</tt>, column <tt>i</tt>%<tt>size2</tt> to
180
+ # <tt>val</tt>.
181
+ #
182
+ # For <tt>#set</tt>, if <tt>args</tt> is empty and <tt>val</tt> is an <tt>Array</tt> of
183
+ # <tt>Arrays</tt>, the contents of <tt>self</tt> are set row by row from the
184
+ # elements (i.e. <tt>Arrays</tt>) of <tt>val</tt>.
185
+ #
186
+ # All other <tt>args</tt> specify a submatrix (as with <tt>#submatrix</tt>) whose
187
+ # elements are assigned from <tt>val</tt>. In this case, <tt>val</tt> can be an
188
+ # <tt>Array</tt> whose elements will be assigned to the rows of the submatrix,
189
+ # <tt>Range</tt> whose elements will be assigned to the elements of the
190
+ # submatrix, <tt>GSL::Matrix</tt> whose elements will be assigned to the
191
+ # elements of the submatrix, or <tt>Numeric</tt> that will be assigned to all
192
+ # elements of the submatrix.
193
+ #
194
+ # NOTE: GSL does not provide a matrix copy function that properly copies data
195
+ # across overlapping memory regions, so watch out if assigning to part of a
196
+ # Matrix from another part of itself (see <tt>#set</tt> example of
197
+ # {GSL::Vector}[link:files/rdoc/vector_rdoc.html]).
198
+ #
199
+ # ---
200
+ # * GSL::Matrix#get(args)
201
+ # * GSL::Matrix#[args]
202
+ #
203
+ # If <tt>args</tt> are two <tt>Fixnums</tt>, <tt>i</tt> and <tt>j</tt>, this method
204
+ # returns the <tt>(i,j)</tt>-th element of the matrix <tt>self</tt>.
205
+ #
206
+ # If <tt>args</tt> is a single <tt>Fixnum</tt>, <tt>i</tt>, this method returns the
207
+ # element at row <tt>i</tt>/<tt>size2</tt>, column <tt>i</tt>%<tt>size2</tt>.
208
+ #
209
+ # All other forms of <tt>args</tt> are treated as with <tt>Matrix#submatrix</tt>
210
+ # and a View object is returned.
211
+ #
212
+ # NOTE: The behavior of the single <tt>Fixnum</tt> argument case is different
213
+ # from earlier versions (< 1.11.2) of Ruby/GSL. These earlier versions
214
+ # returned a <tt>Vector::View</tt> in this case, thereby allowing element
215
+ # (<tt>i</tt>,<tt>j</tt>) to be accessed as <tt>m[<tt>i</tt>][<tt>j</tt>]</tt>. THIS FORM
216
+ # IS NO LONGER SUPPORTED as of Ruby/GSL 1.11.2. Existing occurences of this
217
+ # construct will need to be replaced with the backwards compatible and more
218
+ # efficient <tt>m[<tt>i</tt>,<tt>j</tt>]</tt> or, equivalent to the old and less
219
+ # efficient form, <tt>m[<tt>i</tt>,nil][<tt>j</tt>]</tt>. For GSL::Matrix, the old
220
+ # form will now raise a <tt>NoMethodError</tt> because <tt>Float</tt> has no
221
+ # <tt>#[]</tt> method. For GSL::Matrix::Int, however, the old form will return
222
+ # a single bit from an element of the matrix because <tt>Fixnum</tt> and
223
+ # <tt>Bignum</tt> have a <tt>#[]</tt> method that allows access to the number's
224
+ # individual bits.
225
+ #
226
+ # Examples:
227
+ # >> m = GSL::Matrix[1..9, 3, 3]
228
+ # => GSL::Matrix
229
+ # [ 1.000e+00 2.000e+00 3.000e+00
230
+ # 4.000e+00 5.000e+00 6.000e+00
231
+ # 7.000e+00 8.000e+00 9.000e+00 ]
232
+ # >> m[1, 2]
233
+ # => 6.0
234
+ # >> m[1, 2] = 123 # m.set(1, 2, 123)
235
+ # => 123
236
+ # >> m
237
+ # => GSL::Matrix
238
+ # [ 1.000e+00 2.000e+00 3.000e+00
239
+ # 4.000e+00 5.000e+00 1.230e+02
240
+ # 7.000e+00 8.000e+00 9.000e+00 ]
241
+ # >> m[1]
242
+ # => 2.0
243
+ # >> m.set([3, 5, 2], [4, 5, 3], [7, 1, 5])
244
+ # => GSL::Matrix
245
+ # [ 3.000e+00 5.000e+00 2.000e+00
246
+ # 4.000e+00 5.000e+00 3.000e+00
247
+ # 7.000e+00 1.000e+00 5.000e+00 ]
248
+ # >> m[1][1] # old/unsupported form
249
+ # NoMethodError: undefined method `[]' for 2.0:Float
250
+ # from (irb):8
251
+ # >> m = GSL::Matrix::Int[1..9, 3, 3]
252
+ # => GSL::Matrix::Int
253
+ # [ 1 2 3
254
+ # 4 5 6
255
+ # 7 8 9 ]
256
+ # >> m[1] # m[0,1]
257
+ # => 2
258
+ # >> m[1][0] # Bit 0 of m[0,1]
259
+ # => 0
260
+ # >> m[1][1] # Bit 1 of m[0,1]
261
+ # => 1
262
+ # >> m[1][2] # Bit 2 of m[0,1]
263
+ # => 0
264
+ # >> m[1][3] # Bit 3 of m[0,1]
265
+ # => 0
266
+ #
267
+ #
268
+ # ---
269
+ # * GSL::Matrix#to_a
270
+ #
271
+ # Converts the <tt>Matrix</tt> <tt>self</tt> to a Ruby <tt>Array</tt> of <tt>Arrays</tt>.
272
+ #
273
+ # Example:
274
+ # >> GSL::Matrix.eye(3).to_a
275
+ # => [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]
276
+ #
277
+ # === {}[link:index.html"name="2.2] Initializing matrix elements
278
+ # ---
279
+ # * GSL::Matrix#set_all(x)
280
+ #
281
+ # This method sets all the elements of the matrix <tt>self</tt> to the value x.
282
+ #
283
+ # ---
284
+ # * GSL::Matrix#set_zero
285
+ #
286
+ # This method sets all the elements of the matrix to zero.
287
+ #
288
+ # ---
289
+ # * GSL::Matrix#set_identity
290
+ #
291
+ # This method sets the elements of the matrix to the corresponding
292
+ # elements of the identity matrix, i.e. a unit diagonal with all off-diagonal
293
+ # elements zero. This applies to both square and rectangular matrices.
294
+ #
295
+ # === {}[link:index.html"name="2.3] IO
296
+ # ---
297
+ # * GSL::Matrix#fwrite(io)
298
+ # * GSL::Matrix#fwrite(filename)
299
+ # * GSL::Matrix#fread(io)
300
+ # * GSL::Matrix#fread(filename)
301
+ # * GSL::Matrix#fprintf(io, format = "%e")
302
+ # * GSL::Matrix#fprintf(filename, format = "%e")
303
+ # * GSL::Matrix#fscanf(io)
304
+ # * GSL::Matrix#fscanf(filename)
305
+ #
306
+ #
307
+ # === {}[link:index.html"name="2.4] Matrix views
308
+ # The <tt>GSL::Matrix::View</tt> class is defined to be used as "references" to
309
+ # matrices. The <tt>Matrix::View</tt> class is a subclass of <tt>Matrix</tt>, and an
310
+ # instance of the <tt>View</tt> class created by slicing a <tt>Matrix</tt> object can
311
+ # be used same as the original matrix. The <tt>View</tt> object shares the data with
312
+ # the original matrix, i.e. any changes in the elements of the <tt>View</tt> object
313
+ # affect to the original.
314
+ #
315
+ # The primary means of generating <tt>Matrix::View</tt> objects is with
316
+ # <tt>GSL::Matrix#submatrix</tt> (or its alias <tt>GSL::Matrix#view</tt>). Many forms
317
+ # are supported and they are documented here individually. All forms return a
318
+ # <tt>Matrix::View</tt> unless otherwise documented. In the list below, the
319
+ # parameter name indicates the type of the parameter: <tt>i</tt>, <tt>row</tt>,
320
+ # <tt>col</tt>, <tt>len</tt>, <tt>len1</tt>, and <tt>len2</tt> are <tt>Fixnums</tt>; <tt>rows</tt> and
321
+ # <tt>cols</tt> are <tt>Ranges</tt>.
322
+ #
323
+ # ---
324
+ # * GSL::Matrix#submatrix()
325
+ #
326
+ # View covers all rows and all columns.
327
+ # ---
328
+ # * GSL::Matrix#submatrix(i)
329
+ #
330
+ # View covers single element at row <tt>i</tt>/<tt>size2</tt>, column
331
+ # <tt>i</tt>%<tt>size2</tt>.
332
+ # ---
333
+ # * GSL::Matrix#submatrix(nil,nil)
334
+ #
335
+ # View covers all rows and all columns.
336
+ # ---
337
+ # * GSL::Matrix#submatrix(nil,cols)
338
+ #
339
+ # View covers all rows with columns specified by <tt>cols</tt>.
340
+ # ---
341
+ # * GSL::Matrix#submatrix(nil,col)
342
+ #
343
+ # Returns a <tt>Vector::Col::View</tt> for the column <tt>col</tt>.
344
+ # ---
345
+ # * GSL::Matrix#submatrix(rows, nil)
346
+ #
347
+ # View covers rows specified by <tt>rows</tt> and all columns.
348
+ # ---
349
+ # * GSL::Matrix#submatrix(rows, cols)
350
+ #
351
+ # View covers rows specified by <tt>rows</tt>, columns specified by <tt>cols</tt>.
352
+ # ---
353
+ # * GSL::Matrix#submatrix(rows, col)
354
+ #
355
+ # Returns a <tt>Vector::Col::View</tt> for column <tt>col</tt>, rows <tt>rows</tt>.
356
+ # ---
357
+ # * GSL::Matrix#submatrix(row, nil)
358
+ #
359
+ # Returns a <tt>Vector::View</tt> for row <tt>row</tt>.
360
+ # ---
361
+ # * GSL::Matrix#submatrix(row, cols)
362
+ #
363
+ # Returns a <tt>Vector::View</tt> for row <tt>row</tt>, columns <tt>cols</tt>.
364
+ # ---
365
+ # * GSL::Matrix#submatrix(row, col)
366
+ #
367
+ # View covers a single element at row <tt>row</tt>, column <tt>col</tt>.
368
+ # ---
369
+ # * GSL::Matrix#submatrix(nil, col, len)
370
+ #
371
+ # View covers all rows and <tt>len</tt> columns starting at column <tt>col</tt>.
372
+ # ---
373
+ # * GSL::Matrix#submatrix(rows, col, len)
374
+ #
375
+ # View covers <tt>rows</tt> rows and <tt>len</tt> columns starting at column <tt>col</tt>.
376
+ # ---
377
+ # * GSL::Matrix#submatrix(row, len, nil)
378
+ #
379
+ # View covers <tt>len</tt> rows starting at row <tt>row</tt> and all columns.
380
+ # ---
381
+ # * GSL::Matrix#submatrix(row, len, cols)
382
+ #
383
+ # View covers <tt>len</tt> rows starting at row <tt>row</tt> and <tt>cols</tt> columns.
384
+ # ---
385
+ # * GSL::Matrix#submatrix(row, col, len1, len2)
386
+ #
387
+ # View covers <tt>len1</tt> rows starting at row <tt>row</tt> and <tt>len2</tt>
388
+ # columns starting at column <tt>col</tt>.
389
+ #
390
+ # ---
391
+ # * GSL::Vector#matrix_view(n1, n2)
392
+ #
393
+ # This creates a <tt>Matrix::View</tt> object from the vector <tt>self</tt>.
394
+ #
395
+ # Ex:
396
+ # >> v = Vector[1..9]
397
+ # => GSL::Vector
398
+ # [ 1.000e+00 2.000e+00 3.000e+00 4.000e+00 5.000e+00 6.000e+00 7.000e+00 8.000e+00 9.000e+00 ]
399
+ # >> m = v.matrix_view(3, 3)
400
+ # => GSL::Matrix::View
401
+ # [ 1.000e+00 2.000e+00 3.000e+00
402
+ # 4.000e+00 5.000e+00 6.000e+00
403
+ # 7.000e+00 8.000e+00 9.000e+00 ]
404
+ # >> m[1][1] = 99.99
405
+ # => 99.99
406
+ # >> v
407
+ # => GSL::Vector
408
+ # [ 1.000e+00 2.000e+00 3.000e+00 4.000e+00 9.999e+01 6.000e+00 7.000e+00 8.000e+00 9.000e+00 ]
409
+ # >>
410
+ #
411
+ #
412
+ # === {}[link:index.html"name="2.5] Creating row and column views
413
+ #
414
+ # ---
415
+ # * GSL::Matrix#row(i)
416
+ #
417
+ # These methods return <tt>i</tt>-th row of the matrix as a <tt>Vector::View</tt>
418
+ # object. Any modifications to the <tt>Vectror::View</tt> object returned by this method
419
+ # propagate to the original matrix.
420
+ #
421
+ # ---
422
+ # * GSL::Matrix#column(i)
423
+ # * GSL::Matrix#col(i)
424
+ #
425
+ # These methods return a vector view of the <tt>j</tt>-th column of the matrix.
426
+ #
427
+ # ---
428
+ # * GSL::Matrix#subrow(i, offset, n)
429
+ #
430
+ # Returns a vector view of the <tt>i</tt>-th row of the matrix <tt>self</tt>
431
+ # beginning at <tt>offset</tt> elements past the first column
432
+ # and containing <tt>n</tt> elements. (>= GSL-1.10)
433
+ #
434
+ # ---
435
+ # * GSL::Matrix#subcolumn(j, offset, n)
436
+ #
437
+ # Returns a vector view of the <tt>j</tt>-th column of the matrix <tt>self</tt>
438
+ # beginning at <tt>offset</tt> elements past the first row
439
+ # and containing <tt>n</tt> elements. (>= GSL-1.10)
440
+ #
441
+ # ---
442
+ # * GSL::Matrix#diag
443
+ # * GSL::Matrix#diagonal
444
+ #
445
+ # This method returns a <tt>Vector::View</tt> of the diagonal of the matrix.
446
+ # The matrix is not required to be square. For a rectangular matrix the
447
+ # length of the diagonal is the same as the smaller dimension of the matrix.
448
+ #
449
+ #
450
+ # Ex:
451
+ # >> m = GSL::Matrix[1..9, 3, 3]
452
+ # => GSL::Matrix
453
+ # [ 1.000e+00 2.000e+00 3.000e+00
454
+ # 4.000e+00 5.000e+00 6.000e+00
455
+ # 7.000e+00 8.000e+00 9.000e+00 ]
456
+ # >> m.row(1)
457
+ # => GSL::Vector::View
458
+ # [ 4.000e+00 5.000e+00 6.000e+00 ]
459
+ # >> m.col(2)
460
+ # => GSL::Vector::Col::View
461
+ # [ 3.000e+00
462
+ # 6.000e+00
463
+ # 9.000e+00 ]
464
+ # >> m.col(2)[2] = 123
465
+ # => 123
466
+ # >> m
467
+ # => GSL::Matrix
468
+ # [ 1.000e+00 2.000e+00 3.000e+00
469
+ # 4.000e+00 5.000e+00 6.000e+00
470
+ # 7.000e+00 8.000e+00 1.230e+02 ]
471
+ # >> m.diagonal
472
+ # => GSL::Vector::View:
473
+ # [ 1.000e+00 5.000e+00 1.230e+02 ]
474
+ #
475
+ # ---
476
+ # * GSL::Matrix#subdiagonal(k)
477
+ #
478
+ # Returns a vector view view of the <tt>k</tt>-th subdiagonal
479
+ # of the matrix <tt>self</tt>.
480
+ # The matrix is not required to be square. The diagonal of the matrix
481
+ # corresponds to k = 0.
482
+ #
483
+ # ---
484
+ # * GSL::Matrix#superdiagonal(k)
485
+ #
486
+ # Returns a vector view of the <tt>k</tt>-th superdiagonal of the matrix <tt>self</tt>.
487
+ # The matrix is not required to be square. The diagonal of the matrix
488
+ # corresponds to k = 0.
489
+ #
490
+ # ---
491
+ # * GSL::Matrix#to_v
492
+ #
493
+ # Creates a <tt>GSL::Vector</tt> object "flattening" the rows of the matrix <tt>self</tt>.
494
+ #
495
+ # >> m = GSL::Matrix[1..6, 2, 3]
496
+ # => GSL::Matrix
497
+ # [ 1.000e+00 2.000e+00 3.000e+00
498
+ # 4.000e+00 5.000e+00 6.000e+00 ]
499
+ # >> m.to_v
500
+ # => GSL::Vector
501
+ # [ 1.000e+00 2.000e+00 3.000e+00 4.000e+00 5.000e+00 6.000e+00 ]
502
+ #
503
+ # === {}[link:index.html"name="2.6] Iterators
504
+ # ---
505
+ # * GSL::Matrix#each_row
506
+ #
507
+ # Iterator for each of rows in the matrix <tt>self</tt>.
508
+ # ---
509
+ # * GSL::Matrix#each_col
510
+ #
511
+ # Iterator for each of columns in the matrix <tt>self</tt>.
512
+ #
513
+ # ---
514
+ # * GSL::Matrix#collect { |item| .. }
515
+ # * GSL::Matrix#map { |item| .. }
516
+ # * GSL::Matrix#collect! { |item| .. }
517
+ # * GSL::Matrix#map! { |item| .. }
518
+ #
519
+ #
520
+ # === {}[link:index.html"name="2.7] Copying matrices
521
+ # ---
522
+ # * GSL::Matrix#clone
523
+ # * GSL::Matrix#duplicate
524
+ #
525
+ # Create a new matrix of the same elements.
526
+ #
527
+ # ---
528
+ # * GSL::Matrix.memcpy(dest, src)
529
+ # * GSL::Matrix.swap(dest, src)
530
+ #
531
+ #
532
+ # === {}[link:index.html"name="2.8] Copying rows and columns
533
+ #
534
+ # ---
535
+ # * GSL::Matrix#get_row(i)
536
+ #
537
+ # This method returns a new vector (not a view) which contains the elements
538
+ # of the <tt>i</tt>-th row of the matrix <tt>self</tt>.
539
+ #
540
+ # ---
541
+ # * GSL::Matrix#get_col(j)
542
+ #
543
+ # This method returns a new vector (not a view) which contains the elements of the <tt>j</tt>-th
544
+ # column of the matrix <tt>self</tt>.
545
+ #
546
+ # ---
547
+ # * GSL::Matrix#set_row(i, v)
548
+ #
549
+ # This method copies the elements of the vector <tt>v</tt> into the <tt>i</tt>-th
550
+ # row of the matrix.
551
+ # The length of the vector must be the same as the length of the row.
552
+ #
553
+ # ---
554
+ # * GSL::Matrix#set_col(j, v)
555
+ #
556
+ # This method copies the elements of the vector <tt>v</tt> into the <tt>j</tt>-th
557
+ # column of the matrix. The length of the vector must be the same as the length
558
+ # of the column.
559
+ #
560
+ # === {}[link:index.html"name="2.9] Exchanging rows and columns
561
+ # ---
562
+ # * GSL::Matrix#swap_rows!(i, j)
563
+ #
564
+ # This method exchanges the <tt>i</tt>-th and <tt>j</tt>-th rows of the matrix <tt>in-place</tt>.
565
+ # ---
566
+ # * GSL::Matrix#swap_rows(i, j)
567
+ #
568
+ # This method creates a new matrix exchanging the <tt>i</tt>-th and <tt>j</tt>-th rows of the matrix <tt>self</tt>.
569
+ #
570
+ # ---
571
+ # * GSL::Matrix#swap_columns!(i, j)
572
+ #
573
+ # This method exchanges the <tt>i</tt>-th and <tt>j</tt>-th columns of the matrix <tt>in-place</tt>.
574
+ # ---
575
+ # * GSL::Matrix#swap_columns(i, j)
576
+ #
577
+ # This method creates a new matrix exchanging the <tt>i</tt>-th and <tt>j</tt>-th columns of the matrix <tt>self</tt>.
578
+ #
579
+ # ---
580
+ # * GSL::Matrix#swap_rowcol(i, j)
581
+ #
582
+ # This method exchanges the <tt>i</tt>-th row and <tt>j</tt>-th column of the matrix.
583
+ # The matrix must be square for this operation to be possible.
584
+ #
585
+ # ---
586
+ # * GSL::Matrix#transpose_memcpy
587
+ # * GSL::Matrix#transpose
588
+ #
589
+ # This method returns a matrix of a transpose of the matrix. The matrix
590
+ # <tt>self</tt> is not modified.
591
+ #
592
+ # ---
593
+ # * GSL::Matrix#transpose!
594
+ #
595
+ # This method replaces the matrix by its transpose by copying the
596
+ # elements of the matrix <tt>in-place</tt>. The matrix must be square for this
597
+ # operation to be possible.
598
+ #
599
+ # ---
600
+ # * GSL::Matrix#reverse_rows
601
+ # * GSL::Matrix#flipud
602
+ #
603
+ # Example:
604
+ # >> m = GSL::Matrix::Int[1..9, 3, 3]
605
+ # => GSL::Matrix::Int
606
+ # [ 1 2 3
607
+ # 4 5 6
608
+ # 7 8 9 ]
609
+ # >> m.reverse_rows
610
+ # => GSL::Matrix::Int
611
+ # [ 7 8 9
612
+ # 4 5 6
613
+ # 1 2 3 ]
614
+ #
615
+ # ---
616
+ # * GSL::Matrix#reverse_columns
617
+ # * GSL::Matrix#fliplr
618
+ #
619
+ # Example:
620
+ # >> m = GSL::Matrix::Int[1..9, 3, 3]
621
+ # => GSL::Matrix::Int
622
+ # [ 1 2 3
623
+ # 4 5 6
624
+ # 7 8 9 ]
625
+ # >> m.reverse_rows.reverse_columns
626
+ # => GSL::Matrix::Int
627
+ # [ 9 8 7
628
+ # 6 5 4
629
+ # 3 2 1 ]
630
+ #
631
+ # ---
632
+ # * GSL::Matrix#rot90(n = 1)
633
+ #
634
+ # Return a copy of <tt>self</tt> with the elements rotated
635
+ # counterclockwise in 90-degree increments. The argument <tt>n</tt> is
636
+ # optional, and specifies how many 90-degree rotations are to be applied
637
+ # (the default value is 1).
638
+ # Negative values of <tt>n</tt> rotate the matrix in a clockwise direction.
639
+ #
640
+ # Examples:
641
+ # >> m = GSL::Matrix::Int[1..6, 2, 3]
642
+ # => GSL::Matrix::Int
643
+ # [ 1 2 3
644
+ # 4 5 6 ]
645
+ # >> m.rot90
646
+ # => GSL::Matrix::Int
647
+ # [ 3 6
648
+ # 2 5
649
+ # 1 4 ]
650
+ # >> m.rot90(2)
651
+ # => GSL::Matrix::Int
652
+ # [ 6 5 4
653
+ # 3 2 1 ]
654
+ # >> m.rot90(3)
655
+ # => GSL::Matrix::Int
656
+ # [ 4 1
657
+ # 5 2
658
+ # 6 3 ]
659
+ # >> m.rot90(-1)
660
+ # => GSL::Matrix::Int
661
+ # [ 4 1
662
+ # 5 2
663
+ # 6 3 ]
664
+ #
665
+ # ---
666
+ # * GSL::Matrix#upper
667
+ #
668
+ # This creates a matrix copying the upper half part of the matrix
669
+ # <tt>self</tt>, including the diagonal elements.
670
+ # ---
671
+ # * GSL::Matrix#lower
672
+ #
673
+ # This creates a matrix copying the lower half part of the matrix
674
+ # <tt>self</tt>, including the diagonal elements.
675
+ #
676
+ # >> m = GSL::Matrix[1..9, 3, 3]
677
+ # => GSL::Matrix
678
+ # [ 1.000e+00 2.000e+00 3.000e+00
679
+ # 4.000e+00 5.000e+00 6.000e+00
680
+ # 7.000e+00 8.000e+00 9.000e+00 ]
681
+ # >> m.upper
682
+ # => GSL::Matrix
683
+ # [ 1.000e+00 2.000e+00 3.000e+00
684
+ # 0.000e+00 5.000e+00 6.000e+00
685
+ # 0.000e+00 0.000e+00 9.000e+00 ]
686
+ # >> m.lower
687
+ # => GSL::Matrix
688
+ # [ 1.000e+00 0.000e+00 0.000e+00
689
+ # 4.000e+00 5.000e+00 0.000e+00
690
+ # 7.000e+00 8.000e+00 9.000e+00 ]
691
+ #
692
+ # ---
693
+ # * GSL::Matrix#horzcat(other)
694
+ #
695
+ # Returns the horizontal concatenation of <tt>self</tt> and <tt>other</tt>.
696
+ #
697
+ # Ex:
698
+ # >> require("gsl")
699
+ # => true
700
+ # >> a = GSL::Matrix::Int[1..4, 2, 2]
701
+ # => GSL::Matrix::Int
702
+ # [ 1 2
703
+ # 3 4 ]
704
+ # >> b = GSL::Matrix::Int[5..10, 2, 3]
705
+ # => GSL::Matrix::Int
706
+ # [ 5 6 7
707
+ # 8 9 10 ]
708
+ # >> a.horzcat(b)
709
+ # => GSL::Matrix::Int
710
+ # [ 1 2 5 6 7
711
+ # 3 4 8 9 10 ]
712
+ #
713
+ # ---
714
+ # * GSL::Matrix#vertcat(other)
715
+ #
716
+ # Returns the vertical concatenation of <tt>self</tt> and <tt>other</tt>.
717
+ #
718
+ # Ex:
719
+ # >> a = GSL::Matrix::Int[1..4, 2, 2]
720
+ # => GSL::Matrix::Int
721
+ # [ 1 2
722
+ # 3 4 ]
723
+ # >> b = GSL::Matrix::Int[5..10, 3, 2]
724
+ # => GSL::Matrix::Int
725
+ # [ 5 6
726
+ # 7 8
727
+ # 9 10 ]
728
+ # >> a.vertcat(b)
729
+ # => GSL::Matrix::Int
730
+ # [ 1 2
731
+ # 3 4
732
+ # 5 6
733
+ # 7 8
734
+ # 9 10 ]
735
+ #
736
+ # === {}[link:index.html"name="2.10] Matrix operations
737
+ #
738
+ # ---
739
+ # * GSL::Matrix#add(b)
740
+ # * GSL::Matrix#+(b)
741
+ #
742
+ # This method adds the elements of matrix <tt>b</tt>
743
+ # to the elements of the matrix.
744
+ # The two matrices must have the same dimensions.
745
+ #
746
+ # If <tt>b</tt> is a scalar, these methods add it to all the elements
747
+ # of the matrix <tt>self</tt> (equivalent to the method <tt>add_constant</tt>).
748
+ #
749
+ # ---
750
+ # * GSL::Matrix#sub(b)
751
+ # * GSL::Matrix#-(b)
752
+ #
753
+ # This method subtracts the elements of matrix <tt>b</tt>
754
+ # from the elements of the
755
+ # matrix. The two matrices must have the same dimensions.
756
+ #
757
+ # ---
758
+ # * GSL::Matrix#mul_elements(b)
759
+ #
760
+ # This method multiplies the elements of the matrix by the elements of
761
+ # matrix <tt>b</tt>. The two matrices must have the same dimensions.
762
+ # If <tt>b</tt> is a scalar, the method <tt>scale</tt> (see below)
763
+ # is called.
764
+ #
765
+ # ---
766
+ # * GSL::Matrix#div_elements(b)
767
+ #
768
+ #
769
+ # This method divides the elements of the matrix by the elements of
770
+ # matrix <tt>b</tt>. The two matrices must have the same dimensions.
771
+ #
772
+ # ---
773
+ # * GSL::Matrix#scale(x)
774
+ #
775
+ # This method multiplies the elements of the matrix by the constant
776
+ # factor <tt>x</tt>.
777
+ #
778
+ # ---
779
+ # * GSL::Matrix#add_constant(x)
780
+ #
781
+ # This method adds the constant value <tt>x</tt> to the elements of the matrix.
782
+ #
783
+ # ---
784
+ # * GSL::Matrix#*(b)
785
+ #
786
+ # Matrix multiplication.
787
+ #
788
+ # Ex:
789
+ #
790
+ # >> a = GSL::Matrix[1..4, 2, 2]
791
+ # => GSL::Matrix
792
+ # [ 1.000e+00 2.000e+00
793
+ # 3.000e+00 4.000e+00 ]
794
+ # >> b = GSL::Matrix[5..8, 2, 2]
795
+ # => GSL::Matrix
796
+ # [ 5.000e+00 6.000e+00
797
+ # 7.000e+00 8.000e+00 ]
798
+ # >> a*b
799
+ # => GSL::Matrix
800
+ # [ 1.900e+01 2.200e+01
801
+ # 4.300e+01 5.000e+01 ]
802
+ # >> a*2
803
+ # => GSL::Matrix
804
+ # [ 2.000e+00 4.000e+00
805
+ # 6.000e+00 8.000e+00 ]
806
+ # >> c = Vector[1, 2]
807
+ # => GSL::Vector
808
+ # [ 1.000e+00 2.000e+00 ]
809
+ # >> a*c.col
810
+ # => GSL::Vector::Col
811
+ # [ 5.000e+00
812
+ # 1.100e+01 ]
813
+ #
814
+ # ---
815
+ # * GSL::Matrix#/(b)
816
+ #
817
+ # If <tt>b</tt> is a scalar or a <tt>Matrix</tt>, this method calculates the
818
+ # element-by-element divisions.
819
+ # If a <tt>Vector::Col</tt> is given, this method solves the linear system
820
+ # by using LU decomposition.
821
+ #
822
+ # Ex:
823
+ # >> m = GSL::Matrix[1..4, 2, 2]
824
+ # => GSL::Matrix
825
+ # [ 1.000e+00 2.000e+00
826
+ # 3.000e+00 4.000e+00 ]
827
+ # >> m/3
828
+ # => GSL::Matrix
829
+ # [ 3.333e-01 6.667e-01 <--- 1/3, 2/3
830
+ # 1.000e+00 1.333e+00 ] <--- 3/3, 4/3
831
+ # >> b = Vector[5, 6].col
832
+ # => GSL::Vector::Col
833
+ # [ 5.000e+00
834
+ # 6.000e+00 ]
835
+ # >> x = m/b <--- Solve m (x,y) = b
836
+ # => GSL::Vector::Col
837
+ # [ -4.000e+00 <--- x = -4
838
+ # 4.500e+00 ] <--- y = 4.5
839
+ # >> m*x
840
+ # => GSL::Vector::Col
841
+ # [ 5.000e+00
842
+ # 6.000e+00 ]
843
+ #
844
+ # ---
845
+ # * GSL::Matrix#^(b)
846
+ #
847
+ # Computes matrix power of <tt>b</tt>.
848
+ #
849
+ # === {}[link:index.html"name="2.11] Finding maximum and minimum elements of matrices
850
+ #
851
+ # ---
852
+ # * GSL::Matrix#max
853
+ # * GSL::Matrix#min
854
+ #
855
+ # These methods return the max/min value in the matrix.
856
+ #
857
+ # ---
858
+ # * GSL::Matrix#minmax
859
+ #
860
+ # This method returns a two elements array [min, max],
861
+ # which contains the minimum
862
+ # and the maximum values in the matrix.
863
+ #
864
+ # ---
865
+ # * GSL::Matrix#max_index
866
+ # * GSL::Matrix#min_index
867
+ #
868
+ # These methods return the index of the max/min value in the matrix.
869
+ #
870
+ # ---
871
+ # * GSL::Matrix#minmax_index
872
+ #
873
+ # This method returns a two elements array [imin, imax],
874
+ # which contains the indices
875
+ # of the minimum and the maximum value in the matrix.
876
+ #
877
+ # === {}[link:index.html"name="2.12] Matrix properties
878
+ # ---
879
+ # * GSL::Matrix#isnull
880
+ #
881
+ # This returns 1 if all the elements of the matrix <tt>self</tt> are zero,
882
+ # and 0 otherwise.
883
+ #
884
+ # ---
885
+ # * GSL::Matrix#isnull?
886
+ #
887
+ # This returns <tt>true</tt> if all the elements of the matrix <tt>self</tt>
888
+ # are zero, and <tt>false</tt> otherwise.
889
+ #
890
+ # ---
891
+ # * GSL::Matrix#ispos
892
+ # * GSL::Matrix#ispos?
893
+ #
894
+ # (GSL-1.9 or later) Return 1 (true) if all the elements of the matrix <tt>self</tt> are strictly positive, and 0 (false) otherwise.
895
+ #
896
+ # ---
897
+ # * GSL::Matrix#isneg
898
+ # * GSL::Matrix#isneg?
899
+ #
900
+ # (GSL-1.9 or later) Return 1 (true) if all the elements of the matrix <tt>self</tt> are strictly negative, and 0 (false) otherwise.
901
+ #
902
+ # ---
903
+ # * GSL::Matrix#isnonneg
904
+ # * GSL::Matrix#isnonneg?
905
+ #
906
+ # (GSL-1.10 or later) Return 1 (true) if all the elements of the matrix <tt>self</tt> are non-negative , and 0 (false) otherwise.
907
+ #
908
+ # ---
909
+ # * GSL::Matrix#any
910
+ #
911
+ # Returns a Vector of ones and zeros with each element indicating
912
+ # whether any of the elements of the corresponding column of the
913
+ # matrix are nonzero.
914
+ #
915
+ # ---
916
+ # * GSL::Matrix#all
917
+ #
918
+ # Behaves like the method <tt>any</tt>, except that it returns 1 only if
919
+ # all the elements of the matrix.
920
+ #
921
+ # ---
922
+ # * GSL:Matrix#trace
923
+ #
924
+ # This returns trace of the matrix <tt>self</tt>, the sum of the diagonal
925
+ # elements.
926
+ #
927
+ # ---
928
+ # * GSL:Matrix#norm
929
+ #
930
+ # Returns matrix norm, sqrt(sum_{ij} m_{ij}^2).
931
+ #
932
+ # ---
933
+ # * GSL::Matrix#sgn
934
+ # * GSL::Matrix#signum
935
+ #
936
+ # Creates a new matrix, with elements +1 if <tt>x_i,j</tt> > 0, -1 if
937
+ # <tt>x_i,j</tt> < 0, otherwise 0. Note that this definition gives the signum
938
+ # of NaN as 0 rather than NaN.
939
+ #
940
+ # ---
941
+ # * GSL:Matrix#abs
942
+ # * GSL:Matrix#fabs
943
+ #
944
+ # Example:
945
+ # >> m = GSL::Matrix::Int[-5..4, 3, 3]
946
+ # => GSL::Matrix::Int
947
+ # [ -5 -4 -3
948
+ # -2 -1 0
949
+ # 1 2 3 ]
950
+ # >> m.abs
951
+ # => GSL::Matrix::Int
952
+ # [ 5 4 3
953
+ # 2 1 0
954
+ # 1 2 3 ]
955
+ #
956
+ # ---
957
+ # * GSL::Matrix#equal?(other, eps = 1e-10)
958
+ # * GSL::Matrix#==(other, eps = 1e-10)
959
+ #
960
+ # Returns <tt>true</tt> if the matrices have same size and elements
961
+ # equal to absolute accurary <tt>eps</tt> for all the indices,
962
+ # and <tt>false</tt> otherwise.
963
+ #
964
+ # == {}[link:index.html"name="3] NArray
965
+ #
966
+ # ---
967
+ # * GSL::Matrix#to_na
968
+ #
969
+ # The Matrix object <tt>self</tt> is converted into an <tt>NMatrix</tt> object.
970
+ # The matrix data are copied to newly allocated memory.
971
+ #
972
+ # ---
973
+ # * NArray#to_gm
974
+ # * NArray#to_gslm
975
+ #
976
+ # Convert <tt>NArray</tt> object into <tt>GSL::Matrix</tt>.
977
+ #
978
+ # ---
979
+ # * NArray#to_gm_view
980
+ # * NArray#to_gslm_view
981
+ #
982
+ # A <tt>GSL::Matrix::View</tt> object is created from the NArray object <tt>na</tt>.
983
+ # The data of <tt>na</tt> are
984
+ # not copied, thus any modifications to the View object affect on the original
985
+ # NArray object <tt>na</tt>.
986
+ # The View object can be used as a reference to the NMatrix object.
987
+ #
988
+ # == {}[link:index.html"name="4] Special matrices
989
+ # ---
990
+ # * GSL::Matrix.hirbert(n)
991
+ #
992
+ # Returns the Hilbert matrix of order <tt>n</tt>. The <tt>ij</tt> element is
993
+ # defined as 1/(i+j+1).
994
+ #
995
+ # ---
996
+ # * GSL::Matrix.invhirbert(n)
997
+ #
998
+ # Returns the inverse of a Hilbert matrix of order <tt>n</tt>.
999
+ #
1000
+ # Ex:
1001
+ # >> m = GSL::Matrix.hilbert(4)
1002
+ # => GSL::Matrix
1003
+ # [ 1.000e+00 5.000e-01 3.333e-01 2.500e-01
1004
+ # 5.000e-01 3.333e-01 2.500e-01 2.000e-01
1005
+ # 3.333e-01 2.500e-01 2.000e-01 1.667e-01
1006
+ # 2.500e-01 2.000e-01 1.667e-01 1.429e-01 ]
1007
+ # >> invm = GSL::Matrix.invhilbert(4)
1008
+ # => GSL::Matrix
1009
+ # [ 1.600e+01 -1.200e+02 2.400e+02 -1.400e+02
1010
+ # -1.200e+02 1.200e+03 -2.700e+03 1.680e+03
1011
+ # 2.400e+02 -2.700e+03 6.480e+03 -4.200e+03
1012
+ # -1.400e+02 1.680e+03 -4.200e+03 2.800e+03 ]
1013
+ # >> invm2 = m.inv
1014
+ # => GSL::Matrix
1015
+ # [ 1.600e+01 -1.200e+02 2.400e+02 -1.400e+02
1016
+ # -1.200e+02 1.200e+03 -2.700e+03 1.680e+03
1017
+ # 2.400e+02 -2.700e+03 6.480e+03 -4.200e+03
1018
+ # -1.400e+02 1.680e+03 -4.200e+03 2.800e+03 ]
1019
+ # >> m*invm
1020
+ # => GSL::Matrix
1021
+ # [ 1.000e+00 5.684e-14 -2.274e-13 1.137e-13
1022
+ # 1.998e-15 1.000e+00 -4.663e-14 3.109e-14
1023
+ # 3.664e-15 -7.239e-14 1.000e+00 -1.017e-13
1024
+ # -2.442e-15 1.510e-14 -8.038e-14 1.000e+00 ]
1025
+ # >> m*invm2
1026
+ # => GSL::Matrix
1027
+ # [ 1.000e+00 0.000e+00 0.000e+00 0.000e+00
1028
+ # -1.554e-15 1.000e+00 -2.389e-14 8.349e-15
1029
+ # 1.295e-15 3.405e-15 1.000e+00 -6.957e-15
1030
+ # 1.110e-15 1.916e-14 1.707e-14 1.000e+00 ]
1031
+ #
1032
+ # ---
1033
+ # * GSL::Matrix.pascal(n)
1034
+ #
1035
+ # Returns the Pascal matrix of order <tt>n</tt>, created from Pascal's triangle.
1036
+ #
1037
+ # >> GSL::Matrix::Int.pascal(10)
1038
+ # => GSL::Matrix::Int
1039
+ # [ 1 1 1 1 1 1 1 1 1 1
1040
+ # 1 2 3 4 5 6 7 8 9 10
1041
+ # 1 3 6 10 15 21 28 36 45 55
1042
+ # 1 4 10 20 35 56 84 120 165 220
1043
+ # 1 5 15 35 70 126 210 330 495 715
1044
+ # 1 6 21 56 126 252 462 792 1287 2002
1045
+ # 1 7 28 84 210 462 924 1716 3003 5005
1046
+ # 1 8 36 120 330 792 1716 3432 6435 11440
1047
+ # 1 9 45 165 495 1287 3003 6435 12870 24310
1048
+ # 1 10 55 220 715 2002 5005 11440 24310 48620 ]
1049
+ #
1050
+ # ---
1051
+ # * GSL::Matrix.vandermonde(v)
1052
+ #
1053
+ # Creates a Vendermonde matrix from a vector or an array <tt>v</tt>.
1054
+ #
1055
+ # >> GSL::Matrix.vander([1, 2, 3, 4])
1056
+ # => GSL::Matrix
1057
+ # [ 1.000e+00 1.000e+00 1.000e+00 1.000e+00
1058
+ # 8.000e+00 4.000e+00 2.000e+00 1.000e+00
1059
+ # 2.700e+01 9.000e+00 3.000e+00 1.000e+00
1060
+ # 6.400e+01 1.600e+01 4.000e+00 1.000e+00 ]
1061
+ #
1062
+ # ---
1063
+ # * GSL::Matrix.toeplitz(v)
1064
+ #
1065
+ # Creates a Toeplitz matrix from a vector or an array <tt>v</tt>.
1066
+ #
1067
+ # >> GSL::Matrix::Int.toeplitz([1, 2, 3, 4, 5])
1068
+ # => GSL::Matrix::Int
1069
+ # [ 1 2 3 4 5
1070
+ # 2 1 2 3 4
1071
+ # 3 2 1 2 3
1072
+ # 4 3 2 1 2
1073
+ # 5 4 3 2 1 ]
1074
+ #
1075
+ # ---
1076
+ # * GSL::Matrix.circulant(v)
1077
+ #
1078
+ # Creates a circulant matrix from a vector or an array <tt>v</tt>.
1079
+ #
1080
+ # >> GSL::Matrix::Int.circulant([1, 2, 3, 4])
1081
+ # => GSL::Matrix::Int
1082
+ # [ 4 1 2 3
1083
+ # 3 4 1 2
1084
+ # 2 3 4 1
1085
+ # 1 2 3 4 ]
1086
+ #
1087
+ # {prev}[link:files/rdoc/vector_rdoc.html]
1088
+ # {next}[link:files/rdoc/perm_rdoc.html]
1089
+ #
1090
+ # {Reference index}[link:files/rdoc/ref_rdoc.html]
1091
+ # {top}[link:files/rdoc/index_rdoc.html]
1092
+ #
1093
+ #