rb-gsl 1.15.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (660) hide show
  1. checksums.yaml +7 -0
  2. data/AUTHORS +6 -0
  3. data/COPYING +339 -0
  4. data/ChangeLog +567 -0
  5. data/README +32 -0
  6. data/Rakefile +99 -0
  7. data/THANKS +17 -0
  8. data/VERSION +1 -0
  9. data/examples/alf/alf.gp +15 -0
  10. data/examples/alf/alf.rb +32 -0
  11. data/examples/blas/blas.rb +13 -0
  12. data/examples/blas/dnrm2.rb +16 -0
  13. data/examples/blas/level1.rb +81 -0
  14. data/examples/blas/level2.rb +11 -0
  15. data/examples/blas/level3.rb +12 -0
  16. data/examples/bspline.rb +57 -0
  17. data/examples/cdf.rb +16 -0
  18. data/examples/cheb.rb +21 -0
  19. data/examples/combination.rb +23 -0
  20. data/examples/complex/RC-lpf.rb +47 -0
  21. data/examples/complex/add.rb +36 -0
  22. data/examples/complex/coerce.rb +14 -0
  23. data/examples/complex/complex.rb +25 -0
  24. data/examples/complex/fpmi.rb +70 -0
  25. data/examples/complex/functions.rb +77 -0
  26. data/examples/complex/michelson.rb +36 -0
  27. data/examples/complex/mul.rb +28 -0
  28. data/examples/complex/oscillator.rb +17 -0
  29. data/examples/complex/set.rb +37 -0
  30. data/examples/const/physconst.rb +151 -0
  31. data/examples/const/travel.rb +45 -0
  32. data/examples/deriv/demo.rb +13 -0
  33. data/examples/deriv/deriv.rb +36 -0
  34. data/examples/deriv/diff.rb +35 -0
  35. data/examples/dht.rb +42 -0
  36. data/examples/dirac.rb +56 -0
  37. data/examples/eigen/eigen.rb +34 -0
  38. data/examples/eigen/herm.rb +22 -0
  39. data/examples/eigen/narray.rb +9 -0
  40. data/examples/eigen/nonsymm.rb +37 -0
  41. data/examples/eigen/nonsymmv.rb +43 -0
  42. data/examples/eigen/qhoscillator.gp +35 -0
  43. data/examples/eigen/qhoscillator.rb +90 -0
  44. data/examples/eigen/vander.rb +41 -0
  45. data/examples/fft/fft.rb +17 -0
  46. data/examples/fft/fft2.rb +17 -0
  47. data/examples/fft/forward.rb +25 -0
  48. data/examples/fft/forward2.rb +26 -0
  49. data/examples/fft/radix2.rb +18 -0
  50. data/examples/fft/real-halfcomplex.rb +33 -0
  51. data/examples/fft/real-halfcomplex2.rb +30 -0
  52. data/examples/fft/realradix2.rb +19 -0
  53. data/examples/fft/sunspot.dat +256 -0
  54. data/examples/fft/sunspot.rb +16 -0
  55. data/examples/fit/expdata.dat +20 -0
  56. data/examples/fit/expfit.rb +31 -0
  57. data/examples/fit/gaussfit.rb +29 -0
  58. data/examples/fit/gaussian_2peaks.rb +34 -0
  59. data/examples/fit/hillfit.rb +40 -0
  60. data/examples/fit/lognormal.rb +26 -0
  61. data/examples/fit/lorentzfit.rb +22 -0
  62. data/examples/fit/multifit.rb +72 -0
  63. data/examples/fit/ndlinear.rb +133 -0
  64. data/examples/fit/nonlinearfit.rb +89 -0
  65. data/examples/fit/plot.gp +36 -0
  66. data/examples/fit/polyfit.rb +9 -0
  67. data/examples/fit/powerfit.rb +21 -0
  68. data/examples/fit/sigmoidfit.rb +40 -0
  69. data/examples/fit/sinfit.rb +22 -0
  70. data/examples/fit/wlinear.rb +46 -0
  71. data/examples/fresnel.rb +11 -0
  72. data/examples/function/function.rb +36 -0
  73. data/examples/function/log.rb +7 -0
  74. data/examples/function/min.rb +33 -0
  75. data/examples/function/sin.rb +10 -0
  76. data/examples/function/synchrotron.rb +18 -0
  77. data/examples/gallery/butterfly.rb +7 -0
  78. data/examples/gallery/cayley.rb +12 -0
  79. data/examples/gallery/cornu.rb +23 -0
  80. data/examples/gallery/eight.rb +11 -0
  81. data/examples/gallery/koch.rb +40 -0
  82. data/examples/gallery/lemniscate.rb +11 -0
  83. data/examples/gallery/polar.rb +11 -0
  84. data/examples/gallery/rgplot/cossin.rb +35 -0
  85. data/examples/gallery/rgplot/rgplot.replaced +0 -0
  86. data/examples/gallery/rgplot/roesller.rb +55 -0
  87. data/examples/gallery/roesller.rb +39 -0
  88. data/examples/gallery/scarabaeus.rb +14 -0
  89. data/examples/histogram/cauchy.rb +27 -0
  90. data/examples/histogram/cauchy.sh +2 -0
  91. data/examples/histogram/exponential.rb +19 -0
  92. data/examples/histogram/gauss.rb +16 -0
  93. data/examples/histogram/gsl-histogram.rb +40 -0
  94. data/examples/histogram/histo2d.rb +31 -0
  95. data/examples/histogram/histo3d.rb +34 -0
  96. data/examples/histogram/histogram-pdf.rb +27 -0
  97. data/examples/histogram/histogram.rb +26 -0
  98. data/examples/histogram/integral.rb +28 -0
  99. data/examples/histogram/poisson.rb +27 -0
  100. data/examples/histogram/power.rb +25 -0
  101. data/examples/histogram/rebin.rb +17 -0
  102. data/examples/histogram/smp.dat +5 -0
  103. data/examples/histogram/xexp.rb +21 -0
  104. data/examples/integration/ahmed.rb +21 -0
  105. data/examples/integration/cosmology.rb +75 -0
  106. data/examples/integration/friedmann.gp +16 -0
  107. data/examples/integration/friedmann.rb +35 -0
  108. data/examples/integration/gamma-zeta.rb +35 -0
  109. data/examples/integration/integration.rb +22 -0
  110. data/examples/integration/qag.rb +8 -0
  111. data/examples/integration/qag2.rb +14 -0
  112. data/examples/integration/qag3.rb +8 -0
  113. data/examples/integration/qagi.rb +28 -0
  114. data/examples/integration/qagi2.rb +49 -0
  115. data/examples/integration/qagiu.rb +29 -0
  116. data/examples/integration/qagp.rb +20 -0
  117. data/examples/integration/qags.rb +14 -0
  118. data/examples/integration/qawc.rb +18 -0
  119. data/examples/integration/qawf.rb +41 -0
  120. data/examples/integration/qawo.rb +29 -0
  121. data/examples/integration/qaws.rb +30 -0
  122. data/examples/integration/qng.rb +17 -0
  123. data/examples/interp/demo.gp +20 -0
  124. data/examples/interp/demo.rb +45 -0
  125. data/examples/interp/interp.rb +37 -0
  126. data/examples/interp/points +10 -0
  127. data/examples/interp/spline.rb +20 -0
  128. data/examples/jacobi/deriv.rb +40 -0
  129. data/examples/jacobi/integrate.rb +34 -0
  130. data/examples/jacobi/interp.rb +43 -0
  131. data/examples/jacobi/jacobi.rb +11 -0
  132. data/examples/linalg/HH.rb +15 -0
  133. data/examples/linalg/HH_narray.rb +13 -0
  134. data/examples/linalg/LQ_solve.rb +73 -0
  135. data/examples/linalg/LU.rb +84 -0
  136. data/examples/linalg/LU2.rb +31 -0
  137. data/examples/linalg/LU_narray.rb +24 -0
  138. data/examples/linalg/PTLQ.rb +47 -0
  139. data/examples/linalg/QR.rb +18 -0
  140. data/examples/linalg/QRPT.rb +47 -0
  141. data/examples/linalg/QR_solve.rb +78 -0
  142. data/examples/linalg/QR_solve_narray.rb +13 -0
  143. data/examples/linalg/SV.rb +16 -0
  144. data/examples/linalg/SV_narray.rb +12 -0
  145. data/examples/linalg/SV_solve.rb +49 -0
  146. data/examples/linalg/chol.rb +29 -0
  147. data/examples/linalg/chol_narray.rb +15 -0
  148. data/examples/linalg/complex.rb +57 -0
  149. data/examples/linalg/invert_narray.rb +10 -0
  150. data/examples/math/const.rb +67 -0
  151. data/examples/math/elementary.rb +35 -0
  152. data/examples/math/functions.rb +41 -0
  153. data/examples/math/inf_nan.rb +34 -0
  154. data/examples/math/minmax.rb +22 -0
  155. data/examples/math/power.rb +18 -0
  156. data/examples/math/test.rb +31 -0
  157. data/examples/matrix/a.dat +0 -0
  158. data/examples/matrix/add.rb +45 -0
  159. data/examples/matrix/b.dat +4 -0
  160. data/examples/matrix/cat.rb +31 -0
  161. data/examples/matrix/colvectors.rb +24 -0
  162. data/examples/matrix/complex.rb +41 -0
  163. data/examples/matrix/det.rb +29 -0
  164. data/examples/matrix/diagonal.rb +23 -0
  165. data/examples/matrix/get_all.rb +159 -0
  166. data/examples/matrix/hilbert.rb +31 -0
  167. data/examples/matrix/iterator.rb +19 -0
  168. data/examples/matrix/matrix.rb +57 -0
  169. data/examples/matrix/minmax.rb +53 -0
  170. data/examples/matrix/mul.rb +39 -0
  171. data/examples/matrix/rand.rb +20 -0
  172. data/examples/matrix/read.rb +29 -0
  173. data/examples/matrix/rowcol.rb +47 -0
  174. data/examples/matrix/set.rb +41 -0
  175. data/examples/matrix/set_all.rb +100 -0
  176. data/examples/matrix/view.rb +32 -0
  177. data/examples/matrix/view_all.rb +148 -0
  178. data/examples/matrix/write.rb +23 -0
  179. data/examples/min.rb +29 -0
  180. data/examples/monte/miser.rb +47 -0
  181. data/examples/monte/monte.rb +47 -0
  182. data/examples/monte/plain.rb +47 -0
  183. data/examples/monte/vegas.rb +46 -0
  184. data/examples/multimin/bundle.rb +66 -0
  185. data/examples/multimin/cqp.rb +109 -0
  186. data/examples/multimin/fdfminimizer.rb +40 -0
  187. data/examples/multimin/fminimizer.rb +41 -0
  188. data/examples/multiroot/demo.rb +36 -0
  189. data/examples/multiroot/fdfsolver.rb +50 -0
  190. data/examples/multiroot/fsolver.rb +33 -0
  191. data/examples/multiroot/fsolver2.rb +32 -0
  192. data/examples/multiroot/fsolver3.rb +26 -0
  193. data/examples/narray/histogram.rb +14 -0
  194. data/examples/narray/mandel.rb +27 -0
  195. data/examples/narray/narray.rb +28 -0
  196. data/examples/narray/narray2.rb +44 -0
  197. data/examples/narray/sf.rb +26 -0
  198. data/examples/ntuple/create.rb +17 -0
  199. data/examples/ntuple/project.rb +31 -0
  200. data/examples/odeiv/binarysystem.gp +23 -0
  201. data/examples/odeiv/binarysystem.rb +104 -0
  202. data/examples/odeiv/demo.gp +24 -0
  203. data/examples/odeiv/demo.rb +69 -0
  204. data/examples/odeiv/demo2.gp +26 -0
  205. data/examples/odeiv/duffing.rb +45 -0
  206. data/examples/odeiv/frei1.rb +109 -0
  207. data/examples/odeiv/frei2.rb +76 -0
  208. data/examples/odeiv/legendre.rb +52 -0
  209. data/examples/odeiv/odeiv.rb +32 -0
  210. data/examples/odeiv/odeiv2.rb +45 -0
  211. data/examples/odeiv/oscillator.rb +42 -0
  212. data/examples/odeiv/sedov.rb +97 -0
  213. data/examples/odeiv/whitedwarf.gp +40 -0
  214. data/examples/odeiv/whitedwarf.rb +158 -0
  215. data/examples/ool/conmin.rb +100 -0
  216. data/examples/ool/gencan.rb +99 -0
  217. data/examples/ool/pgrad.rb +100 -0
  218. data/examples/ool/spg.rb +100 -0
  219. data/examples/pdf/bernoulli.rb +5 -0
  220. data/examples/pdf/beta.rb +7 -0
  221. data/examples/pdf/binomiral.rb +10 -0
  222. data/examples/pdf/cauchy.rb +6 -0
  223. data/examples/pdf/chisq.rb +8 -0
  224. data/examples/pdf/exponential.rb +7 -0
  225. data/examples/pdf/exppow.rb +6 -0
  226. data/examples/pdf/fdist.rb +7 -0
  227. data/examples/pdf/flat.rb +7 -0
  228. data/examples/pdf/gamma.rb +8 -0
  229. data/examples/pdf/gauss-tail.rb +5 -0
  230. data/examples/pdf/gauss.rb +6 -0
  231. data/examples/pdf/geometric.rb +5 -0
  232. data/examples/pdf/gumbel.rb +6 -0
  233. data/examples/pdf/hypergeometric.rb +11 -0
  234. data/examples/pdf/landau.rb +5 -0
  235. data/examples/pdf/laplace.rb +7 -0
  236. data/examples/pdf/logarithmic.rb +5 -0
  237. data/examples/pdf/logistic.rb +6 -0
  238. data/examples/pdf/lognormal.rb +6 -0
  239. data/examples/pdf/neg-binomiral.rb +10 -0
  240. data/examples/pdf/pareto.rb +7 -0
  241. data/examples/pdf/pascal.rb +10 -0
  242. data/examples/pdf/poisson.rb +5 -0
  243. data/examples/pdf/rayleigh-tail.rb +6 -0
  244. data/examples/pdf/rayleigh.rb +6 -0
  245. data/examples/pdf/tdist.rb +6 -0
  246. data/examples/pdf/weibull.rb +8 -0
  247. data/examples/permutation/ex1.rb +22 -0
  248. data/examples/permutation/permutation.rb +16 -0
  249. data/examples/poly/bell.rb +6 -0
  250. data/examples/poly/bessel.rb +6 -0
  251. data/examples/poly/cheb.rb +6 -0
  252. data/examples/poly/cheb_II.rb +6 -0
  253. data/examples/poly/cubic.rb +9 -0
  254. data/examples/poly/demo.rb +20 -0
  255. data/examples/poly/eval.rb +28 -0
  256. data/examples/poly/eval_derivs.rb +14 -0
  257. data/examples/poly/fit.rb +21 -0
  258. data/examples/poly/hermite.rb +6 -0
  259. data/examples/poly/poly.rb +13 -0
  260. data/examples/poly/quadratic.rb +25 -0
  261. data/examples/random/diffusion.rb +34 -0
  262. data/examples/random/gaussian.rb +9 -0
  263. data/examples/random/generator.rb +27 -0
  264. data/examples/random/hdsobol.rb +21 -0
  265. data/examples/random/poisson.rb +9 -0
  266. data/examples/random/qrng.rb +19 -0
  267. data/examples/random/randomwalk.rb +37 -0
  268. data/examples/random/randomwalk2d.rb +19 -0
  269. data/examples/random/rayleigh.rb +36 -0
  270. data/examples/random/rng.rb +33 -0
  271. data/examples/random/rngextra.rb +14 -0
  272. data/examples/roots/bisection.rb +25 -0
  273. data/examples/roots/brent.rb +43 -0
  274. data/examples/roots/demo.rb +30 -0
  275. data/examples/roots/newton.rb +46 -0
  276. data/examples/roots/recombination.gp +12 -0
  277. data/examples/roots/recombination.rb +61 -0
  278. data/examples/roots/steffenson.rb +48 -0
  279. data/examples/sf/ShiChi.rb +6 -0
  280. data/examples/sf/SiCi.rb +6 -0
  281. data/examples/sf/airy_Ai.rb +8 -0
  282. data/examples/sf/airy_Bi.rb +8 -0
  283. data/examples/sf/bessel_IK.rb +12 -0
  284. data/examples/sf/bessel_JY.rb +13 -0
  285. data/examples/sf/beta_inc.rb +9 -0
  286. data/examples/sf/clausen.rb +6 -0
  287. data/examples/sf/dawson.rb +5 -0
  288. data/examples/sf/debye.rb +9 -0
  289. data/examples/sf/dilog.rb +6 -0
  290. data/examples/sf/ellint.rb +6 -0
  291. data/examples/sf/expint.rb +8 -0
  292. data/examples/sf/fermi.rb +10 -0
  293. data/examples/sf/gamma_inc_P.rb +9 -0
  294. data/examples/sf/gegenbauer.rb +8 -0
  295. data/examples/sf/hyperg.rb +7 -0
  296. data/examples/sf/laguerre.rb +19 -0
  297. data/examples/sf/lambertW.rb +5 -0
  298. data/examples/sf/legendre_P.rb +10 -0
  299. data/examples/sf/lngamma.rb +5 -0
  300. data/examples/sf/psi.rb +54 -0
  301. data/examples/sf/sphbessel.gp +27 -0
  302. data/examples/sf/sphbessel.rb +30 -0
  303. data/examples/sf/synchrotron.rb +5 -0
  304. data/examples/sf/transport.rb +10 -0
  305. data/examples/sf/zetam1.rb +5 -0
  306. data/examples/siman.rb +44 -0
  307. data/examples/sort/heapsort.rb +23 -0
  308. data/examples/sort/heapsort_vector_complex.rb +21 -0
  309. data/examples/sort/sort.rb +23 -0
  310. data/examples/sort/sort2.rb +16 -0
  311. data/examples/stats/mean.rb +17 -0
  312. data/examples/stats/statistics.rb +18 -0
  313. data/examples/stats/test.rb +9 -0
  314. data/examples/sum.rb +34 -0
  315. data/examples/tamu_anova.rb +18 -0
  316. data/examples/vector/a.dat +0 -0
  317. data/examples/vector/add.rb +56 -0
  318. data/examples/vector/b.dat +4 -0
  319. data/examples/vector/c.dat +3 -0
  320. data/examples/vector/collect.rb +26 -0
  321. data/examples/vector/compare.rb +28 -0
  322. data/examples/vector/complex.rb +51 -0
  323. data/examples/vector/complex_get_all.rb +85 -0
  324. data/examples/vector/complex_set_all.rb +131 -0
  325. data/examples/vector/complex_view_all.rb +77 -0
  326. data/examples/vector/connect.rb +22 -0
  327. data/examples/vector/decimate.rb +38 -0
  328. data/examples/vector/diff.rb +31 -0
  329. data/examples/vector/filescan.rb +17 -0
  330. data/examples/vector/floor.rb +23 -0
  331. data/examples/vector/get_all.rb +82 -0
  332. data/examples/vector/gnuplot.rb +38 -0
  333. data/examples/vector/graph.rb +28 -0
  334. data/examples/vector/histogram.rb +22 -0
  335. data/examples/vector/linspace.rb +24 -0
  336. data/examples/vector/log.rb +17 -0
  337. data/examples/vector/logic.rb +33 -0
  338. data/examples/vector/logspace.rb +25 -0
  339. data/examples/vector/minmax.rb +47 -0
  340. data/examples/vector/mul.rb +49 -0
  341. data/examples/vector/narray.rb +46 -0
  342. data/examples/vector/read.rb +29 -0
  343. data/examples/vector/set.rb +35 -0
  344. data/examples/vector/set_all.rb +121 -0
  345. data/examples/vector/smpv.dat +15 -0
  346. data/examples/vector/test.rb +43 -0
  347. data/examples/vector/test_gslblock.rb +58 -0
  348. data/examples/vector/vector.rb +110 -0
  349. data/examples/vector/view.rb +35 -0
  350. data/examples/vector/view_all.rb +73 -0
  351. data/examples/vector/where.rb +29 -0
  352. data/examples/vector/write.rb +24 -0
  353. data/examples/vector/zip.rb +34 -0
  354. data/examples/wavelet/ecg.dat +256 -0
  355. data/examples/wavelet/wavelet1.rb +50 -0
  356. data/ext/alf.c +206 -0
  357. data/ext/array.c +642 -0
  358. data/ext/array_complex.c +248 -0
  359. data/ext/blas.c +29 -0
  360. data/ext/blas1.c +734 -0
  361. data/ext/blas2.c +1093 -0
  362. data/ext/blas3.c +881 -0
  363. data/ext/block.c +44 -0
  364. data/ext/block_source.c +887 -0
  365. data/ext/bspline.c +130 -0
  366. data/ext/bundle.c +3 -0
  367. data/ext/cdf.c +754 -0
  368. data/ext/cheb.c +542 -0
  369. data/ext/combination.c +283 -0
  370. data/ext/common.c +325 -0
  371. data/ext/complex.c +1004 -0
  372. data/ext/const.c +673 -0
  373. data/ext/const_additional.c +120 -0
  374. data/ext/cqp.c +283 -0
  375. data/ext/deriv.c +195 -0
  376. data/ext/dht.c +361 -0
  377. data/ext/diff.c +166 -0
  378. data/ext/dirac.c +389 -0
  379. data/ext/eigen.c +2373 -0
  380. data/ext/error.c +193 -0
  381. data/ext/extconf.rb +303 -0
  382. data/ext/fcmp.c +66 -0
  383. data/ext/fft.c +1102 -0
  384. data/ext/fit.c +205 -0
  385. data/ext/fresnel.c +312 -0
  386. data/ext/function.c +524 -0
  387. data/ext/geometry.c +139 -0
  388. data/ext/graph.c +1640 -0
  389. data/ext/gsl.c +280 -0
  390. data/ext/gsl_narray.c +804 -0
  391. data/ext/histogram.c +1991 -0
  392. data/ext/histogram2d.c +1068 -0
  393. data/ext/histogram3d.c +884 -0
  394. data/ext/histogram3d_source.c +750 -0
  395. data/ext/histogram_find.c +101 -0
  396. data/ext/histogram_oper.c +159 -0
  397. data/ext/ieee.c +100 -0
  398. data/ext/integration.c +1179 -0
  399. data/ext/interp.c +512 -0
  400. data/ext/jacobi.c +739 -0
  401. data/ext/linalg.c +4042 -0
  402. data/ext/linalg_complex.c +739 -0
  403. data/ext/math.c +725 -0
  404. data/ext/matrix.c +39 -0
  405. data/ext/matrix_complex.c +1737 -0
  406. data/ext/matrix_double.c +560 -0
  407. data/ext/matrix_int.c +256 -0
  408. data/ext/matrix_source.c +2734 -0
  409. data/ext/min.c +250 -0
  410. data/ext/monte.c +992 -0
  411. data/ext/multifit.c +1871 -0
  412. data/ext/multimin.c +806 -0
  413. data/ext/multimin_fsdf.c +156 -0
  414. data/ext/multiroots.c +955 -0
  415. data/ext/multiset.c +214 -0
  416. data/ext/ndlinear.c +321 -0
  417. data/ext/nmf.c +171 -0
  418. data/ext/nmf_wrap.c +75 -0
  419. data/ext/ntuple.c +469 -0
  420. data/ext/odeiv.c +962 -0
  421. data/ext/ool.c +879 -0
  422. data/ext/oper_complex_source.c +253 -0
  423. data/ext/permutation.c +596 -0
  424. data/ext/poly.c +42 -0
  425. data/ext/poly2.c +265 -0
  426. data/ext/poly_source.c +1915 -0
  427. data/ext/qrng.c +171 -0
  428. data/ext/randist.c +1873 -0
  429. data/ext/rational.c +480 -0
  430. data/ext/rng.c +612 -0
  431. data/ext/root.c +408 -0
  432. data/ext/sf.c +1494 -0
  433. data/ext/sf_airy.c +200 -0
  434. data/ext/sf_bessel.c +871 -0
  435. data/ext/sf_clausen.c +28 -0
  436. data/ext/sf_coulomb.c +206 -0
  437. data/ext/sf_coupling.c +121 -0
  438. data/ext/sf_dawson.c +29 -0
  439. data/ext/sf_debye.c +157 -0
  440. data/ext/sf_dilog.c +43 -0
  441. data/ext/sf_elementary.c +46 -0
  442. data/ext/sf_ellint.c +206 -0
  443. data/ext/sf_elljac.c +30 -0
  444. data/ext/sf_erfc.c +93 -0
  445. data/ext/sf_exp.c +169 -0
  446. data/ext/sf_expint.c +211 -0
  447. data/ext/sf_fermi_dirac.c +148 -0
  448. data/ext/sf_gamma.c +347 -0
  449. data/ext/sf_gegenbauer.c +97 -0
  450. data/ext/sf_hyperg.c +203 -0
  451. data/ext/sf_laguerre.c +113 -0
  452. data/ext/sf_lambert.c +47 -0
  453. data/ext/sf_legendre.c +368 -0
  454. data/ext/sf_log.c +105 -0
  455. data/ext/sf_mathieu.c +238 -0
  456. data/ext/sf_power.c +47 -0
  457. data/ext/sf_psi.c +98 -0
  458. data/ext/sf_synchrotron.c +48 -0
  459. data/ext/sf_transport.c +76 -0
  460. data/ext/sf_trigonometric.c +210 -0
  461. data/ext/sf_zeta.c +119 -0
  462. data/ext/signal.c +308 -0
  463. data/ext/siman.c +717 -0
  464. data/ext/sort.c +208 -0
  465. data/ext/spline.c +395 -0
  466. data/ext/stats.c +800 -0
  467. data/ext/sum.c +168 -0
  468. data/ext/tamu_anova.c +56 -0
  469. data/ext/tensor.c +38 -0
  470. data/ext/tensor_source.c +1123 -0
  471. data/ext/vector.c +38 -0
  472. data/ext/vector_complex.c +2246 -0
  473. data/ext/vector_double.c +1438 -0
  474. data/ext/vector_int.c +204 -0
  475. data/ext/vector_source.c +3336 -0
  476. data/ext/wavelet.c +945 -0
  477. data/include/rb_gsl.h +158 -0
  478. data/include/rb_gsl_array.h +238 -0
  479. data/include/rb_gsl_cheb.h +21 -0
  480. data/include/rb_gsl_common.h +348 -0
  481. data/include/rb_gsl_complex.h +25 -0
  482. data/include/rb_gsl_config.h +62 -0
  483. data/include/rb_gsl_const.h +29 -0
  484. data/include/rb_gsl_dirac.h +13 -0
  485. data/include/rb_gsl_eigen.h +17 -0
  486. data/include/rb_gsl_fft.h +62 -0
  487. data/include/rb_gsl_fit.h +25 -0
  488. data/include/rb_gsl_function.h +27 -0
  489. data/include/rb_gsl_graph.h +70 -0
  490. data/include/rb_gsl_histogram.h +63 -0
  491. data/include/rb_gsl_histogram3d.h +97 -0
  492. data/include/rb_gsl_integration.h +17 -0
  493. data/include/rb_gsl_interp.h +46 -0
  494. data/include/rb_gsl_linalg.h +25 -0
  495. data/include/rb_gsl_math.h +26 -0
  496. data/include/rb_gsl_odeiv.h +21 -0
  497. data/include/rb_gsl_poly.h +71 -0
  498. data/include/rb_gsl_rational.h +37 -0
  499. data/include/rb_gsl_rng.h +21 -0
  500. data/include/rb_gsl_root.h +22 -0
  501. data/include/rb_gsl_sf.h +119 -0
  502. data/include/rb_gsl_statistics.h +17 -0
  503. data/include/rb_gsl_tensor.h +45 -0
  504. data/include/rb_gsl_with_narray.h +29 -0
  505. data/include/templates_off.h +87 -0
  506. data/include/templates_on.h +241 -0
  507. data/lib/gsl.rb +3 -0
  508. data/lib/gsl/gnuplot.rb +41 -0
  509. data/lib/gsl/oper.rb +68 -0
  510. data/lib/ool.rb +22 -0
  511. data/lib/ool/conmin.rb +30 -0
  512. data/lib/rbgsl.rb +3 -0
  513. data/rdoc/alf.rdoc +77 -0
  514. data/rdoc/blas.rdoc +269 -0
  515. data/rdoc/bspline.rdoc +42 -0
  516. data/rdoc/changes.rdoc +164 -0
  517. data/rdoc/cheb.rdoc +99 -0
  518. data/rdoc/cholesky_complex.rdoc +46 -0
  519. data/rdoc/combi.rdoc +125 -0
  520. data/rdoc/complex.rdoc +210 -0
  521. data/rdoc/const.rdoc +546 -0
  522. data/rdoc/dht.rdoc +122 -0
  523. data/rdoc/diff.rdoc +133 -0
  524. data/rdoc/ehandling.rdoc +50 -0
  525. data/rdoc/eigen.rdoc +401 -0
  526. data/rdoc/fft.rdoc +535 -0
  527. data/rdoc/fit.rdoc +284 -0
  528. data/rdoc/function.rdoc +94 -0
  529. data/rdoc/graph.rdoc +137 -0
  530. data/rdoc/hist.rdoc +409 -0
  531. data/rdoc/hist2d.rdoc +279 -0
  532. data/rdoc/hist3d.rdoc +112 -0
  533. data/rdoc/index.rdoc +62 -0
  534. data/rdoc/integration.rdoc +398 -0
  535. data/rdoc/interp.rdoc +231 -0
  536. data/rdoc/intro.rdoc +27 -0
  537. data/rdoc/linalg.rdoc +681 -0
  538. data/rdoc/linalg_complex.rdoc +88 -0
  539. data/rdoc/math.rdoc +276 -0
  540. data/rdoc/matrix.rdoc +1093 -0
  541. data/rdoc/min.rdoc +189 -0
  542. data/rdoc/monte.rdoc +234 -0
  543. data/rdoc/multimin.rdoc +312 -0
  544. data/rdoc/multiroot.rdoc +293 -0
  545. data/rdoc/narray.rdoc +177 -0
  546. data/rdoc/ndlinear.rdoc +250 -0
  547. data/rdoc/nonlinearfit.rdoc +348 -0
  548. data/rdoc/ntuple.rdoc +88 -0
  549. data/rdoc/odeiv.rdoc +378 -0
  550. data/rdoc/perm.rdoc +221 -0
  551. data/rdoc/poly.rdoc +335 -0
  552. data/rdoc/qrng.rdoc +90 -0
  553. data/rdoc/randist.rdoc +233 -0
  554. data/rdoc/ref.rdoc +93 -0
  555. data/rdoc/rng.rdoc +203 -0
  556. data/rdoc/rngextra.rdoc +11 -0
  557. data/rdoc/roots.rdoc +305 -0
  558. data/rdoc/screenshot.rdoc +40 -0
  559. data/rdoc/sf.rdoc +1622 -0
  560. data/rdoc/siman.rdoc +89 -0
  561. data/rdoc/sort.rdoc +94 -0
  562. data/rdoc/start.rdoc +16 -0
  563. data/rdoc/stats.rdoc +219 -0
  564. data/rdoc/sum.rdoc +65 -0
  565. data/rdoc/tensor.rdoc +251 -0
  566. data/rdoc/tut.rdoc +5 -0
  567. data/rdoc/use.rdoc +177 -0
  568. data/rdoc/vector.rdoc +1243 -0
  569. data/rdoc/vector_complex.rdoc +347 -0
  570. data/rdoc/wavelet.rdoc +218 -0
  571. data/setup.rb +1585 -0
  572. data/tests/blas/amax.rb +14 -0
  573. data/tests/blas/asum.rb +16 -0
  574. data/tests/blas/axpy.rb +25 -0
  575. data/tests/blas/copy.rb +23 -0
  576. data/tests/blas/dot.rb +23 -0
  577. data/tests/bspline.rb +53 -0
  578. data/tests/cdf.rb +1388 -0
  579. data/tests/cheb.rb +112 -0
  580. data/tests/combination.rb +123 -0
  581. data/tests/complex.rb +17 -0
  582. data/tests/const.rb +24 -0
  583. data/tests/deriv.rb +85 -0
  584. data/tests/dht/dht1.rb +17 -0
  585. data/tests/dht/dht2.rb +23 -0
  586. data/tests/dht/dht3.rb +23 -0
  587. data/tests/dht/dht4.rb +23 -0
  588. data/tests/diff.rb +78 -0
  589. data/tests/eigen/eigen.rb +220 -0
  590. data/tests/eigen/gen.rb +105 -0
  591. data/tests/eigen/genherm.rb +66 -0
  592. data/tests/eigen/gensymm.rb +68 -0
  593. data/tests/eigen/nonsymm.rb +53 -0
  594. data/tests/eigen/nonsymmv.rb +53 -0
  595. data/tests/eigen/symm-herm.rb +74 -0
  596. data/tests/err.rb +58 -0
  597. data/tests/fit.rb +124 -0
  598. data/tests/gsl_test.rb +118 -0
  599. data/tests/gsl_test2.rb +110 -0
  600. data/tests/histo.rb +12 -0
  601. data/tests/integration/integration1.rb +72 -0
  602. data/tests/integration/integration2.rb +71 -0
  603. data/tests/integration/integration3.rb +71 -0
  604. data/tests/integration/integration4.rb +71 -0
  605. data/tests/interp.rb +45 -0
  606. data/tests/linalg/HH.rb +64 -0
  607. data/tests/linalg/LU.rb +47 -0
  608. data/tests/linalg/QR.rb +77 -0
  609. data/tests/linalg/SV.rb +24 -0
  610. data/tests/linalg/TDN.rb +116 -0
  611. data/tests/linalg/TDS.rb +122 -0
  612. data/tests/linalg/bidiag.rb +73 -0
  613. data/tests/linalg/cholesky.rb +20 -0
  614. data/tests/linalg/linalg.rb +158 -0
  615. data/tests/matrix/matrix_complex_test.rb +36 -0
  616. data/tests/matrix/matrix_nmf_test.rb +39 -0
  617. data/tests/matrix/matrix_test.rb +48 -0
  618. data/tests/min.rb +99 -0
  619. data/tests/monte/miser.rb +31 -0
  620. data/tests/monte/vegas.rb +45 -0
  621. data/tests/multifit/test_2dgauss.rb +112 -0
  622. data/tests/multifit/test_brown.rb +90 -0
  623. data/tests/multifit/test_enso.rb +246 -0
  624. data/tests/multifit/test_filip.rb +155 -0
  625. data/tests/multifit/test_gauss.rb +97 -0
  626. data/tests/multifit/test_longley.rb +110 -0
  627. data/tests/multifit/test_multifit.rb +52 -0
  628. data/tests/multimin.rb +139 -0
  629. data/tests/multiroot.rb +131 -0
  630. data/tests/multiset.rb +52 -0
  631. data/tests/narray/blas_dnrm2.rb +20 -0
  632. data/tests/odeiv.rb +353 -0
  633. data/tests/poly/poly.rb +290 -0
  634. data/tests/poly/special.rb +65 -0
  635. data/tests/qrng.rb +131 -0
  636. data/tests/quartic.rb +29 -0
  637. data/tests/randist.rb +134 -0
  638. data/tests/rng.rb +305 -0
  639. data/tests/roots.rb +76 -0
  640. data/tests/run-test.sh +17 -0
  641. data/tests/sf/gsl_test_sf.rb +249 -0
  642. data/tests/sf/test_airy.rb +83 -0
  643. data/tests/sf/test_bessel.rb +306 -0
  644. data/tests/sf/test_coulomb.rb +17 -0
  645. data/tests/sf/test_dilog.rb +25 -0
  646. data/tests/sf/test_gamma.rb +209 -0
  647. data/tests/sf/test_hyperg.rb +356 -0
  648. data/tests/sf/test_legendre.rb +227 -0
  649. data/tests/sf/test_mathieu.rb +59 -0
  650. data/tests/sf/test_mode.rb +19 -0
  651. data/tests/sf/test_sf.rb +839 -0
  652. data/tests/stats.rb +174 -0
  653. data/tests/stats_mt.rb +16 -0
  654. data/tests/sum.rb +98 -0
  655. data/tests/sys.rb +323 -0
  656. data/tests/tensor.rb +419 -0
  657. data/tests/vector/vector_complex_test.rb +101 -0
  658. data/tests/vector/vector_test.rb +141 -0
  659. data/tests/wavelet.rb +142 -0
  660. metadata +789 -0
