numo-gsl 0.1.0

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 (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,66 @@
1
+ static VALUE cLinearResult;
2
+
3
+ static void
4
+ iter_<%=c_func%>(na_loop_t *const lp)
5
+ {
6
+ gsl_matrix X;
7
+ gsl_vector y;
8
+ gsl_vector c;
9
+ gsl_matrix cov;
10
+ double *chisq;
11
+ <%=struct%> *ws = (<%=struct%>*)(lp->opt_ptr);
12
+
13
+ SET_GSL_MATRIX_FROM_LOOPT(lp,0,X);
14
+ SET_GSL_VECTOR_FROM_LOOPT(lp,1,y);
15
+ SET_GSL_VECTOR_FROM_LOOPT(lp,2,c);
16
+ SET_GSL_MATRIX_FROM_LOOPT(lp,3,cov);
17
+ chisq = (double*)NDL_PTR(lp,4);
18
+
19
+ <%=func_name%>(&X,&y,&c,&cov,chisq,ws);
20
+ }
21
+
22
+ /*
23
+ @overload <%=name%>(<%=args[0][1]%>,<%=args[1][1]%>)
24
+ @param [DFloat] <%=args[0][1]%> (input matrix) predictor variables
25
+ @param [DFloat] <%=args[1][1]%> (input vector) observation
26
+ @return [GSL::Multifit::LinearResult] result Struct with members: <%=args[2][1]%>, <%=args[3][1]%>, <%=args[4][1]%>.
27
+
28
+ <%=desc%>
29
+
30
+ */
31
+ static VALUE
32
+ <%=c_func(2)%>(VALUE mod, VALUE v1, VALUE v2)
33
+ {
34
+ size_t c_shape[1], cov_shape[2];
35
+ ndfunc_arg_in_t ain[2] = {{cDF,2},{cDF,1}};
36
+ ndfunc_arg_out_t aout[3] = {{cDF,1,c_shape},{cDF,2,cov_shape},{cDF,0}};
37
+ ndfunc_t ndf = { iter_<%=c_func%>, NO_LOOP|NDF_EXTRACT,
38
+ 2, 3, ain, aout };
39
+ VALUE vws, r, result;
40
+ narray_t *X, *y;
41
+ size_t n, p;
42
+ <%=struct%> *ws;
43
+
44
+ GetNArray(v1,X);
45
+ GetNArray(v2,y);
46
+ CHECK_GE_2D(X);
47
+ CHECK_GE_1D(y);
48
+ n = MAT_SIZE1(X);
49
+ p = MAT_SIZE2(X);
50
+ CHECK_SIZE_EQ(n,VEC_SIZE(y),"y size does not match X column size");
51
+
52
+ c_shape[0] = cov_shape[0] = cov_shape[1] = p;
53
+
54
+ ws = gsl_multifit_linear_alloc(n,p);
55
+ if (!ws)
56
+ rb_raise(rb_eNoMemError,"fail to allocate struct");
57
+ vws = TypedData_Wrap_Struct(<%=class_var%>, &<%=data_type_var%>, (void*)ws);
58
+
59
+ r = na_ndloop3(&ndf, ws, 2, v1, v2);
60
+
61
+ result = rb_class_new_instance(3, RARRAY_PTR(r), cLinearResult);
62
+
63
+ RB_GC_GUARD(vws);
64
+ RB_GC_GUARD(r);
65
+ return result;
66
+ }
@@ -0,0 +1,48 @@
1
+ static void
2
+ iter_<%=c_func%>(na_loop_t *const lp)
3
+ {
4
+ gsl_vector x;
5
+ gsl_vector c;
6
+ gsl_matrix cov;
7
+ double y, yerr;
8
+
9
+ SET_GSL_VECTOR_FROM_LOOPT(lp,0,x);
10
+ SET_GSL_VECTOR_FROM_LOOPT(lp,1,c);
11
+ SET_GSL_MATRIX_FROM_LOOPT(lp,2,cov);
12
+
13
+ <%=func_name%>(&x, &c, &cov, &y, &yerr);
14
+
15
+ *(double*)NDL_PTR(lp,3) = y;
16
+ *(double*)NDL_PTR(lp,4) = yerr;
17
+ }
18
+
19
+ /*
20
+ @overload <%=name%>(<%=args[0][1]%>,<%=args[1][1]%>,<%=args[2][1]%>)
21
+ @param [DFloat] <%=args[0][1]%> (input vector) observations
22
+ @param [DFloat] <%=args[1][1]%> (input vector) solusions
23
+ @param [DFloat] <%=args[2][1]%> (input matrix) covariance
24
+ @return [[DFloat,DFloat]] array of (<%=args[3][1]%>, <%=args[4][1]%>).
25
+
26
+ <%=desc%>
27
+
28
+ */
29
+ static VALUE
30
+ <%=c_func(3)%>(VALUE mod, VALUE v1, VALUE v2, VALUE v3)
31
+ {
32
+ ndfunc_arg_in_t ain[3] = {{cDF,1},{cDF,1},{cDF,2}};
33
+ ndfunc_arg_out_t aout[2] = {{cDF,0},{cDF,0}};
34
+ ndfunc_t ndf = { iter_<%=c_func%>, NO_LOOP|NDF_EXTRACT,
35
+ 3, 2, ain, aout };
36
+ narray_t *x, *c, *cov;
37
+
38
+ GetNArray(v1,x);
39
+ GetNArray(v2,c);
40
+ GetNArray(v3,cov);
41
+ CHECK_GE_1D(x);
42
+ CHECK_GE_1D(c);
43
+ CHECK_GE_2D(cov);
44
+ CHECK_SIZE_EQ(VEC_SIZE(x),VEC_SIZE(c),"x size does not match c size");
45
+ CHECK_SIZE_EQ(MAT_SIZE1(cov),MAT_SIZE2(cov),"cov is not square matrix");
46
+ CHECK_SIZE_EQ(VEC_SIZE(c),MAT_SIZE1(cov),"c size does not match cov row size");
47
+ return na_ndloop(&ndf, 3, v1, v2, v3);
48
+ }
@@ -0,0 +1,47 @@
1
+ static void
2
+ iter_<%=c_func%>(na_loop_t *const lp)
3
+ {
4
+ gsl_matrix x;
5
+ gsl_vector y;
6
+ gsl_vector c;
7
+ gsl_vector r;
8
+
9
+ SET_GSL_MATRIX_FROM_LOOPT(lp,0,x);
10
+ SET_GSL_VECTOR_FROM_LOOPT(lp,1,y);
11
+ SET_GSL_VECTOR_FROM_LOOPT(lp,2,c);
12
+ SET_GSL_VECTOR_FROM_LOOPT(lp,3,r);
13
+
14
+ <%=func_name%>(&x, &y, &c, &r);
15
+ }
16
+
17
+ /*
18
+ @overload <%=name%>(<%=args[0][1]%>,<%=args[1][1]%>,<%=args[2][1]%>)
19
+ @param [DFloat] <%=args[0][1]%> (input matrix) design matrix
20
+ @param [DFloat] <%=args[1][1]%> (input vector) rhs vector
21
+ @param [DFloat] <%=args[2][1]%> (input vector) fit coefficients
22
+ @return [DFloat] returns <%=args[3][1]%>
23
+
24
+ <%=desc%>
25
+
26
+ */
27
+ static VALUE
28
+ <%=c_func(3)%>(VALUE mod, VALUE v1, VALUE v2, VALUE v3)
29
+ {
30
+ size_t shape[1];
31
+ ndfunc_arg_in_t ain[3] = {{cDF,2},{cDF,1},{cDF,1}};
32
+ ndfunc_arg_out_t aout[1] = {{cDF,1,shape}};
33
+ ndfunc_t ndf = { iter_<%=c_func%>, NO_LOOP|NDF_EXTRACT,
34
+ 3, 1, ain, aout };
35
+ narray_t *x, *y, *c;
36
+
37
+ GetNArray(v1,x);
38
+ GetNArray(v2,y);
39
+ GetNArray(v3,c);
40
+ CHECK_GE_2D(x);
41
+ CHECK_GE_1D(y);
42
+ CHECK_GE_1D(c);
43
+ CHECK_SIZE_EQ(MAT_SIZE1(x),VEC_SIZE(y),"y size does not match x row size");
44
+ CHECK_SIZE_EQ(MAT_SIZE2(x),VEC_SIZE(c),"c size does not match x column size");
45
+ shape[0] = VEC_SIZE(y);
46
+ return na_ndloop(&ndf, 3, v1, v2, v3);
47
+ }
@@ -0,0 +1,70 @@
1
+ static void
2
+ iter_<%=c_func%>(na_loop_t *const lp)
3
+ {
4
+ gsl_matrix X;
5
+ gsl_vector y;
6
+ gsl_vector w;
7
+ gsl_vector c;
8
+ gsl_matrix cov;
9
+ double *chisq;
10
+ <%=struct%> *ws = (<%=struct%>*)(lp->opt_ptr);
11
+
12
+ SET_GSL_MATRIX_FROM_LOOPT(lp,0,X);
13
+ SET_GSL_VECTOR_FROM_LOOPT(lp,1,y);
14
+ SET_GSL_VECTOR_FROM_LOOPT(lp,2,w);
15
+ SET_GSL_VECTOR_FROM_LOOPT(lp,3,c);
16
+ SET_GSL_MATRIX_FROM_LOOPT(lp,4,cov);
17
+ chisq = (double*)NDL_PTR(lp,5);
18
+
19
+ <%=func_name%>(&X,&y,&w,&c,&cov,chisq,ws);
20
+ }
21
+
22
+ /*
23
+ @overload <%=name%>(<%=args[0][1]%>,<%=args[1][1]%>,<%=args[2][1]%>)
24
+ @param [DFloat] <%=args[0][1]%> (input matrix) predictor variables
25
+ @param [DFloat] <%=args[1][1]%> (input vector) observations
26
+ @param [DFloat] <%=args[2][1]%> (input vector) weights
27
+ @return [GSL::Multifit::LinearResult] result Struct with members: <%=args[3][1]%>, <%=args[4][1]%>, <%=args[5][1]%>.
28
+
29
+ <%=desc%>
30
+
31
+ */
32
+ static VALUE
33
+ <%=c_func(3)%>(VALUE mod, VALUE v1, VALUE v2, VALUE v3)
34
+ {
35
+ size_t c_shape[1], cov_shape[2];
36
+ ndfunc_arg_in_t ain[3] = {{cDF,2},{cDF,1},{cDF,1}};
37
+ ndfunc_arg_out_t aout[3] = {{cDF,1,c_shape},{cDF,2,cov_shape},{cDF,0}};
38
+ ndfunc_t ndf = { iter_<%=c_func%>, NO_LOOP|NDF_EXTRACT,
39
+ 3, 3, ain, aout };
40
+ VALUE vws, r, result;
41
+ narray_t *X, *y, *w;
42
+ size_t n, p;
43
+ <%=struct%> *ws;
44
+
45
+ GetNArray(v1,X);
46
+ GetNArray(v2,y);
47
+ GetNArray(v3,w);
48
+ CHECK_GE_2D(X);
49
+ CHECK_GE_1D(y);
50
+ CHECK_GE_1D(w);
51
+ n = MAT_SIZE1(X);
52
+ p = MAT_SIZE2(X);
53
+ CHECK_SIZE_EQ(n,VEC_SIZE(y),"y size does not match X column size");
54
+ CHECK_SIZE_EQ(n,VEC_SIZE(w),"w size does not match X column size");
55
+
56
+ c_shape[0] = cov_shape[0] = cov_shape[1] = p;
57
+
58
+ ws = gsl_multifit_linear_alloc(n,p);
59
+ if (!ws)
60
+ rb_raise(rb_eNoMemError,"fail to allocate struct");
61
+ vws = TypedData_Wrap_Struct(<%=class_var%>, &<%=data_type_var%>, (void*)ws);
62
+
63
+ r = na_ndloop3(&ndf, ws, 3, v1, v2, v3);
64
+
65
+ result = rb_class_new_instance(3, RARRAY_PTR(r), cLinearResult);
66
+
67
+ RB_GC_GUARD(vws);
68
+ RB_GC_GUARD(r);
69
+ return result;
70
+ }
@@ -0,0 +1 @@
1
+ ["gsl_multifit_nlinear_trust"]
@@ -0,0 +1,117 @@
1
+ #ifndef NUMO_GSL_H
2
+ #define NUMO_GSL_H
3
+
4
+ #define GET_PTR(lp,i) NDL_PTR(lp,i)
5
+ // (((lp)->args[i]).ptr + ((lp)->args[i].iter[0]).pos)
6
+
7
+ #if SIZEOF_INT == 4
8
+ #define cI numo_cInt32
9
+ #define cUI numo_cUInt32
10
+ #elif SIZEOF_INT==8
11
+ #define cI numo_cInt64
12
+ #define cUI numo_cUInt64
13
+ #endif
14
+
15
+ #if SIZEOF_SIZE_T == 4
16
+ #define cSZ numo_cUInt32
17
+ #define cSSZ numo_cInt32
18
+ #elif SIZEOF_SIZE_T == 8
19
+ #define cSZ numo_cUInt64
20
+ #define cSSZ numo_cInt64
21
+ #endif
22
+
23
+ #define cDF numo_cDFloat
24
+ #define cDC numo_cDComplex
25
+ #define cInt cI
26
+ #define cUInt cUI
27
+
28
+ #define ALLOCA_GSL_VECTOR_FROM_NARRAY(nary,gvec,mode) \
29
+ { \
30
+ narray_t *na; \
31
+ GetNArray(nary,na); \
32
+ gvec = ALLOCA_N(gsl_vector,1); \
33
+ gvec->data = (double*)na_get_pointer_for_##mode(nary); \
34
+ gvec->size = na->shape[0]; \
35
+ gvec->stride = 1; \
36
+ gvec->block = 0; \
37
+ gvec->owner = 0; \
38
+ }
39
+
40
+ #define ALLOCA_GSL_MATRIX_FROM_NARRAY(nary,gmat,mode) \
41
+ { \
42
+ narray_t *na; \
43
+ GetNArray(nary,na); \
44
+ gmat = ALLOCA_N(gsl_matrix,1); \
45
+ gmat->data = (double*)na_get_pointer_for_##mode(nary); \
46
+ gmat->size1 = na->shape[0]; \
47
+ gmat->size2 = na->shape[1]; \
48
+ gmat->tda = na->shape[1]; \
49
+ gmat->block = 0; \
50
+ gmat->owner = 0; \
51
+ }
52
+
53
+ #define ALLOCA_GSL_VECTOR_FROM_NARRAY_R(nary,gvec) \
54
+ ALLOCA_GSL_VECTOR_FROM_NARRAY(nary,gvec,read)
55
+ #define ALLOCA_GSL_MATRIX_FROM_NARRAY_R(nary,gmat) \
56
+ ALLOCA_GSL_MATRIX_FROM_NARRAY(nary,gmat,read)
57
+ #define ALLOCA_GSL_VECTOR_FROM_NARRAY_W(nary,gvec) \
58
+ ALLOCA_GSL_VECTOR_FROM_NARRAY(nary,gvec,write)
59
+ #define ALLOCA_GSL_MATRIX_FROM_NARRAY_W(nary,gmat) \
60
+ ALLOCA_GSL_MATRIX_FROM_NARRAY(nary,gmat,write)
61
+ #define ALLOCA_GSL_VECTOR_FROM_NARRAY_RW(nary,gvec) \
62
+ ALLOCA_GSL_VECTOR_FROM_NARRAY(nary,gvec,read_write)
63
+ #define ALLOCA_GSL_MATRIX_FROM_NARRAY_RW(nary,gmat) \
64
+ ALLOCA_GSL_MATRIX_FROM_NARRAY(nary,gmat,read_write)
65
+
66
+ #define ALLOCA_GSL_MATRIX_FROM_LOOPT(lp,i,gmat) \
67
+ { \
68
+ assert((lp)->args[i].ndim == 2); \
69
+ gmat = ALLOCA_N(gsl_matrix,1); \
70
+ gmat->data = (double*)NDL_PTR(lp,i); \
71
+ gmat->size1 = (lp)->args[i].shape[0]; \
72
+ gmat->size2 = (lp)->args[i].shape[1]; \
73
+ gmat->tda = gmat->size2; \
74
+ gmat->block = 0; \
75
+ gmat->owner = 0; \
76
+ }
77
+
78
+ #define ALLOCA_GSL_VECTOR_FROM_LOOPT(lp,i,gvec) \
79
+ { \
80
+ assert((lp)->args[i].ndim == 1); \
81
+ gvec = ALLOCA_N(gsl_vector,1); \
82
+ gvec->data = (double*)NDL_PTR(lp,i); \
83
+ gvec->size = (lp)->args[i].shape[0]; \
84
+ gvec->stride = NDL_STP(lp,i)/sizeof(double); \
85
+ gvec->block = 0; \
86
+ gvec->owner = 0; \
87
+ }
88
+
89
+ #define SET_GSL_MATRIX_FROM_LOOPT(lp,i,gmat) \
90
+ { \
91
+ assert((lp)->args[i].ndim == 2); \
92
+ gmat.data = (double*)NDL_PTR(lp,i); \
93
+ gmat.size1 = (lp)->args[i].shape[0]; \
94
+ gmat.size2 = (lp)->args[i].shape[1]; \
95
+ gmat.tda = gmat.size2; \
96
+ gmat.block = 0; \
97
+ gmat.owner = 0; \
98
+ }
99
+
100
+ #define SET_GSL_VECTOR_FROM_LOOPT(lp,i,gvec) \
101
+ { \
102
+ assert((lp)->args[i].ndim == 1); \
103
+ gvec.data = (double*)NDL_PTR(lp,i); \
104
+ gvec.size = (lp)->args[i].shape[0]; \
105
+ gvec.stride = NDL_STP(lp,i)/sizeof(double); \
106
+ gvec.block = 0; \
107
+ gvec.owner = 0; \
108
+ }
109
+
110
+ #define MAT_SIZE1(x) ((x)->shape[(x)->ndim-2])
111
+ #define MAT_SIZE2(x) ((x)->shape[(x)->ndim-1])
112
+ #define VEC_SIZE(x) ((x)->shape[(x)->ndim-1])
113
+ #define CHECK_GE_1D(x) {if ((x)->ndim < 1) {rb_raise(nary_eDimensionError,#x" dimension must be >= 1");}}
114
+ #define CHECK_GE_2D(x) {if ((x)->ndim < 2) {rb_raise(nary_eDimensionError,#x" dimension must be >= 2");}}
115
+ #define CHECK_SIZE_EQ(x,y,msg) {if ((x)!=(y)) {rb_raise(nary_eShapeError,msg);}}
116
+
117
+ #endif /* ifndef NUMO_GSL_H */
@@ -0,0 +1,17 @@
1
+ COGEN=ruby erbpp_pdf.rb
2
+ GENSRC=gsl_pdf.c
3
+ GENDEPS=erbpp_pdf.rb ../gen/*.rb ../gen/tmpl/*.c tmpl/*.c
4
+
5
+ src : $(GENSRC)
6
+
7
+ $(GENSRC) : $(GENDEPS)
8
+ $(COGEN) > $@
9
+
10
+ doc : $(GENSRC)
11
+ yard doc $(GENSRC)
12
+
13
+ clean: cleansrc cleandoc
14
+ cleansrc:
15
+ -$(Q)$(RM) $(GENSRC)
16
+ cleandoc:
17
+ -$(Q)$(RM_RF) doc .yardoc
@@ -0,0 +1,26 @@
1
+ require_relative "parse_pdf"
2
+ require "erbpp/line_number"
3
+
4
+ DefLib.new do
5
+ set erb_dir: %w[tmpl ../gen/tmpl]
6
+ set erb_suffix: ".c"
7
+ set ns_var: "mG"
8
+
9
+ name = "Pdf"
10
+ base = name.downcase
11
+ set file_name: "gsl_#{name}.c"
12
+ set include_files: ["gsl/gsl_randist.h"]
13
+ set lib_name: base
14
+
15
+ DefPdf.new(self) do
16
+ set name: base
17
+ set module_name: name
18
+ set module_var: "m"+name
19
+ set full_module_name: "Numo::GSL::"+name
20
+
21
+ ErbppGsl.read_func.each do |h|
22
+ check_func(h)
23
+ end
24
+ end
25
+
26
+ end.run
@@ -0,0 +1,9 @@
1
+ require_relative '../extconf_gsl.rb'
2
+
3
+ # source file to compile
4
+ srcs = %w(
5
+ gsl_pdf
6
+ )
7
+ $objs = srcs.collect{|i| i+".o"}
8
+
9
+ create_makefile('numo/gsl/pdf')
@@ -0,0 +1,306 @@
1
+ [{:func_name=>"gsl_ran_gaussian_pdf",
2
+ :func_type=>"double",
3
+ :args=>[["double", "x"], ["double", "sigma"]],
4
+ :desc=>
5
+ "This function computes the probability density p(x) at x\n" +
6
+ "for a Gaussian distribution with standard deviation sigma, using\n" +
7
+ "the formula given above."},
8
+ {:func_name=>"gsl_ran_ugaussian_pdf",
9
+ :func_type=>"double",
10
+ :args=>[["double", "x"]],
11
+ :desc=>
12
+ "These functions compute results for the unit Gaussian distribution. They\n" +
13
+ "are equivalent to the functions above with a standard deviation of one,\n" +
14
+ "sigma = 1."},
15
+ {:func_name=>"gsl_ran_gaussian_tail_pdf",
16
+ :func_type=>"double",
17
+ :args=>[["double", "x"], ["double", "a"], ["double", "sigma"]],
18
+ :desc=>
19
+ "This function computes the probability density p(x) at x\n" +
20
+ "for a Gaussian tail distribution with standard deviation sigma and\n" +
21
+ "lower limit a, using the formula given above."},
22
+ {:func_name=>"gsl_ran_ugaussian_tail_pdf",
23
+ :func_type=>"double",
24
+ :args=>[["double", "x"], ["double", "a"]],
25
+ :desc=>
26
+ "These functions compute results for the tail of a unit Gaussian\n" +
27
+ "distribution. They are equivalent to the functions above with a standard\n" +
28
+ "deviation of one, sigma = 1."},
29
+ {:func_name=>"gsl_ran_bivariate_gaussian_pdf",
30
+ :func_type=>"double",
31
+ :args=>
32
+ [["double", "x"],
33
+ ["double", "y"],
34
+ ["double", "sigma_x"],
35
+ ["double", "sigma_y"],
36
+ ["double", "rho"]],
37
+ :desc=>
38
+ "This function computes the probability density p(x,y) at\n" +
39
+ "(x,y) for a bivariate Gaussian distribution with standard\n" +
40
+ "deviations sigma_x, sigma_y and correlation coefficient\n" +
41
+ "rho, using the formula given above."},
42
+ {:func_name=>"gsl_ran_multivariate_gaussian_pdf",
43
+ :func_type=>"int",
44
+ :args=>
45
+ [["const gsl_vector *", "x"],
46
+ ["const gsl_vector *", "mu"],
47
+ ["const gsl_matrix *", "L"],
48
+ ["double *", "result"],
49
+ ["gsl_vector *", "work"]],
50
+ :desc=>
51
+ "These functions compute p(x) or \\log{p(x)} at the point x, using mean vector\n" +
52
+ "mu and variance-covariance matrix specified by its Cholesky factor L using the formula\n" +
53
+ "above. Additional workspace of length k is required in work."},
54
+ {:func_name=>"gsl_ran_multivariate_gaussian_log_pdf",
55
+ :func_type=>"int",
56
+ :args=>
57
+ [["const gsl_vector *", "x"],
58
+ ["const gsl_vector *", "mu"],
59
+ ["const gsl_matrix *", "L"],
60
+ ["double *", "result"],
61
+ ["gsl_vector *", "work"]],
62
+ :desc=>
63
+ "These functions compute p(x) or \\log{p(x)} at the point x, using mean vector\n" +
64
+ "mu and variance-covariance matrix specified by its Cholesky factor L using the formula\n" +
65
+ "above. Additional workspace of length k is required in work."},
66
+ {:func_name=>"gsl_ran_exponential_pdf",
67
+ :func_type=>"double",
68
+ :args=>[["double", "x"], ["double", "mu"]],
69
+ :desc=>
70
+ "This function computes the probability density p(x) at x\n" +
71
+ "for an exponential distribution with mean mu, using the formula\n" +
72
+ "given above."},
73
+ {:func_name=>"gsl_ran_laplace_pdf",
74
+ :func_type=>"double",
75
+ :args=>[["double", "x"], ["double", "a"]],
76
+ :desc=>
77
+ "This function computes the probability density p(x) at x\n" +
78
+ "for a Laplace distribution with width a, using the formula\n" +
79
+ "given above."},
80
+ {:func_name=>"gsl_ran_exppow_pdf",
81
+ :func_type=>"double",
82
+ :args=>[["double", "x"], ["double", "a"], ["double", "b"]],
83
+ :desc=>
84
+ "This function computes the probability density p(x) at x\n" +
85
+ "for an exponential power distribution with scale parameter a\n" +
86
+ "and exponent b, using the formula given above."},
87
+ {:func_name=>"gsl_ran_cauchy_pdf",
88
+ :func_type=>"double",
89
+ :args=>[["double", "x"], ["double", "a"]],
90
+ :desc=>
91
+ "This function computes the probability density p(x) at x\n" +
92
+ "for a Cauchy distribution with scale parameter a, using the formula\n" +
93
+ "given above."},
94
+ {:func_name=>"gsl_ran_rayleigh_pdf",
95
+ :func_type=>"double",
96
+ :args=>[["double", "x"], ["double", "sigma"]],
97
+ :desc=>
98
+ "This function computes the probability density p(x) at x\n" +
99
+ "for a Rayleigh distribution with scale parameter sigma, using the\n" +
100
+ "formula given above."},
101
+ {:func_name=>"gsl_ran_rayleigh_tail_pdf",
102
+ :func_type=>"double",
103
+ :args=>[["double", "x"], ["double", "a"], ["double", "sigma"]],
104
+ :desc=>
105
+ "This function computes the probability density p(x) at x\n" +
106
+ "for a Rayleigh tail distribution with scale parameter sigma and\n" +
107
+ "lower limit a, using the formula given above."},
108
+ {:func_name=>"gsl_ran_landau_pdf",
109
+ :func_type=>"double",
110
+ :args=>[["double", "x"]],
111
+ :desc=>
112
+ "This function computes the probability density p(x) at x\n" +
113
+ "for the Landau distribution using an approximation to the formula given\n" +
114
+ "above."},
115
+ {:func_name=>"gsl_ran_gamma_pdf",
116
+ :func_type=>"double",
117
+ :args=>[["double", "x"], ["double", "a"], ["double", "b"]],
118
+ :desc=>
119
+ "This function computes the probability density p(x) at x\n" +
120
+ "for a gamma distribution with parameters a and b, using the\n" +
121
+ "formula given above."},
122
+ {:func_name=>"gsl_ran_flat_pdf",
123
+ :func_type=>"double",
124
+ :args=>[["double", "x"], ["double", "a"], ["double", "b"]],
125
+ :desc=>
126
+ "This function computes the probability density p(x) at x\n" +
127
+ "for a uniform distribution from a to b, using the formula\n" +
128
+ "given above."},
129
+ {:func_name=>"gsl_ran_lognormal_pdf",
130
+ :func_type=>"double",
131
+ :args=>[["double", "x"], ["double", "zeta"], ["double", "sigma"]],
132
+ :desc=>
133
+ "This function computes the probability density p(x) at x\n" +
134
+ "for a lognormal distribution with parameters zeta and sigma,\n" +
135
+ "using the formula given above."},
136
+ {:func_name=>"gsl_ran_chisq_pdf",
137
+ :func_type=>"double",
138
+ :args=>[["double", "x"], ["double", "nu"]],
139
+ :desc=>
140
+ "This function computes the probability density p(x) at x\n" +
141
+ "for a chi-squared distribution with nu degrees of freedom, using\n" +
142
+ "the formula given above."},
143
+ {:func_name=>"gsl_ran_fdist_pdf",
144
+ :func_type=>"double",
145
+ :args=>[["double", "x"], ["double", "nu1"], ["double", "nu2"]],
146
+ :desc=>
147
+ "This function computes the probability density p(x) at x\n" +
148
+ "for an F-distribution with nu1 and nu2 degrees of freedom,\n" +
149
+ "using the formula given above."},
150
+ {:func_name=>"gsl_ran_tdist_pdf",
151
+ :func_type=>"double",
152
+ :args=>[["double", "x"], ["double", "nu"]],
153
+ :desc=>
154
+ "This function computes the probability density p(x) at x\n" +
155
+ "for a t-distribution with nu degrees of freedom, using the formula\n" +
156
+ "given above."},
157
+ {:func_name=>"gsl_ran_beta_pdf",
158
+ :func_type=>"double",
159
+ :args=>[["double", "x"], ["double", "a"], ["double", "b"]],
160
+ :desc=>
161
+ "This function computes the probability density p(x) at x\n" +
162
+ "for a beta distribution with parameters a and b, using the\n" +
163
+ "formula given above."},
164
+ {:func_name=>"gsl_ran_logistic_pdf",
165
+ :func_type=>"double",
166
+ :args=>[["double", "x"], ["double", "a"]],
167
+ :desc=>
168
+ "This function computes the probability density p(x) at x\n" +
169
+ "for a logistic distribution with scale parameter a, using the\n" +
170
+ "formula given above."},
171
+ {:func_name=>"gsl_ran_pareto_pdf",
172
+ :func_type=>"double",
173
+ :args=>[["double", "x"], ["double", "a"], ["double", "b"]],
174
+ :desc=>
175
+ "This function computes the probability density p(x) at x\n" +
176
+ "for a Pareto distribution with exponent a and scale b, using\n" +
177
+ "the formula given above."},
178
+ {:func_name=>"gsl_ran_weibull_pdf",
179
+ :func_type=>"double",
180
+ :args=>[["double", "x"], ["double", "a"], ["double", "b"]],
181
+ :desc=>
182
+ "This function computes the probability density p(x) at x\n" +
183
+ "for a Weibull distribution with scale a and exponent b,\n" +
184
+ "using the formula given above."},
185
+ {:func_name=>"gsl_ran_gumbel1_pdf",
186
+ :func_type=>"double",
187
+ :args=>[["double", "x"], ["double", "a"], ["double", "b"]],
188
+ :desc=>
189
+ "This function computes the probability density p(x) at x\n" +
190
+ "for a Type-1 Gumbel distribution with parameters a and b,\n" +
191
+ "using the formula given above."},
192
+ {:func_name=>"gsl_ran_gumbel2_pdf",
193
+ :func_type=>"double",
194
+ :args=>[["double", "x"], ["double", "a"], ["double", "b"]],
195
+ :desc=>
196
+ "This function computes the probability density p(x) at x\n" +
197
+ "for a Type-2 Gumbel distribution with parameters a and b,\n" +
198
+ "using the formula given above."},
199
+ {:func_name=>"gsl_ran_dirichlet_pdf",
200
+ :func_type=>"double",
201
+ :args=>
202
+ [["size_t", "K"], ["const double", "alpha[]"], ["const double", "theta[]"]],
203
+ :desc=>
204
+ "This function computes the probability density \n" +
205
+ "$p(\\theta_1, \\ldots , \\theta_K)$\n" +
206
+ "p(\\theta_1, ... , \\theta_K)\n" +
207
+ "at theta[K] for a Dirichlet distribution with parameters \n" +
208
+ "alpha[K], using the formula given above."},
209
+ {:func_name=>"gsl_ran_dirichlet_lnpdf",
210
+ :func_type=>"double",
211
+ :args=>
212
+ [["size_t", "K"], ["const double", "alpha[]"], ["const double", "theta[]"]],
213
+ :desc=>
214
+ "This function computes the logarithm of the probability density \n" +
215
+ "$p(\\theta_1, \\ldots , \\theta_K)$\n" +
216
+ "p(\\theta_1, ... , \\theta_K)\n" +
217
+ "for a Dirichlet distribution with parameters \n" +
218
+ "alpha[K]."},
219
+ {:func_name=>"gsl_ran_discrete_pdf",
220
+ :func_type=>"double",
221
+ :args=>[["size_t", "k"], ["const gsl_ran_discrete_t *", "g"]],
222
+ :desc=>
223
+ "Returns the probability P[k] of observing the variable k.\n" +
224
+ "Since P[k] is not stored as part of the lookup table, it must be\n" +
225
+ "recomputed; this computation takes O(K), so if K is large\n" +
226
+ "and you care about the original array P[k] used to create the\n" +
227
+ "lookup table, then you should just keep this original array P[k]\n" +
228
+ "around."},
229
+ {:func_name=>"gsl_ran_poisson_pdf",
230
+ :func_type=>"double",
231
+ :args=>[["unsigned int", "k"], ["double", "mu"]],
232
+ :desc=>
233
+ "This function computes the probability p(k) of obtaining k\n" +
234
+ "from a Poisson distribution with mean mu, using the formula\n" +
235
+ "given above."},
236
+ {:func_name=>"gsl_ran_bernoulli_pdf",
237
+ :func_type=>"double",
238
+ :args=>[["unsigned int", "k"], ["double", "p"]],
239
+ :desc=>
240
+ "This function computes the probability p(k) of obtaining\n" +
241
+ "k from a Bernoulli distribution with probability parameter\n" +
242
+ "p, using the formula given above."},
243
+ {:func_name=>"gsl_ran_binomial_pdf",
244
+ :func_type=>"double",
245
+ :args=>[["unsigned int", "k"], ["double", "p"], ["unsigned int", "n"]],
246
+ :desc=>
247
+ "This function computes the probability p(k) of obtaining k\n" +
248
+ "from a binomial distribution with parameters p and n, using\n" +
249
+ "the formula given above."},
250
+ {:func_name=>"gsl_ran_multinomial_pdf",
251
+ :func_type=>"double",
252
+ :args=>
253
+ [["size_t", "K"], ["const double", "p[]"], ["const unsigned int", "n[]"]],
254
+ :desc=>
255
+ "This function computes the probability \n" +
256
+ "$P(n_1, n_2, \\ldots, n_K)$\n" +
257
+ "P(n_1, n_2, ..., n_K)\n" +
258
+ "of sampling n[K] from a multinomial distribution \n" +
259
+ "with parameters p[K], using the formula given above."},
260
+ {:func_name=>"gsl_ran_multinomial_lnpdf",
261
+ :func_type=>"double",
262
+ :args=>
263
+ [["size_t", "K"], ["const double", "p[]"], ["const unsigned int", "n[]"]],
264
+ :desc=>
265
+ "This function returns the logarithm of the probability for the\n" +
266
+ "multinomial distribution $P(n_1, n_2, \\ldots, n_K)$\n" +
267
+ "P(n_1, n_2, ..., n_K) with parameters p[K]."},
268
+ {:func_name=>"gsl_ran_negative_binomial_pdf",
269
+ :func_type=>"double",
270
+ :args=>[["unsigned int", "k"], ["double", "p"], ["double", "n"]],
271
+ :desc=>
272
+ "This function computes the probability p(k) of obtaining k\n" +
273
+ "from a negative binomial distribution with parameters p and\n" +
274
+ "n, using the formula given above."},
275
+ {:func_name=>"gsl_ran_pascal_pdf",
276
+ :func_type=>"double",
277
+ :args=>[["unsigned int", "k"], ["double", "p"], ["unsigned int", "n"]],
278
+ :desc=>
279
+ "This function computes the probability p(k) of obtaining k\n" +
280
+ "from a Pascal distribution with parameters p and\n" +
281
+ "n, using the formula given above."},
282
+ {:func_name=>"gsl_ran_geometric_pdf",
283
+ :func_type=>"double",
284
+ :args=>[["unsigned int", "k"], ["double", "p"]],
285
+ :desc=>
286
+ "This function computes the probability p(k) of obtaining k\n" +
287
+ "from a geometric distribution with probability parameter p, using\n" +
288
+ "the formula given above."},
289
+ {:func_name=>"gsl_ran_hypergeometric_pdf",
290
+ :func_type=>"double",
291
+ :args=>
292
+ [["unsigned int", "k"],
293
+ ["unsigned int", "n1"],
294
+ ["unsigned int", "n2"],
295
+ ["unsigned int", "t"]],
296
+ :desc=>
297
+ "This function computes the probability p(k) of obtaining k\n" +
298
+ "from a hypergeometric distribution with parameters n1, n2,\n" +
299
+ "t, using the formula given above."},
300
+ {:func_name=>"gsl_ran_logarithmic_pdf",
301
+ :func_type=>"double",
302
+ :args=>[["unsigned int", "k"], ["double", "p"]],
303
+ :desc=>
304
+ "This function computes the probability p(k) of obtaining k\n" +
305
+ "from a logarithmic distribution with probability parameter p,\n" +
306
+ "using the formula given above."}]