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,50 @@
1
+ static void
2
+ iter_<%=c_func%>(na_loop_t *const lp)
3
+ {
4
+ size_t n;
5
+ char *p1,*p2;
6
+ double *p3,*p4,*p5;
7
+ ssize_t s1, s2;
8
+
9
+ n = lp->args[0].shape[0];
10
+ INIT_PTR(lp, 0, p1, s1);
11
+ INIT_PTR(lp, 1, p2, s2);
12
+ p3 = (double*)GET_PTR(lp,2);
13
+ p4 = (double*)GET_PTR(lp,3);
14
+ p5 = (double*)GET_PTR(lp,4);
15
+
16
+ <%=func_name%>((double*)p1,s1/sizeof(double),
17
+ (double*)p2,s2/sizeof(double),
18
+ n,p3,p4,p5);
19
+ }
20
+
21
+ /*
22
+ @overload <%=name%>(<%=args[0][1]%>,<%=args[2][1]%>)
23
+ @param [DFloat] <%=args[0][1]%> (input array)
24
+ @param [DFloat] <%=args[2][1]%> (input array)
25
+ @return [GSL::Fit::<%=result_class%>] result Struct with members: <%=args[5][1]%>, <%=args[6][1]%>, <%=args[7][1]%>.
26
+
27
+ <%=desc%>
28
+
29
+ */
30
+ static VALUE
31
+ <%=c_func(2)%>(VALUE mod, VALUE v1, VALUE v2)
32
+ {
33
+ VALUE r, result;
34
+ ndfunc_arg_in_t ain[2] = {{cDF,1},{cDF,1}};
35
+ ndfunc_arg_out_t aout[3] = {{cDF,0},{cDF,0},{cDF,0}};
36
+ ndfunc_t ndf = { iter_<%=c_func%>, STRIDE_LOOP_NIP|NDF_EXTRACT,
37
+ 2, 3, ain, aout };
38
+ narray_t *x,*y;
39
+
40
+ GetNArray(v1,x);
41
+ GetNArray(v2,y);
42
+ CHECK_GE_1D(x);
43
+ CHECK_GE_1D(y);
44
+ CHECK_SIZE_EQ(VEC_SIZE(x),VEC_SIZE(y),"x size does not match y size");
45
+
46
+ r = na_ndloop(&ndf, 2, v1, v2);
47
+ result = rb_class_new_instance(3, RARRAY_PTR(r), c<%=result_class%>);
48
+ RB_GC_GUARD(r);
49
+ return result;
50
+ }
@@ -0,0 +1,47 @@
1
+ static void
2
+ iter_<%=c_func%>(na_loop_t *const lp)
3
+ {
4
+ size_t i;
5
+ char *p1,*p2,*p3,*p4,*p5;
6
+ ssize_t s1, s2, s3, s4, s5;
7
+ double x,c1,cov11,y,ye;
8
+
9
+ INIT_COUNTER(lp, i);
10
+ INIT_PTR(lp, 0, p1, s1);
11
+ INIT_PTR(lp, 1, p2, s2);
12
+ INIT_PTR(lp, 2, p3, s3);
13
+ INIT_PTR(lp, 3, p4, s4);
14
+ INIT_PTR(lp, 4, p5, s5);
15
+
16
+ for (; i--; ) {
17
+ GET_DATA_STRIDE(p1,s1,double,x);
18
+ GET_DATA_STRIDE(p2,s2,double,c1);
19
+ GET_DATA_STRIDE(p3,s3,double,cov11);
20
+ <%=func_name%>(x, c1, cov11, &y, &ye);
21
+ SET_DATA_STRIDE(p4,s4,double,y);
22
+ SET_DATA_STRIDE(p5,s5,double,ye);
23
+ }
24
+ }
25
+
26
+ /*
27
+ @overload <%=name%>(<%=args[0][1]%>, mul_result)
28
+ @param [DFloat] <%=args[0][1]%>
29
+ @param [(M|Wm)ulResult] mul_result Result of GSL::Fit.mul|wmul
30
+ @return [[DFloat,DFloat]] array of [<%=args[3][1]%>,<%=args[4][1]%>]
31
+
32
+ <%=desc%>
33
+
34
+ */
35
+ static VALUE
36
+ <%=c_func(2)%>(VALUE mod, VALUE v1, VALUE v2)
37
+ {
38
+ ndfunc_arg_in_t ain[3] = {{cDF,0},{cDF,0},{cDF,0}};
39
+ ndfunc_arg_out_t aout[2] = {{cDF,0},{cDF,0}};
40
+ ndfunc_t ndf = { iter_<%=c_func%>, STRIDE_LOOP_NIP|NDF_EXTRACT,
41
+ 3, 2, ain, aout };
42
+ VALUE c1, cov11;
43
+
44
+ c1 = RSTRUCT_GET(v2,0);
45
+ cov11 = RSTRUCT_GET(v2,1);
46
+ return na_ndloop(&ndf, 3, v1, c1, cov11);
47
+ }
@@ -0,0 +1,59 @@
1
+ static void
2
+ iter_<%=c_func%>(na_loop_t *const lp)
3
+ {
4
+ size_t n;
5
+ char *p1,*p2,*p3;
6
+ double *p4,*p5,*p6,*p7,*p8,*p9;
7
+ ssize_t s1, s2, s3;
8
+
9
+ n = lp->args[0].shape[0];
10
+ INIT_PTR(lp, 0, p1, s1);
11
+ INIT_PTR(lp, 1, p2, s2);
12
+ INIT_PTR(lp, 2, p3, s3);
13
+ p4 = (double*)GET_PTR(lp,3);
14
+ p5 = (double*)GET_PTR(lp,4);
15
+ p6 = (double*)GET_PTR(lp,5);
16
+ p7 = (double*)GET_PTR(lp,6);
17
+ p8 = (double*)GET_PTR(lp,7);
18
+ p9 = (double*)GET_PTR(lp,8);
19
+
20
+ <%=func_name%>((double*)p1,s1/sizeof(double),
21
+ (double*)p2,s2/sizeof(double),
22
+ (double*)p3,s3/sizeof(double),
23
+ n,p4,p5,p6,p7,p8,p9);
24
+ }
25
+
26
+ /*
27
+ @overload <%=name%>(<%=args[0][1]%>,<%=args[2][1]%>,<%=args[4][1]%>)
28
+ @param [DFloat] <%=args[0][1]%> (input array)
29
+ @param [DFloat] <%=args[2][1]%> (input array)
30
+ @param [DFloat] <%=args[4][1]%> (input array)
31
+ @return [GSL::Fit::<%=result_class%>] result Struct with members: <%=args[7][1]%>, <%=args[8][1]%>, <%=args[9][1]%>, <%=args[10][1]%>, <%=args[11][1]%>, <%=args[12][1]%>.
32
+
33
+ <%=desc%>
34
+
35
+ */
36
+ static VALUE
37
+ <%=c_func(3)%>(VALUE mod, VALUE v1, VALUE v2, VALUE v3)
38
+ {
39
+ ndfunc_arg_in_t ain[3] = {{cDF,1},{cDF,1},{cDF,1}};
40
+ ndfunc_arg_out_t aout[6] = {{cDF,0},{cDF,0},{cDF,0},{cDF,0},{cDF,0},{cDF,0}};
41
+ ndfunc_t ndf = { iter_<%=c_func%>, STRIDE_LOOP_NIP|NDF_EXTRACT,
42
+ 3, 6, ain, aout };
43
+ narray_t *x, *y, *w;
44
+ VALUE r, result;
45
+
46
+ GetNArray(v1,x);
47
+ GetNArray(v2,y);
48
+ GetNArray(v3,w);
49
+ CHECK_GE_1D(x);
50
+ CHECK_GE_1D(y);
51
+ CHECK_GE_1D(w);
52
+ CHECK_SIZE_EQ(VEC_SIZE(x),VEC_SIZE(y),"y size does not match x size");
53
+ CHECK_SIZE_EQ(VEC_SIZE(x),VEC_SIZE(w),"w size does not match x size");
54
+
55
+ r = na_ndloop(&ndf, 3, v1, v2, v3);
56
+ result = rb_class_new_instance(6, RARRAY_PTR(r), c<%=result_class%>);
57
+ RB_GC_GUARD(r);
58
+ return result;
59
+ }
@@ -0,0 +1,56 @@
1
+ static void
2
+ iter_<%=c_func%>(na_loop_t *const lp)
3
+ {
4
+ size_t n;
5
+ char *p1,*p2,*p3;
6
+ double *p4,*p5,*p6;
7
+ ssize_t s1, s2, s3;
8
+
9
+ n = lp->args[0].shape[0];
10
+ INIT_PTR(lp, 0, p1, s1);
11
+ INIT_PTR(lp, 1, p2, s2);
12
+ INIT_PTR(lp, 2, p3, s3);
13
+ p4 = (double*)GET_PTR(lp,3);
14
+ p5 = (double*)GET_PTR(lp,4);
15
+ p6 = (double*)GET_PTR(lp,5);
16
+
17
+ <%=func_name%>((double*)p1,s1/sizeof(double),
18
+ (double*)p2,s2/sizeof(double),
19
+ (double*)p3,s3/sizeof(double),
20
+ n,p4,p5,p6);
21
+ }
22
+
23
+ /*
24
+ @overload <%=name%>(<%=args[0][1]%>,<%=args[2][1]%>,<%=args[4][1]%>)
25
+ @param [DFloat] <%=args[0][1]%> (input array)
26
+ @param [DFloat] <%=args[2][1]%> (input array)
27
+ @param [DFloat] <%=args[4][1]%> (input array)
28
+ @return [GSL::Fit::<%=result_class%>] result Struct with members: <%=args[7][1]%>, <%=args[8][1]%>, <%=args[9][1]%>.
29
+
30
+ <%=desc%>
31
+
32
+ */
33
+ static VALUE
34
+ <%=c_func(3)%>(VALUE mod, VALUE v1, VALUE v2, VALUE v3)
35
+ {
36
+ VALUE r, result;
37
+ ndfunc_arg_in_t ain[3] = {{cDF,1},{cDF,1},{cDF,1}};
38
+ ndfunc_arg_out_t aout[3] = {{cDF,0},{cDF,0},{cDF,0}};
39
+ ndfunc_t ndf = { iter_<%=c_func%>, STRIDE_LOOP_NIP|NDF_EXTRACT,
40
+ 3, 3, ain, aout };
41
+ narray_t *x,*y,*w;
42
+
43
+ GetNArray(v1,x);
44
+ GetNArray(v2,y);
45
+ GetNArray(v3,w);
46
+ CHECK_GE_1D(x);
47
+ CHECK_GE_1D(y);
48
+ CHECK_GE_1D(w);
49
+ CHECK_SIZE_EQ(VEC_SIZE(x),VEC_SIZE(y),"y size does not match x size");
50
+ CHECK_SIZE_EQ(VEC_SIZE(x),VEC_SIZE(w),"w size does not match x size");
51
+
52
+ r = na_ndloop(&ndf, 3, v1, v2, v3);
53
+ result = rb_class_new_instance(3, RARRAY_PTR(r), c<%=result_class%>);
54
+ RB_GC_GUARD(r);
55
+ return result;
56
+ }
@@ -0,0 +1,132 @@
1
+ require 'erb'
2
+
3
+ class ErbPP
4
+
5
+ class CountLnString < String
6
+
7
+ def initialize(filename)
8
+ @filename = filename
9
+ @lnchar = "\n"
10
+ @buf = ""
11
+ @str = ""
12
+ @countln = 1
13
+ @current = 1
14
+ super("\n"+report_line)
15
+ end
16
+
17
+ def report_line
18
+ "#line #{@current} \"#{@filename}\"\n"
19
+ end
20
+
21
+ def concat0(s)
22
+ ln(caller[0])
23
+ @buf.concat(s)
24
+ @str.concat(s)
25
+ end
26
+
27
+ def concat1(s)
28
+ ln(caller[0])
29
+ @buf.concat(s)
30
+ end
31
+
32
+ def ln(status=nil)
33
+ case status
34
+ when /:(\d+):/
35
+ n = $1.to_i
36
+ else
37
+ n = status.to_i
38
+ end
39
+ return if n == @current
40
+ if @current != @countln || @postpone
41
+ if /\A\s*\z/ =~ @str || /\A#line / =~ @buf
42
+ @postpone = true
43
+ elsif @in_comment
44
+ @postpone = false
45
+ else
46
+ if self[-1] != "\n"
47
+ concat("\n")
48
+ end
49
+ concat(report_line)
50
+ @postpone = false
51
+ end
52
+ end
53
+ concat(@buf)
54
+
55
+ b = @buf.gsub(/".*?(?<!\\)"/,'""')
56
+ /^.*(\/\*)(.*?)$/ =~ b
57
+ x = $2
58
+ /^.*(\*\/)(.*?)$/ =~ b
59
+ y = $2
60
+ if x
61
+ if y
62
+ if x.size < y.size
63
+ #:in_comment
64
+ @in_comment = true
65
+ else
66
+ #:out_comment
67
+ @in_comment = false
68
+ end
69
+ else
70
+ #:in_comment
71
+ @in_comment = true
72
+ end
73
+ else
74
+ if y
75
+ #:out_comment
76
+ @in_comment = false
77
+ else
78
+ #:keep
79
+ end
80
+ end
81
+
82
+ @countln = @current + @buf.count(@lnchar)
83
+ @current = n
84
+ @buf = ""
85
+ @str = ""
86
+ end
87
+
88
+ def d(s)
89
+ p [s, [x,y], r]
90
+ r
91
+ end
92
+
93
+ def final
94
+ ln(caller[0])
95
+ concat(@buf)
96
+ end
97
+
98
+ end
99
+
100
+ class ERBLN
101
+
102
+ def initialize(str, filename, trim_mode=nil, eoutvar='_erbout')
103
+ @filename = filename
104
+ compiler = ERB::Compiler.new(trim_mode)
105
+ set_eoutvar(compiler, eoutvar)
106
+ @src, @enc = *compiler.compile(str)
107
+ end
108
+
109
+ def set_eoutvar(compiler, eoutvar = '_erbout')
110
+ compiler.put_cmd = "#{eoutvar}.concat0"
111
+ compiler.insert_cmd = "#{eoutvar}.concat1"
112
+ compiler.pre_cmd = ["#{eoutvar} = CountLnString.new(#{@filename.inspect})"]
113
+ compiler.post_cmd = ["#{eoutvar}.final"]
114
+ end
115
+
116
+ def run(b)
117
+ print self.result(b)
118
+ end
119
+
120
+ def result(b)
121
+ #open("tmpout","a") do |f|
122
+ # f.puts "\n#file:#{@filename}"
123
+ # f.puts @src
124
+ #end
125
+ eval(@src, b, (@filename || '(erb)'), 0)
126
+ end
127
+
128
+ #require "fileutils"
129
+ #FileUtils.rm_f("tmpout")
130
+ end
131
+
132
+ end
@@ -0,0 +1,344 @@
1
+ require "erb"
2
+ require_relative "erbln"
3
+
4
+ class ErbPP
5
+
6
+ def initialize(parent=nil, erb_base=nil, **opts, &block)
7
+ @parent = parent
8
+ @children = []
9
+ @opts = opts
10
+ set erb_base: erb_base if erb_base
11
+ @parent.add_child(self) if @parent
12
+ instance_eval(&block) if block
13
+ end
14
+
15
+ attr_reader :children
16
+ attr_accessor :parent
17
+
18
+ def add_child(child)
19
+ @children.push(child)
20
+ end
21
+
22
+ def set(**opts)
23
+ @opts.merge!(opts)
24
+ end
25
+
26
+ def get(key, *args, &block)
27
+ if respond_to?(key)
28
+ return send(key, *args, &block)
29
+ end
30
+ if args.empty? && block.nil? && @opts.has_key?(key)
31
+ return @opts[key]
32
+ end
33
+ if @parent
34
+ return @parent.get(key, *args, &block)
35
+ end
36
+ nil
37
+ end
38
+
39
+ def description
40
+ if s = @opts[:description] || @opts[:desc]
41
+ s.gsub(/\@\{/,"[").gsub(/\@\}/,"]")
42
+ end
43
+ end
44
+
45
+ alias desc description
46
+
47
+ alias method_missing_alias method_missing
48
+
49
+ def method_missing(_meth_id, *args, &block)
50
+ if args.empty?
51
+ #$stderr.puts _meth_id.inspect
52
+ v = get(_meth_id, *args, &block)
53
+ return v if !v.nil?
54
+ end
55
+ method_missing_alias(_meth_id, *args, &block)
56
+ end
57
+
58
+ # ERB Loader
59
+
60
+ def load_erb(base_name)
61
+ safe_level = nil
62
+ trim_mode = '%<>'
63
+ file = base_name + get(:erb_suffix)
64
+ dirs = get(:erb_dir)
65
+ dirs = [dirs] if !dirs.kind_of?(Array)
66
+ dirs.each do |x|
67
+ Dir.glob(x).each do |dir|
68
+ path = File.join(dir,file)
69
+ if File.exist?(path)
70
+ if get(:line_number)
71
+ erb = ERBLN.new(File.read(path), path, trim_mode)
72
+ else
73
+ erb = ERB.new(File.read(path), safe_level, trim_mode)
74
+ erb.filename = path
75
+ end
76
+ return erb
77
+ end
78
+ end
79
+ end
80
+ raise "file not found: #{file.inspect} in #{dirs.inspect}"
81
+ end
82
+
83
+ def run
84
+ if base = @opts[:erb_base]
85
+ load_erb(base).run(binding)
86
+ end
87
+ end
88
+
89
+ def result
90
+ if base = @opts[:erb_base]
91
+ load_erb(base).result(binding)
92
+ end
93
+ end
94
+
95
+ def write(output)
96
+ File.open(output,"wt") do |f|
97
+ f.print(result)
98
+ end
99
+ end
100
+
101
+ def init_def
102
+ end
103
+
104
+ def find_tmpl(name)
105
+ @parent.children.find{|x| x.name == name }
106
+ end
107
+
108
+ def find(name)
109
+ children.find{|x| x.name == name }
110
+ end
111
+ end
112
+
113
+
114
+ class DefLib < ErbPP
115
+ def initialize(parent=nil, **opts, &block)
116
+ opts[:erb_base] ||= 'lib'
117
+ opts[:include_files] ||= []
118
+ super(parent, **opts, &block)
119
+ end
120
+ def id_assign
121
+ ids = []
122
+ @children.each{|c| a=c.get(:id_list); ids.concat(a) if a}
123
+ ids.sort.uniq.map{|x| "id_#{x[1]} = rb_intern(\"#{x[0]}\");"}
124
+ end
125
+ def id_decl
126
+ ids = []
127
+ @children.each{|c| a=c.get(:id_list); ids.concat(a) if a}
128
+ ids.sort.uniq.map{|x| "static ID id_#{x[1]};\n"}
129
+ end
130
+ def def_class(**opts, &block)
131
+ DefClass.new(self, **opts, &block)
132
+ end
133
+ def def_module(**opts, &block)
134
+ DefModule.new(self, **opts, &block)
135
+ end
136
+ end
137
+
138
+ module DeclMethod
139
+ def def_alloc_func(m, erb_path=nil, **opts, &block)
140
+ DefAllocFunc.new(self, erb_path||m, name:m, singleton:true, **opts, &block)
141
+ end
142
+ def undef_alloc_func
143
+ UndefAllocFunc.new(self)
144
+ end
145
+ def def_method(m, erb_path=nil, **opts, &block)
146
+ DefMethod.new(self, erb_path||m, name:m, **opts, &block)
147
+ end
148
+ def undef_method(m)
149
+ UndefMethod.new(self,name:m)
150
+ end
151
+ def def_singleton_method(m, erb_path=nil, **opts, &block)
152
+ DefMethod.new(self, erb_path||m, name:m, singleton:true, **opts, &block)
153
+ end
154
+ def undef_singleton_method(m)
155
+ UndefSingletonMethod.new(self,name:m)
156
+ end
157
+ def def_module_function(m, erb_path=nil, **opts, &block)
158
+ DefModuleFunction.new(self, erb_path||m, name:m, **opts, &block)
159
+ end
160
+ def def_alias(from, to)
161
+ DefAlias.new(self, from:from, to:to)
162
+ end
163
+ def def_const(m, v, **opts, &block)
164
+ DefConst.new(self, name:m, value:v, **opts, &block)
165
+ end
166
+ end
167
+
168
+ class DefModule < ErbPP
169
+ include DeclMethod
170
+ def initialize(parent, **opts, &block)
171
+ eb = opts[:erb_base] || 'module'
172
+ super(parent, erb_base:eb, **opts, &block)
173
+ end
174
+ def id_list
175
+ @id_list ||= []
176
+ end
177
+ def def_id(name,var=nil)
178
+ var = name.gsub(/\?/,"_p").gsub(/\!/,"_bang") if var.nil?
179
+ id_list << [name,var]
180
+ end
181
+ def init_def
182
+ load_erb(init_erb).result(binding)
183
+ end
184
+ def init_erb
185
+ @opts[:init_erb] || "init_module"
186
+ end
187
+ def method_code
188
+ @children.map{|c| c.result}.join("\n")
189
+ end
190
+ def _mod_var
191
+ @opts[:module_var]
192
+ end
193
+ end
194
+
195
+ class DefClass < DefModule
196
+ def initialize(parent, **opts, &block)
197
+ eb = opts[:erb_base] || 'class'
198
+ super(parent, erb_base:eb, **opts, &block)
199
+ end
200
+ def _mod_var
201
+ @opts[:class_var]
202
+ end
203
+ def init_erb
204
+ @opts[:init_erb] || "init_class"
205
+ end
206
+ def super_class
207
+ @opts[:super_class] || "rb_cObject"
208
+ end
209
+ def free_func
210
+ @opts[:free_func] || "gsl_"+get(:name)+"_free"
211
+ end
212
+ end
213
+
214
+ class DefMethod < ErbPP
215
+ include DeclMethod
216
+
217
+ def initialize(parent, erb_base, **opts, &block)
218
+ super(parent, **opts, &block)
219
+ set erb_base: erb_base
220
+ end
221
+
222
+ def id_op
223
+ if op.size == 1
224
+ "'#{op}'"
225
+ else
226
+ "id_#{c_name}"
227
+ end
228
+ end
229
+
230
+ def c_name
231
+ @opts[:name].gsub(/\?/,"_p").gsub(/\!/,"_bang").gsub(/=/,"_set")
232
+ end
233
+
234
+ def op_map
235
+ @opts[:op] || @opts[:name]
236
+ end
237
+
238
+ def c_func(n_arg=nil)
239
+ set n_arg: n_arg if n_arg
240
+ s = (singleton) ? "_s" : ""
241
+ "#{@parent.name}#{s}_#{c_name}"
242
+ end
243
+
244
+ def c_iter
245
+ "iter_#{c_func}"
246
+ end
247
+
248
+ def define_method_args
249
+ "#{_mod_var}, \"#{op_map}\", #{c_func}, #{n_arg}"
250
+ end
251
+
252
+ def init_def
253
+ return if n_arg == :nodef
254
+ s = (singleton) ? "_singleton" : ""
255
+ "rb_define#{s}_method(#{define_method_args});"
256
+ end
257
+
258
+ def singleton
259
+ @opts[:singleton]
260
+ end
261
+ end
262
+
263
+ class DefModuleFunction < DefMethod
264
+ def initialize(parent, erb_base, **opts, &block)
265
+ super(parent, erb_base, **opts, &block)
266
+ set singleton: true
267
+ end
268
+
269
+ def init_def
270
+ return if n_arg == :nodef
271
+ "rb_define_module_function(#{define_method_args});"
272
+ end
273
+ end
274
+
275
+ class DefAlias < ErbPP
276
+ def init_def
277
+ "rb_define_alias(#{_mod_var}, \"#{from}\", \"#{to}\");"
278
+ end
279
+ end
280
+
281
+ class DefAllocFunc < DefMethod
282
+ def init_def
283
+ "rb_define_alloc_func(#{_mod_var}, #{c_func});"
284
+ end
285
+ end
286
+
287
+ class UndefAllocFunc < ErbPP
288
+ def init_def
289
+ "rb_undef_alloc_func(#{_mod_var});"
290
+ end
291
+ end
292
+
293
+ class UndefMethod < ErbPP
294
+ def init_def
295
+ "rb_undef_method(#{_mod_var},\"#{name}\");"
296
+ end
297
+ end
298
+
299
+ class UndefSingletonMethod < ErbPP
300
+ def init_def
301
+ "rb_undef_method(rb_singleton_class(#{_mod_var}),\"#{name}\");"
302
+ end
303
+ end
304
+
305
+ class DefConst < ErbPP
306
+ def init_def
307
+ "/*#{desc}*/
308
+ rb_define_const(#{_mod_var},\"#{name}\",#{value});"
309
+ end
310
+ end
311
+
312
+ class DefError < ErbPP
313
+ def initialize(parent, name, sup_var, **opts, &block)
314
+ super(parent, error_name:name, error_var:"e"+name, super_var:sup_var,
315
+ **opts, &block)
316
+ end
317
+ def result
318
+ "static VALUE #{error_var};"
319
+ end
320
+ def init_def
321
+ "/*#{description}*/
322
+ #{error_var} = rb_define_class_under(#{ns_var},\"#{error_name}\",#{super_var});"
323
+ end
324
+ end
325
+
326
+ class DefStruct < ErbPP
327
+ def method_code
328
+ "static VALUE #{class_var};"
329
+ end
330
+ def init_def
331
+ items = members.map{|s| "\"#{s}\""}.join(",")
332
+ "/*#{description}*/
333
+ #{class_var} = rb_struct_define(\"#{class_name}\",#{items},NULL);"
334
+ end
335
+ end
336
+
337
+ class DefInclueModule < ErbPP
338
+ def initialize(parent=nil, incl_class, incl_module, **opts, &block)
339
+ super(parent,incl_class:incl_class,incl_module:incl_module,**opts,&block)
340
+ end
341
+ def init_def
342
+ "rb_include_module(#{get(:incl_class)}, #{get(:incl_module)});"
343
+ end
344
+ end