numo-gsl-alt 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (320) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +4 -0
  3. data/README.md +83 -0
  4. data/Rakefile +16 -0
  5. data/ext/numo/gsl/cdf/depend +17 -0
  6. data/ext/numo/gsl/cdf/erbpp_cdf.rb +44 -0
  7. data/ext/numo/gsl/cdf/extconf.rb +9 -0
  8. data/ext/numo/gsl/cdf/func_def.rb +610 -0
  9. data/ext/numo/gsl/const/const_2.4.rb +419 -0
  10. data/ext/numo/gsl/const/const_2.5.rb +419 -0
  11. data/ext/numo/gsl/const/const_2.6.rb +419 -0
  12. data/ext/numo/gsl/const/const_def.rb +419 -0
  13. data/ext/numo/gsl/const/depend +17 -0
  14. data/ext/numo/gsl/const/erbpp_const.rb +28 -0
  15. data/ext/numo/gsl/const/extconf.rb +9 -0
  16. data/ext/numo/gsl/err/depend +1 -0
  17. data/ext/numo/gsl/err/err.c +22 -0
  18. data/ext/numo/gsl/err/extconf.rb +9 -0
  19. data/ext/numo/gsl/extconf_gsl.rb +58 -0
  20. data/ext/numo/gsl/fit/depend +17 -0
  21. data/ext/numo/gsl/fit/erbpp_fit.rb +73 -0
  22. data/ext/numo/gsl/fit/extconf.rb +9 -0
  23. data/ext/numo/gsl/fit/func_2.4.rb +128 -0
  24. data/ext/numo/gsl/fit/func_2.5.rb +128 -0
  25. data/ext/numo/gsl/fit/func_2.6.rb +128 -0
  26. data/ext/numo/gsl/fit/func_def.rb +129 -0
  27. data/ext/numo/gsl/fit/tmpl/check_1d.c +9 -0
  28. data/ext/numo/gsl/fit/tmpl/fit_linear.c +53 -0
  29. data/ext/numo/gsl/fit/tmpl/fit_linear_est.c +56 -0
  30. data/ext/numo/gsl/fit/tmpl/fit_mul.c +50 -0
  31. data/ext/numo/gsl/fit/tmpl/fit_mul_est.c +47 -0
  32. data/ext/numo/gsl/fit/tmpl/fit_wlinear.c +59 -0
  33. data/ext/numo/gsl/fit/tmpl/fit_wmul.c +56 -0
  34. data/ext/numo/gsl/gen/erbln.rb +132 -0
  35. data/ext/numo/gsl/gen/erbpp2.rb +344 -0
  36. data/ext/numo/gsl/gen/erbpp_gsl.rb +170 -0
  37. data/ext/numo/gsl/gen/func_parser.rb +518 -0
  38. data/ext/numo/gsl/gen/tmpl/c_DFloat_f_DFloat.c +40 -0
  39. data/ext/numo/gsl/gen/tmpl/c_DFloat_f_SZ.c +41 -0
  40. data/ext/numo/gsl/gen/tmpl/c_DFloat_f_SZ_x2.c +44 -0
  41. data/ext/numo/gsl/gen/tmpl/c_DFloat_x2_f_DFloat_x2.c +45 -0
  42. data/ext/numo/gsl/gen/tmpl/c_double_f_double.c +16 -0
  43. data/ext/numo/gsl/gen/tmpl/c_double_f_sizet.c +16 -0
  44. data/ext/numo/gsl/gen/tmpl/c_double_f_sizet_x2.c +17 -0
  45. data/ext/numo/gsl/gen/tmpl/c_double_f_void.c +15 -0
  46. data/ext/numo/gsl/gen/tmpl/c_double_x2_f_void.c +17 -0
  47. data/ext/numo/gsl/gen/tmpl/c_new_DFloat.c +29 -0
  48. data/ext/numo/gsl/gen/tmpl/c_new_double.c +22 -0
  49. data/ext/numo/gsl/gen/tmpl/c_new_f_other.c +25 -0
  50. data/ext/numo/gsl/gen/tmpl/c_new_sizet.c +22 -0
  51. data/ext/numo/gsl/gen/tmpl/c_new_sizet_double.c +23 -0
  52. data/ext/numo/gsl/gen/tmpl/c_new_sizet_x2.c +23 -0
  53. data/ext/numo/gsl/gen/tmpl/c_new_void.c +21 -0
  54. data/ext/numo/gsl/gen/tmpl/c_other_f_void.c +19 -0
  55. data/ext/numo/gsl/gen/tmpl/c_self_f_DFloat.c +46 -0
  56. data/ext/numo/gsl/gen/tmpl/c_self_f_DFloat_x2.c +41 -0
  57. data/ext/numo/gsl/gen/tmpl/c_self_f_DFloat_x3.c +44 -0
  58. data/ext/numo/gsl/gen/tmpl/c_self_f_DFloat_x4.c +47 -0
  59. data/ext/numo/gsl/gen/tmpl/c_self_f_SZ_x2_DFloat.c +45 -0
  60. data/ext/numo/gsl/gen/tmpl/c_self_f_double.c +17 -0
  61. data/ext/numo/gsl/gen/tmpl/c_self_f_other.c +17 -0
  62. data/ext/numo/gsl/gen/tmpl/c_self_f_sizet.c +21 -0
  63. data/ext/numo/gsl/gen/tmpl/c_self_f_void.c +14 -0
  64. data/ext/numo/gsl/gen/tmpl/c_sizet_f_void.c +15 -0
  65. data/ext/numo/gsl/gen/tmpl/c_sizet_x2_f_void.c +17 -0
  66. data/ext/numo/gsl/gen/tmpl/c_str_f_void.c +15 -0
  67. data/ext/numo/gsl/gen/tmpl/c_super_new_void.c +18 -0
  68. data/ext/numo/gsl/gen/tmpl/c_uint_f_void.c +15 -0
  69. data/ext/numo/gsl/gen/tmpl/c_ulong_f_void.c +15 -0
  70. data/ext/numo/gsl/gen/tmpl/c_void_f_double.c +17 -0
  71. data/ext/numo/gsl/gen/tmpl/c_void_f_double_x2.c +18 -0
  72. data/ext/numo/gsl/gen/tmpl/c_void_f_double_x4.c +20 -0
  73. data/ext/numo/gsl/gen/tmpl/c_void_f_ulong.c +17 -0
  74. data/ext/numo/gsl/gen/tmpl/c_void_f_void.c +14 -0
  75. data/ext/numo/gsl/gen/tmpl/cast_1d_contiguous.c +15 -0
  76. data/ext/numo/gsl/gen/tmpl/cast_2d_contiguous.c +15 -0
  77. data/ext/numo/gsl/gen/tmpl/class.c +26 -0
  78. data/ext/numo/gsl/gen/tmpl/create_new_narray.c +26 -0
  79. data/ext/numo/gsl/gen/tmpl/init_class.c +10 -0
  80. data/ext/numo/gsl/gen/tmpl/init_module.c +12 -0
  81. data/ext/numo/gsl/gen/tmpl/lib.c +41 -0
  82. data/ext/numo/gsl/gen/tmpl/m_DFloat_Int_f_DFloat.c +38 -0
  83. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_DFloat.c +35 -0
  84. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_DFloat_Int.c +39 -0
  85. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_DFloat_UInt.c +39 -0
  86. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_DFloat_double.c +42 -0
  87. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_DFloat_double_x2.c +47 -0
  88. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_DFloat_int.c +42 -0
  89. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_DFloat_x2.c +38 -0
  90. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_DFloat_x3.c +41 -0
  91. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_Int.c +36 -0
  92. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_UInt.c +36 -0
  93. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_UInt32.c +36 -0
  94. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_UInt32_double.c +43 -0
  95. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_UInt32_double_uint.c +49 -0
  96. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_UInt32_double_x2.c +48 -0
  97. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_UInt32_uint_x3.c +51 -0
  98. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_UInt_double.c +43 -0
  99. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_UInt_double_uint.c +50 -0
  100. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_UInt_double_x2.c +48 -0
  101. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_UInt_uint_x3.c +51 -0
  102. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_int_DFloat.c +41 -0
  103. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_int_DFloat_x2.c +44 -0
  104. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_int_x2_DFloat_x2.c +46 -0
  105. data/ext/numo/gsl/gen/tmpl/m_Int_f_DFloat.c +36 -0
  106. data/ext/numo/gsl/gen/tmpl/m_Int_f_DFloat_x3.c +42 -0
  107. data/ext/numo/gsl/gen/tmpl/m_Int_f_int_DFloat.c +42 -0
  108. data/ext/numo/gsl/gen/tmpl/m_Int_f_int_DFloat_x2.c +45 -0
  109. data/ext/numo/gsl/gen/tmpl/mod_func_noloop.c +54 -0
  110. data/ext/numo/gsl/gen/tmpl/mod_func_scalar.c +27 -0
  111. data/ext/numo/gsl/gen/tmpl/module.c +9 -0
  112. data/ext/numo/gsl/histogram/depend +17 -0
  113. data/ext/numo/gsl/histogram/erbpp_histogram.rb +109 -0
  114. data/ext/numo/gsl/histogram/extconf.rb +9 -0
  115. data/ext/numo/gsl/histogram/func_2.4.rb +742 -0
  116. data/ext/numo/gsl/histogram/func_2.5.rb +742 -0
  117. data/ext/numo/gsl/histogram/func_2.6.rb +742 -0
  118. data/ext/numo/gsl/histogram/func_def.rb +763 -0
  119. data/ext/numo/gsl/histogram/tmpl/c_DFloat_f_2d_get.c +54 -0
  120. data/ext/numo/gsl/histogram/tmpl/c_DFloat_f_field.c +35 -0
  121. data/ext/numo/gsl/histogram/tmpl/c_DFloat_f_get.c +47 -0
  122. data/ext/numo/gsl/histogram/tmpl/c_DFloat_x2_f_get_range.c +56 -0
  123. data/ext/numo/gsl/histogram/tmpl/c_bool_f_other.c +19 -0
  124. data/ext/numo/gsl/histogram/tmpl/c_bool_f_pdf_init.c +24 -0
  125. data/ext/numo/gsl/histogram/tmpl/c_self_f_2d_set_ranges.c +26 -0
  126. data/ext/numo/gsl/histogram/tmpl/c_self_f_set_ranges.c +21 -0
  127. data/ext/numo/gsl/histogram/tmpl/c_sizet_f_field.c +15 -0
  128. data/ext/numo/gsl/interp/depend +17 -0
  129. data/ext/numo/gsl/interp/erbpp_interp.rb +60 -0
  130. data/ext/numo/gsl/interp/extconf.rb +9 -0
  131. data/ext/numo/gsl/interp/func_2.4.rb +804 -0
  132. data/ext/numo/gsl/interp/func_2.5.rb +804 -0
  133. data/ext/numo/gsl/interp/func_2.6.rb +804 -0
  134. data/ext/numo/gsl/interp/func_def.rb +816 -0
  135. data/ext/numo/gsl/interp/parse_interp.rb +67 -0
  136. data/ext/numo/gsl/interp/tmpl/interp2d_new.c +36 -0
  137. data/ext/numo/gsl/interp/tmpl/interp2d_type_new.c +17 -0
  138. data/ext/numo/gsl/interp/tmpl/interp_bsearch.c +57 -0
  139. data/ext/numo/gsl/interp/tmpl/interp_new.c +29 -0
  140. data/ext/numo/gsl/interp/tmpl/interp_type_new.c +16 -0
  141. data/ext/numo/gsl/interp/tmpl/spline2d_eval.c +61 -0
  142. data/ext/numo/gsl/interp/tmpl/spline_eval.c +55 -0
  143. data/ext/numo/gsl/interp/tmpl/spline_integ.c +56 -0
  144. data/ext/numo/gsl/interp/type_def.rb +9 -0
  145. data/ext/numo/gsl/mkmf_gsl.rb +33 -0
  146. data/ext/numo/gsl/multifit/depend +17 -0
  147. data/ext/numo/gsl/multifit/erbpp_multifit.rb +99 -0
  148. data/ext/numo/gsl/multifit/extconf.rb +9 -0
  149. data/ext/numo/gsl/multifit/func_2.1.rb +1035 -0
  150. data/ext/numo/gsl/multifit/func_2.2.1.rb +736 -0
  151. data/ext/numo/gsl/multifit/func_2.2.rb +736 -0
  152. data/ext/numo/gsl/multifit/func_2.3.rb +872 -0
  153. data/ext/numo/gsl/multifit/func_2.4.rb +859 -0
  154. data/ext/numo/gsl/multifit/func_2.5.rb +859 -0
  155. data/ext/numo/gsl/multifit/func_2.6.rb +859 -0
  156. data/ext/numo/gsl/multifit/func_def.rb +1012 -0
  157. data/ext/numo/gsl/multifit/tmpl/multifit_linear.c +66 -0
  158. data/ext/numo/gsl/multifit/tmpl/multifit_linear_est.c +48 -0
  159. data/ext/numo/gsl/multifit/tmpl/multifit_linear_residuals.c +47 -0
  160. data/ext/numo/gsl/multifit/tmpl/multifit_wlinear.c +70 -0
  161. data/ext/numo/gsl/multifit/type_def.rb +1 -0
  162. data/ext/numo/gsl/multilarge/func_2.4.rb +216 -0
  163. data/ext/numo/gsl/multilarge/func_2.5.rb +216 -0
  164. data/ext/numo/gsl/multilarge/func_2.6.rb +216 -0
  165. data/ext/numo/gsl/multilarge/func_def.rb +215 -0
  166. data/ext/numo/gsl/numo_gsl.h +117 -0
  167. data/ext/numo/gsl/pdf/depend +17 -0
  168. data/ext/numo/gsl/pdf/erbpp_pdf.rb +27 -0
  169. data/ext/numo/gsl/pdf/extconf.rb +9 -0
  170. data/ext/numo/gsl/pdf/func_2.2.1.rb +306 -0
  171. data/ext/numo/gsl/pdf/func_2.2.rb +306 -0
  172. data/ext/numo/gsl/pdf/func_2.3.rb +306 -0
  173. data/ext/numo/gsl/pdf/func_2.4.rb +303 -0
  174. data/ext/numo/gsl/pdf/func_2.5.rb +333 -0
  175. data/ext/numo/gsl/pdf/func_2.6.rb +333 -0
  176. data/ext/numo/gsl/pdf/func_def.rb +282 -0
  177. data/ext/numo/gsl/pdf/parse_pdf.rb +42 -0
  178. data/ext/numo/gsl/pdf/tmpl/dirichlet.c +39 -0
  179. data/ext/numo/gsl/pdf/tmpl/multinomial.c +39 -0
  180. data/ext/numo/gsl/poly/depend +17 -0
  181. data/ext/numo/gsl/poly/erbpp_poly.rb +70 -0
  182. data/ext/numo/gsl/poly/extconf.rb +9 -0
  183. data/ext/numo/gsl/poly/func_2.4.rb +220 -0
  184. data/ext/numo/gsl/poly/func_2.5.rb +220 -0
  185. data/ext/numo/gsl/poly/func_2.6.rb +220 -0
  186. data/ext/numo/gsl/poly/func_def.rb +234 -0
  187. data/ext/numo/gsl/poly/tmpl/poly_complex_solve.c +59 -0
  188. data/ext/numo/gsl/poly/tmpl/poly_eval.c +70 -0
  189. data/ext/numo/gsl/poly/tmpl/poly_eval_derivs.c +40 -0
  190. data/ext/numo/gsl/ran/depend +17 -0
  191. data/ext/numo/gsl/ran/erbpp_ran.rb +43 -0
  192. data/ext/numo/gsl/ran/extconf.rb +9 -0
  193. data/ext/numo/gsl/ran/func_2.2.1.rb +1658 -0
  194. data/ext/numo/gsl/ran/func_2.2.rb +1658 -0
  195. data/ext/numo/gsl/ran/func_2.3.rb +1658 -0
  196. data/ext/numo/gsl/ran/func_2.4.rb +1526 -0
  197. data/ext/numo/gsl/ran/func_2.5.rb +1573 -0
  198. data/ext/numo/gsl/ran/func_2.6.rb +1573 -0
  199. data/ext/numo/gsl/ran/func_def.rb +1594 -0
  200. data/ext/numo/gsl/ran/parse_ran.rb +10 -0
  201. data/ext/numo/gsl/rng/depend +17 -0
  202. data/ext/numo/gsl/rng/erbpp_rng.rb +59 -0
  203. data/ext/numo/gsl/rng/extconf.rb +9 -0
  204. data/ext/numo/gsl/rng/func_2.4.rb +187 -0
  205. data/ext/numo/gsl/rng/func_2.5.rb +187 -0
  206. data/ext/numo/gsl/rng/func_2.6.rb +187 -0
  207. data/ext/numo/gsl/rng/func_def.rb +230 -0
  208. data/ext/numo/gsl/rng/parse_rng.rb +126 -0
  209. data/ext/numo/gsl/rng/tmpl/ran.c +44 -0
  210. data/ext/numo/gsl/rng/tmpl/ran_DFloat_f_DFloat.c +28 -0
  211. data/ext/numo/gsl/rng/tmpl/ran_DFloat_x2.c +45 -0
  212. data/ext/numo/gsl/rng/tmpl/ran_DFloat_x3.c +51 -0
  213. data/ext/numo/gsl/rng/tmpl/ran_multinomial.c +32 -0
  214. data/ext/numo/gsl/rng/tmpl/rng_DFloat.c +29 -0
  215. data/ext/numo/gsl/rng/tmpl/rng_UInt.c +44 -0
  216. data/ext/numo/gsl/rng/tmpl/rng_alloc.c +24 -0
  217. data/ext/numo/gsl/rng/tmpl/rng_type_new.c +14 -0
  218. data/ext/numo/gsl/rng/type_def.rb +63 -0
  219. data/ext/numo/gsl/rstat/depend +17 -0
  220. data/ext/numo/gsl/rstat/erbpp_rstat.rb +64 -0
  221. data/ext/numo/gsl/rstat/extconf.rb +9 -0
  222. data/ext/numo/gsl/rstat/func_2.2.1.rb +116 -0
  223. data/ext/numo/gsl/rstat/func_2.2.rb +116 -0
  224. data/ext/numo/gsl/rstat/func_2.3.rb +123 -0
  225. data/ext/numo/gsl/rstat/func_2.4.rb +122 -0
  226. data/ext/numo/gsl/rstat/func_2.5.rb +122 -0
  227. data/ext/numo/gsl/rstat/func_2.6.rb +122 -0
  228. data/ext/numo/gsl/rstat/func_def.rb +102 -0
  229. data/ext/numo/gsl/sf/depend +17 -0
  230. data/ext/numo/gsl/sf/erbpp_sf.rb +51 -0
  231. data/ext/numo/gsl/sf/extconf.rb +9 -0
  232. data/ext/numo/gsl/sf/func_2.4.rb +4482 -0
  233. data/ext/numo/gsl/sf/func_2.5.rb +4508 -0
  234. data/ext/numo/gsl/sf/func_2.6.rb +4538 -0
  235. data/ext/numo/gsl/sf/func_def.rb +4703 -0
  236. data/ext/numo/gsl/sf/parse_sf.rb +277 -0
  237. data/ext/numo/gsl/sf/tmpl/c_DFloat_f_int_x2_DFloat.c +50 -0
  238. data/ext/numo/gsl/sf/tmpl/c_DFloat_f_int_x2_DFloat_x2.c +52 -0
  239. data/ext/numo/gsl/sf/tmpl/c_DFloat_f_int_x3_DFloat_x2.c +55 -0
  240. data/ext/numo/gsl/sf/tmpl/m_DFloat_f_DFloat_mode.c +47 -0
  241. data/ext/numo/gsl/sf/tmpl/m_DFloat_f_lmax_array.c +41 -0
  242. data/ext/numo/gsl/sf/tmpl/m_DFloat_f_nmin_nmax_array.c +49 -0
  243. data/ext/numo/gsl/spmatrix/const_2.2.1.rb +3 -0
  244. data/ext/numo/gsl/spmatrix/const_2.2.rb +3 -0
  245. data/ext/numo/gsl/spmatrix/const_2.3.rb +3 -0
  246. data/ext/numo/gsl/spmatrix/const_def.rb +2 -0
  247. data/ext/numo/gsl/spmatrix/depend +17 -0
  248. data/ext/numo/gsl/spmatrix/erbpp_spmatrix.rb +101 -0
  249. data/ext/numo/gsl/spmatrix/extconf.rb +9 -0
  250. data/ext/numo/gsl/spmatrix/func_2.2.1.rb +297 -0
  251. data/ext/numo/gsl/spmatrix/func_2.2.rb +297 -0
  252. data/ext/numo/gsl/spmatrix/func_2.3.rb +297 -0
  253. data/ext/numo/gsl/spmatrix/func_2.4.rb +300 -0
  254. data/ext/numo/gsl/spmatrix/func_2.5.rb +300 -0
  255. data/ext/numo/gsl/spmatrix/func_2.6.rb +372 -0
  256. data/ext/numo/gsl/spmatrix/func_def.rb +218 -0
  257. data/ext/numo/gsl/spmatrix/parse_spmatrix.rb +70 -0
  258. data/ext/numo/gsl/spmatrix/tmpl/itersolve_iterate.c +47 -0
  259. data/ext/numo/gsl/spmatrix/tmpl/itersolve_new.c +22 -0
  260. data/ext/numo/gsl/spmatrix/tmpl/itersolve_type_new.c +16 -0
  261. data/ext/numo/gsl/spmatrix/tmpl/spblas_dgemm.c +35 -0
  262. data/ext/numo/gsl/spmatrix/tmpl/spblas_dgemv.c +43 -0
  263. data/ext/numo/gsl/spmatrix/tmpl/spmatrix_add.c +22 -0
  264. data/ext/numo/gsl/spmatrix/tmpl/spmatrix_d2sp.c +28 -0
  265. data/ext/numo/gsl/spmatrix/tmpl/spmatrix_new.c +40 -0
  266. data/ext/numo/gsl/spmatrix/tmpl/spmatrix_sp2d.c +25 -0
  267. data/ext/numo/gsl/spmatrix/type_def.rb +1 -0
  268. data/ext/numo/gsl/stats/depend +17 -0
  269. data/ext/numo/gsl/stats/erbpp_stats.rb +30 -0
  270. data/ext/numo/gsl/stats/extconf.rb +9 -0
  271. data/ext/numo/gsl/stats/func_2.2.1.rb +608 -0
  272. data/ext/numo/gsl/stats/func_2.2.rb +608 -0
  273. data/ext/numo/gsl/stats/func_2.3.rb +608 -0
  274. data/ext/numo/gsl/stats/func_2.4.rb +583 -0
  275. data/ext/numo/gsl/stats/func_2.5.rb +718 -0
  276. data/ext/numo/gsl/stats/func_2.6.rb +718 -0
  277. data/ext/numo/gsl/stats/func_def.rb +608 -0
  278. data/ext/numo/gsl/stats/parse_stats.rb +63 -0
  279. data/ext/numo/gsl/stats/tmpl/stats_1a0p.c +37 -0
  280. data/ext/numo/gsl/stats/tmpl/stats_1a0p_index.c +60 -0
  281. data/ext/numo/gsl/stats/tmpl/stats_1a1p.c +41 -0
  282. data/ext/numo/gsl/stats/tmpl/stats_1a2p.c +42 -0
  283. data/ext/numo/gsl/stats/tmpl/stats_2a0p.c +39 -0
  284. data/ext/numo/gsl/stats/tmpl/stats_2a1p.c +43 -0
  285. data/ext/numo/gsl/stats/tmpl/stats_2a2p.c +44 -0
  286. data/ext/numo/gsl/stats/tmpl/stats_minmax.c +37 -0
  287. data/ext/numo/gsl/stats/tmpl/stats_minmax_index.c +67 -0
  288. data/ext/numo/gsl/stats/tmpl/stats_spearman.c +46 -0
  289. data/ext/numo/gsl/sys/const_2.4.rb +20 -0
  290. data/ext/numo/gsl/sys/const_2.5.rb +20 -0
  291. data/ext/numo/gsl/sys/const_2.6.rb +20 -0
  292. data/ext/numo/gsl/sys/const_def.rb +21 -0
  293. data/ext/numo/gsl/sys/depend +17 -0
  294. data/ext/numo/gsl/sys/enum_def.rb +75 -0
  295. data/ext/numo/gsl/sys/erbpp_sys.rb +60 -0
  296. data/ext/numo/gsl/sys/extconf.rb +9 -0
  297. data/ext/numo/gsl/sys/func_2.4.rb +236 -0
  298. data/ext/numo/gsl/sys/func_2.5.rb +236 -0
  299. data/ext/numo/gsl/sys/func_2.6.rb +236 -0
  300. data/ext/numo/gsl/sys/func_def.rb +249 -0
  301. data/ext/numo/gsl/version.h +1 -0
  302. data/ext/numo/gsl/wavelet/depend +17 -0
  303. data/ext/numo/gsl/wavelet/erbpp_wavelet.rb +48 -0
  304. data/ext/numo/gsl/wavelet/extconf.rb +9 -0
  305. data/ext/numo/gsl/wavelet/func_2.4.rb +304 -0
  306. data/ext/numo/gsl/wavelet/func_2.5.rb +304 -0
  307. data/ext/numo/gsl/wavelet/func_2.6.rb +304 -0
  308. data/ext/numo/gsl/wavelet/func_def.rb +337 -0
  309. data/ext/numo/gsl/wavelet/parse_wavelet.rb +47 -0
  310. data/ext/numo/gsl/wavelet/tmpl/wavelet2d_transform.c +56 -0
  311. data/ext/numo/gsl/wavelet/tmpl/wavelet_array_check.c +56 -0
  312. data/ext/numo/gsl/wavelet/tmpl/wavelet_macro.c +1 -0
  313. data/ext/numo/gsl/wavelet/tmpl/wavelet_new.c +20 -0
  314. data/ext/numo/gsl/wavelet/tmpl/wavelet_transform.c +55 -0
  315. data/ext/numo/gsl/wavelet/tmpl/wavelet_transform2.c +22 -0
  316. data/ext/numo/gsl/wavelet/tmpl/wavelet_type_new.c +15 -0
  317. data/ext/numo/gsl/wavelet/type_def.rb +6 -0
  318. data/lib/numo/gsl.rb +17 -0
  319. data/numo-gsl-alt.gemspec +33 -0
  320. metadata +406 -0
