numo-gsl 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (266) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +4 -0
  3. data/README.md +84 -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_def.rb +419 -0
  10. data/ext/numo/gsl/const/depend +17 -0
  11. data/ext/numo/gsl/const/erbpp_const.rb +30 -0
  12. data/ext/numo/gsl/const/extconf.rb +9 -0
  13. data/ext/numo/gsl/err/depend +1 -0
  14. data/ext/numo/gsl/err/err.c +22 -0
  15. data/ext/numo/gsl/err/extconf.rb +9 -0
  16. data/ext/numo/gsl/extconf_gsl.rb +44 -0
  17. data/ext/numo/gsl/fit/depend +17 -0
  18. data/ext/numo/gsl/fit/erbpp_fit.rb +74 -0
  19. data/ext/numo/gsl/fit/extconf.rb +9 -0
  20. data/ext/numo/gsl/fit/func_def.rb +129 -0
  21. data/ext/numo/gsl/fit/tmpl/check_1d.c +9 -0
  22. data/ext/numo/gsl/fit/tmpl/fit_linear.c +53 -0
  23. data/ext/numo/gsl/fit/tmpl/fit_linear_est.c +56 -0
  24. data/ext/numo/gsl/fit/tmpl/fit_mul.c +50 -0
  25. data/ext/numo/gsl/fit/tmpl/fit_mul_est.c +47 -0
  26. data/ext/numo/gsl/fit/tmpl/fit_wlinear.c +59 -0
  27. data/ext/numo/gsl/fit/tmpl/fit_wmul.c +56 -0
  28. data/ext/numo/gsl/gen/erbpp2.rb +306 -0
  29. data/ext/numo/gsl/gen/erbpp_gsl.rb +166 -0
  30. data/ext/numo/gsl/gen/func_parser.rb +520 -0
  31. data/ext/numo/gsl/gen/tmpl/c_DFloat_f_DFloat.c +40 -0
  32. data/ext/numo/gsl/gen/tmpl/c_DFloat_f_SZ.c +41 -0
  33. data/ext/numo/gsl/gen/tmpl/c_DFloat_f_SZ_x2.c +44 -0
  34. data/ext/numo/gsl/gen/tmpl/c_DFloat_x2_f_DFloat_x2.c +45 -0
  35. data/ext/numo/gsl/gen/tmpl/c_double_f_double.c +16 -0
  36. data/ext/numo/gsl/gen/tmpl/c_double_f_sizet.c +16 -0
  37. data/ext/numo/gsl/gen/tmpl/c_double_f_sizet_x2.c +17 -0
  38. data/ext/numo/gsl/gen/tmpl/c_double_f_void.c +15 -0
  39. data/ext/numo/gsl/gen/tmpl/c_double_x2_f_void.c +17 -0
  40. data/ext/numo/gsl/gen/tmpl/c_new_DFloat.c +29 -0
  41. data/ext/numo/gsl/gen/tmpl/c_new_double.c +22 -0
  42. data/ext/numo/gsl/gen/tmpl/c_new_f_other.c +25 -0
  43. data/ext/numo/gsl/gen/tmpl/c_new_sizet.c +22 -0
  44. data/ext/numo/gsl/gen/tmpl/c_new_sizet_double.c +23 -0
  45. data/ext/numo/gsl/gen/tmpl/c_new_sizet_x2.c +23 -0
  46. data/ext/numo/gsl/gen/tmpl/c_new_void.c +21 -0
  47. data/ext/numo/gsl/gen/tmpl/c_other_f_void.c +19 -0
  48. data/ext/numo/gsl/gen/tmpl/c_self_f_DFloat.c +46 -0
  49. data/ext/numo/gsl/gen/tmpl/c_self_f_DFloat_x2.c +41 -0
  50. data/ext/numo/gsl/gen/tmpl/c_self_f_DFloat_x3.c +44 -0
  51. data/ext/numo/gsl/gen/tmpl/c_self_f_DFloat_x4.c +47 -0
  52. data/ext/numo/gsl/gen/tmpl/c_self_f_SZ_x2_DFloat.c +45 -0
  53. data/ext/numo/gsl/gen/tmpl/c_self_f_double.c +17 -0
  54. data/ext/numo/gsl/gen/tmpl/c_self_f_other.c +17 -0
  55. data/ext/numo/gsl/gen/tmpl/c_self_f_sizet.c +21 -0
  56. data/ext/numo/gsl/gen/tmpl/c_self_f_void.c +14 -0
  57. data/ext/numo/gsl/gen/tmpl/c_sizet_f_void.c +15 -0
  58. data/ext/numo/gsl/gen/tmpl/c_sizet_x2_f_void.c +17 -0
  59. data/ext/numo/gsl/gen/tmpl/c_str_f_void.c +15 -0
  60. data/ext/numo/gsl/gen/tmpl/c_super_new_void.c +18 -0
  61. data/ext/numo/gsl/gen/tmpl/c_uint_f_void.c +15 -0
  62. data/ext/numo/gsl/gen/tmpl/c_ulong_f_void.c +15 -0
  63. data/ext/numo/gsl/gen/tmpl/c_void_f_double.c +17 -0
  64. data/ext/numo/gsl/gen/tmpl/c_void_f_double_x2.c +18 -0
  65. data/ext/numo/gsl/gen/tmpl/c_void_f_double_x4.c +20 -0
  66. data/ext/numo/gsl/gen/tmpl/c_void_f_ulong.c +17 -0
  67. data/ext/numo/gsl/gen/tmpl/c_void_f_void.c +14 -0
  68. data/ext/numo/gsl/gen/tmpl/cast_1d_contiguous.c +15 -0
  69. data/ext/numo/gsl/gen/tmpl/cast_2d_contiguous.c +15 -0
  70. data/ext/numo/gsl/gen/tmpl/class.c +26 -0
  71. data/ext/numo/gsl/gen/tmpl/create_new_narray.c +26 -0
  72. data/ext/numo/gsl/gen/tmpl/init_class.c +10 -0
  73. data/ext/numo/gsl/gen/tmpl/init_module.c +12 -0
  74. data/ext/numo/gsl/gen/tmpl/lib.c +41 -0
  75. data/ext/numo/gsl/gen/tmpl/m_DFloat_Int_f_DFloat.c +38 -0
  76. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_DFloat.c +35 -0
  77. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_DFloat_Int.c +39 -0
  78. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_DFloat_UInt.c +39 -0
  79. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_DFloat_double.c +42 -0
  80. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_DFloat_double_x2.c +47 -0
  81. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_DFloat_int.c +42 -0
  82. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_DFloat_x2.c +38 -0
  83. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_DFloat_x3.c +41 -0
  84. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_Int.c +36 -0
  85. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_UInt.c +36 -0
  86. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_UInt32.c +36 -0
  87. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_UInt32_double.c +43 -0
  88. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_UInt32_double_uint.c +49 -0
  89. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_UInt32_double_x2.c +48 -0
  90. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_UInt32_uint_x3.c +51 -0
  91. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_UInt_double.c +43 -0
  92. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_UInt_double_uint.c +50 -0
  93. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_UInt_double_x2.c +48 -0
  94. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_UInt_uint_x3.c +51 -0
  95. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_int_DFloat.c +41 -0
  96. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_int_DFloat_x2.c +44 -0
  97. data/ext/numo/gsl/gen/tmpl/m_DFloat_f_int_x2_DFloat_x2.c +46 -0
  98. data/ext/numo/gsl/gen/tmpl/m_Int_f_DFloat.c +36 -0
  99. data/ext/numo/gsl/gen/tmpl/m_Int_f_DFloat_x3.c +42 -0
  100. data/ext/numo/gsl/gen/tmpl/m_Int_f_int_DFloat.c +42 -0
  101. data/ext/numo/gsl/gen/tmpl/m_Int_f_int_DFloat_x2.c +45 -0
  102. data/ext/numo/gsl/gen/tmpl/mod_func_noloop.c +54 -0
  103. data/ext/numo/gsl/gen/tmpl/mod_func_scalar.c +27 -0
  104. data/ext/numo/gsl/gen/tmpl/module.c +9 -0
  105. data/ext/numo/gsl/histogram/depend +17 -0
  106. data/ext/numo/gsl/histogram/erbpp_histogram.rb +109 -0
  107. data/ext/numo/gsl/histogram/extconf.rb +9 -0
  108. data/ext/numo/gsl/histogram/func_def.rb +763 -0
  109. data/ext/numo/gsl/histogram/tmpl/c_DFloat_f_2d_get.c +54 -0
  110. data/ext/numo/gsl/histogram/tmpl/c_DFloat_f_field.c +35 -0
  111. data/ext/numo/gsl/histogram/tmpl/c_DFloat_f_get.c +47 -0
  112. data/ext/numo/gsl/histogram/tmpl/c_DFloat_x2_f_get_range.c +56 -0
  113. data/ext/numo/gsl/histogram/tmpl/c_bool_f_other.c +19 -0
  114. data/ext/numo/gsl/histogram/tmpl/c_bool_f_pdf_init.c +24 -0
  115. data/ext/numo/gsl/histogram/tmpl/c_self_f_2d_set_ranges.c +26 -0
  116. data/ext/numo/gsl/histogram/tmpl/c_self_f_set_ranges.c +21 -0
  117. data/ext/numo/gsl/histogram/tmpl/c_sizet_f_field.c +15 -0
  118. data/ext/numo/gsl/interp/depend +17 -0
  119. data/ext/numo/gsl/interp/erbpp_interp.rb +59 -0
  120. data/ext/numo/gsl/interp/extconf.rb +9 -0
  121. data/ext/numo/gsl/interp/func_def.rb +816 -0
  122. data/ext/numo/gsl/interp/parse_interp.rb +67 -0
  123. data/ext/numo/gsl/interp/tmpl/interp2d_new.c +36 -0
  124. data/ext/numo/gsl/interp/tmpl/interp2d_type_new.c +17 -0
  125. data/ext/numo/gsl/interp/tmpl/interp_bsearch.c +57 -0
  126. data/ext/numo/gsl/interp/tmpl/interp_new.c +29 -0
  127. data/ext/numo/gsl/interp/tmpl/interp_type_new.c +16 -0
  128. data/ext/numo/gsl/interp/tmpl/spline2d_eval.c +61 -0
  129. data/ext/numo/gsl/interp/tmpl/spline_eval.c +55 -0
  130. data/ext/numo/gsl/interp/tmpl/spline_integ.c +56 -0
  131. data/ext/numo/gsl/interp/type_def.rb +9 -0
  132. data/ext/numo/gsl/multifit/depend +17 -0
  133. data/ext/numo/gsl/multifit/erbpp_multifit.rb +99 -0
  134. data/ext/numo/gsl/multifit/extconf.rb +9 -0
  135. data/ext/numo/gsl/multifit/func_2.1.rb +1035 -0
  136. data/ext/numo/gsl/multifit/func_2.2.1.rb +736 -0
  137. data/ext/numo/gsl/multifit/func_2.2.rb +736 -0
  138. data/ext/numo/gsl/multifit/func_2.3.rb +872 -0
  139. data/ext/numo/gsl/multifit/func_def.rb +1012 -0
  140. data/ext/numo/gsl/multifit/tmpl/multifit_linear.c +66 -0
  141. data/ext/numo/gsl/multifit/tmpl/multifit_linear_est.c +48 -0
  142. data/ext/numo/gsl/multifit/tmpl/multifit_linear_residuals.c +47 -0
  143. data/ext/numo/gsl/multifit/tmpl/multifit_wlinear.c +70 -0
  144. data/ext/numo/gsl/multifit/type_def.rb +1 -0
  145. data/ext/numo/gsl/numo_gsl.h +117 -0
  146. data/ext/numo/gsl/pdf/depend +17 -0
  147. data/ext/numo/gsl/pdf/erbpp_pdf.rb +26 -0
  148. data/ext/numo/gsl/pdf/extconf.rb +9 -0
  149. data/ext/numo/gsl/pdf/func_2.2.1.rb +306 -0
  150. data/ext/numo/gsl/pdf/func_2.2.rb +306 -0
  151. data/ext/numo/gsl/pdf/func_2.3.rb +306 -0
  152. data/ext/numo/gsl/pdf/func_def.rb +282 -0
  153. data/ext/numo/gsl/pdf/parse_pdf.rb +42 -0
  154. data/ext/numo/gsl/pdf/tmpl/dirichlet.c +39 -0
  155. data/ext/numo/gsl/pdf/tmpl/multinomial.c +39 -0
  156. data/ext/numo/gsl/poly/depend +17 -0
  157. data/ext/numo/gsl/poly/erbpp_poly.rb +70 -0
  158. data/ext/numo/gsl/poly/extconf.rb +9 -0
  159. data/ext/numo/gsl/poly/func_def.rb +234 -0
  160. data/ext/numo/gsl/poly/tmpl/poly_complex_solve.c +59 -0
  161. data/ext/numo/gsl/poly/tmpl/poly_eval.c +70 -0
  162. data/ext/numo/gsl/poly/tmpl/poly_eval_derivs.c +40 -0
  163. data/ext/numo/gsl/ran/depend +17 -0
  164. data/ext/numo/gsl/ran/erbpp_ran.rb +42 -0
  165. data/ext/numo/gsl/ran/extconf.rb +9 -0
  166. data/ext/numo/gsl/ran/func_2.2.1.rb +1658 -0
  167. data/ext/numo/gsl/ran/func_2.2.rb +1658 -0
  168. data/ext/numo/gsl/ran/func_2.3.rb +1658 -0
  169. data/ext/numo/gsl/ran/func_def.rb +1594 -0
  170. data/ext/numo/gsl/ran/parse_ran.rb +10 -0
  171. data/ext/numo/gsl/rng/depend +17 -0
  172. data/ext/numo/gsl/rng/erbpp_rng.rb +58 -0
  173. data/ext/numo/gsl/rng/extconf.rb +9 -0
  174. data/ext/numo/gsl/rng/func_def.rb +230 -0
  175. data/ext/numo/gsl/rng/parse_rng.rb +125 -0
  176. data/ext/numo/gsl/rng/tmpl/ran.c +40 -0
  177. data/ext/numo/gsl/rng/tmpl/ran_DFloat_f_DFloat.c +28 -0
  178. data/ext/numo/gsl/rng/tmpl/ran_DFloat_x2.c +45 -0
  179. data/ext/numo/gsl/rng/tmpl/ran_DFloat_x3.c +51 -0
  180. data/ext/numo/gsl/rng/tmpl/ran_multinomial.c +32 -0
  181. data/ext/numo/gsl/rng/tmpl/rng_DFloat.c +29 -0
  182. data/ext/numo/gsl/rng/tmpl/rng_UInt.c +44 -0
  183. data/ext/numo/gsl/rng/tmpl/rng_alloc.c +24 -0
  184. data/ext/numo/gsl/rng/tmpl/rng_type_new.c +14 -0
  185. data/ext/numo/gsl/rng/type_def.rb +63 -0
  186. data/ext/numo/gsl/rstat/depend +17 -0
  187. data/ext/numo/gsl/rstat/erbpp_rstat.rb +64 -0
  188. data/ext/numo/gsl/rstat/extconf.rb +9 -0
  189. data/ext/numo/gsl/rstat/func_2.2.1.rb +116 -0
  190. data/ext/numo/gsl/rstat/func_2.2.rb +116 -0
  191. data/ext/numo/gsl/rstat/func_2.3.rb +123 -0
  192. data/ext/numo/gsl/rstat/func_def.rb +102 -0
  193. data/ext/numo/gsl/sf/depend +17 -0
  194. data/ext/numo/gsl/sf/erbpp_sf.rb +51 -0
  195. data/ext/numo/gsl/sf/extconf.rb +9 -0
  196. data/ext/numo/gsl/sf/func_def.rb +4703 -0
  197. data/ext/numo/gsl/sf/parse_sf.rb +277 -0
  198. data/ext/numo/gsl/sf/tmpl/c_DFloat_f_int_x2_DFloat.c +50 -0
  199. data/ext/numo/gsl/sf/tmpl/c_DFloat_f_int_x2_DFloat_x2.c +52 -0
  200. data/ext/numo/gsl/sf/tmpl/c_DFloat_f_int_x3_DFloat_x2.c +55 -0
  201. data/ext/numo/gsl/sf/tmpl/m_DFloat_f_DFloat_mode.c +47 -0
  202. data/ext/numo/gsl/sf/tmpl/m_DFloat_f_lmax_array.c +41 -0
  203. data/ext/numo/gsl/sf/tmpl/m_DFloat_f_nmin_nmax_array.c +49 -0
  204. data/ext/numo/gsl/spmatrix/const_2.2.1.rb +3 -0
  205. data/ext/numo/gsl/spmatrix/const_2.2.rb +3 -0
  206. data/ext/numo/gsl/spmatrix/const_2.3.rb +3 -0
  207. data/ext/numo/gsl/spmatrix/const_def.rb +2 -0
  208. data/ext/numo/gsl/spmatrix/depend +17 -0
  209. data/ext/numo/gsl/spmatrix/erbpp_spmatrix.rb +100 -0
  210. data/ext/numo/gsl/spmatrix/extconf.rb +9 -0
  211. data/ext/numo/gsl/spmatrix/func_2.2.1.rb +297 -0
  212. data/ext/numo/gsl/spmatrix/func_2.2.rb +297 -0
  213. data/ext/numo/gsl/spmatrix/func_2.3.rb +297 -0
  214. data/ext/numo/gsl/spmatrix/func_def.rb +218 -0
  215. data/ext/numo/gsl/spmatrix/parse_spmatrix.rb +70 -0
  216. data/ext/numo/gsl/spmatrix/tmpl/itersolve_iterate.c +47 -0
  217. data/ext/numo/gsl/spmatrix/tmpl/itersolve_new.c +22 -0
  218. data/ext/numo/gsl/spmatrix/tmpl/itersolve_type_new.c +16 -0
  219. data/ext/numo/gsl/spmatrix/tmpl/spblas_dgemm.c +35 -0
  220. data/ext/numo/gsl/spmatrix/tmpl/spblas_dgemv.c +43 -0
  221. data/ext/numo/gsl/spmatrix/tmpl/spmatrix_add.c +22 -0
  222. data/ext/numo/gsl/spmatrix/tmpl/spmatrix_d2sp.c +28 -0
  223. data/ext/numo/gsl/spmatrix/tmpl/spmatrix_new.c +40 -0
  224. data/ext/numo/gsl/spmatrix/tmpl/spmatrix_sp2d.c +25 -0
  225. data/ext/numo/gsl/spmatrix/type_def.rb +1 -0
  226. data/ext/numo/gsl/stats/depend +17 -0
  227. data/ext/numo/gsl/stats/erbpp_stats.rb +29 -0
  228. data/ext/numo/gsl/stats/extconf.rb +9 -0
  229. data/ext/numo/gsl/stats/func_2.2.1.rb +608 -0
  230. data/ext/numo/gsl/stats/func_2.2.rb +608 -0
  231. data/ext/numo/gsl/stats/func_2.3.rb +608 -0
  232. data/ext/numo/gsl/stats/func_def.rb +608 -0
  233. data/ext/numo/gsl/stats/parse_stats.rb +63 -0
  234. data/ext/numo/gsl/stats/tmpl/stats_1a0p.c +37 -0
  235. data/ext/numo/gsl/stats/tmpl/stats_1a0p_index.c +60 -0
  236. data/ext/numo/gsl/stats/tmpl/stats_1a1p.c +41 -0
  237. data/ext/numo/gsl/stats/tmpl/stats_1a2p.c +42 -0
  238. data/ext/numo/gsl/stats/tmpl/stats_2a0p.c +39 -0
  239. data/ext/numo/gsl/stats/tmpl/stats_2a1p.c +43 -0
  240. data/ext/numo/gsl/stats/tmpl/stats_2a2p.c +44 -0
  241. data/ext/numo/gsl/stats/tmpl/stats_minmax.c +37 -0
  242. data/ext/numo/gsl/stats/tmpl/stats_minmax_index.c +67 -0
  243. data/ext/numo/gsl/stats/tmpl/stats_spearman.c +46 -0
  244. data/ext/numo/gsl/sys/const_def.rb +21 -0
  245. data/ext/numo/gsl/sys/depend +17 -0
  246. data/ext/numo/gsl/sys/enum_def.rb +75 -0
  247. data/ext/numo/gsl/sys/erbpp_sys.rb +60 -0
  248. data/ext/numo/gsl/sys/extconf.rb +9 -0
  249. data/ext/numo/gsl/sys/func_def.rb +249 -0
  250. data/ext/numo/gsl/version.h +1 -0
  251. data/ext/numo/gsl/wavelet/depend +17 -0
  252. data/ext/numo/gsl/wavelet/erbpp_wavelet.rb +48 -0
  253. data/ext/numo/gsl/wavelet/extconf.rb +9 -0
  254. data/ext/numo/gsl/wavelet/func_def.rb +337 -0
  255. data/ext/numo/gsl/wavelet/parse_wavelet.rb +47 -0
  256. data/ext/numo/gsl/wavelet/tmpl/wavelet2d_transform.c +56 -0
  257. data/ext/numo/gsl/wavelet/tmpl/wavelet_array_check.c +56 -0
  258. data/ext/numo/gsl/wavelet/tmpl/wavelet_macro.c +1 -0
  259. data/ext/numo/gsl/wavelet/tmpl/wavelet_new.c +20 -0
  260. data/ext/numo/gsl/wavelet/tmpl/wavelet_transform.c +55 -0
  261. data/ext/numo/gsl/wavelet/tmpl/wavelet_transform2.c +22 -0
  262. data/ext/numo/gsl/wavelet/tmpl/wavelet_type_new.c +15 -0
  263. data/ext/numo/gsl/wavelet/type_def.rb +6 -0
  264. data/lib/numo/gsl.rb +17 -0
  265. data/numo-gsl.gemspec +33 -0
  266. metadata +367 -0