@@ -0,0 +1,251 @@
1
+ #
2
+ # = Tensor manipulations
3
+ # The tensor library is developed by J. Burguet and distributed
4
+ # as an add-on package of GSL. See {here}[http://sources.redhat.com/ml/gsl-discuss/2004-q4/msg00053.html"target="_top] and {here}[http://sources.redhat.com/ml/gsl-discuss/2004-q4/msg00055.html"target="_top].
5
+ #
6
+ # == {}[link:index.html"name="1] Class methods
7
+ # ---
8
+ # * GSL::Tensor.new(rank, dimention)
9
+ # * GSL::Tensor.alloc(rank, dimention)
10
+ # * GSL::Tensor[rank, dimention]
11
+ #
12
+ # Create a tensor of rank <tt>rank</tt> and dimension <tt>dimention</tt>.
13
+ #
14
+ # ---
15
+ # * GSL::Tensor.calloc(rank, dimention)
16
+ #
17
+ # Creates a tensor of rank <tt>rank</tt> and dimension <tt>dimention</tt>,
18
+ # and initializes all the elements to zero.
19
+ #
20
+ # ---
21
+ # * GSL::Tensor.copy(tensor)
22
+ #
23
+ # Create a tensor copying the existing tensor <tt>tensor</tt>.
24
+ #
25
+ # ---
26
+ # * GSL::Tensor.memcpy(dest, src)
27
+ #
28
+ # Copies the tensor <tt>src</tt> to another <tt>dest</tt>. The two
29
+ # tensors must have the same shape.
30
+ #
31
+ # ---
32
+ # * GSL::Tensor.swap(a, b)
33
+ #
34
+ # Exchanges the elements of the tensor <tt>a</tt> and <tt>b</tt>.
35
+ #
36
+ # == {}[link:index.html"name="2] Instance methods
37
+ # === {}[link:index.html"name="2.1] Accessing tensor elements
38
+ # ---
39
+ # * GSL::Tensor#set_zero
40
+ #
41
+ # Sets all the element of the tensor <tt>self</tt> to zero.
42
+ # ---
43
+ # * GSL::Tensor#set_all(x)
44
+ #
45
+ # Sets all the element of the tensor <tt>self</tt> to <tt>x</tt>.
46
+ # ---
47
+ # * GSL::Tensor#set(indices, x)
48
+ # * GSL::Tensor#[indices]=x
49
+ #
50
+ # Sets the element of the given indices to <tt>x</tt>.
51
+ #
52
+ # ---
53
+ # * GSL::Tensor#get(indices)
54
+ # * GSL::Tensor#[indices]
55
+ #
56
+ # Returns the tensor element. If the number of indices given is smaller than the
57
+ # rank of the tensor, the method GSL::Tensor#subtensor is called.
58
+ #
59
+ # Ex:
60
+ # >> t = Tensor.new(2, 3)
61
+ # => #<GSL::Tensor:0x762ae8>
62
+ # >> t.set(1, 2, 2, 123)
63
+ # => #<GSL::Tensor:0x762ae8>
64
+ # >> t.get(1, 2, 2)
65
+ # => 123.0
66
+ # >> t[0, 0, 2] = 456
67
+ # => 456
68
+ # >> t[0, 0, 2]
69
+ # => 456.0
70
+ #
71
+ # ---
72
+ # * GSL::Tensor#subtensor(indices)
73
+ # * GSL::Tensor#[indices]
74
+ #
75
+ # Return a subtensor.
76
+ #
77
+ # Ex:
78
+ # >> require("gsl")
79
+ # => true
80
+ # >> t = Vector[1..125].to_tensor(3, 5)
81
+ # => GSL::Tensor:
82
+ # [ 1.000e+00 2.000e+00 3.000e+00 4.000e+00 5.000e+00 6.000e+00 7.000e+00 ... ]
83
+ # >> t[0]
84
+ # => GSL::Tensor::View:
85
+ # [ 1.000e+00 2.000e+00 3.000e+00 4.000e+00 5.000e+00
86
+ # 6.000e+00 7.000e+00 8.000e+00 9.000e+00 1.000e+01
87
+ # 1.100e+01 1.200e+01 1.300e+01 1.400e+01 1.500e+01
88
+ # 1.600e+01 1.700e+01 1.800e+01 1.900e+01 2.000e+01
89
+ # 2.100e+01 2.200e+01 2.300e+01 2.400e+01 2.500e+01 ]
90
+ # >> t[0,2]
91
+ # => GSL::Tensor::View:
92
+ # [ 1.100e+01 1.200e+01 1.300e+01 1.400e+01 1.500e+01 ]
93
+ # >> t[3,1]
94
+ # => GSL::Tensor::View:
95
+ # [ 8.100e+01 8.200e+01 8.300e+01 8.400e+01 8.500e+01 ]
96
+ # >> t[1][2]
97
+ # => GSL::Tensor::View:
98
+ # [ 3.600e+01 3.700e+01 3.800e+01 3.900e+01 4.000e+01 ]
99
+ #
100
+ # ---
101
+ # * GSL::Tensor#swap_indices(i, j)
102
+ # * GSL::Tensor#data
103
+ #
104
+ # Returns the data as <tt>GSL::Vector::View</tt>.
105
+ # ---
106
+ # * GSL::Tensor#to_v
107
+ #
108
+ # Creates a new vector from the tensor.
109
+ #
110
+ # ---
111
+ # * GSL::Tensor#to_vector
112
+ #
113
+ # Converts the tensor of rank 1 into a <tt>GSL::Vector::View</tt> object.
114
+ # ---
115
+ # * GSL::Tensor#to_matrix
116
+ #
117
+ # Converts the tensor of rank 2 into a <tt>GSL::Matrix::View</tt> object.
118
+ #
119
+ # === {}[link:index.html"name="2.2] IO
120
+ # ---
121
+ # * GSL::Tensor#fwrite(io)
122
+ # * GSL::Tensor#fwrite(filename)
123
+ # * GSL::Tensor#fread(io)
124
+ # * GSL::Tensor#fread(filename)
125
+ # * GSL::Tensor#fprintf(io, format="%g")
126
+ # * GSL::Tensor#fprintf(filename, format="%g")
127
+ # * GSL::Tensor#fscanf(io)
128
+ # * GSL::Tensor#fscanf(filename)
129
+ #
130
+ #
131
+ # === {}[link:index.html"name="2.3] Max, min
132
+ # ---
133
+ # * GSL::Tensor#max
134
+ # * GSL::Tensor#min
135
+ # * GSL::Tensor#minmax
136
+ # * GSL::Tensor#max_index
137
+ # * GSL::Tensor#min_index
138
+ # * GSL::Tensor#minmax_index
139
+ #
140
+ #
141
+ # === {}[link:index.html"name="2.4] Tensor operations
142
+ # ---
143
+ # * GSL::Tensor#add(b)
144
+ # * GSL::Tensor#+(b)
145
+ #
146
+ # Creates a new tensor adding two tensors <tt>self</tt> and <tt>b</tt>.
147
+ # ---
148
+ # * GSL::Tensor#add!(b)
149
+ #
150
+ # Adds the element of tensor <tt>b</tt> to the elements of <tt>self</tt> , <tt>in-place</tt>.
151
+ # ---
152
+ # * GSL::Tensor#sub(b)
153
+ # * GSL::Tensor#+(b)
154
+ #
155
+ # Creates a new tensor subtracting the tensors <tt>b</tt> from <tt>self</tt>.
156
+ # ---
157
+ # * GSL::Tensor#sub!(b)
158
+ #
159
+ # Subtracts the element of tensor <tt>b</tt> from the elements of <tt>self</tt> , <tt>in-place</tt>.
160
+ # ---
161
+ # * GSL::Tensor#mul_elements(b)
162
+ #
163
+ # This calculate element-by-element multiplication of <tt>self</tt> and <tt>b</tt>,
164
+ # and returns a new tensor.
165
+ # ---
166
+ # * GSL::Tensor#mul_elements!(b)
167
+ #
168
+ # Multiplies the elements of tensor <tt>self</tt> to the elements of <tt>b</tt> , <tt>in-place</tt>.
169
+ # ---
170
+ # * GSL::Tensor#div_elements(b)
171
+ # * GSL::Tensor#/(b)
172
+ #
173
+ # This calculate element-by-element division of <tt>self</tt> and <tt>b</tt>,
174
+ # and returns a new tensor.
175
+ # Multiplies the elements of tensor <tt>b</tt> to the elements of <tt>self</tt> , <tt>in-place</tt>.
176
+ # ---
177
+ # * GSL::Tensor#div_elements!(b)
178
+ #
179
+ # Divides the elements of tensor <tt>self</tt> to the elements of <tt>b</tt> , <tt>in-place</tt>.
180
+ # ---
181
+ # * GSL::Tensor#add_constant(x)
182
+ #
183
+ # Creates a new tensor adding the constant <tt>x</tt> to the tensor <tt>self</tt>.
184
+ # ---
185
+ # * GSL::Tensor#add_constant!(x)
186
+ #
187
+ # Adds the constant <tt>x</tt> to the elements of tensor <tt>self</tt> , <tt>in-place</tt>.
188
+ # ---
189
+ # * GSL::Tensor#scale(x)
190
+ #
191
+ # Creates a new tensor scaling the tensor <tt>self</tt> by the constant <tt>x</tt>.
192
+ # ---
193
+ # * GSL::Tensor#scale!(x)
194
+ #
195
+ # Multiplies the constant <tt>x</tt> to the elements of tensor <tt>self</tt> , <tt>in-place</tt>.
196
+ # ---
197
+ # * GSL::Tensor#add_diagonal(x)
198
+ #
199
+ # Creates a new tensor adding the constant <tt>x</tt> to the diagonal elements
200
+ # of the tensor <tt>self</tt>.
201
+ # ---
202
+ # * GSL::Tensor#add_diagonal!(x)
203
+ #
204
+ # Adds the constant <tt>x</tt> to the diagonal elements of tensor <tt>self</tt> , <tt>in-place</tt>.
205
+ # ---
206
+ # * GSL::Tensor#product(b)
207
+ # * GSL::Tensor#*(b)
208
+ #
209
+ # Calculate tensorian product of <tt>self</tt> and <tt>b</tt>.
210
+ # ---
211
+ # * GSL::Tensor#contract(i, j)
212
+ #
213
+ #
214
+ # ---
215
+ # * GSL::Tensor#equal?(b, eps = 1e-10)
216
+ # * GSL::Tensor#==(b)
217
+ #
218
+ # Returns <tt>true</tt> if the tensors have same size and elements
219
+ # equal to absolute accurary <tt>eps</tt> for all the indices,
220
+ # and <tt>false</tt> otherwise.
221
+ #
222
+ # === {}[link:index.html"name="2.5] Tensor properties
223
+ # ---
224
+ # * GSL::Tensor#isnull
225
+ #
226
+ # Returns 1 if all the elements of the tensor are zero, and 0 otherwise.
227
+ # ---
228
+ # * GSL::Tensor#isnull?
229
+ #
230
+ # Returns <tt>true</tt> if all the elements of the tensor are zero, and <tt>false</tt> otherwise.
231
+ #
232
+ # ---
233
+ # * GSL::Tensor#rank
234
+ #
235
+ # Returns the rank
236
+ # ---
237
+ # * GSL::Tensor#dimension
238
+ #
239
+ # Returns the dimension
240
+ # ---
241
+ # * GSL::Tensor#size
242
+ #
243
+ # Returns the size
244
+ #
245
+ # {prev}[link:files/rdoc/rngextra_rdoc.html]
246
+ # {next}[link:files/rdoc/narray_rdoc.html]
247
+ #
248
+ # {Reference index}[link:files/rdoc/ref_rdoc.html]
249
+ # {top}[link:files/rdoc/index_rdoc.html]
250
+ #
251
+ #
@@ -0,0 +1,5 @@
1
+ #
2
+ # = Ruby/GSL Tutorial
3
+ # 1. {Getting started}[link:files/rdoc/start_rdoc.html]
4
+ #
5
+ #
@@ -0,0 +1,177 @@
1
+ #
2
+ # = Using Ruby/GSL
3
+ # == {}[link:index.html"name="1] Installation
4
+ # See {here}[link:files/rdoc/index_rdoc.html].
5
+ #
6
+ # == {}[link:index.html"name="2] Load the library
7
+ # Put at the head of your scripts,
8
+ #
9
+ # require 'rubygems' # if installed via RubyGems
10
+ # require 'gsl'
11
+ #
12
+ # == {}[link:index.html"name="3] Naming conventions, C Structs and Ruby Classes
13
+ #
14
+ # Most of the GSL data types, functions or constants are named as <tt>gsl_xxx</tt> or <tt>GSL_XXX</tt>.
15
+ # In Ruby/GSL, the prefix <tt>gsl_</tt> is replaced by the module identifier <tt>GSL::</tt>,
16
+ # where <tt>GSL</tt> is the top level module of Ruby/GSL,
17
+ # and the Ruby classes are defined for each of the GSL C structs under the <tt>GSL</tt> module.
18
+ # According to the Ruby manner, the name of each class begins with a capital. For example,
19
+ #
20
+ # * Struct <tt>gsl_vector</tt> ---> Ruby class <tt>GSL::Vector</tt>
21
+ # * Function call as <tt>v = gsl_vector_alloc(5);</tt> ---> Class method <tt>v = GSL::Vector.alloc(5)</tt>
22
+ # * Function call as <tt>gsl_vector_set(v, i, 1.5);</tt> ---> Method <tt>v.set(i, 1.5)</tt> or <tt>v[i] = 1.5</tt>
23
+ # * Constant <tt>GSL_SUCCESS</tt> ---> Ruby module constant <tt>GSL::SUCCESS</tt>
24
+ # * Function <tt>gsl_sf_bessel_J0(x)</tt> --->
25
+ # * Submodule <tt>GSL::Sf</tt>
26
+ # * Module function <tt>GSL::Sf::bessel_J0(x)</tt>
27
+ # * <tt>GSL::Sf::Bessel::J0(x)</tt> is also OK, where <tt>J0(x)</tt> is a module function of the sub-sub-module <tt>GSL::Sf::Bessel</tt>.
28
+ # * Function <tt>gsl_linalg_LU_decomp</tt> --->
29
+ # * Module <tt>GSL::Linalg::LU</tt>
30
+ # * Singleton method <tt>GSL::Linalg::LU_decomp</tt>
31
+ # * Submodule <tt>GSL::Linalg::LU</tt>
32
+ # * Singleton method <tt>GSL::Linalg::LU.decomp</tt>
33
+ # * Method <tt>GSL::Matrix#LU_decomp</tt>
34
+ #
35
+ # == {}[link:index.html"name="4] Examples
36
+ # See the directories "examples/" and "tests/".
37
+ #
38
+ # Some of the examples use the <tt>graph</tt> utility to show the results. The <tt>graph</tt>
39
+ # utility is included in the {GNU plotutils}[http://www.gnu.org/software/plotutils/plotutils.html"target="_top] package. Windows-cygwin binaries of <tt>GNU plotutils</tt> and
40
+ # related packages are available from
41
+ # {here}[http://rustam.uwp.edu/support"target="_top].
42
+ #
43
+ # == {}[link:index.html"name="5] Modules and Classes
44
+ # The following is the list of Ruby/GSL modules and classes, <Name> (<Module or Class>)
45
+ #
46
+ # * GSL (Module)
47
+ # * Complex (Class)
48
+ # * Poly (Class)
49
+ # * Workspace (Class)
50
+ # * DividedDifferenceRepresentation (Class)
51
+ # * Taylor (Class)
52
+ # * Sf (Module)
53
+ # * Result (Class)
54
+ # * Block (Class)
55
+ # * Int (Class)
56
+ # * Byte (Class)
57
+ # * Index < Permutation
58
+ # * Vector (Class)
59
+ # * View < Vector
60
+ # * Complex (Class)
61
+ # * View < Vector::Complex
62
+ # * Matrix (Class)
63
+ # * View < Matrix (Class)
64
+ # * Complex (Class)
65
+ # * View < Matrix::Complex
66
+ # * Permutation (Class)
67
+ # * Combination (Class)
68
+ # * Linalg (Module)
69
+ # * LU (Module)
70
+ # * QR (Module)
71
+ # * QRPT (Module)
72
+ # * LQ (Module)
73
+ # * LQPT (Module)
74
+ # * SV (Module)
75
+ # * Cholesky (Module)
76
+ # * Symmtd (Module)
77
+ # * HH (Module)
78
+ # * Eigen (Module)
79
+ # * EigenValues < Vector
80
+ # * EigenVectors < Matrix
81
+ # * Symm (Module)
82
+ # * Workspace (Class)
83
+ # * Symmv (Module)
84
+ # * Workspace (Class)
85
+ # * Unsymm (Module)
86
+ # * Workspace (Class)
87
+ # * Unsymmv (Module)
88
+ # * Workspace (Class)
89
+ # * Herm (Module)
90
+ # * Workspace (Class)
91
+ # * Hermv (Module)
92
+ # * Workspace (Class)
93
+ # * FFT (Module)
94
+ # * ComplexWavetable (Class)
95
+ # * ComplexWorkspace (Class)
96
+ # * HalfComplexWavetable (Class)
97
+ # * RealWavetable (Class)
98
+ # * RealWorkspace (Class)
99
+ # * Wavelet (Class)
100
+ # * Wavelet2d < Wavelet
101
+ # * Function (Class)
102
+ # * Function_fdf (Class)
103
+ # * Integration (Module)
104
+ # * Workspace
105
+ # * QAWS_Table
106
+ # * QAWO_Table
107
+ # * Rng (Class)
108
+ # * QRng (Class)
109
+ # * Ran (Module)
110
+ # * Stats (Module)
111
+ # * Histogram (Class)
112
+ # * Integral < Histogram
113
+ # * Pdf (Class)
114
+ # * Histogram2d (Class)
115
+ # * N-tuples
116
+ # * SelectFn (Class)
117
+ # * ValueFn (Class)
118
+ # * Monte (Module)
119
+ # * Function (Class)
120
+ # * Plain (Class)
121
+ # * Miser (Class)
122
+ # * Vegas (Class)
123
+ # * Siman (Module)
124
+ # * Efunc (Class)
125
+ # * Step (Class)
126
+ # * Metric (Class)
127
+ # * Print (Class)
128
+ # * Params (Class)
129
+ # * Solver (Class)
130
+ # * Odeiv (Module)
131
+ # * Control (Class)
132
+ # * Evolve (Class)
133
+ # * System (Class)
134
+ # * Solver (Class)
135
+ # * Interp (Class)
136
+ # * Accel (Class)
137
+ # * Spline (Class)
138
+ # * Diff (Module)
139
+ # * Deriv (Module)
140
+ # * Cheb (Class)
141
+ # * Sum (Module)
142
+ # * Levin_u (Class)
143
+ # * Levin_utrunc (Class)
144
+ # * Dht (Class)
145
+ # * Root (Module)
146
+ # * Solver (Class)
147
+ # * FdfSolver (Class)
148
+ # * Min(Module)
149
+ # * FMinimizer (Class)
150
+ # * MultiRoot (Module)
151
+ # * Function (Class)
152
+ # * FSolver (Class)
153
+ # * Function_fdf (Class)
154
+ # * FdfSolver (Class)
155
+ # * MultiMin (Module)
156
+ # * Function (Class)
157
+ # * FMinimizer (Class)
158
+ # * Function_fdf (Class)
159
+ # * FdfMinimizer (Class)
160
+ # * Fit (Module)
161
+ # * MultiFit (Module)
162
+ # * Workspace (Class)
163
+ # * Solver (Class)
164
+ # * Function_fdf (Class)
165
+ # * FdfSolver (Class)
166
+ # * CONST (Module)
167
+ # * MKSA (Module)
168
+ # * CGSM (Module)
169
+ # * NUM (Module)
170
+ #
171
+ # {prev}[link:files/rdoc/intro_rdoc.html]
172
+ # {next}[link:files/rdoc/ehandling_rdoc.html]
173
+ #
174
+ # {Reference index}[link:files/rdoc/ref_rdoc.html]
175
+ # {top}[link:files/rdoc/index_rdoc.html]
176
+ #
177
+ #
@@ -0,0 +1,1243 @@
1
+ #
2
+ # = GSL::Vector class
3
+ #
4
+ # Contents:
5
+ # 1. {Class methods}[link:files/rdoc/vector_rdoc.html#1]
6
+ # 1. {Notes}[link:files/rdoc/vector_rdoc.html#2]
7
+ # 1. {Methods}[link:files/rdoc/vector_rdoc.html#3]
8
+ # 1. {Accessing vector elements}[link:files/rdoc/vector_rdoc.html#3.1]
9
+ # 1. {Initializing vector elements}[link:files/rdoc/vector_rdoc.html#3.2]
10
+ # 1. {Iterators}[link:files/rdoc/vector_rdoc.html#3.3]
11
+ # 1. {IO}[link:files/rdoc/vector_rdoc.html#3.4]
12
+ # 1. {Copying vectors}[link:files/rdoc/vector_rdoc.html#3.5]
13
+ # 1. {Vector views}[link:files/rdoc/vector_rdoc.html#3.6]
14
+ # 1. {Vector operations}[link:files/rdoc/vector_rdoc.html#3.7]
15
+ # 1. {Vector operations with size changes}[link:files/rdoc/vector_rdoc.html#3.8]
16
+ # 1. {Finding maximum and minimum elements of vectors}[link:files/rdoc/vector_rdoc.html#3.9]
17
+ # 1. {Vector properties}[link:files/rdoc/vector_rdoc.html#3.10]
18
+ # 1. {Element-wise vector comparison}[link:files/rdoc/vector_rdoc.html#3.11]
19
+ # 1. {Histogram}[link:files/rdoc/vector_rdoc.html#3.12]
20
+ # 1. {Sorting}[link:files/rdoc/vector_rdoc.html#3.13]
21
+ # 1. {BLAS methods}[link:files/rdoc/vector_rdoc.html#3.14]
22
+ # 1. {Data type conversions}[link:files/rdoc/vector_rdoc.html#3.15]
23
+ # 1. {NArray}[link:files/rdoc/vector_rdoc.html#3.16]
24
+ # 1. {GNU graph interface}[link:files/rdoc/vector_rdoc.html#3.17]
25
+ #
26
+ # See also {GSL::Vector::Complex}[link:files/rdoc/vector_complex_rdoc.html].
27
+ #
28
+ # == {}[link:index.html"name="1] Class methods
29
+ #
30
+ # ---
31
+ # * GSL::Vector.alloc(ary)
32
+ # * GSL::Vector.alloc(ary)
33
+ # * GSL::Vector.alloc(range)
34
+ # * GSL::Vector.alloc(size)
35
+ # * GSL::Vector.alloc(elm0, elm1, ....)
36
+ # * GSL::Vector[elm0, elm1, ....]
37
+ #
38
+ # Constructors.
39
+ #
40
+ # Ex:
41
+ # >> v1 = GSL::Vector.alloc(5)
42
+ # => GSL::Vector: [ 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 ]
43
+ # >> v2 = GSL::Vector.alloc(1, 3, 5, 2)
44
+ # => GSL::Vector: [ 1.000e+00 3.000e+00 5.000e+00 2.000e+00 ]
45
+ # >> v3 = GSL::Vector[1, 3, 5, 2]
46
+ # => GSL::Vector: [ 1.000e+00 3.000e+00 5.000e+00 2.000e+00 ]
47
+ # >> v4 = GSL::Vector.alloc([1, 3, 5, 2])
48
+ # => GSL::Vector: [ 1.000e+00 3.000e+00 5.000e+00 2.000e+00 ]
49
+ # >> v5 = GSL::Vector[1..6]
50
+ # => GSL::Vector: [ 1.000e+00 2.000e+00 3.000e+00 4.000e+00 5.000e+00 6.000e+00 ]
51
+ #
52
+ # ---
53
+ # * GSL::Vector.calloc(size)
54
+ #
55
+ # This method creates a vector object, and initializes all the elements to zero.
56
+ #
57
+ # ---
58
+ # * GSL::Vector.linspace(min, max, n = 10)
59
+ #
60
+ # Creates an <tt>GSL::Vector</tt> with <tt>n</tt> linearly spaced elements
61
+ # between <tt>min</tt> and <tt>max</tt>. If <tt>min</tt> is greater than <tt>max</tt>,
62
+ # the elements are stored in decreasing order. This mimics the <tt>linspace</tt>
63
+ # function of {GNU Octave}[http://www.octave.org/"target="_top].
64
+ #
65
+ # Ex:
66
+ # >> x = GSL::Vector.linspace(0, 10, 5)
67
+ # [ 0.000e+00 2.500e+00 5.000e+00 7.500e+00 1.000e+01 ]
68
+ # >> y = GSL::Vector.linspace(10, 0, 5)
69
+ # [ 1.000e+01 7.500e+00 5.000e+00 2.500e+00 0.000e+00 ]
70
+ #
71
+ # ---
72
+ # * GSL::Vector.logspace(min, max, n)
73
+ #
74
+ # Similar to <tt>GSL::Vector#linspace</tt> except that the values are
75
+ # logarithmically spaced from 10^<tt>min</tt> to 10^<tt>max</tt>.
76
+ #
77
+ # Ex:
78
+ # >> x = GSL::Vector.logspace(1, 3, 5)
79
+ # [ 1.000e+01 3.162e+01 1.000e+02 3.162e+02 1.000e+03 ]
80
+ # >> x = GSL::Vector.logspace(3, 1, 5)
81
+ # [ 1.000e+03 3.162e+02 1.000e+02 3.162e+01 1.000e+01 ]
82
+ #
83
+ # ---
84
+ # * GSL::Vector.logspace2(min, max, n)
85
+ #
86
+ # Similar to <tt>GSL::Vector#linspace</tt> except that the values are
87
+ # logarithmically spaced from <tt>min</tt> to <tt>max</tt>.
88
+ #
89
+ # Ex:
90
+ # >> x = GSL::Vector.logspace2(10, 1000, 5)
91
+ # [ 1.000e+01 3.162e+01 1.000e+02 3.162e+02 1.000e+03 ]
92
+ # >> x = GSL::Vector.logspace2(1000, 10, 5)
93
+ # [ 1.000e+03 3.162e+02 1.000e+02 3.162e+01 1.000e+01 ]
94
+ #
95
+ # ---
96
+ # * GSL::Vector.indgen(n, start=0, step=1)
97
+ #
98
+ # This creates a vector of length <tt>n</tt> with elements from <tt>start</tt>
99
+ # with interval <tt>step</tt> (mimics NArray#indgen).
100
+ #
101
+ # Ex:
102
+ # >> v = GSL::Vector::Int.indgen(5)
103
+ # => GSL::Vector::Int:
104
+ # [ 0 1 2 3 4 ]
105
+ # >> v = GSL::Vector::Int.indgen(5, 3)
106
+ # => GSL::Vector::Int:
107
+ # [ 3 4 5 6 7 ]
108
+ # >> v = GSL::Vector.indgen(4, 1.2, 0.3)
109
+ # => GSL::Vector
110
+ # [ 1.200e+00 1.500e+00 1.800e+00 2.100e+00 ]
111
+ #
112
+ # ---
113
+ # * GSL::Vector.filescan(filename)
114
+ #
115
+ # Reads a formatted ascii file and returns an array of vectors.
116
+ # For a data file <tt>a.dat</tt> as
117
+ # 1 5 6 5
118
+ # 3 5 6 7
119
+ # 5 6 7 9
120
+ # then <tt>a, b, c, d = Vetor.filescan("a.dat")</tt> yields
121
+ # a = [1, 3, 5]
122
+ # b = [5, 5, 6]
123
+ # c = [6, 6, 7]
124
+ # d = [5, 7, 9]
125
+ #
126
+ # === {}[link:index.html"name="1.1] NArray Extension
127
+ # If an <tt>NArray</tt> object is given, a newly allocated vector is created.
128
+ #
129
+ # Ex:
130
+ # na = NArray[1.0, 2, 3, 4, 5]
131
+ # p na <----- NArray.float(5):
132
+ # [ 1.0, 2.0, 3.0, 4.0, 5.0]
133
+ # v = GSL::Vector.alloc(na)
134
+ # p v <----- [ 1 2 3 4 5 ]
135
+ #
136
+ #
137
+ # See also {here}[link:files/rdoc/vector_rdoc.html#3.16].
138
+ #
139
+ # == {}[link:index.html"name="2] NOTE:
140
+ # In Ruby/GSL, vector length is limited within the range of Fixnum.
141
+ # For 32-bit CPU, the maximum of vector length is 2^30 ~ 1e9.
142
+ #
143
+ # == {}[link:index.html"name="3] Methods
144
+ #
145
+ # === {}[link:index.html"name="3.1] Accessing vector elements
146
+ # ---
147
+ # * GSL::Vector#get(args)
148
+ # * GSL::Vector#[args]
149
+ #
150
+ # Returns elements(s) of the vector <tt>self</tt> if <tt>args</tt> is a single
151
+ # <tt>Fixnum</tt>, a single <tt>Array</tt> of <tt>Fixnums</tt>, or a single
152
+ # <tt>GSL::Permutation</tt> (or <tt>GSL::Index</tt>). For all other <tt>args</tt>,
153
+ # the arguments are treated as with <tt>Vector#subvector</tt> and a
154
+ # <tt>Vector::View</tt> is returned.
155
+ #
156
+ # ---
157
+ # * GSL::Vector#set(args, val)
158
+ # * GSL::Vector#[args] = val
159
+ #
160
+ # If <tt>args</tt> is empty, behaves as <tt>#set_all</tt> and <tt>val</tt> must be a
161
+ # <tt>Numeric</tt>.
162
+ #
163
+ # If <tt>args</tt> is a single <tt>Fixnum</tt>, <tt>i</tt>, sets the <tt>i</tt>-th
164
+ # element of the vector <tt>self</tt> to <tt>val</tt>, which must be a
165
+ # <tt>Numeric</tt>.
166
+ #
167
+ # All other <tt>args</tt> specify a subvector (as with <tt>#subvector</tt>) whose
168
+ # elements are assigned from <tt>val</tt>. In this case, <tt>val</tt> can be an
169
+ # <tt>Array</tt>, <tt>Range</tt>, <tt>GSL::Vector</tt>, or <tt>Numeric</tt>.
170
+ #
171
+ # NOTE: GSL does not provide a vector copy function that properly copies data
172
+ # across overlapping memory regions, so watch out if assigning to part of a
173
+ # Vector from another part of itself (see example below).
174
+ #
175
+ # Ex:
176
+ # >> require 'gsl'
177
+ # => true
178
+ # >> v = GSL::Vector[0..5]
179
+ # => GSL::Vector
180
+ # [ 0.000e+00 1.000e+00 2.000e+00 3.000e+00 4.000e+00 5.000e+00 ]
181
+ # >> v[2]
182
+ # => 2.0
183
+ # >> v[1,2,3]
184
+ # => GSL::Vector::View
185
+ # [ 1.000e+00 3.000e+00 5.000e+00 ]
186
+ # >> v[[1,2,3]]
187
+ # => GSL::Vector
188
+ # [ 1.000e+00 2.000e+00 3.000e+00 ]
189
+ # >> v[3] = 9
190
+ # => 9
191
+ # >> v[-1] = 123
192
+ # => 123
193
+ # >> v
194
+ # => GSL::Vector
195
+ # [ 0.000e+00 1.000e+00 2.000e+00 9.000e+00 4.000e+00 1.230e+02 ]
196
+ # >> v[2,3] = 0
197
+ # => 0
198
+ # >> v
199
+ # => GSL::Vector
200
+ # [ 0.000e+00 1.000e+00 0.000e+00 0.000e+00 0.000e+00 1.230e+02 ]
201
+ # >> v[2,3] = [4,5,6]
202
+ # => [4, 5, 6]
203
+ # >> v
204
+ # => GSL::Vector
205
+ # [ 0.000e+00 1.000e+00 4.000e+00 5.000e+00 6.000e+00 1.230e+02 ]
206
+ # >> v[1,4] = v[0,4] # !!! Overlapping !!!
207
+ # => GSL::Vector::View
208
+ # [ 0.000e+00 0.000e+00 0.000e+00 0.000e+00 ]
209
+ # >> v
210
+ # => GSL::Vector
211
+ # [ 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 1.230e+02 ]
212
+ #
213
+ #
214
+ # === {}[link:index.html"name="3.2] Initializing vector elements
215
+ # ---
216
+ # * GSL::Vector#set_all(x)
217
+ #
218
+ # This method sets all the elements of the vector to the value <tt>x</tt>.
219
+ #
220
+ # ---
221
+ # * GSL::Vector#set_zero
222
+ #
223
+ # This method sets all the elements of the vector to zero.
224
+ #
225
+ # ---
226
+ # * GSL::Vector#set_basis!(i)
227
+ #
228
+ # This method makes a basis vector by setting all the elements of the vector
229
+ # to zero except for the <tt>i</tt>-th element, which is set to one.
230
+ # For a vector <tt>v</tt> of size 10, the method
231
+ # v.set_basis!(4)
232
+ # sets the vector <tt>v</tt> to a basis vector <tt>[0, 0, 0, 0, 1, 0, 0, 0, 0, 0]</tt>.
233
+ #
234
+ # ---
235
+ # * GSL::Vector#set_basis(i)
236
+ #
237
+ # This method returns a new basis vector by setting all the elements of the
238
+ # vector to zero except for the i-th element which is set to one.
239
+ # For a vector <tt>v</tt> of size 10, the method
240
+ # vb = v.set_basis(4)
241
+ # creates a new vector <tt>vb</tt> with elements <tt>[0, 0, 0, 0, 1, 0, 0, 0, 0, 0]</tt>.
242
+ # The vector <tt>v</tt> is not changed.
243
+ #
244
+ # ---
245
+ # * GSL::Vector#indgen!(start=0, step=1)
246
+ # * GSL::Vector#indgen(start=0, step=1)
247
+ #
248
+ # Mimics NArray#indgen!.
249
+ #
250
+ # === {}[link:index.html"name="3.3] Iterators
251
+ # ---
252
+ # * GSL::Vector#each
253
+ # * GSL::Vector#reverse_each
254
+ #
255
+ # An iterator for each of the vector elements, used as
256
+ #
257
+ # v.each do |x| # Show all the elements
258
+ # p x
259
+ # end
260
+ #
261
+ # ---
262
+ # * GSL::Vector#each_index
263
+ # * GSL::Vector#reverse_each_index
264
+ #
265
+ # Iterators
266
+ #
267
+ # ---
268
+ # * GSL::Vector#collect { |item| .. }
269
+ # * GSL::Vector#map { |item| .. }
270
+ #
271
+ # Creates a new vector by collecting the vector elements modified with some
272
+ # operations.
273
+ #
274
+ # Ex:
275
+ # >> a = GSL::Vector::Int[0..5]
276
+ # => GSL::Vector::Int
277
+ # [ 0 1 2 3 4 5 ]
278
+ # >> b = a.collect {|v| v*v}
279
+ # => GSL::Vector::Int
280
+ # [ 0 1 4 9 16 25 ]
281
+ # >> a
282
+ # => GSL::Vector::Int
283
+ # [ 0 1 2 3 4 5 ]
284
+ #
285
+ # ---
286
+ # * GSL::Vector#collect! { |item| .. }
287
+ # * GSL::Vector#map! { |item| .. }
288
+ #
289
+ # Ex:
290
+ # >> a = GSL::Vector::Int[0..5]
291
+ # => GSL::Vector::Int
292
+ # [ 0 1 2 3 4 5 ]
293
+ # >> a.collect! {|v| v*v}
294
+ # => GSL::Vector::Int
295
+ # [ 0 1 4 9 16 25 ]
296
+ # >> a
297
+ # => GSL::Vector::Int
298
+ # [ 0 1 4 9 16 25 ]
299
+ #
300
+ # === {}[link:index.html"name="3.4] IO
301
+ # ---
302
+ # * GSL::Vector#print
303
+ # * GSL::Vector#fprintf(io, format = "%e")
304
+ # * GSL::Vector#fprintf(filename, format = "%e")
305
+ # * GSL::Vector#fscanf(io)
306
+ # * GSL::Vector#fscanf(filename)
307
+ # * GSL::Vector#fwrite(io)
308
+ # * GSL::Vector#fwrite(filename)
309
+ # * GSL::Vector#fread(io)
310
+ # * GSL::Vector#fread(filename)
311
+ #
312
+ # Methods for writing or reading the vector.
313
+ # The first argument is an <tt>IO</tt> or a <tt>String</tt> object.
314
+ #
315
+ # === {}[link:index.html"name="3.5] Copying vectors
316
+ # ---
317
+ # * GSL::Vector#clone
318
+ # * GSL::Vector#duplicate
319
+ #
320
+ # Create a new vector of the same elements.
321
+ #
322
+ # === {}[link:index.html"name="3.6] Vector views
323
+ # The <tt>GSL::Vector::View</tt> class is defined to be used as "references" to
324
+ # vectors. Since the <tt>Vector::View</tt> class is a subclass of <tt>Vector</tt>,
325
+ # an instance of the <tt>View</tt> class created by slicing a <tt>Vector</tt> object
326
+ # can be used same as the original vector. A
327
+ # <tt>View</tt> object shares the data with the original vector, i.e. any changes
328
+ # in the elements of the <tt>View</tt> object affect to the original vector.
329
+ #
330
+ # ---
331
+ # * GSL::Vector#subvector
332
+ # * GSL::Vector#subvector(n)
333
+ # * GSL::Vector#subvector(offset, n)
334
+ # * GSL::Vector#subvector(offset, stride, n)
335
+ # * GSL::Vector#subvector(range, stride=1)
336
+ #
337
+ # Create a <tt>Vector::View</tt> object slicing <tt>n</tt> elements
338
+ # of the vector <tt>self</tt> from the offset <tt>offset</tt>. If called with one
339
+ # argument <tt>n</tt>, <tt>offset</tt> is set to 0. With no arguments, a view is
340
+ # created with the same length of the original vector. If called with a
341
+ # <tt>range</tt> parameter (and optional <tt>stride</tt>), a view is created for
342
+ # that range (and stride). Note the <tt>n</tt>, if given, is the length of the
343
+ # returned View.
344
+ #
345
+ # * Example:
346
+ # #!/usr/bin/env ruby
347
+ # require("gsl")
348
+ #
349
+ # v = GSL::Vector[1, 2, 3, 4, 5, 6]
350
+ # view = v.subvector(1, 4)
351
+ # p view.class <----- GSL::Vector::View
352
+ # view.print <----- [ 2 3 4 5 ]
353
+ #
354
+ # view[2] = 99
355
+ # view.print <----- [ 2 3 99 5 ]
356
+ # v.print <----- [ 1 2 3 99 5 6 ]
357
+ #
358
+ # ---
359
+ # * GSL::Vector#subvector_with_stride(stride)
360
+ # * GSL::Vector#subvector_with_stride(offset, stride)
361
+ # * GSL::Vector#subvector_with_stride(offset, stride, n)
362
+ #
363
+ # Return a <tt>Vector::View</tt> object of a subvector of another vector
364
+ # <tt>self</tt> with an additional stride argument. The subvector is formed in
365
+ # the same way as for <tt>Vector#subvector</tt> but the new vector view has
366
+ # <tt>n</tt> elements with a step-size of <tt>stride</tt> from one element to the
367
+ # next in the original vector. Note that <tt>n</tt>, if given, is the length of
368
+ # the returned View.
369
+ #
370
+ # ---
371
+ # * GSL::Vector#matrix_view(n1, n2)
372
+ #
373
+ # This creates a <tt>Matrix::View</tt> object from the vector <tt>self</tt>.
374
+ # It enables to use the vector as a {Matrix}[link:files/rdoc/matrix_rdoc.html] object.
375
+ #
376
+ # * Ex:
377
+ #
378
+ # >> v = GSL::Vector::Int.alloc(1..9)
379
+ # => GSL::Vector::Int:
380
+ # [ 1 2 3 4 5 6 7 8 9 ]
381
+ # >> m = v.matrix_view(3, 3)
382
+ # => GSL::Matrix::Int::View:
383
+ # [ 1 2 3
384
+ # 4 5 6
385
+ # 7 8 9 ]
386
+ # >> m[1][2] = 99
387
+ # => 99
388
+ # >> v
389
+ # => GSL::Vector::Int:
390
+ # [ 1 2 3 4 5 99 7 8 9 ]
391
+ #
392
+ # === {}[link:index.html"name="3.7] Vector operations
393
+ #
394
+ # ---
395
+ # * GSL::Vector#swap_elements(i, j)
396
+ #
397
+ # This method exchanges the i-th and j-th elements of the vector <tt>in-place</tt>.
398
+ #
399
+ # ---
400
+ # * GSL::Vector#reverse
401
+ #
402
+ # Reverses the order of the elements of the vector.
403
+ #
404
+ # >> v = GSL::Vector::Int[1..5]
405
+ # => GSL::Vector::Int:
406
+ # [ 1 2 3 4 5 ]
407
+ # >> v.reverse
408
+ # => GSL::Vector::Int:
409
+ # [ 5 4 3 2 1 ]
410
+ #
411
+ # ---
412
+ # * GSL::Vector#trans
413
+ # * GSL::Vector#transpose
414
+ # * GSL::Vector#col
415
+ # * GSL::Vector#row
416
+ #
417
+ # Transpose the vector from a row vector into a column vector and vice versa.
418
+ #
419
+ # >> v = GSL::Vector::Int[1..5]
420
+ # => GSL::Vector::Int:
421
+ # [ 1 2 3 4 5 ]
422
+ # >> v.col
423
+ # => GSL::Vector::Int::Col:
424
+ # [ 1
425
+ # 2
426
+ # 3
427
+ # 4
428
+ # 5 ]
429
+ #
430
+ # ---
431
+ # * GSL::Vector#add(b)
432
+ #
433
+ # Adds the elements of vector <tt>b</tt> to the elements
434
+ # of the vector <tt>self</tt>. A new vector is created, and the vector
435
+ # <tt>self</tt> is not changed.
436
+ #
437
+ # ---
438
+ # * GSL::Vector#sub(b)
439
+ #
440
+ # Subtracts the element of vector <tt>b</tt> from the elements of <tt>self</tt>.
441
+ # A new vector is created, and the vector <tt>self</tt> is not changed.
442
+ #
443
+ # ---
444
+ # * GSL::Vector#mul(b)
445
+ #
446
+ # Multiplies the elements of vector <tt>self</tt> by the elements of vector <tt>b</tt>.
447
+ # ---
448
+ # * GSL::Vector#div(b)
449
+ #
450
+ # Divides the elements of vector <tt>self</tt> by the elements of vector <tt>b</tt>.
451
+ #
452
+ # ---
453
+ # * GSL::Vector#scale(x)
454
+ # * GSL::Vector#scale!(x)
455
+ #
456
+ # This method multiplies the elements of vector <tt>self</tt> by
457
+ # the constant factor <tt>x</tt>.
458
+ #
459
+ # ---
460
+ # * GSL::Vector#add_constant(x)
461
+ # * GSL::Vector#add_constant!(x)
462
+ #
463
+ # Adds the constant value <tt>x</tt> to the elements of the vector <tt>self</tt>.
464
+ #
465
+ # ---
466
+ # * GSL::Vector#+(b)
467
+ #
468
+ # For <tt>b</tt>,
469
+ # * a Number: ---> <tt>self.add_constanb(b)</tt>
470
+ # * a Vector: ---> <tt>self.add(b)</tt>
471
+ # ---
472
+ # * GSL::Vector#-(b)
473
+ #
474
+ # For <tt>b</tt>,
475
+ # * a Number: ---> <tt>self.add_constanb(-b)</tt>
476
+ # * a Vector: ---> <tt>self.sub(b)</tt>
477
+ # ---
478
+ # * GSL::Vector#/(b)
479
+ #
480
+ # For <tt>b</tt>,
481
+ # * a Number: ---> <tt>self.scale(1/b)</tt>
482
+ # * a Vector: ---> <tt>self.div(b)</tt>
483
+ #
484
+ # ---
485
+ # * GSL::Vector#*(b)
486
+ #
487
+ # Vector multiplication.
488
+ #
489
+ # 1. Scale
490
+ # >> v = GSL::Vector[1, 2]
491
+ # [ 1 2 ]
492
+ # >> v*2
493
+ # [ 2 4 ]
494
+ # 1. Element-by-element multiplication
495
+ # >> a = GSL::Vector[1, 2]; b = GSL::Vector[3, 4]
496
+ # [ 3 4 ]
497
+ # >> a*b
498
+ # [ 3 8 ]
499
+ # 1. Inner product
500
+ # >> a = GSL::Vector[1, 2]; b = GSL::Vector[3, 4]
501
+ # [ 3
502
+ # 4 ]
503
+ # >> a*b.col
504
+ # => 11.0
505
+ # 1. GSL::Vector::Col*Vector -> GSL::Matrix
506
+ # >> a = GSL::Vector::Col[1, 2]; b = GSL::Vector[3, 4]
507
+ # [ 3 4 ]
508
+ # >> a*b
509
+ # [ 3 4
510
+ # 6 8 ]
511
+ # 1. GSL::Matrix*Vector::Col -> GSL::Vector::Col
512
+ # >> a = GSL::Vector[1, 2]; m = GSL::Matrix[[2, 3], [4, 5]]
513
+ # [ 2 3
514
+ # 4 5 ]
515
+ # >> m*a <--- Error
516
+ # TypeError: Operation with GSL::Vector is not defined (GSL::Vector::Col expected)
517
+ # from (irb):30:in `*'
518
+ # from (irb):30
519
+ # >> m*a.col
520
+ # [ 8
521
+ # 14 ]
522
+ #
523
+ # ---
524
+ # * GSL::Vector#add!(b)
525
+ # * GSL::Vector#sub!(b)
526
+ # * GSL::Vector#mul!(b)
527
+ # * GSL::Vector#div!(b)
528
+ #
529
+ # In-place operations with a vector <tt>b</tt>.
530
+ #
531
+ # ---
532
+ # * GSL::Vector#pow(p)
533
+ # * GSL::Vector#**(p)
534
+ # * GSL::Vector#pow!(p)
535
+ #
536
+ # Element-wise calculation of power p.
537
+ #
538
+ # Ex)
539
+ # >> require("gsl")
540
+ # >> v = GSL::Vector[1, 2, 3]
541
+ # => GSL::Vector
542
+ # [ 1.000e+00 2.000e+00 3.000e+00 ]
543
+ # >> v.pow(2)
544
+ # => GSL::Vector
545
+ # [ 1.000e+00 4.000e+00 9.000e+00 ]
546
+ # >> v**2
547
+ # => GSL::Vector
548
+ # [ 1.000e+00 4.000e+00 9.000e+00 ]
549
+ # >> v
550
+ # => GSL::Vector
551
+ # [ 1.000e+00 2.000e+00 3.000e+00 ]
552
+ # >> v.pow!(2)
553
+ # => GSL::Vector
554
+ # [ 1.000e+00 4.000e+00 9.000e+00 ]
555
+ # >> v
556
+ # => GSL::Vector
557
+ # [ 1.000e+00 4.000e+00 9.000e+00 ]
558
+ #
559
+ # ---
560
+ # * GSL::Vector#swap_elements(i, j)
561
+ #
562
+ # This exchanges the <tt>i</tt>-th and <tt>j</tt>-th elements of the vector <tt>self</tt> in-place.
563
+ # ---
564
+ # * GSL::Vector#clone
565
+ # * GSL::Vector#duplicate
566
+ #
567
+ # These create a copy of the vector <tt>self</tt>.
568
+ #
569
+ # ---
570
+ # * GSL::Vector.connect(v1, v2, v3, ...)
571
+ # * GSL::Vector#connect(v2, v3, ...)
572
+ #
573
+ # Creates a new vector by connecting all the elements of the given vectors.
574
+ #
575
+ # >> v1 = GSL::Vector::Int[1, 3]
576
+ # => GSL::Vector::Int:
577
+ # [ 1 3 ]
578
+ # >> v2 = GSL::Vector::Int[4, 3, 5]
579
+ # => GSL::Vector::Int:
580
+ # [ 4 3 5 ]
581
+ # >> v1.connect(v2)
582
+ # => GSL::Vector::Int:
583
+ # [ 1 3 4 3 5 ]
584
+ #
585
+ # ---
586
+ # * GSL::Vector#sgn
587
+ # * GSL::Vector#signum
588
+ #
589
+ # Creates a new vector, with elements +1 if <tt>x_i</tt> > 0, -1 if <tt>x_i</tt> <
590
+ # 0, otherwise 0. Note that this definition gives the signum of NaN as 0
591
+ # rather than NaN.
592
+ #
593
+ # ---
594
+ # * GSL::Vector#abs
595
+ # * GSL::Vector#fabs
596
+ #
597
+ # Creates a new vector, with elements <tt>fabs(x_i)</tt>.
598
+ #
599
+ # >> v = GSL::Vector::Int[-3, 2, -5, 4]
600
+ # => GSL::Vector::Int:
601
+ # [ -3 2 -5 4 ]
602
+ # >> v.abs
603
+ # => GSL::Vector::Int:
604
+ # [ 3 2 5 4 ]
605
+ #
606
+ # ---
607
+ # * GSL::Vector#square
608
+ # * GSL::Vector#abs2
609
+ #
610
+ # Create a new vector, with elements <tt>x_i*x_i</tt>.
611
+ #
612
+ # >> v = GSL::Vector::Int[1..4]
613
+ # => GSL::Vector::Int:
614
+ # [ 1 2 3 4 ]
615
+ # >> v.square
616
+ # => GSL::Vector::Int:
617
+ # [ 1 4 9 16 ]
618
+ #
619
+ # ---
620
+ # * GSL::Vector#sqrt
621
+ #
622
+ # Creates a new vector, with elements <tt>sqrt</tt>(<tt>x_i</tt>).
623
+ #
624
+ # ---
625
+ # * GSL::Vector#floor
626
+ # * GSL::Vector#ceil
627
+ # * GSL::Vector#round
628
+ #
629
+ #
630
+ # Ex:
631
+ # >> v = GSL::Vector[1.1, 2.7, 3.5, 4.3]
632
+ # => GSL::Vector
633
+ # [ 1.100e+00 2.700e+00 3.500e+00 4.300e+00 ]
634
+ # >> v.floor
635
+ # => GSL::Vector::Int
636
+ # [ 1 2 3 4 ]
637
+ # >> v.ceil
638
+ # => GSL::Vector::Int
639
+ # [ 2 3 4 5 ]
640
+ # >> v.round
641
+ # => GSL::Vector::Int
642
+ # [ 1 3 4 4 ]
643
+ #
644
+ # ---
645
+ # * GSL::Vector#normalize(nrm = 1.0)
646
+ #
647
+ # Creates a new vector of norm <tt>nrm</tt>, by scaling the vector <tt>self</tt>.
648
+ # ---
649
+ # * GSL::Vector#normalize!(nrm = 1.0)
650
+ #
651
+ # This normalizes the vector <tt>self</tt> in-place.
652
+ #
653
+ # Ex:
654
+ # tcsh> irb
655
+ # >> require("gsl")
656
+ # => true
657
+ # >> a = GSL::Vector[-1, -2, -3, -4]
658
+ # => GSL::Vector:
659
+ # [ -1.000e+00 -2.000e+00 -3.000e+00 -4.000e+00 ]
660
+ # >> b = a.abs
661
+ # => GSL::Vector:
662
+ # [ 1.000e+00 2.000e+00 3.000e+00 4.000e+00 ]
663
+ # >> b.sqrt
664
+ # => GSL::Vector:
665
+ # [ 1.000e+00 1.414e+00 1.732e+00 2.000e+00 ]
666
+ # >> b.square
667
+ # => GSL::Vector:
668
+ # [ 1.000e+00 4.000e+00 9.000e+00 1.600e+01 ]
669
+ # >> c = b.normalize(2)
670
+ # => GSL::Vector:
671
+ # [ 2.582e-01 5.164e-01 7.746e-01 1.033e+00 ]
672
+ # >> c.square.sum
673
+ # => 2.0
674
+ #
675
+ # ---
676
+ # * GSL::Vector#decimate(n)
677
+ #
678
+ # Creates a new vector by averaring every <tt>n</tt>
679
+ # points of the vector <tt>self</tt> down to one point.
680
+ #
681
+ # ---
682
+ # * GSL::Vector#diff(k = 1)
683
+ #
684
+ # Calculate <tt>k</tt>-th differences of a vector <tt>self</tt>.
685
+ #
686
+ #
687
+ # ---
688
+ # * GSL::Vector#join(sep = " ")
689
+ #
690
+ # Converts the vector to a <tt>String</tt> by joining all the elements with a
691
+ # separator <tt>sep</tt>.
692
+ #
693
+ # ---
694
+ # * GSL::Vector#zip(vec, ...)
695
+ # * GSL::Vector.zip(vec, ...)
696
+ #
697
+ # Create an <tt>Array</tt> of vectors by merging the elements of <tt>self</tt>
698
+ # with corresponding elements from each arguments.
699
+ #
700
+ # Ex:
701
+ # >> require("gsl")
702
+ # >> a = GSL::Vector[4, 5, 6]
703
+ # >> b = GSL::Vector[7, 8, 9]
704
+ # >> GSL::Vector[1, 2, 3].zip(a, b)
705
+ # [[ 1.000e+00 4.000e+00 7.000e+00 ],
706
+ # [ 2.000e+00 5.000e+00 8.000e+00 ],
707
+ # [ 3.000e+00 6.000e+00 9.000e+00 ]]
708
+ # >> GSL::Vector[1, 2].zip(a, b)
709
+ # [[ 1.000e+00 4.000e+00 7.000e+00 ],
710
+ # [ 2.000e+00 5.000e+00 8.000e+00 ]]
711
+ # >> a.zip(GSL::Vector[1, 2], GSL::Vector[8.0])
712
+ # [[ 4.000e+00 1.000e+00 8.000e+00 ],
713
+ # [ 5.000e+00 2.000e+00 0.000e+00 ],
714
+ # [ 6.000e+00 0.000e+00 0.000e+00 ]]
715
+ #
716
+ # ---
717
+ # * GSL::Vector#concat(x)
718
+ #
719
+ # Returns a new Vector that contains the concatenation <tt>self</tt> and
720
+ # <tt>x</tt>, which must be an <tt>Array</tt>, <tt>Fixnum</tt>, <tt>Bignum</tt>,
721
+ # <tt>Float</tt>, <tt>Range</tt>, or <tt>GSL::Vector</tt>.
722
+ #
723
+ # === {}[link:index.html"name="3.8] Vector operations with size changes
724
+ # The methods below change vector length of <tt>self</tt>. A Vector's length may
725
+ # not extend past its original allocation. Use of these methods is discouraged.
726
+ # Existing Views may still refer to elements beyond the end of the shortened
727
+ # Vector. These elements remain allocated, but are effectvely unmanaged.
728
+ #
729
+ # ---
730
+ # * GSL::Vector#delete(x)
731
+ #
732
+ # Deletes items from <tt>self</tt> that are equal to <tt>x</tt>. If the item is
733
+ # not found, returns <tt>nil</tt>, otherwise returns <tt>x</tt>.
734
+ # ---
735
+ # * GSL::Vector#delete_at(i)
736
+ #
737
+ # Deletes the element at the specified index <tt>i</tt>,
738
+ # returning that element, or <tt>nil</tt> if the index is out of range.
739
+ # ---
740
+ # * GSL::Vector#delete_if { |x| ... }
741
+ #
742
+ # Deletes every element of <tt>self</tt> for which block evaluates to <tt>true</tt>
743
+ # and returns <tt>self</tt>.
744
+ #
745
+ # === {}[link:index.html"name="3.9] Finding maximum and minimum elements of vectors
746
+ #
747
+ # ---
748
+ # * GSL::Vector#max
749
+ #
750
+ # This method returns the maximum value in the vector.
751
+ #
752
+ # ---
753
+ # * GSL::Vector#min
754
+ #
755
+ # This method returns the minimum value in the vector.
756
+ #
757
+ # ---
758
+ # * GSL::Vector#minmax
759
+ #
760
+ # This method returns an array of two elements, the minimum and the maximum values
761
+ # in the vector <tt>self</tt>.
762
+ #
763
+ # ---
764
+ # * GSL::Vector#max_index
765
+ #
766
+ # This method returns the index of the maximum value in the vector. When there are
767
+ # several equal maximum elements then the lowest index is returned.
768
+ #
769
+ # ---
770
+ # * GSL::Vector#min_index
771
+ #
772
+ # This method returns the index of the minimum value in the vector. When there are
773
+ # several equal minimum elements then the lowest index is returned.
774
+ #
775
+ # ---
776
+ # * GSL::Vector#minmax_index
777
+ #
778
+ # This method returns an array of two elements which has the indices
779
+ # of the minimum and the maximum values in the vector <tt>self</tt>.
780
+ #
781
+ # === {}[link:index.html"name="3.10] Vector Properties
782
+ # ---
783
+ # * GSL::Vector#size
784
+ # * GSL::Vector#len
785
+ # * GSL::Vector#length
786
+ #
787
+ # Return the vector length.
788
+ #
789
+ # ---
790
+ # * GSL::Vector#stride
791
+ #
792
+ # Return the vector stride.
793
+ #
794
+ # ---
795
+ # * GSL::Vector#sum
796
+ #
797
+ # Returns the sum of the vector elements.
798
+ #
799
+ # ---
800
+ # * GSL::Vector#prod
801
+ #
802
+ # Returns the product of the vector elements.
803
+ #
804
+ # ---
805
+ # * GSL::Vector#cumsum
806
+ #
807
+ # Calculate the cumulative sum of elements of <tt>self</tt> and returns as a new vector.
808
+ #
809
+ # ---
810
+ # * GSL::Vector#cumprod
811
+ #
812
+ # Calculate the cumulative product of elements of <tt>self</tt> and returns as a new vector.
813
+ #
814
+ # ---
815
+ # * GSL::Vector#isnull
816
+ #
817
+ # Returns 1 if all the elements of the vector <tt>self</tt>
818
+ # are zero, and 0 otherwise.
819
+ # ---
820
+ # * GSL::Vector#isnull?
821
+ #
822
+ # Return <tt>true</tt> if all the elements of the vector <tt>self</tt>
823
+ # are zero, and <tt>false</tt> otherwise.
824
+ # ---
825
+ # * GSL::Vector#ispos
826
+ # * GSL::Vector#ispos?
827
+ # * GSL::Vector#isneg
828
+ # * GSL::Vector#isneg?
829
+ #
830
+ # (GSL-1.9 or later) Return 1 (true) if all the elements of the vector <tt>self</tt> are zero, strictly positive, strictly negative respectively, and 0 (false) otherwise.
831
+ #
832
+ # ---
833
+ # * GSL::Vector#isnonneg
834
+ # * GSL::Vector#isnonneg?
835
+ #
836
+ # (GSL-1.10 or later) Return 1 (true) if all the elements of the vector <tt>self</tt> are non-negative , and 0 (false) otherwise.
837
+ #
838
+ # ---
839
+ # * GSL::Vector#all?
840
+ #
841
+ # Returns <tt>true</tt> if all the vector elements are non-zero, and <tt>false</tt>
842
+ # otherwise. If a block is given, the method returns <tt>true</tt> if the
843
+ # tests are true for all the elements.
844
+ # ---
845
+ # * GSL::Vector#any?
846
+ #
847
+ # Returns <tt>true</tt> if any the vector elements are non-zero, and <tt>false</tt>
848
+ # otherwise. If a block is given, the method returns <tt>true</tt> if the
849
+ # tests are true for any of the elements.
850
+ # ---
851
+ # * GSL::Vector#none?
852
+ #
853
+ # Returns <tt>true</tt> if all the elements of the vector <tt>self</tt>
854
+ # are zero, and <tt>false</tt> otherwise (just as <tt>GSL::Vector#isnull?</tt>).
855
+ # If a block is given, the method returns <tt>true</tt> if the
856
+ # tests are false for all the elements.
857
+ #
858
+ # Ex:
859
+ # >> a = GSL::Vector[1, 2, 3]
860
+ # >> b = GSL::Vector[1, 2, 0]
861
+ # >> c = GSL::Vector[0, 0, 0]
862
+ # >> a.all?
863
+ # => true
864
+ # >> b.all?
865
+ # => false
866
+ # >> b.any?
867
+ # => true
868
+ # >> c.any?
869
+ # => false
870
+ # >> a.none?
871
+ # => false
872
+ # >> c.none?
873
+ # => true
874
+ #
875
+ # ---
876
+ # * GSL::Vector#all
877
+ # * GSL::Vector#any
878
+ # * GSL::Vector#none
879
+ #
880
+ # Returns 1 or 0.
881
+ #
882
+ # ---
883
+ # * GSL::Vector#equal?(other, eps = 1e-10)
884
+ # * GSL::Vector#==(other, eps = 1e-10)
885
+ #
886
+ # Returns <tt>true</tt> if the vectors have same size and elements
887
+ # equal to absolute accurary <tt>eps</tt> for all the indices,
888
+ # and <tt>false</tt> otherwise.
889
+ #
890
+ # === {}[link:index.html"name="3.11] Element-wise vector comparison
891
+ # ---
892
+ # * GSL::Vector#eq(other)
893
+ # * GSL::Vector#ne(other)
894
+ # * GSL::Vector#gt(other)
895
+ # * GSL::Vector#ge(other)
896
+ # * GSL::Vector#lt(other)
897
+ # * GSL::Vector#le(other)
898
+ #
899
+ # Return a <tt>Block::Byte</tt> object with elements 0/1 by comparing the two vectors
900
+ # <tt>self</tt> and <tt>other</tt>. Note that the values returned are 0/1,
901
+ # not <tt>true/false</tt>, thus all of the elements are "true" in Ruby.
902
+ #
903
+ # Ex:
904
+ # >> a = GSL::Vector[1, 2, 3]
905
+ # >> b = GSL::Vector[1, 2, 5]
906
+ # >> a.eq(b)
907
+ # [ 1 1 0 ]
908
+ # >> a.ne(b)
909
+ # [ 0 0 1 ]
910
+ # >> a.gt(b)
911
+ # [ 0 0 0 ]
912
+ # >> a.ge(b)
913
+ # [ 1 1 0 ]
914
+ # >> a.eq(3)
915
+ # [ 0 0 1 ]
916
+ # >> a.ne(2)
917
+ # [ 1 0 1 ]
918
+ # >> a.ge(2)
919
+ # [ 0 1 1 ]
920
+ #
921
+ # ---
922
+ # * GSL::Vector#and(other)
923
+ # * GSL::Vector#or(other)
924
+ # * GSL::Vector#xor(other)
925
+ # * GSL::Vector#not
926
+ #
927
+ #
928
+ # Ex:
929
+ # >> a = GSL::Vector[1, 0, 3, 0]
930
+ # >> b = GSL::Vector[3, 4, 0, 0]
931
+ # >> a.and(b)
932
+ # [ 1 0 0 0 ]
933
+ # >> a.or(b)
934
+ # [ 1 1 1 0 ]
935
+ # >> a.xor(b)
936
+ # [ 0 1 1 0 ]
937
+ # >> a.not
938
+ # [ 0 1 0 1 ]
939
+ # >> b.not
940
+ # [ 0 0 1 1 ]
941
+ #
942
+ # ---
943
+ # * GSL::Vector#where
944
+ # * GSL::Vector#where { |elm| ... }
945
+ #
946
+ # Returns the vector indices where the tests are true. If all the test failed
947
+ # <tt>nil</tt> is returned.
948
+ #
949
+ # Ex:
950
+ # >> v = GSL::Vector::Int[0, 3, 0, -2, 3, 5, 0, 3]
951
+ # >> v.where
952
+ # [ 1 3 4 5 7 ] # where elements are non-zero
953
+ # >> v.where { |elm| elm == -2 }
954
+ # [ 3 ]
955
+ # >> a = GSL::Vector[0, 0, 0]
956
+ # >> a.where
957
+ # => nil
958
+ #
959
+ # === {}[link:index.html"name="3.12] Histogram
960
+ # ---
961
+ # * GSL::Vector#histogram(n)
962
+ # * GSL::Vector#histogram(ranges)
963
+ # * GSL::Vector#histogram(n, min, max)
964
+ # * GSL::Vector#histogram(n, [min, max])
965
+ #
966
+ # Creates a histogram filling the vector <tt>self</tt>.
967
+ #
968
+ # Example:
969
+ # >> r = GSL::Rng.alloc # Random number generator
970
+ # => #<GSL::Rng:0x6d8594>
971
+ # >> v = r.gaussian(1, 1000) # Generate 1000 Gaussian random numbers
972
+ # => GSL::Vector
973
+ # [ 1.339e-01 -8.810e-02 1.674e+00 7.336e-01 9.975e-01 -1.278e+00 -2.397e+00 ... ]
974
+ # >> h = v.histogram(50, [-4, 4]) # Creates a histogram of size 50, range [-4, 4)
975
+ # => #<GSL::Histogram:0x6d28b0>
976
+ # >> h.graph("-T X -C -g 3") # Show the histogram
977
+ # => true
978
+ #
979
+ # This is equivalent to
980
+ # h = Histogram.alloc(50, [-4, 4])
981
+ # h.increment(v)
982
+ #
983
+ # === {}[link:index.html"name="3.13] Sorting
984
+ #
985
+ # ---
986
+ # * GSL::Vector#sort
987
+ # * GSL::Vector#sort!
988
+ #
989
+ # These methods sort the vector <tt>self</tt> in ascending numerical order.
990
+ #
991
+ # ---
992
+ # * GSL::Vector#sort_index
993
+ #
994
+ # This method indirectly sorts the elements of the vector <tt>self</tt> into
995
+ # ascending order, and returns the resulting permutation.
996
+ # The elements of permutation give the index of the vector element which
997
+ # would have been stored in that position if the vector had been sorted in place.
998
+ # The first element of permutation gives the index of the least element in the
999
+ # vector, and the last element of permutation gives the index of the greatest
1000
+ # vector element. The vector <tt>self</tt> is not changed.
1001
+ #
1002
+ # ---
1003
+ # * GSL::Vector#sort_smallest(n)
1004
+ # * GSL::Vector#sort_largest(n)
1005
+ # * GSL::Vector#sort_smallest_index(n)
1006
+ # * GSL::Vector#sort_largest_index(n)
1007
+ #
1008
+ #
1009
+ # Ex:
1010
+ # >> v = GSL::Vector::Int[8, 2, 3, 7, 9, 1, 4]
1011
+ # => GSL::Vector::Int:
1012
+ # [ 8 2 3 7 9 1 4 ]
1013
+ # >> v.sort
1014
+ # => GSL::Vector::Int:
1015
+ # [ 1 2 3 4 7 8 9 ]
1016
+ # >> v.sort_index
1017
+ # => GSL::Permutation:
1018
+ # [ 5 1 2 6 3 0 4 ]
1019
+ # >> v.sort_largest(3)
1020
+ # => GSL::Vector::Int:
1021
+ # [ 9 8 7 ]
1022
+ # >> v.sort_smallest(3)
1023
+ # => GSL::Vector::Int:
1024
+ # [ 1 2 3 ]
1025
+ #
1026
+ # === {}[link:index.html"name="3.14] BLAS Methods
1027
+ # ---
1028
+ # * GSL::Vector#nrm2
1029
+ # * GSL::Vector#dnrm2
1030
+ #
1031
+ # Compute the Euclidean norm ||x||_2 = sqrt {sum x_i^2} of the vector.
1032
+ #
1033
+ # ---
1034
+ # * GSL::Vector#asum
1035
+ # * GSL::Vector#dasum
1036
+ #
1037
+ # Compute the absolute sum \sum |x_i| of the elements of the vector.
1038
+ #
1039
+ # === {}[link:index.html"name="3.15] Data type conversions
1040
+ # ---
1041
+ # * GSL::Vector#to_a
1042
+ #
1043
+ # This method converts the vector into a Ruby array. A Ruby array also can be
1044
+ # converted into a GSL::Vector object with the <tt>to_gv</tt> method. For example,
1045
+ #
1046
+ # v = GSL::Vector.alloc([1, 2, 3, 4, 5])
1047
+ # a = v.to_a -> GSL::Vector to an array
1048
+ # p a -> [1.0, 2.0, 3.0, 4.0, 5.0]
1049
+ # a[2] = 12.0
1050
+ # v2 = a.to_gv -> a new GSL::Vector object
1051
+ # v2.print -> 1.0000e+00 2.0000e+00 1.2000e+01 4.0000e+00 5.0000e+00
1052
+ #
1053
+ # ---
1054
+ # * GSL::Vector#to_m(nrow, ncol)
1055
+ #
1056
+ # Creates a <tt>GSL::Matrix</tt> object of <tt>nrow</tt> rows and <tt>ncol</tt> columns.
1057
+ #
1058
+ # >> v = GSL::Vector::Int[1..5]
1059
+ # => GSL::Vector::Int:
1060
+ # [ 1 2 3 4 5 ]
1061
+ # >> v.to_m(2, 3)
1062
+ # => GSL::Matrix::Int:
1063
+ # [ 1 2 3
1064
+ # 4 5 0 ]
1065
+ # >> v.to_m(2, 2)
1066
+ # => GSL::Matrix::Int:
1067
+ # [ 1 2
1068
+ # 3 4 ]
1069
+ # >> v.to_m(3, 2)
1070
+ # => GSL::Matrix::Int:
1071
+ # [ 1 2
1072
+ # 3 4
1073
+ # 5 0 ]
1074
+ #
1075
+ # ---
1076
+ # * GSL::Vector#to_m_diagonal
1077
+ #
1078
+ # Converts the vector into a diagonal matrix.
1079
+ # See also {GSL::Matrix.diagonal(v)}[link:files/rdoc/matrix_rdoc.html].
1080
+ #
1081
+ # >> v = GSL::Vector[1..4].to_i
1082
+ # => GSL::Vector::Int:
1083
+ # [ 1 2 3 4 ]
1084
+ # >> v.to_m_diagonal
1085
+ # => GSL::Matrix::Int:
1086
+ # [ 1 0 0 0
1087
+ # 0 2 0 0
1088
+ # 0 0 3 0
1089
+ # 0 0 0 4 ]
1090
+ #
1091
+ # ---
1092
+ # * GSL::Vector#to_m_circulant
1093
+ #
1094
+ # Creates a circulant matrix.
1095
+ #
1096
+ # >> v = GSL::Vector::Int[1..5]
1097
+ # => GSL::Vector::Int:
1098
+ # [ 1 2 3 4 5 ]
1099
+ # >> v.to_m_circulant
1100
+ # => GSL::Matrix::Int:
1101
+ # [ 5 1 2 3 4
1102
+ # 4 5 1 2 3
1103
+ # 3 4 5 1 2
1104
+ # 2 3 4 5 1
1105
+ # 1 2 3 4 5 ]
1106
+ #
1107
+ # ---
1108
+ # * GSL::Vector#to_complex
1109
+ # * GSL::Vector#to_complex2
1110
+ #
1111
+ # Example:
1112
+ #
1113
+ # >> v = GSL::Vector[1..4]
1114
+ # => GSL::Vector
1115
+ # [ 1.000e+00 2.000e+00 3.000e+00 4.000e+00 ]
1116
+ # >> v.to_complex
1117
+ # [ [1.000e+00 0.000e+00] [2.000e+00 0.000e+00] [3.000e+00 0.000e+00] [4.000e+00 0.000e+00] ]
1118
+ # => #<GSL::Vector::Complex:0x6d7d24>
1119
+ # >> v.to_complex2
1120
+ # [ [1.000e+00 2.000e+00] [3.000e+00 4.000e+00] ]
1121
+ # => #<GSL::Vector::Complex:0x6d6424>
1122
+ #
1123
+ # ---
1124
+ # * GSL::Vector#to_tensor(rank, dimension)
1125
+ #
1126
+ #
1127
+ # === {}[link:index.html"name="3.16] GSL::Vector <---> NArray
1128
+ #
1129
+ # ---
1130
+ # * GSL::Vector#to_na
1131
+ #
1132
+ # Converts a vector <tt>self</tt> into an <tt>NArray</tt> object.
1133
+ # The data are copied to newly allocated memory.
1134
+ #
1135
+ # ---
1136
+ # * GSL::Vector#to_na2
1137
+ # * GSL::Vector#to_na_ref
1138
+ #
1139
+ # Create an <tt>NArray</tt> reference of the vector <tt>self</tt>.
1140
+ #
1141
+ # Example:
1142
+ # >> v = GSL::Vector::Int[1, 2, 3, 4]
1143
+ # => GSL::Vector::Int
1144
+ # [ 1 2 3 4 ]
1145
+ # >> na = v.to_na
1146
+ # => NArray.int(4):
1147
+ # [ 1, 2, 3, 4 ]
1148
+ # >> na2 = v.to_na2
1149
+ # => NArray(ref).int(4):
1150
+ # [ 1, 2, 3, 4 ]
1151
+ # >> na[1] = 99
1152
+ # => 99
1153
+ # >> v # na and v are independent
1154
+ # => GSL::Vector::Int
1155
+ # [ 1 2 3 4 ]
1156
+ # >> na2[1] = 99 # na2 points to the data of v
1157
+ # => 99
1158
+ # >> v
1159
+ # => GSL::Vector::Int
1160
+ # [ 1 99 3 4 ]
1161
+ #
1162
+ # ---
1163
+ # * NArray#to_gv
1164
+ # * NArray#to_gslv
1165
+ #
1166
+ # Create <tt>GSL::Vector</tt> object from the <tt>NArray</tt> object <tt>self</tt>.
1167
+ #
1168
+ # ---
1169
+ # * NArray#to_gv_view
1170
+ # * NArray#to_gv2
1171
+ # * NArray#to_gslv_view
1172
+ #
1173
+ # A <tt>GSL::Vector::View</tt> object is created from the NArray object <tt>self</tt>.
1174
+ # This method does not allocate memory for the data: the data of <tt>self</tt>
1175
+ # are not copied, but shared with the <tt>View</tt> object created, thus
1176
+ # any modifications to the <tt>View</tt> object affect on the original NArray
1177
+ # object. In other words, the <tt>View</tt> object can be used as a <tt>reference</tt>
1178
+ # to the NArray object.
1179
+ #
1180
+ # Ex:
1181
+ # tcsh> irb
1182
+ # >> require("gsl")
1183
+ # => true
1184
+ # >> na = NArray[1.0, 2, 3, 4, 5]
1185
+ # => NArray.float(5):
1186
+ # [ 1.0, 2.0, 3.0, 4.0, 5.0 ]
1187
+ # >> vv = na.to_gv_view # Create a view sharing the memory
1188
+ # => GSL::Vector::View
1189
+ # [ 1.000e+00 2.000e+00 3.000e+00 4.000e+00 5.000e+00 ]
1190
+ # >> vv[3] = 9
1191
+ # => 9
1192
+ # >> na
1193
+ # => NArray.float(5):
1194
+ # [ 1.0, 2.0, 3.0, 9.0, 5.0 ] # The data are changed
1195
+ # >> v = na.to_gv # A vector with newly allocated memory
1196
+ # => GSL::Vector
1197
+ # [ 1.000e+00 2.000e+00 3.000e+00 9.000e+00 5.000e+00 ]
1198
+ # >> v[1] = 123
1199
+ # => 123
1200
+ # >> v
1201
+ # => GSL::Vector
1202
+ # [ 1.000e+00 1.230e+02 3.000e+00 9.000e+00 5.000e+00 ]
1203
+ # >> na
1204
+ # => NArray.float(5):
1205
+ # [ 1.0, 2.0, 3.0, 9.0, 5.0 ] # v and na are independent
1206
+ # >> na = NArray[1.0, 2, 3, 4, 5, 6]
1207
+ # => NArray.float(6):
1208
+ # [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]
1209
+ # >> m = na.to_gv_view.matrix_view(2, 3)
1210
+ # => GSL::Matrix::View
1211
+ # [ 1.000e+00 2.000e+00 3.000e+00
1212
+ # 4.000e+00 5.000e+00 6.000e+00 ]
1213
+ # >> m[1][2] = 9
1214
+ # => 9
1215
+ # >> na
1216
+ # => NArray.float(6):
1217
+ # [ 1.0, 2.0, 3.0, 4.0, 5.0, 9.0 ]
1218
+ #
1219
+ # === {}[link:index.html"name="3.17] Graphics
1220
+ # ---
1221
+ # * GSL::Vector.graph(y)
1222
+ # * GSL::Vector.graph(y, options)
1223
+ # * GSL::Vector.graph(x, y)
1224
+ # * GSL::Vector.graph(x, y, options)
1225
+ # * GSL::Vector#graph(options)
1226
+ # * GSL::Vector#graph(x, options)
1227
+ #
1228
+ # These methods use the GNU plotutils <tt>graph</tt> application to plot
1229
+ # a vector <tt>self</tt>. The options of <tt>graph</tt> as "-T X -C" can be given by a String.
1230
+ #
1231
+ # Example:
1232
+ # >> x = GSL::Vector.linspace(0, 2.0*M_PI, 20)
1233
+ # >> c = GSL::Sf::cos(x)
1234
+ # >> s = GSL::Sf::sin(x)
1235
+ # >> GSL::Vector.graph(x, c, s, "-T X -C -L 'cos(x), sin(x)'")
1236
+ #
1237
+ # {prev}[link:files/rdoc/sf_rdoc.html]
1238
+ # {next}[link:files/rdoc/matrix_rdoc.html]
1239
+ #
1240
+ # {Reference index}[link:files/rdoc/ref_rdoc.html]
1241
+ # {top}[link:files/rdoc/index_rdoc.html]
1242
+ #
1243
+ #