@@ -0,0 +1,230 @@
1
+ [{:func_name=>"gsl_rng_alloc",
2
+ :func_type=>"gsl_rng *",
3
+ :args=>[["const gsl_rng_type *", "T"]],
4
+ :desc=>
5
+ "This function returns a pointer to a newly-created\n" +
6
+ "instance of a random number generator of type T.\n" +
7
+ "For example, the following code creates an instance of the Tausworthe\n" +
8
+ "generator,\n" +
9
+ "\n" +
10
+ "gsl_rng * r = gsl_rng_alloc (gsl_rng_taus);\n" +
11
+ "\n" +
12
+ "If there is insufficient memory to create the generator then the\n" +
13
+ "function returns a null pointer and the error handler is invoked with an\n" +
14
+ "error code of GSL_ENOMEM.\n" +
15
+ "\n" +
16
+ "The generator is automatically initialized with the default seed,\n" +
17
+ "gsl_rng_default_seed. This is zero by default but can be changed\n" +
18
+ "either directly or by using the environment variable GSL_RNG_SEED\n" +
19
+ "(Random number environment variables).\n" +
20
+ "\n" +
21
+ "The details of the available generator types are\n" +
22
+ "described later in this chapter."},
23
+ {:func_name=>"gsl_rng_clone",
24
+ :func_type=>"gsl_rng *",
25
+ :args=>[["const gsl_rng *", "r"]],
26
+ :desc=>
27
+ "This function returns a pointer to a newly created generator which is an\n" +
28
+ "exact copy of the generator r."},
29
+ {:func_name=>"gsl_rng_env_setup",
30
+ :func_type=>"const gsl_rng_type *",
31
+ :args=>[["", "void"]],
32
+ :desc=>
33
+ "This function reads the environment variables GSL_RNG_TYPE and\n" +
34
+ "GSL_RNG_SEED and uses their values to set the corresponding\n" +
35
+ "library variables gsl_rng_default and\n" +
36
+ "gsl_rng_default_seed. These global variables are defined as\n" +
37
+ "follows,\n" +
38
+ "\n" +
39
+ "extern const gsl_rng_type *gsl_rng_default\n" +
40
+ "extern unsigned long int gsl_rng_default_seed\n" +
41
+ "\n" +
42
+ "The environment variable GSL_RNG_TYPE should be the name of a\n" +
43
+ "generator, such as taus or mt19937. The environment\n" +
44
+ "variable GSL_RNG_SEED should contain the desired seed value. It\n" +
45
+ "is converted to an unsigned long int using the C library function\n" +
46
+ "strtoul.\n" +
47
+ "\n" +
48
+ "If you don't specify a generator for GSL_RNG_TYPE then\n" +
49
+ "gsl_rng_mt19937 is used as the default. The initial value of\n" +
50
+ "gsl_rng_default_seed is zero.\n"},
51
+ {:func_name=>"gsl_rng_fread",
52
+ :func_type=>"int",
53
+ :args=>[["FILE *", "stream"], ["gsl_rng *", "r"]],
54
+ :desc=>
55
+ "This function reads the random number state into the random number\n" +
56
+ "generator r from the open stream stream in binary format.\n" +
57
+ "The random number generator r must be preinitialized with the\n" +
58
+ "correct random number generator type since type information is not\n" +
59
+ "saved. The return value is 0 for success and GSL_EFAILED if\n" +
60
+ "there was a problem reading from the file. The data is assumed to\n" +
61
+ "have been written in the native binary format on the same\n" +
62
+ "architecture."},
63
+ {:func_name=>"gsl_rng_free",
64
+ :func_type=>"void",
65
+ :args=>[["gsl_rng *", "r"]],
66
+ :desc=>
67
+ "This function frees all the memory associated with the generator\n" +
68
+ "r."},
69
+ {:func_name=>"gsl_rng_fwrite",
70
+ :func_type=>"int",
71
+ :args=>[["FILE *", "stream"], ["const gsl_rng *", "r"]],
72
+ :desc=>
73
+ "This function writes the random number state of the random number\n" +
74
+ "generator r to the stream stream in binary format. The\n" +
75
+ "return value is 0 for success and GSL_EFAILED if there was a\n" +
76
+ "problem writing to the file. Since the data is written in the native\n" +
77
+ "binary format it may not be portable between different architectures."},
78
+ {:func_name=>"gsl_rng_get",
79
+ :func_type=>"unsigned long int",
80
+ :args=>[["const gsl_rng *", "r"]],
81
+ :desc=>
82
+ "This function returns a random integer from the generator r. The\n" +
83
+ "minimum and maximum values depend on the algorithm used, but all\n" +
84
+ "integers in the range [min,max] are equally likely. The\n" +
85
+ "values of min and max can be determined using the auxiliary\n" +
86
+ "functions gsl_rng_max (r) and gsl_rng_min (r)."},
87
+ {:func_name=>"gsl_rng_max",
88
+ :func_type=>"unsigned long int",
89
+ :args=>[["const gsl_rng *", "r"]],
90
+ :desc=>
91
+ "gsl_rng_max returns the largest value that gsl_rng_get\n" + "can return."},
92
+ {:func_name=>"gsl_rng_memcpy",
93
+ :func_type=>"int",
94
+ :args=>[["gsl_rng *", "dest"], ["const gsl_rng *", "src"]],
95
+ :desc=>
96
+ "This function copies the random number generator src into the\n" +
97
+ "pre-existing generator dest, making dest into an exact copy\n" +
98
+ "of src. The two generators must be of the same type."},
99
+ {:func_name=>"gsl_rng_min",
100
+ :func_type=>"unsigned long int",
101
+ :args=>[["const gsl_rng *", "r"]],
102
+ :desc=>
103
+ "gsl_rng_min returns the smallest value that gsl_rng_get\n" +
104
+ "can return. Usually this value is zero. There are some generators with\n" +
105
+ "algorithms that cannot return zero, and for these generators the minimum\n" +
106
+ "value is 1."},
107
+ {:func_name=>"gsl_rng_name",
108
+ :func_type=>"const char *",
109
+ :args=>[["const gsl_rng *", "r"]],
110
+ :desc=>
111
+ "This function returns a pointer to the name of the generator.\n" +
112
+ "For example,\n" +
113
+ "\n" +
114
+ "printf (\"r is a '%s' generator\\n\", \n" +
115
+ " gsl_rng_name (r));\n" +
116
+ "\n" +
117
+ "would print something like r is a 'taus' generator."},
118
+ {:func_name=>"gsl_rng_set",
119
+ :func_type=>"void",
120
+ :args=>[["const gsl_rng *", "r"], ["unsigned long int", "s"]],
121
+ :desc=>
122
+ "This function initializes (or `seeds') the random number generator. If\n" +
123
+ "the generator is seeded with the same value of s on two different\n" +
124
+ "runs, the same stream of random numbers will be generated by successive\n" +
125
+ "calls to the routines below. If different values of $s \\geq 1$\n" +
126
+ "s >= 1 are supplied, then the generated streams of random\n" +
127
+ "numbers should be completely different. If the seed s is zero\n" +
128
+ "then the standard seed from the original implementation is used\n" +
129
+ "instead. For example, the original Fortran source code for the\n" +
130
+ "ranlux generator used a seed of 314159265, and so choosing\n" +
131
+ "s equal to zero reproduces this when using\n" +
132
+ "gsl_rng_ranlux. \n" +
133
+ "\n" +
134
+ "When using multiple seeds with the same generator, choose seed values\n" +
135
+ "greater than zero to avoid collisions with the default setting. \n" +
136
+ "\n" +
137
+ "Note that the most generators only accept 32-bit seeds, with higher\n" +
138
+ "values being reduced modulo $2^{32}$ \n" +
139
+ "2^32. For generators\n" +
140
+ "with smaller ranges the maximum seed value will typically be lower."},
141
+ {:func_name=>"gsl_rng_size",
142
+ :func_type=>"size_t",
143
+ :args=>[["const gsl_rng *", "r"]],
144
+ :desc=>
145
+ "These functions return a pointer to the state of generator r and\n" +
146
+ "its size. You can use this information to access the state directly. For\n" +
147
+ "example, the following code will write the state of a generator to a\n" +
148
+ "stream,\n" +
149
+ "\n" +
150
+ "void * state = gsl_rng_state (r);\n" +
151
+ "size_t n = gsl_rng_size (r);\n" +
152
+ "fwrite (state, n, 1, stream);"},
153
+ {:func_name=>"gsl_rng_state",
154
+ :func_type=>"void *",
155
+ :args=>[["const gsl_rng *", "r"]],
156
+ :desc=>
157
+ "These functions return a pointer to the state of generator r and\n" +
158
+ "its size. You can use this information to access the state directly. For\n" +
159
+ "example, the following code will write the state of a generator to a\n" +
160
+ "stream,\n" +
161
+ "\n" +
162
+ "void * state = gsl_rng_state (r);\n" +
163
+ "size_t n = gsl_rng_size (r);\n" +
164
+ "fwrite (state, n, 1, stream);"},
165
+ {:func_name=>"gsl_rng_types_setup",
166
+ :func_type=>"const gsl_rng_type **",
167
+ :args=>[["", "void"]],
168
+ :desc=>
169
+ "This function returns a pointer to an array of all the available\n" +
170
+ "generator types, terminated by a null pointer. The function should be\n" +
171
+ "called once at the start of the program, if needed. The following code\n" +
172
+ "fragment shows how to iterate over the array of generator types to print\n" +
173
+ "the names of the available algorithms,\n" +
174
+ "\n" +
175
+ "const gsl_rng_type **t, **t0;\n" +
176
+ "\n" +
177
+ "t0 = gsl_rng_types_setup ();\n" +
178
+ "\n" +
179
+ "printf (\"Available generators:\\n\");\n" +
180
+ "\n" +
181
+ "for (t = t0; *t != 0; t++)\n" +
182
+ " @{\n" +
183
+ " printf (\"%s\\n\", (*t)->name);\n" +
184
+ " @}"},
185
+ {:func_name=>"gsl_rng_uniform",
186
+ :func_type=>"double",
187
+ :args=>[["const gsl_rng *", "r"]],
188
+ :desc=>
189
+ "This function returns a double precision floating point number uniformly\n" +
190
+ "distributed in the range [0,1). The range includes 0.0 but excludes 1.0.\n" +
191
+ "The value is typically obtained by dividing the result of\n" +
192
+ "gsl_rng_get(r) by gsl_rng_max(r) + 1.0 in double\n" +
193
+ "precision. Some generators compute this ratio internally so that they\n" +
194
+ "can provide floating point numbers with more than 32 bits of randomness\n" +
195
+ "(the maximum number of bits that can be portably represented in a single\n" +
196
+ "unsigned long int)."},
197
+ {:func_name=>"gsl_rng_uniform_int",
198
+ :func_type=>"unsigned long int",
199
+ :args=>[["const gsl_rng *", "r"], ["unsigned long int", "n"]],
200
+ :desc=>
201
+ "This function returns a random integer from 0 to n-1 inclusive\n" +
202
+ "by scaling down and/or discarding samples from the generator r.\n" +
203
+ "All integers in the range [0,n-1] are produced with equal\n" +
204
+ "probability. For generators with a non-zero minimum value an offset\n" +
205
+ "is applied so that zero is returned with the correct probability.\n" +
206
+ "\n" +
207
+ "Note that this function is designed for sampling from ranges smaller\n" +
208
+ "than the range of the underlying generator. The parameter n\n" +
209
+ "must be less than or equal to the range of the generator r.\n" +
210
+ "If n is larger than the range of the generator then the function\n" +
211
+ "calls the error handler with an error code of GSL_EINVAL and\n" +
212
+ "returns zero.\n" +
213
+ "\n" +
214
+ "In particular, this function is not intended for generating the full range of\n" +
215
+ "unsigned integer values $[0,2^{32}-1]$ \n" +
216
+ "[0,2^32-1]. Instead\n" +
217
+ "choose a generator with the maximal integer range and zero minimum\n" +
218
+ "value, such as gsl_rng_ranlxd1, gsl_rng_mt19937 or\n" +
219
+ "gsl_rng_taus, and sample it directly using\n" +
220
+ "gsl_rng_get. The range of each generator can be found using\n" +
221
+ "the auxiliary functions described in the next section."},
222
+ {:func_name=>"gsl_rng_uniform_pos",
223
+ :func_type=>"double",
224
+ :args=>[["const gsl_rng *", "r"]],
225
+ :desc=>
226
+ "This function returns a positive double precision floating point number\n" +
227
+ "uniformly distributed in the range (0,1), excluding both 0.0 and 1.0.\n" +
228
+ "The number is obtained by sampling the generator with the algorithm of\n" +
229
+ "gsl_rng_uniform until a non-zero value is obtained. You can use\n" +
230
+ "this function if you need to avoid a singularity at 0.0."}]
@@ -0,0 +1,126 @@
1
+ require_relative "../gen/erbpp_gsl"
2
+
3
+ class DefRng < DefGslClass
4
+ def lookup(h)
5
+ case h
6
+ when FM(name:/_free$/); false
7
+ when FM(name:/_alloc$/); "rng_alloc"
8
+ when FM(tp, type:dbl); "rng_DFloat"
9
+ when FM(tp, ulong, type:ulong); "rng_UInt"
10
+ when FM(tp, type:str); "c_str_f_void"
11
+ when FM(tp, type:szt); "c_sizet_f_void"
12
+ when FM(tp, type:ulong); "c_ulong_f_void"
13
+ when FM(tp, type:tp); "c_other_f_void"
14
+ when FM(tp, ulong); "c_void_f_ulong"
15
+ when FM(tp, tp); "c_self_f_other"
16
+ end
17
+ end
18
+
19
+ def check_func(h)
20
+ if t = lookup(h)
21
+ m = h[:func_name].sub(/^gsl_rng_/,"")
22
+ DefMethod.new(self, t, name:m, **h)
23
+ if /_alloc$/ =~ h[:func_name]
24
+ read_type.each do |tp|
25
+ DefSubclassNew.new(self, "rng_type_new", tp, **h)
26
+ end
27
+ end
28
+ return true
29
+ end
30
+ $stderr.puts "skip #{h[:func_name]}"
31
+ false
32
+ end
33
+ end
34
+
35
+ # ----------------------------------------------------------
36
+
37
+ class DefRan < DefGslModule
38
+ def lookup(h)
39
+ dblbk = [dbl,/\[\]/]
40
+ uintbk = [uint,/\[\]/]
41
+ case h
42
+ when FM(tp, type:dbl); "ran"
43
+ when FM(tp, dbl, type:dbl); "ran"
44
+ when FM(tp, *[dbl]*2, type:dbl); "ran"
45
+ when FM(tp, dbl, type:uint); "ran"
46
+ when FM(tp, *[dbl]*2, type:uint); "ran"
47
+ when FM(tp, dbl,uint, type:uint); "ran"
48
+ when FM(tp, *[uint]*3, type:uint); "ran"
49
+ when FM(tp, *[dbl]*3,*[dblp]*2,); "ran_DFloat_x2"
50
+ when FM(tp, *[dblp]*2,); "ran_DFloat_x2"
51
+ when FM(tp, *[dblp]*3,); "ran_DFloat_x3"
52
+ when FM(tp, szt,dblp,); false
53
+ when FM(tp, szt,*[dblbk]*2); "ran_DFloat_f_DFloat"
54
+ when FM(tp, szt,uint,dblbk,uintbk); "ran_multinomial"
55
+ end
56
+ end
57
+
58
+ def define_method(t,**h)
59
+ RanMethod.new(self, t, **h)
60
+ end
61
+ end
62
+
63
+
64
+ class RanMethod < DefMethod
65
+
66
+ def initialize(parent,tmpl,**h)
67
+ name = h[:func_name].sub(/^gsl_ran_/,"")
68
+ super(parent, tmpl, name:name, **h)
69
+
70
+ args = get(:args).dup
71
+ unless /gsl_rng */ =~ args.shift[0]
72
+ $stderr.puts h.inspect
73
+ raise
74
+ end
75
+ if desc
76
+ desc.gsub!(/@{/,"[")
77
+ desc.gsub!(/@}/,"]")
78
+ end
79
+
80
+ case h[:func_type]
81
+ when "double"
82
+ set func_type_var: "cDF"
83
+ set ret_class: "Float or DFloat"
84
+ when "unsigned int"
85
+ set func_type_var: "cUInt"
86
+ set ret_class: "Integer or UInt"
87
+ end
88
+
89
+ @an = []
90
+ @vn = []
91
+ @vardef = []
92
+ @varconv = []
93
+ @params = []
94
+
95
+ unknown = false
96
+ args.each_with_index do |tn,i|
97
+ if /^\w+$/ !~ tn[1] # pointer?
98
+ unknown = true
99
+ break
100
+ end
101
+ a = "a#{i}"
102
+ v = "v#{i}"
103
+ case tn[0]
104
+ when "double"
105
+ @varconv << "#{a} = NUM2DBL(#{v});"
106
+ @params << [tn[1],"Float"]
107
+ when "unsigned int"
108
+ @varconv << "#{a} = NUM2UINT(#{v});"
109
+ @params << [tn[1],"Integer"]
110
+ when "double *"
111
+ # skip
112
+ next
113
+ else
114
+ unknown = true
115
+ break
116
+ end
117
+ @vn << v
118
+ @an << a
119
+ @vardef << "#{tn[0]} #{a}"
120
+ end
121
+ if unknown
122
+ $stderr.puts "not defined: #{name} #{h[:args].inspect}"
123
+ end
124
+ end
125
+
126
+ end
@@ -0,0 +1,44 @@
1
+ /*
2
+ @overload <%= name %>(<%@params.each{|x|%><%=x[0]%>,<%}%>[shape])
3
+ <% @params.each do |x|%>
4
+ @param [<%=x[1]%>] <%=x[0]%><% end %>
5
+ @param [Array or Integer] shape (optional) shape for result NArray
6
+ @return [<%=get(:ret_class)%>] returns random number
7
+
8
+ <%= desc %>
9
+
10
+ */
11
+ static VALUE
12
+ <%=c_func(-1)%>(int argc, VALUE *argv, VALUE self)
13
+ {
14
+ VALUE vshape, vna;
15
+ size_t i, size;
16
+ int nargs;
17
+ <%=func_type%> *ptr;
18
+ <% @vn.each do |v|%>
19
+ VALUE <%=v%>;<% end %>
20
+ <% @vardef.each do |x|%>
21
+ <%=x%>;<% end %>
22
+ gsl_rng *r;
23
+
24
+ TypedData_Get_Struct(self, <%=struct%>, &<%=data_type_var%>, r);
25
+
26
+ nargs = rb_scan_args(argc, argv, "<%=@params.size%>1" <%@vn.map{|v|%>, &<%=v%><%}%>, &vshape);
27
+ <% @varconv.each do |x|%><%=x%>
28
+ <% end %>
29
+ if (nargs == <%=@params.size%>) {
30
+ <% if func_type == ErbppGsl.uint %>
31
+ return ULONG2NUM(<%=func_name%>(r <%@an.map{|a|%>, <%=a%><%}%>));
32
+ <% else %>
33
+ return rb_float_new(<%=func_name%>(r <%@an.map{|a|%>, <%=a%><%}%>));
34
+ <% end %>
35
+ } else {
36
+ vna = create_new_narray(<%=get(:func_type_var)%>,vshape);
37
+ ptr = (<%=func_type%>*)na_get_pointer_for_write(vna);
38
+ size = RNARRAY_SIZE(vna);
39
+ for (i=0; i<size; i++) {
40
+ ptr[i] = <%=func_name%>(r <%@an.map{|a|%>, <%=a%><%}%>);
41
+ }
42
+ return vna;
43
+ }
44
+ }
@@ -0,0 +1,28 @@
1
+ /*
2
+ @overload <%=name%>(<%=args[2][1]%>)
3
+ @param [DFloat] <%=args[2][1]%>
4
+ @return [DFloat] <%=args[3][1]%>
5
+
6
+ <%= desc %>
7
+
8
+ */
9
+ static VALUE
10
+ <%=c_func(1)%>(VALUE self, VALUE valpha)
11
+ {
12
+ VALUE vtheta;
13
+ double *alpha, *theta;
14
+ narray_t *na;
15
+ gsl_rng *r;
16
+
17
+ TypedData_Get_Struct(self, <%=struct%>, &<%=data_type_var%>, r);
18
+
19
+ valpha = cast_1d_contiguous(valpha, cDF);
20
+ GetNArray(valpha,na);
21
+ vtheta = rb_narray_new(cDF,na->ndim,na->shape);
22
+ theta = (double*)na_get_pointer_for_write(vtheta);
23
+ alpha = (double*)na_get_pointer_for_read(valpha);
24
+
25
+ <%=func_name%>(r, na->size, alpha, theta);
26
+ RB_GC_GUARD(valpha);
27
+ return vtheta;
28
+ }
@@ -0,0 +1,45 @@
1
+ /*
2
+ @overload <%= name %>(<%@params.each{|x|%><%=x[0]%>,<%}%>[shape])
3
+ <% @params.each do |x|%>
4
+ @param [<%=x[1]%>] <%=x[0]%><% end %>
5
+ @param [Array or Integer] shape (optional) shape for result NArray
6
+ @return [<%=get(:ret_class)%>] returns random number
7
+
8
+ <%= desc %>
9
+
10
+ */
11
+ static VALUE
12
+ <%=c_func(-1)%>(int argc, VALUE *argv, VALUE self)
13
+ {
14
+ VALUE vshape, vx, vy;
15
+ size_t i, size;
16
+ int nargs;
17
+ double x, y;
18
+ double *px, *py;
19
+ <% @vn.each do |v|%>
20
+ VALUE <%=v%>;<% end %>
21
+ <% @vardef.each do |x|%>
22
+ <%=x%>;<% end %>
23
+ gsl_rng *r;
24
+
25
+ TypedData_Get_Struct(self, <%=struct%>, &<%=data_type_var%>, r);
26
+
27
+ nargs = rb_scan_args(argc, argv, "<%=@params.size%>1" <%@vn.map{|v|%>, &<%=v%><%}%>, &vshape);
28
+ <% @varconv.each do |x|%>
29
+ <%=x%><% end %>
30
+ if (nargs == <%=@params.size%>) {
31
+ <%=func_name%>(r <%@an.map{|a|%>, <%=a%><%}%>, &x, &y);
32
+ return rb_assoc_new(DBL2NUM(x),DBL2NUM(y));
33
+ } else {
34
+ vx = create_new_narray(cDF,vshape);
35
+ vy = create_new_narray(cDF,vshape);
36
+ px = (double*)na_get_pointer_for_write(vx);
37
+ py = (double*)na_get_pointer_for_write(vy);
38
+ size = RNARRAY_SIZE(vx);
39
+ for (i=0; i<size; i++) {
40
+ <%=func_name%>(r <%@an.map{|a|%>, <%=a%><%}%>, px, py);
41
+ px++; py++;
42
+ }
43
+ return rb_assoc_new(vx,vy);
44
+ }
45
+ }
@@ -0,0 +1,51 @@
1
+ /*
2
+ @overload <%= name %>(<%@params.each{|x|%><%=x[0]%>,<%}%>[shape])
3
+ <% @params.each do |x|%>
4
+ @param [<%=x[1]%>] <%=x[0]%><% end %>
5
+ @param [Array or Integer] shape (optional) shape for result Numo::NArray
6
+ @return [Array] returns array of [x,y,z], where x,y,z are Float or Numo::DFloat
7
+
8
+ <%= desc %>
9
+
10
+ */
11
+ static VALUE
12
+ <%=c_func(-1)%>(int argc, VALUE *argv, VALUE self)
13
+ {
14
+ VALUE vshape;
15
+ VALUE v[3];
16
+ size_t i, size;
17
+ int nargs;
18
+ double x, y, z;
19
+ double *px, *py, *pz;
20
+ <% @vn.each do |v|%>
21
+ VALUE <%=v%>;<% end %>
22
+ <% @vardef.each do |x|%>
23
+ <%=x%>;<% end %>
24
+ gsl_rng *r;
25
+
26
+ TypedData_Get_Struct(self, <%=struct%>, &<%=data_type_var%>, r);
27
+
28
+ nargs = rb_scan_args(argc, argv, "<%=@params.size%>1" <%@vn.map{|v|%>, &<%=v%><%}%>, &vshape);
29
+ <% @varconv.each do |x|%>
30
+ <%=x%><% end %>
31
+ if (nargs == <%=@params.size%>) {
32
+ <%=func_name%>(r <%@an.map{|a|%>, <%=a%><%}%>, &x, &y, &z);
33
+ v[0] = DBL2NUM(x);
34
+ v[1] = DBL2NUM(y);
35
+ v[2] = DBL2NUM(z);
36
+ return rb_ary_new4(3,v);
37
+ } else {
38
+ v[0] = create_new_narray(cDF,vshape);
39
+ v[1] = create_new_narray(cDF,vshape);
40
+ v[2] = create_new_narray(cDF,vshape);
41
+ px = (double*)na_get_pointer_for_write(v[0]);
42
+ py = (double*)na_get_pointer_for_write(v[1]);
43
+ pz = (double*)na_get_pointer_for_write(v[2]);
44
+ size = RNARRAY_SIZE(v[0]);
45
+ for (i=0; i<size; i++) {
46
+ <%=func_name%>(r <%@an.map{|a|%>, <%=a%><%}%>, px, py, pz);
47
+ px++; py++; pz++;
48
+ }
49
+ return rb_ary_new4(3,v);
50
+ }
51
+ }
@@ -0,0 +1,32 @@
1
+ /*
2
+ @overload <%=name%>(<%=args[2][1]%>, <%=args[3][1]%>)
3
+ @param [Integer] <%=args[2][1]%>
4
+ @param [DFloat] <%=args[3][1]%>
5
+ @return [UInt] <%=args[4][1]%>
6
+
7
+ <%= desc %>
8
+
9
+ */
10
+ static VALUE
11
+ <%=c_func(2)%>(VALUE self, VALUE vN, VALUE vp)
12
+ {
13
+ VALUE vn;
14
+ double *p;
15
+ unsigned int *n;
16
+ unsigned int N;
17
+ narray_t *na;
18
+ gsl_rng *r;
19
+
20
+ TypedData_Get_Struct(self, <%=struct%>, &<%=data_type_var%>, r);
21
+
22
+ N = NUM2UINT(vN);
23
+ vp = cast_1d_contiguous(vp, cDF);
24
+ GetNArray(vp,na);
25
+ p = (double*)na_get_pointer_for_read(vp);
26
+ vn = rb_narray_new(cUInt,na->ndim,na->shape);
27
+ n = (unsigned int*)na_get_pointer_for_write(vn);
28
+
29
+ <%=func_name%>(r, na->size, N, p, n);
30
+ RB_GC_GUARD(vp);
31
+ return vn;
32
+ }
@@ -0,0 +1,29 @@
1
+ /*
2
+ @overload <%=name%>([shape])
3
+ @param [Array or Integer] shape (optional) shape for result NArray
4
+ @return [Float or DFloat] returns random number
5
+
6
+ <%= desc %>
7
+ */
8
+ static VALUE
9
+ <%=c_func(-1)%>(int argc, VALUE *argv, VALUE self)
10
+ {
11
+ VALUE vshape, vna;
12
+ size_t i, size;
13
+ double *ptr;
14
+ <%=struct%> *r;
15
+
16
+ TypedData_Get_Struct(self, <%=struct%>, &<%=data_type_var%>, r);
17
+
18
+ if (rb_scan_args(argc, argv, "01", &vshape) == 0) {
19
+ return rb_float_new(<%=func_name%>(r));
20
+ } else {
21
+ vna = create_new_narray(cDF,vshape);
22
+ ptr = (double*)na_get_pointer_for_write(vna);
23
+ size = RNARRAY_SIZE(vna);
24
+ for (i=0; i<size; i++) {
25
+ ptr[i] = <%=func_name%>(r);
26
+ }
27
+ return vna;
28
+ }
29
+ }
@@ -0,0 +1,44 @@
1
+ /*
2
+ @overload <%=name%>(n,[shape])
3
+ @param [Integer] n
4
+ @param [Array or Integer] shape (optional) shape for result NArray
5
+ @return [Integer or UInt32/UInt64] returns random number
6
+
7
+ <%= desc %>
8
+ */
9
+ static VALUE
10
+ <%=c_func(-1)%>(int argc, VALUE *argv, VALUE self)
11
+ {
12
+ VALUE vshape, vna, vn;
13
+ size_t i, size;
14
+ int nargs;
15
+ unsigned long n;
16
+ u_int32_t *p32;
17
+ u_int64_t *p64;
18
+ <%=struct%> *r;
19
+
20
+ TypedData_Get_Struct(self, <%=struct%>, &<%=data_type_var%>, r);
21
+
22
+ nargs = rb_scan_args(argc, argv, "11", &vn, &vshape);
23
+ n = NUM2ULONG(vn);
24
+ if (nargs == 1) {
25
+ return ULONG2NUM(<%=func_name%>(r, n));
26
+ } else {
27
+ if (n > 4294967295ul) {
28
+ vna = create_new_narray(numo_cUInt64,vshape);
29
+ p64 = (u_int64_t*)na_get_pointer_for_write(vna);
30
+ size = RNARRAY_SIZE(vna);
31
+ for (i=0; i<size; i++) {
32
+ p64[i] = (u_int64_t)<%=func_name%>(r, n);
33
+ }
34
+ } else {
35
+ vna = create_new_narray(numo_cUInt32,vshape);
36
+ p32 = (u_int32_t*)na_get_pointer_for_write(vna);
37
+ size = RNARRAY_SIZE(vna);
38
+ for (i=0; i<size; i++) {
39
+ p32[i] = (u_int32_t)<%=func_name%>(r, n);
40
+ }
41
+ }
42
+ return vna;
43
+ }
44
+ }
@@ -0,0 +1,24 @@
1
+ <%
2
+ set name: "new"
3
+ set singleton: true
4
+ %>
5
+ /*
6
+ :nodoc:
7
+ */
8
+ static VALUE
9
+ <%=c_func(:nodef)%>(int argc, VALUE *argv, VALUE self, const <%=type_struct%> *t)
10
+ {
11
+ <%=struct%> *w;
12
+
13
+ if (argc > 1) {
14
+ rb_raise(rb_eArgError,"wrong number of arguments (given %d, expected 0..1)", argc);
15
+ }
16
+ w = <%=func_name%>(t);
17
+ if (!w) {
18
+ rb_raise(rb_eNoMemError,"fail to allocate struct");
19
+ }
20
+ if (argc == 1) {
21
+ gsl_rng_set(w, NUM2ULONG(argv[0]));
22
+ }
23
+ return TypedData_Wrap_Struct(<%=class_var%>, &<%=data_type_var%>, (void*)w);
24
+ }
@@ -0,0 +1,14 @@
1
+ /*
2
+ @overload <%=name%>([seed])
3
+ @param [Integer] seed Random seed.
4
+
5
+ Generate an instance of <%=full_class_name%>::<%=subtype_class%> class,
6
+ a subclass of <%=full_class_name%> class with <%=subtype_var%> type.
7
+
8
+ <%= desc %>
9
+ */
10
+ static VALUE
11
+ <%=c_func(-1)%>(int argc, VALUE *argv, VALUE self)
12
+ {
13
+ return <%=c_superclass_new%>(argc, argv, self, <%=subtype_var%>);
14
+ }