@@ -0,0 +1,277 @@
1
+ require_relative "../gen/erbpp_gsl"
2
+
3
+ class DefSf < DefModule
4
+
5
+ def check_func(h)
6
+ if /These functions are now deprecated/m =~ h[:desc]
7
+ $stderr.puts "depricated: #{h[:func_name]}"
8
+ return false
9
+ end
10
+ if /This function is now deprecated/m =~ h[:desc]
11
+ $stderr.puts "depricated: #{h[:func_name]}"
12
+ return false
13
+ end
14
+ [
15
+ LegendreArray,
16
+ MathieuArray,
17
+ BesselArray,
18
+ CoulombArray,
19
+ GegenpolyArray,
20
+ SfTemplate,
21
+ SfBasic
22
+ ].each do |c|
23
+ if tmpl = c.lookup(h)
24
+ c.new(self, tmpl, **h)
25
+ return true
26
+ end
27
+ end
28
+ $stderr.puts "skip #{h[:func_type]} #{h[:func_name]} #{h[:args].inspect}"
29
+ false
30
+ end
31
+
32
+ end
33
+
34
+
35
+ class SfTemplate < DefGslModuleFunction
36
+ include FuncParser
37
+
38
+ def self.lookup(h)
39
+ arg_types = h[:args].map{|a| a[0].sub(/^const /,"")}
40
+ case h[:func_type]
41
+ when "int"
42
+ case arg_types
43
+ when ["double"]; "m_Int_f_DFloat"
44
+ when ["double"]*3; "m_Int_f_DFloat_x3" # gsl_fcmp
45
+ when ["int","double"]; "m_Int_f_int_DFloat"
46
+ when ["int"]+["double"]*2; "m_Int_f_int_DFloat_x2"
47
+ end
48
+ when "double"
49
+ case arg_types
50
+ when ["int","double"]; "m_DFloat_f_int_DFloat"
51
+ when ["int"]*2+["double"]*2; "m_DFloat_f_int_x2_DFloat_x2"
52
+ when ["double","gsl_mode_t"]; "m_DFloat_f_DFloat_mode"
53
+ when ["double"]; "m_DFloat_f_DFloat"
54
+ when ["double"]*2; "m_DFloat_f_DFloat_x2"
55
+ when ["double"]*3; "m_DFloat_f_DFloat_x3"
56
+ when ["int"]; "m_DFloat_f_Int"
57
+ when ["double","int"]; "m_DFloat_f_DFloat_Int"
58
+ when ["double","int *"]; "m_DFloat_Int_f_DFloat" # gsl_frexp
59
+ when ["double","unsigned int"]; "m_DFloat_f_DFloat_UInt"
60
+ when ["unsigned int"]; "m_DFloat_f_UInt"
61
+ end
62
+ end
63
+ end
64
+
65
+ def initialize(parent,tmpl,**h)
66
+ m = h[:name] || h[:func_name].sub(/^gsl_sf_/,"")
67
+ super(parent, tmpl, name:m, **h)
68
+ parse_args(h)
69
+ if @args_param.any?{|a| a.type=="gsl_mode_t"}
70
+ set n_arg: -1
71
+ else
72
+ set n_arg: @args_param.size+@args_in.size
73
+ end
74
+ @preproc_code = ""
75
+ end
76
+
77
+ end
78
+
79
+ #----------------------------------------------------------
80
+
81
+ class SfBasic < SfTemplate
82
+ RE = /^gsl_sf_/
83
+
84
+ PARAM_DESC =
85
+ {
86
+ "norm"=>"@param [Integer] norm Type of normalization to use. "+
87
+ "The possible values are: Numo::GSL::Sf::Legendre::NONE, "+
88
+ "Numo::GSL::Sf::Legendre::SCHMIDT, "+
89
+ "Numo::GSL::Sf::Legendre::SPHARM, Numo::GSL::Sf::Legendre::FULL",
90
+ "mode"=>"@param [Integer] mode The following precision levels are available: "+
91
+ "Numo::GSL::PREC_DOUBLE, Numo::GSL::PREC_SINGLE, Numo::GSL::PREC_APPROX.",
92
+ "lmax"=>"@param [Integer] lmax",
93
+ "csphase"=>"@param [Float] csphase To include or exclude "+
94
+ "the Condon-Shortley phase factor of (-1)^m, "+
95
+ "set the parameter csphase to either -1 or 1 respectively.",
96
+ "work"=>"@param [Numo::GSL::Sf::MathieuWorkspace] work",
97
+ }
98
+ PARAM_NAMES =
99
+ {
100
+ "double" => %w[csphase],
101
+ "int" => true, #%w[n m i j l kmax lmax nmin nmax size order_min order_max],
102
+ "size_t" => true, #%w[lmax],
103
+ "gsl_sf_legendre_t" => true,
104
+ "gsl_mode_t" => true,
105
+ "gsl_sf_mathieu_workspace *"=>true,
106
+ }
107
+
108
+ def self.lookup(h)
109
+ if RE =~ h[:func_name]
110
+ case h[:func_name]
111
+ when /_(alloc)|(free)$/
112
+ false
113
+ when /angle_restrict_\w+_e/ # overwrite on *theta
114
+ false
115
+ when /bessel_sequence_Jnu_e/ # overwrite on v[]
116
+ false
117
+ else
118
+ meth = h[:func_name].sub(/^gsl_sf_/,"")
119
+ if [/^coupling_/,
120
+ /^legendre_array_(n|index)/,
121
+ /^psi(_1)?_int/,
122
+ /^z?eta(m1)?_int/].any?{|re| re =~ meth}
123
+ "mod_func_scalar"
124
+ else
125
+ "mod_func_noloop"
126
+ end
127
+ end
128
+ else
129
+ false
130
+ end
131
+ end
132
+
133
+ end
134
+
135
+
136
+ class MathieuArray < DefMethod
137
+ RE = /^gsl_sf_mathieu_\w+_array$/
138
+
139
+ def self.lookup(h)
140
+ case h[:func_name]
141
+ when "gsl_sf_mathieu_alloc"
142
+ "c_new_sizet_double"
143
+ when RE
144
+ arg_types = h[:args].map{|a| a[0].sub(/^const /,"")}
145
+ tp = "gsl_sf_mathieu_workspace *"
146
+ case arg_types
147
+ when ["int"]*2+["double",tp,"double"]; "c_DFloat_f_int_x2_DFloat"
148
+ when ["int"]*2+["double"]*2+[tp,"double"]; "c_DFloat_f_int_x2_DFloat_x2"
149
+ when ["int"]*3+["double"]*2+[tp,"double"]; "c_DFloat_f_int_x3_DFloat_x2"
150
+ end
151
+ end
152
+ end
153
+
154
+ def initialize(parent,tmpl,**h)
155
+ super(parent,tmpl,**h)
156
+
157
+ case h[:func_name]
158
+ when "gsl_sf_mathieu_alloc"
159
+ set name: "new"
160
+ set singleton: true
161
+ when /_array$/
162
+ set name: h[:func_name].sub(/^gsl_sf_mathieu_/,"")
163
+ set singleton: false
164
+ end
165
+
166
+ case func_name
167
+ when /_(a|b)_array$/
168
+ @mathieu_type = :characteristic
169
+ when /_(c|s)e_array$/
170
+ @mathieu_type = :angular
171
+ when /_M(c|s)_array$/
172
+ @mathieu_type = :radial
173
+ end
174
+
175
+ if @mathieu_type == :radial
176
+ @preproc_code = <<EOL
177
+ if (c0!=1 || c0!=2) {
178
+ rb_raise(rb_eArgError,"j should be 1 or 2");
179
+ }
180
+ if (c1<0 || c2<0 || c1>c2) {
181
+ rb_raise(rb_eArgError,"should be nmin>=0 && nmax>=0 && nmin<=nmax");
182
+ }
183
+ shape[0] = c2-c1+1;
184
+ EOL
185
+ else
186
+ @preproc_code = <<EOL
187
+ if (c0<0 || c1<0 || c0>c1) {
188
+ rb_raise(rb_eArgError,"should be nmin>=0 && nmax>=0 && nmin<=nmax");
189
+ }
190
+ shape[0] = c1-c0+1;
191
+ EOL
192
+ end
193
+ end
194
+ end
195
+
196
+
197
+ class BesselArray < SfBasic
198
+ RE = /^gsl_sf_bessel_\w+_array$/
199
+
200
+ def self.lookup(h)
201
+ "mod_func_noloop" if RE =~ h[:func_name]
202
+ end
203
+
204
+ def initialize(parent,tmpl,**h)
205
+ super(parent,tmpl,**h)
206
+ if n_arg == 3
207
+ @preproc_code = <<EOL
208
+ if (c0<0 || c1<0 || c0>c1) {
209
+ rb_raise(rb_eArgError,"should be nmin>=0 && nmax>=0 && nmin<=nmax");
210
+ }
211
+ shape[0] = c1-c0+1;
212
+ EOL
213
+ else
214
+ @preproc_code = <<EOL
215
+ if (c0<0) {
216
+ rb_raise(rb_eArgError,"should be lmax>=0");
217
+ }
218
+ shape[0] = c0+1;
219
+ EOL
220
+ end
221
+ end
222
+ end
223
+
224
+
225
+ class CoulombArray < SfBasic
226
+ RE = /^gsl_sf_coulomb_\w+_array$/
227
+
228
+ def self.lookup(h)
229
+ "mod_func_noloop" if RE =~ h[:func_name]
230
+ end
231
+
232
+ def initialize(parent,tmpl,**h)
233
+ super(parent,tmpl,**h)
234
+ c = find_name("kmax").c_var
235
+ @preproc_code = <<EOL
236
+ if (#{c}<0) {
237
+ rb_raise(rb_eArgError,"should be kmax>=0");
238
+ }
239
+ shape[0] = #{c}+1;
240
+ EOL
241
+ end
242
+ end
243
+
244
+
245
+ class GegenpolyArray < SfBasic
246
+ RE = /^gsl_sf_gegenpoly_array$/
247
+
248
+ def self.lookup(h)
249
+ "mod_func_noloop" if RE =~ h[:func_name]
250
+ end
251
+
252
+ def initialize(parent,tmpl,**h)
253
+ super(parent,tmpl,**h)
254
+ c = find_name("nmax").c_var
255
+ @preproc_code = <<EOL
256
+ if (#{c}<0) {
257
+ rb_raise(rb_eArgError,"should be kmax>=0");
258
+ }
259
+ shape[0] = #{c}+1;
260
+ EOL
261
+ end
262
+ end
263
+
264
+
265
+ class LegendreArray < SfBasic
266
+ RE = /^gsl_sf_legendre\w*_array(_e)?$/
267
+
268
+ def self.lookup(h)
269
+ "mod_func_noloop" if RE =~ h[:func_name]
270
+ end
271
+
272
+ def initialize(parent,tmpl,**h)
273
+ super(parent,tmpl,**h)
274
+ c = find_name("lmax").c_var
275
+ @preproc_code = " shape[0] = gsl_sf_legendre_array_n(#{c});"
276
+ end
277
+ end
@@ -0,0 +1,50 @@
1
+ static void
2
+ iter_<%=c_func%>(na_loop_t *const lp)
3
+ {
4
+ int c0, c1;
5
+ double c2, *c4;
6
+ <%=struct%> *w;
7
+ void **opt = (void**)(lp->opt_ptr);
8
+
9
+ w = (<%=struct%>*)(opt[0]);
10
+ c0 = *(int*)(opt[1]); //<%=args[0][1]%>
11
+ c1 = *(int*)(opt[2]); //<%=args[1][1]%>
12
+ c2 = *(double*)GET_PTR(lp,0); //<%=args[2][1]%>
13
+ c4 = (double*)GET_PTR(lp,1); //<%=args[4][1]%>
14
+ <%=func_name%>(c0,c1,c2,w,c4);
15
+ }
16
+
17
+ /*
18
+ @overload <%=name%>(<%=args[0][1]%>,<%=args[1][1]%>,<%=args[2][1]%>)
19
+
20
+ @param [Integer] <%=args[0][1]%>
21
+ @param [Integer] <%=args[1][1]%>
22
+ @param [Numo::DFloat] <%=args[2][1]%>
23
+ @return [Numo::DFloat] returns <%=args[4][1]%>
24
+
25
+ <%= description %>
26
+ */
27
+ static VALUE
28
+ <%=c_func(3)%>(VALUE self, VALUE v0, VALUE v1, VALUE v2)
29
+ {
30
+ <%=struct%> *w;
31
+ int nmin, nmax;
32
+ size_t shape[1];
33
+ ndfunc_arg_in_t ain[1] = {{cDF,0}};
34
+ ndfunc_arg_out_t aout[1] = {{cDF,1,shape}};
35
+ ndfunc_t ndf = {iter_<%=c_func%>,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,1,1,ain,aout};
36
+ void *opt[3];
37
+
38
+ TypedData_Get_Struct(self, <%=struct%>, &<%=data_type_var%>, w);
39
+
40
+ nmin = NUM2INT(v0);
41
+ nmax = NUM2INT(v1);
42
+ opt[0] = w;
43
+ opt[1] = &nmin;
44
+ opt[2] = &nmax;
45
+ if (nmin<0 || nmax<0 || nmin>nmax) {
46
+ rb_raise(rb_eArgError,"should be nmin>=0 && nmax>=0 && nmin<=nmax");
47
+ }
48
+ shape[0] = nmax-nmin+1;
49
+ return na_ndloop3(&ndf,opt,1,v2);
50
+ }
@@ -0,0 +1,52 @@
1
+ static void
2
+ iter_<%=c_func%>(na_loop_t *const lp)
3
+ {
4
+ int c0, c1;
5
+ double c2, c3, *c5;
6
+ <%=struct%> *w;
7
+ void **opt = (void**)(lp->opt_ptr);
8
+
9
+ w = (<%=struct%>*)(opt[0]);
10
+ c0 = *(int*)(opt[1]); //<%=args[0][1]%>
11
+ c1 = *(int*)(opt[2]); //<%=args[1][1]%>
12
+ c2 = *(double*)GET_PTR(lp,0); //<%=args[2][1]%>
13
+ c3 = *(double*)GET_PTR(lp,1); //<%=args[3][1]%>
14
+ c5 = (double*)GET_PTR(lp,2); //<%=args[5][1]%>
15
+ <%=func_name%>(c0,c1,c2,c3,w,c5);
16
+ }
17
+
18
+ /*
19
+ @overload <%=name%>(<%=args[0][1]%>,<%=args[1][1]%>,<%=args[2][1]%>,<%=args[3][1]%>)
20
+
21
+ @param [Integer] <%=args[0][1]%>
22
+ @param [Integer] <%=args[1][1]%>
23
+ @param [Numo::DFloat] <%=args[2][1]%>
24
+ @param [Numo::DFloat] <%=args[3][1]%>
25
+ @return [Numo::DFloat] returns <%=args[5][1]%>
26
+
27
+ <%= description %>
28
+ */
29
+ static VALUE
30
+ <%=c_func(4)%>(VALUE self, VALUE v0, VALUE v1, VALUE v2, VALUE v3)
31
+ {
32
+ <%=struct%> *w;
33
+ int nmin, nmax;
34
+ size_t shape[1];
35
+ ndfunc_arg_in_t ain[2] = {{cDF,0},{cDF,0}};
36
+ ndfunc_arg_out_t aout[1] = {{cDF,1,shape}};
37
+ ndfunc_t ndf = {iter_<%=c_func%>,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,2,1,ain,aout};
38
+ void *opt[3];
39
+
40
+ TypedData_Get_Struct(self, <%=struct%>, &<%=data_type_var%>, w);
41
+
42
+ nmin = NUM2INT(v0);
43
+ nmax = NUM2INT(v1);
44
+ opt[0] = w;
45
+ opt[1] = &nmin;
46
+ opt[2] = &nmax;
47
+ if (nmin<0 || nmax<0 || nmin>nmax) {
48
+ rb_raise(rb_eArgError,"should be nmin>=0 && nmax>=0 && nmin<=nmax");
49
+ }
50
+ shape[0] = nmax-nmin+1;
51
+ return na_ndloop3(&ndf,opt,2,v2,v3);
52
+ }
@@ -0,0 +1,55 @@
1
+ static void
2
+ iter_<%=c_func%>(na_loop_t *const lp)
3
+ {
4
+ int c0, c1, c2;
5
+ double c3, c4, *c6;
6
+ <%=struct%> *w;
7
+ void **opt = (void**)(lp->opt_ptr);
8
+
9
+ w = (<%=struct%>*)(opt[0]);
10
+ c0 = *(int*)(opt[1]); //<%=args[0][1]%>
11
+ c1 = *(int*)(opt[2]); //<%=args[1][1]%>
12
+ c2 = *(int*)(opt[3]); //<%=args[2][1]%>
13
+ c3 = *(double*)GET_PTR(lp,0); //<%=args[3][1]%>
14
+ c4 = *(double*)GET_PTR(lp,1); //<%=args[4][1]%>
15
+ c6 = (double*)GET_PTR(lp,2); //<%=args[6][1]%>
16
+ <%=func_name%>(c0,c1,c2,c3,c4,w,c6);
17
+ }
18
+
19
+ /*
20
+ @overload <%=name%>(<%=args[0][1]%>,<%=args[1][1]%>,<%=args[2][1]%>,<%=args[3][1]%>)
21
+
22
+ @param [Integer] <%=args[0][1]%>
23
+ @param [Integer] <%=args[1][1]%>
24
+ @param [Numo::DFloat] <%=args[2][1]%>
25
+ @param [Numo::DFloat] <%=args[3][1]%>
26
+ @return [Numo::DFloat] returns <%=args[5][1]%>
27
+
28
+ <%= description %>
29
+ */
30
+ static VALUE
31
+ <%=c_func(5)%>(VALUE self, VALUE v0, VALUE v1, VALUE v2, VALUE v3, VALUE v4)
32
+ {
33
+ <%=struct%> *w;
34
+ int j, nmin, nmax;
35
+ size_t shape[1];
36
+ ndfunc_arg_in_t ain[2] = {{cDF,0},{cDF,0}};
37
+ ndfunc_arg_out_t aout[1] = {{cDF,1,shape}};
38
+ ndfunc_t ndf = {iter_<%=c_func%>,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,2,1,ain,aout};
39
+ void *opt[4];
40
+
41
+ TypedData_Get_Struct(self, <%=struct%>, &<%=data_type_var%>, w);
42
+
43
+ j = NUM2INT(v0);
44
+ nmin = NUM2INT(v1);
45
+ nmax = NUM2INT(v2);
46
+ opt[0] = w;
47
+ opt[1] = &j; //j
48
+ opt[2] = &nmin;
49
+ opt[3] = &nmax;
50
+ if (nmin<0 || nmax<0 || nmin>nmax) {
51
+ rb_raise(rb_eArgError,"should be nmin>=0 && nmax>=0 && nmin<=nmax");
52
+ }
53
+ shape[0] = nmax-nmin+1;
54
+ return na_ndloop3(&ndf,opt,2,v3,v4);
55
+ }
@@ -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;
6
+ ssize_t s1, s2;
7
+ double x, y;
8
+ gsl_mode_t c1;
9
+
10
+ INIT_COUNTER(lp, i);
11
+ INIT_PTR(lp, 0, p1, s1);
12
+ INIT_PTR(lp, 1, p2, s2);
13
+
14
+ c1 = *(gsl_mode_t*)(lp->opt_ptr);
15
+
16
+ for (; i--;) {
17
+ GET_DATA_STRIDE(p1,s1,double,x);
18
+ y = <%=func_name%>(x, c1);
19
+ SET_DATA_STRIDE(p2,s2,double,y);
20
+ }
21
+ }
22
+
23
+ /*
24
+ @overload <%=name%>(<%=args[0][1]%>[,<%=args[1][1]%>])
25
+ @param [DFloat] <%=args[0][1]%>
26
+ @param [Integer] <%=args[1][1]%> The following precision levels are available: Numo::GSL::PREC_DOUBLE, Numo::GSL::PREC_SINGLE, Numo::GSL::PREC_APPROX.
27
+ @return [DFloat] result
28
+
29
+ <%= description %>
30
+ */
31
+ static VALUE
32
+ <%=c_func(-1)%>(int argc, VALUE *v, VALUE mod)
33
+ {
34
+ ndfunc_arg_in_t ain[1] = {{cDF,0}};
35
+ ndfunc_arg_out_t aout[1] = {{cDF,0}};
36
+ ndfunc_t ndf = {iter_<%=c_func%>, STRIDE_LOOP|NDF_EXTRACT, 1,1, ain,aout};
37
+ gsl_mode_t c1;
38
+
39
+ if (argc==1) {
40
+ c1 = GSL_MODE_DEFAULT;
41
+ } else if (argc==2) {
42
+ c1 = NUM2INT(v[1]);
43
+ } else {
44
+ rb_raise(rb_eArgError,"invalid number of argument: %d for 1..2",argc);
45
+ }
46
+ return na_ndloop3(&ndf, &c1, 1, v[0]);
47
+ }