numo-gsl 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +4 -0
- data/README.md +84 -0
- data/Rakefile +16 -0
- data/ext/numo/gsl/cdf/depend +17 -0
- data/ext/numo/gsl/cdf/erbpp_cdf.rb +44 -0
- data/ext/numo/gsl/cdf/extconf.rb +9 -0
- data/ext/numo/gsl/cdf/func_def.rb +610 -0
- data/ext/numo/gsl/const/const_def.rb +419 -0
- data/ext/numo/gsl/const/depend +17 -0
- data/ext/numo/gsl/const/erbpp_const.rb +30 -0
- data/ext/numo/gsl/const/extconf.rb +9 -0
- data/ext/numo/gsl/err/depend +1 -0
- data/ext/numo/gsl/err/err.c +22 -0
- data/ext/numo/gsl/err/extconf.rb +9 -0
- data/ext/numo/gsl/extconf_gsl.rb +44 -0
- data/ext/numo/gsl/fit/depend +17 -0
- data/ext/numo/gsl/fit/erbpp_fit.rb +74 -0
- data/ext/numo/gsl/fit/extconf.rb +9 -0
- data/ext/numo/gsl/fit/func_def.rb +129 -0
- data/ext/numo/gsl/fit/tmpl/check_1d.c +9 -0
- data/ext/numo/gsl/fit/tmpl/fit_linear.c +53 -0
- data/ext/numo/gsl/fit/tmpl/fit_linear_est.c +56 -0
- data/ext/numo/gsl/fit/tmpl/fit_mul.c +50 -0
- data/ext/numo/gsl/fit/tmpl/fit_mul_est.c +47 -0
- data/ext/numo/gsl/fit/tmpl/fit_wlinear.c +59 -0
- data/ext/numo/gsl/fit/tmpl/fit_wmul.c +56 -0
- data/ext/numo/gsl/gen/erbpp2.rb +306 -0
- data/ext/numo/gsl/gen/erbpp_gsl.rb +166 -0
- data/ext/numo/gsl/gen/func_parser.rb +520 -0
- data/ext/numo/gsl/gen/tmpl/c_DFloat_f_DFloat.c +40 -0
- data/ext/numo/gsl/gen/tmpl/c_DFloat_f_SZ.c +41 -0
- data/ext/numo/gsl/gen/tmpl/c_DFloat_f_SZ_x2.c +44 -0
- data/ext/numo/gsl/gen/tmpl/c_DFloat_x2_f_DFloat_x2.c +45 -0
- data/ext/numo/gsl/gen/tmpl/c_double_f_double.c +16 -0
- data/ext/numo/gsl/gen/tmpl/c_double_f_sizet.c +16 -0
- data/ext/numo/gsl/gen/tmpl/c_double_f_sizet_x2.c +17 -0
- data/ext/numo/gsl/gen/tmpl/c_double_f_void.c +15 -0
- data/ext/numo/gsl/gen/tmpl/c_double_x2_f_void.c +17 -0
- data/ext/numo/gsl/gen/tmpl/c_new_DFloat.c +29 -0
- data/ext/numo/gsl/gen/tmpl/c_new_double.c +22 -0
- data/ext/numo/gsl/gen/tmpl/c_new_f_other.c +25 -0
- data/ext/numo/gsl/gen/tmpl/c_new_sizet.c +22 -0
- data/ext/numo/gsl/gen/tmpl/c_new_sizet_double.c +23 -0
- data/ext/numo/gsl/gen/tmpl/c_new_sizet_x2.c +23 -0
- data/ext/numo/gsl/gen/tmpl/c_new_void.c +21 -0
- data/ext/numo/gsl/gen/tmpl/c_other_f_void.c +19 -0
- data/ext/numo/gsl/gen/tmpl/c_self_f_DFloat.c +46 -0
- data/ext/numo/gsl/gen/tmpl/c_self_f_DFloat_x2.c +41 -0
- data/ext/numo/gsl/gen/tmpl/c_self_f_DFloat_x3.c +44 -0
- data/ext/numo/gsl/gen/tmpl/c_self_f_DFloat_x4.c +47 -0
- data/ext/numo/gsl/gen/tmpl/c_self_f_SZ_x2_DFloat.c +45 -0
- data/ext/numo/gsl/gen/tmpl/c_self_f_double.c +17 -0
- data/ext/numo/gsl/gen/tmpl/c_self_f_other.c +17 -0
- data/ext/numo/gsl/gen/tmpl/c_self_f_sizet.c +21 -0
- data/ext/numo/gsl/gen/tmpl/c_self_f_void.c +14 -0
- data/ext/numo/gsl/gen/tmpl/c_sizet_f_void.c +15 -0
- data/ext/numo/gsl/gen/tmpl/c_sizet_x2_f_void.c +17 -0
- data/ext/numo/gsl/gen/tmpl/c_str_f_void.c +15 -0
- data/ext/numo/gsl/gen/tmpl/c_super_new_void.c +18 -0
- data/ext/numo/gsl/gen/tmpl/c_uint_f_void.c +15 -0
- data/ext/numo/gsl/gen/tmpl/c_ulong_f_void.c +15 -0
- data/ext/numo/gsl/gen/tmpl/c_void_f_double.c +17 -0
- data/ext/numo/gsl/gen/tmpl/c_void_f_double_x2.c +18 -0
- data/ext/numo/gsl/gen/tmpl/c_void_f_double_x4.c +20 -0
- data/ext/numo/gsl/gen/tmpl/c_void_f_ulong.c +17 -0
- data/ext/numo/gsl/gen/tmpl/c_void_f_void.c +14 -0
- data/ext/numo/gsl/gen/tmpl/cast_1d_contiguous.c +15 -0
- data/ext/numo/gsl/gen/tmpl/cast_2d_contiguous.c +15 -0
- data/ext/numo/gsl/gen/tmpl/class.c +26 -0
- data/ext/numo/gsl/gen/tmpl/create_new_narray.c +26 -0
- data/ext/numo/gsl/gen/tmpl/init_class.c +10 -0
- data/ext/numo/gsl/gen/tmpl/init_module.c +12 -0
- data/ext/numo/gsl/gen/tmpl/lib.c +41 -0
- data/ext/numo/gsl/gen/tmpl/m_DFloat_Int_f_DFloat.c +38 -0
- data/ext/numo/gsl/gen/tmpl/m_DFloat_f_DFloat.c +35 -0
- data/ext/numo/gsl/gen/tmpl/m_DFloat_f_DFloat_Int.c +39 -0
- data/ext/numo/gsl/gen/tmpl/m_DFloat_f_DFloat_UInt.c +39 -0
- data/ext/numo/gsl/gen/tmpl/m_DFloat_f_DFloat_double.c +42 -0
- data/ext/numo/gsl/gen/tmpl/m_DFloat_f_DFloat_double_x2.c +47 -0
- data/ext/numo/gsl/gen/tmpl/m_DFloat_f_DFloat_int.c +42 -0
- data/ext/numo/gsl/gen/tmpl/m_DFloat_f_DFloat_x2.c +38 -0
- data/ext/numo/gsl/gen/tmpl/m_DFloat_f_DFloat_x3.c +41 -0
- data/ext/numo/gsl/gen/tmpl/m_DFloat_f_Int.c +36 -0
- data/ext/numo/gsl/gen/tmpl/m_DFloat_f_UInt.c +36 -0
- data/ext/numo/gsl/gen/tmpl/m_DFloat_f_UInt32.c +36 -0
- data/ext/numo/gsl/gen/tmpl/m_DFloat_f_UInt32_double.c +43 -0
- data/ext/numo/gsl/gen/tmpl/m_DFloat_f_UInt32_double_uint.c +49 -0
- data/ext/numo/gsl/gen/tmpl/m_DFloat_f_UInt32_double_x2.c +48 -0
- data/ext/numo/gsl/gen/tmpl/m_DFloat_f_UInt32_uint_x3.c +51 -0
- data/ext/numo/gsl/gen/tmpl/m_DFloat_f_UInt_double.c +43 -0
- data/ext/numo/gsl/gen/tmpl/m_DFloat_f_UInt_double_uint.c +50 -0
- data/ext/numo/gsl/gen/tmpl/m_DFloat_f_UInt_double_x2.c +48 -0
- data/ext/numo/gsl/gen/tmpl/m_DFloat_f_UInt_uint_x3.c +51 -0
- data/ext/numo/gsl/gen/tmpl/m_DFloat_f_int_DFloat.c +41 -0
- data/ext/numo/gsl/gen/tmpl/m_DFloat_f_int_DFloat_x2.c +44 -0
- data/ext/numo/gsl/gen/tmpl/m_DFloat_f_int_x2_DFloat_x2.c +46 -0
- data/ext/numo/gsl/gen/tmpl/m_Int_f_DFloat.c +36 -0
- data/ext/numo/gsl/gen/tmpl/m_Int_f_DFloat_x3.c +42 -0
- data/ext/numo/gsl/gen/tmpl/m_Int_f_int_DFloat.c +42 -0
- data/ext/numo/gsl/gen/tmpl/m_Int_f_int_DFloat_x2.c +45 -0
- data/ext/numo/gsl/gen/tmpl/mod_func_noloop.c +54 -0
- data/ext/numo/gsl/gen/tmpl/mod_func_scalar.c +27 -0
- data/ext/numo/gsl/gen/tmpl/module.c +9 -0
- data/ext/numo/gsl/histogram/depend +17 -0
- data/ext/numo/gsl/histogram/erbpp_histogram.rb +109 -0
- data/ext/numo/gsl/histogram/extconf.rb +9 -0
- data/ext/numo/gsl/histogram/func_def.rb +763 -0
- data/ext/numo/gsl/histogram/tmpl/c_DFloat_f_2d_get.c +54 -0
- data/ext/numo/gsl/histogram/tmpl/c_DFloat_f_field.c +35 -0
- data/ext/numo/gsl/histogram/tmpl/c_DFloat_f_get.c +47 -0
- data/ext/numo/gsl/histogram/tmpl/c_DFloat_x2_f_get_range.c +56 -0
- data/ext/numo/gsl/histogram/tmpl/c_bool_f_other.c +19 -0
- data/ext/numo/gsl/histogram/tmpl/c_bool_f_pdf_init.c +24 -0
- data/ext/numo/gsl/histogram/tmpl/c_self_f_2d_set_ranges.c +26 -0
- data/ext/numo/gsl/histogram/tmpl/c_self_f_set_ranges.c +21 -0
- data/ext/numo/gsl/histogram/tmpl/c_sizet_f_field.c +15 -0
- data/ext/numo/gsl/interp/depend +17 -0
- data/ext/numo/gsl/interp/erbpp_interp.rb +59 -0
- data/ext/numo/gsl/interp/extconf.rb +9 -0
- data/ext/numo/gsl/interp/func_def.rb +816 -0
- data/ext/numo/gsl/interp/parse_interp.rb +67 -0
- data/ext/numo/gsl/interp/tmpl/interp2d_new.c +36 -0
- data/ext/numo/gsl/interp/tmpl/interp2d_type_new.c +17 -0
- data/ext/numo/gsl/interp/tmpl/interp_bsearch.c +57 -0
- data/ext/numo/gsl/interp/tmpl/interp_new.c +29 -0
- data/ext/numo/gsl/interp/tmpl/interp_type_new.c +16 -0
- data/ext/numo/gsl/interp/tmpl/spline2d_eval.c +61 -0
- data/ext/numo/gsl/interp/tmpl/spline_eval.c +55 -0
- data/ext/numo/gsl/interp/tmpl/spline_integ.c +56 -0
- data/ext/numo/gsl/interp/type_def.rb +9 -0
- data/ext/numo/gsl/multifit/depend +17 -0
- data/ext/numo/gsl/multifit/erbpp_multifit.rb +99 -0
- data/ext/numo/gsl/multifit/extconf.rb +9 -0
- data/ext/numo/gsl/multifit/func_2.1.rb +1035 -0
- data/ext/numo/gsl/multifit/func_2.2.1.rb +736 -0
- data/ext/numo/gsl/multifit/func_2.2.rb +736 -0
- data/ext/numo/gsl/multifit/func_2.3.rb +872 -0
- data/ext/numo/gsl/multifit/func_def.rb +1012 -0
- data/ext/numo/gsl/multifit/tmpl/multifit_linear.c +66 -0
- data/ext/numo/gsl/multifit/tmpl/multifit_linear_est.c +48 -0
- data/ext/numo/gsl/multifit/tmpl/multifit_linear_residuals.c +47 -0
- data/ext/numo/gsl/multifit/tmpl/multifit_wlinear.c +70 -0
- data/ext/numo/gsl/multifit/type_def.rb +1 -0
- data/ext/numo/gsl/numo_gsl.h +117 -0
- data/ext/numo/gsl/pdf/depend +17 -0
- data/ext/numo/gsl/pdf/erbpp_pdf.rb +26 -0
- data/ext/numo/gsl/pdf/extconf.rb +9 -0
- data/ext/numo/gsl/pdf/func_2.2.1.rb +306 -0
- data/ext/numo/gsl/pdf/func_2.2.rb +306 -0
- data/ext/numo/gsl/pdf/func_2.3.rb +306 -0
- data/ext/numo/gsl/pdf/func_def.rb +282 -0
- data/ext/numo/gsl/pdf/parse_pdf.rb +42 -0
- data/ext/numo/gsl/pdf/tmpl/dirichlet.c +39 -0
- data/ext/numo/gsl/pdf/tmpl/multinomial.c +39 -0
- data/ext/numo/gsl/poly/depend +17 -0
- data/ext/numo/gsl/poly/erbpp_poly.rb +70 -0
- data/ext/numo/gsl/poly/extconf.rb +9 -0
- data/ext/numo/gsl/poly/func_def.rb +234 -0
- data/ext/numo/gsl/poly/tmpl/poly_complex_solve.c +59 -0
- data/ext/numo/gsl/poly/tmpl/poly_eval.c +70 -0
- data/ext/numo/gsl/poly/tmpl/poly_eval_derivs.c +40 -0
- data/ext/numo/gsl/ran/depend +17 -0
- data/ext/numo/gsl/ran/erbpp_ran.rb +42 -0
- data/ext/numo/gsl/ran/extconf.rb +9 -0
- data/ext/numo/gsl/ran/func_2.2.1.rb +1658 -0
- data/ext/numo/gsl/ran/func_2.2.rb +1658 -0
- data/ext/numo/gsl/ran/func_2.3.rb +1658 -0
- data/ext/numo/gsl/ran/func_def.rb +1594 -0
- data/ext/numo/gsl/ran/parse_ran.rb +10 -0
- data/ext/numo/gsl/rng/depend +17 -0
- data/ext/numo/gsl/rng/erbpp_rng.rb +58 -0
- data/ext/numo/gsl/rng/extconf.rb +9 -0
- data/ext/numo/gsl/rng/func_def.rb +230 -0
- data/ext/numo/gsl/rng/parse_rng.rb +125 -0
- data/ext/numo/gsl/rng/tmpl/ran.c +40 -0
- data/ext/numo/gsl/rng/tmpl/ran_DFloat_f_DFloat.c +28 -0
- data/ext/numo/gsl/rng/tmpl/ran_DFloat_x2.c +45 -0
- data/ext/numo/gsl/rng/tmpl/ran_DFloat_x3.c +51 -0
- data/ext/numo/gsl/rng/tmpl/ran_multinomial.c +32 -0
- data/ext/numo/gsl/rng/tmpl/rng_DFloat.c +29 -0
- data/ext/numo/gsl/rng/tmpl/rng_UInt.c +44 -0
- data/ext/numo/gsl/rng/tmpl/rng_alloc.c +24 -0
- data/ext/numo/gsl/rng/tmpl/rng_type_new.c +14 -0
- data/ext/numo/gsl/rng/type_def.rb +63 -0
- data/ext/numo/gsl/rstat/depend +17 -0
- data/ext/numo/gsl/rstat/erbpp_rstat.rb +64 -0
- data/ext/numo/gsl/rstat/extconf.rb +9 -0
- data/ext/numo/gsl/rstat/func_2.2.1.rb +116 -0
- data/ext/numo/gsl/rstat/func_2.2.rb +116 -0
- data/ext/numo/gsl/rstat/func_2.3.rb +123 -0
- data/ext/numo/gsl/rstat/func_def.rb +102 -0
- data/ext/numo/gsl/sf/depend +17 -0
- data/ext/numo/gsl/sf/erbpp_sf.rb +51 -0
- data/ext/numo/gsl/sf/extconf.rb +9 -0
- data/ext/numo/gsl/sf/func_def.rb +4703 -0
- data/ext/numo/gsl/sf/parse_sf.rb +277 -0
- data/ext/numo/gsl/sf/tmpl/c_DFloat_f_int_x2_DFloat.c +50 -0
- data/ext/numo/gsl/sf/tmpl/c_DFloat_f_int_x2_DFloat_x2.c +52 -0
- data/ext/numo/gsl/sf/tmpl/c_DFloat_f_int_x3_DFloat_x2.c +55 -0
- data/ext/numo/gsl/sf/tmpl/m_DFloat_f_DFloat_mode.c +47 -0
- data/ext/numo/gsl/sf/tmpl/m_DFloat_f_lmax_array.c +41 -0
- data/ext/numo/gsl/sf/tmpl/m_DFloat_f_nmin_nmax_array.c +49 -0
- data/ext/numo/gsl/spmatrix/const_2.2.1.rb +3 -0
- data/ext/numo/gsl/spmatrix/const_2.2.rb +3 -0
- data/ext/numo/gsl/spmatrix/const_2.3.rb +3 -0
- data/ext/numo/gsl/spmatrix/const_def.rb +2 -0
- data/ext/numo/gsl/spmatrix/depend +17 -0
- data/ext/numo/gsl/spmatrix/erbpp_spmatrix.rb +100 -0
- data/ext/numo/gsl/spmatrix/extconf.rb +9 -0
- data/ext/numo/gsl/spmatrix/func_2.2.1.rb +297 -0
- data/ext/numo/gsl/spmatrix/func_2.2.rb +297 -0
- data/ext/numo/gsl/spmatrix/func_2.3.rb +297 -0
- data/ext/numo/gsl/spmatrix/func_def.rb +218 -0
- data/ext/numo/gsl/spmatrix/parse_spmatrix.rb +70 -0
- data/ext/numo/gsl/spmatrix/tmpl/itersolve_iterate.c +47 -0
- data/ext/numo/gsl/spmatrix/tmpl/itersolve_new.c +22 -0
- data/ext/numo/gsl/spmatrix/tmpl/itersolve_type_new.c +16 -0
- data/ext/numo/gsl/spmatrix/tmpl/spblas_dgemm.c +35 -0
- data/ext/numo/gsl/spmatrix/tmpl/spblas_dgemv.c +43 -0
- data/ext/numo/gsl/spmatrix/tmpl/spmatrix_add.c +22 -0
- data/ext/numo/gsl/spmatrix/tmpl/spmatrix_d2sp.c +28 -0
- data/ext/numo/gsl/spmatrix/tmpl/spmatrix_new.c +40 -0
- data/ext/numo/gsl/spmatrix/tmpl/spmatrix_sp2d.c +25 -0
- data/ext/numo/gsl/spmatrix/type_def.rb +1 -0
- data/ext/numo/gsl/stats/depend +17 -0
- data/ext/numo/gsl/stats/erbpp_stats.rb +29 -0
- data/ext/numo/gsl/stats/extconf.rb +9 -0
- data/ext/numo/gsl/stats/func_2.2.1.rb +608 -0
- data/ext/numo/gsl/stats/func_2.2.rb +608 -0
- data/ext/numo/gsl/stats/func_2.3.rb +608 -0
- data/ext/numo/gsl/stats/func_def.rb +608 -0
- data/ext/numo/gsl/stats/parse_stats.rb +63 -0
- data/ext/numo/gsl/stats/tmpl/stats_1a0p.c +37 -0
- data/ext/numo/gsl/stats/tmpl/stats_1a0p_index.c +60 -0
- data/ext/numo/gsl/stats/tmpl/stats_1a1p.c +41 -0
- data/ext/numo/gsl/stats/tmpl/stats_1a2p.c +42 -0
- data/ext/numo/gsl/stats/tmpl/stats_2a0p.c +39 -0
- data/ext/numo/gsl/stats/tmpl/stats_2a1p.c +43 -0
- data/ext/numo/gsl/stats/tmpl/stats_2a2p.c +44 -0
- data/ext/numo/gsl/stats/tmpl/stats_minmax.c +37 -0
- data/ext/numo/gsl/stats/tmpl/stats_minmax_index.c +67 -0
- data/ext/numo/gsl/stats/tmpl/stats_spearman.c +46 -0
- data/ext/numo/gsl/sys/const_def.rb +21 -0
- data/ext/numo/gsl/sys/depend +17 -0
- data/ext/numo/gsl/sys/enum_def.rb +75 -0
- data/ext/numo/gsl/sys/erbpp_sys.rb +60 -0
- data/ext/numo/gsl/sys/extconf.rb +9 -0
- data/ext/numo/gsl/sys/func_def.rb +249 -0
- data/ext/numo/gsl/version.h +1 -0
- data/ext/numo/gsl/wavelet/depend +17 -0
- data/ext/numo/gsl/wavelet/erbpp_wavelet.rb +48 -0
- data/ext/numo/gsl/wavelet/extconf.rb +9 -0
- data/ext/numo/gsl/wavelet/func_def.rb +337 -0
- data/ext/numo/gsl/wavelet/parse_wavelet.rb +47 -0
- data/ext/numo/gsl/wavelet/tmpl/wavelet2d_transform.c +56 -0
- data/ext/numo/gsl/wavelet/tmpl/wavelet_array_check.c +56 -0
- data/ext/numo/gsl/wavelet/tmpl/wavelet_macro.c +1 -0
- data/ext/numo/gsl/wavelet/tmpl/wavelet_new.c +20 -0
- data/ext/numo/gsl/wavelet/tmpl/wavelet_transform.c +55 -0
- data/ext/numo/gsl/wavelet/tmpl/wavelet_transform2.c +22 -0
- data/ext/numo/gsl/wavelet/tmpl/wavelet_type_new.c +15 -0
- data/ext/numo/gsl/wavelet/type_def.rb +6 -0
- data/lib/numo/gsl.rb +17 -0
- data/numo-gsl.gemspec +33 -0
- metadata +367 -0
@@ -0,0 +1,166 @@
|
|
1
|
+
require_relative "func_parser"
|
2
|
+
|
3
|
+
module ErbppGsl
|
4
|
+
|
5
|
+
module_function
|
6
|
+
|
7
|
+
def FM(*args,**opts)
|
8
|
+
FuncMatch.new(*args,**opts)
|
9
|
+
end
|
10
|
+
|
11
|
+
def dbl; "double" end
|
12
|
+
def dblp; "double *" end
|
13
|
+
def str; "char *" end
|
14
|
+
def szt; "size_t" end
|
15
|
+
def sztp; "size_t *" end
|
16
|
+
def int; "int" end
|
17
|
+
def intp; "int *" end
|
18
|
+
def long; "long" end
|
19
|
+
def uint; "unsigned int" end
|
20
|
+
def ulong; /^unsigned long/ end
|
21
|
+
def void; "void" end
|
22
|
+
def tp; get(:struct)+" *" end
|
23
|
+
|
24
|
+
def read_eval(prefix)
|
25
|
+
fmt = prefix + "_%s.rb"
|
26
|
+
fn = fmt % `gsl-config --version`.chomp
|
27
|
+
if !File.exist?(fn)
|
28
|
+
fn = fmt % "def"
|
29
|
+
end
|
30
|
+
File.exist?(fn) ? eval(open(fn).read) : []
|
31
|
+
end
|
32
|
+
|
33
|
+
def read_func(prefix="func")
|
34
|
+
read_eval(prefix).each do |h|
|
35
|
+
h[:desc].gsub!(/\/\*/,"//")
|
36
|
+
h[:desc].gsub!(/\*\//,"")
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def read_const
|
41
|
+
read_eval("const")
|
42
|
+
end
|
43
|
+
|
44
|
+
def read_enum
|
45
|
+
read_eval("enum")
|
46
|
+
end
|
47
|
+
|
48
|
+
def read_type
|
49
|
+
read_eval("type")
|
50
|
+
end
|
51
|
+
|
52
|
+
def read_func_pattern(*a)
|
53
|
+
read_func.each do |h|
|
54
|
+
no_match = true
|
55
|
+
a.each do |re,list|
|
56
|
+
if re === h[:func_name]
|
57
|
+
list << h
|
58
|
+
no_match = false
|
59
|
+
break
|
60
|
+
end
|
61
|
+
end
|
62
|
+
if no_match
|
63
|
+
$stderr.puts "skip "+h[:func_name]
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
class DefSubclassNew < DefMethod
|
71
|
+
def initialize(parent,tmpl,var,subtp=nil,**h)
|
72
|
+
super(parent, tmpl, name:"new", **h)
|
73
|
+
if !subtp
|
74
|
+
subtp = var.sub(/gsl_#{parent.name}_/,"")
|
75
|
+
end
|
76
|
+
set subtype_var: var
|
77
|
+
set subtype_name: subtp
|
78
|
+
set subtype_class: subtp.split('_').map{|x| x.capitalize}.join("")
|
79
|
+
set c_superclass_new: "#{parent.name}_s_new"
|
80
|
+
end
|
81
|
+
|
82
|
+
def c_func(narg=nil)
|
83
|
+
super(narg)
|
84
|
+
"#{@parent.name}_#{get(:subtype_name)}_s_new"
|
85
|
+
end
|
86
|
+
|
87
|
+
def init_def
|
88
|
+
if n_arg != :nodef
|
89
|
+
"{ VALUE c#{subtype_class} = rb_define_class_under(#{_mod_var}, \"#{subtype_class}\", #{_mod_var});
|
90
|
+
rb_define_singleton_method(c#{subtype_class}, \"new\", #{c_func}, #{n_arg}); }"
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
|
96
|
+
class DefGslClass < DefClass
|
97
|
+
include ErbppGsl
|
98
|
+
|
99
|
+
def lookup(h)
|
100
|
+
# implement in Subclass
|
101
|
+
raise NotImplementedError
|
102
|
+
end
|
103
|
+
|
104
|
+
def check_func(h)
|
105
|
+
fn = h[:func_name]
|
106
|
+
if t = lookup(h)
|
107
|
+
m = to_method_name(fn)
|
108
|
+
define_method(t, name:m, **h)
|
109
|
+
elsif /_free$/ =~ fn
|
110
|
+
set free_func: fn
|
111
|
+
else
|
112
|
+
$stderr.puts "skip #{fn}"
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def to_method_name(s)
|
117
|
+
s.sub(/^gsl_#{name}_/,"")
|
118
|
+
end
|
119
|
+
|
120
|
+
def define_method(t,**h)
|
121
|
+
DefGslMethod.new(self, t, **h)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
class DefGslModule < DefModule
|
126
|
+
include ErbppGsl
|
127
|
+
|
128
|
+
def lookup(h)
|
129
|
+
# implement in Subclass
|
130
|
+
end
|
131
|
+
|
132
|
+
def check_func(h)
|
133
|
+
if t = lookup(h)
|
134
|
+
m = to_method_name(h[:func_name])
|
135
|
+
define_method(t, name:m, **h)
|
136
|
+
else
|
137
|
+
$stderr.puts "skip #{h[:func_name]}"
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
def to_method_name(s)
|
142
|
+
s.sub(/^gsl_#{name}_/,"")
|
143
|
+
end
|
144
|
+
|
145
|
+
def define_method(t,**h)
|
146
|
+
DefGslModuleFunction.new(self, t, **h)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
class DefGslModuleFunction < DefModuleFunction
|
151
|
+
include FuncParser
|
152
|
+
|
153
|
+
def initialize(parent,tmpl,**h)
|
154
|
+
super(parent,tmpl,**h)
|
155
|
+
parse_args(h)
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
class DefGslMethod < DefMethod
|
160
|
+
include FuncParser
|
161
|
+
|
162
|
+
def initialize(parent,tmpl,**h)
|
163
|
+
super(parent,tmpl,**h)
|
164
|
+
parse_args(h)
|
165
|
+
end
|
166
|
+
end
|
@@ -0,0 +1,520 @@
|
|
1
|
+
require_relative "erbpp2"
|
2
|
+
|
3
|
+
class Argument
|
4
|
+
|
5
|
+
def description
|
6
|
+
@func.param_desc[@name] ||
|
7
|
+
if @prop[:param]
|
8
|
+
"@param [#{rb_class}] #{@name}"
|
9
|
+
elsif @prop[:narray]
|
10
|
+
"@param [#{na_class}] #{@name}"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
NUM2DATA =
|
15
|
+
{
|
16
|
+
"double"=>"%2 = NUM2DBL(%1)",
|
17
|
+
"int"=>"%2 = NUM2INT(%1)",
|
18
|
+
"unsigned int"=>"%2 = NUM2UINT(%1)",
|
19
|
+
"size_t"=>"%2 = NUM2SIZET(%1)",
|
20
|
+
"gsl_mode_t"=>"%2 = NUM2INT(%1)",
|
21
|
+
"gsl_sf_legendre_t"=>"%2 = NUM2INT(%1)",
|
22
|
+
"gsl_sf_mathieu_workspace *"=>'
|
23
|
+
if (rb_obj_is_kind_of(%1,cWorkspace)!=Qtrue) {
|
24
|
+
rb_raise(rb_eTypeError,"last argument must be "
|
25
|
+
"Numo::GSL::Sf::MathieuWorkspace class");
|
26
|
+
}
|
27
|
+
TypedData_Get_Struct(%1, gsl_sf_mathieu_workspace, &mathieuws_type, %2)'
|
28
|
+
}
|
29
|
+
|
30
|
+
DATA2NUM =
|
31
|
+
{
|
32
|
+
"double"=>"DBL2NUM(%1)",
|
33
|
+
"int"=>"INT2NUM(%1)",
|
34
|
+
"unsigned int"=>"UINT2NUM(%1)",
|
35
|
+
"size_t"=>"SIZET2NUM(%1)",
|
36
|
+
"gsl_sf_result *"=>["DBL2NUM(%1.val)","DBL2NUM(%1.err)"]
|
37
|
+
}
|
38
|
+
|
39
|
+
TYPEMAP =
|
40
|
+
{
|
41
|
+
"double"=>"cDF",
|
42
|
+
"gsl_complex"=>"cDC",
|
43
|
+
"unsigned int"=>"cUI",
|
44
|
+
"int"=>"cI",
|
45
|
+
"size_t"=>"cSZ",
|
46
|
+
}
|
47
|
+
|
48
|
+
NACLASSMAP =
|
49
|
+
{
|
50
|
+
"double"=>"Numo::DFloat",
|
51
|
+
"gsl_complex"=>"Numo::DComplex",
|
52
|
+
"unsigned int"=>"Numo::UInt",
|
53
|
+
"int"=>"Numo::Int",
|
54
|
+
"size_t"=>"Numo::UInt64",
|
55
|
+
"gsl_sf_result *"=>["Numo::DFloat"]*2,
|
56
|
+
"gsl_sf_result_e10 *"=>["Numo::DFloat"]*2+["Numo::Int"],
|
57
|
+
"gsl_sf_mathieu_workspace *"=>"Numo::GSL::Sf::MathieuWorkspace"
|
58
|
+
}
|
59
|
+
|
60
|
+
RBCLASSMAP =
|
61
|
+
{
|
62
|
+
"double"=>"Float",
|
63
|
+
"gsl_complex"=>"Complex",
|
64
|
+
"unsigned int"=>"Integer",
|
65
|
+
"int"=>"Integer",
|
66
|
+
"size_t"=>"Integer",
|
67
|
+
"gsl_mode_t"=>"Integer",
|
68
|
+
"gsl_sf_result *"=>["Float"]*2
|
69
|
+
}
|
70
|
+
|
71
|
+
CTYPEMAP =
|
72
|
+
{
|
73
|
+
"double"=>"double",
|
74
|
+
#"unsigned int"=>"uint32_t",
|
75
|
+
#"int"=>"int32_t",
|
76
|
+
"unsigned int"=>"unsigned int",
|
77
|
+
"int"=>"int",
|
78
|
+
"size_t"=>"uint64_t",
|
79
|
+
"gsl_complex"=>"gsl_complex",
|
80
|
+
}
|
81
|
+
|
82
|
+
RETNAMEMAP =
|
83
|
+
{
|
84
|
+
"double"=>"Numo::DFloat",
|
85
|
+
"gsl_complex"=>"Numo::DComplex",
|
86
|
+
#"unsigned int"=>"Numo::UInt32",
|
87
|
+
#"int"=>"Numo::Int32",
|
88
|
+
"unsigned int"=>"Numo::UInt",
|
89
|
+
"int"=>"Numo::Int",
|
90
|
+
"size_t"=>"Numo::UInt64",
|
91
|
+
"gsl_sf_result *"=>["Numo::DFloat"]*2,
|
92
|
+
"gsl_sf_result_e10 *"=>["Numo::DFloat"]*2+["Numo::Int"]
|
93
|
+
}
|
94
|
+
|
95
|
+
def initialize(func,idx,type,name,prop)
|
96
|
+
@func = func
|
97
|
+
@idx = idx
|
98
|
+
@type = type
|
99
|
+
@name = name
|
100
|
+
@prop = prop
|
101
|
+
@pass = @prop[:pass]
|
102
|
+
|
103
|
+
if /(.+)\*$/ =~ @type
|
104
|
+
@type2 = $1.strip
|
105
|
+
end
|
106
|
+
|
107
|
+
if @prop[:output]
|
108
|
+
@n_out =
|
109
|
+
case @type
|
110
|
+
when "gsl_sf_result_e10 *"; 3
|
111
|
+
when "gsl_sf_result *"; 2
|
112
|
+
else 1
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
@ctype = CTYPEMAP[@type] || CTYPEMAP[@type2]
|
117
|
+
end
|
118
|
+
|
119
|
+
attr_reader :type, :name
|
120
|
+
attr_reader :pass, :n_out
|
121
|
+
|
122
|
+
[:input,:output,:param,:narray].each do |sym|
|
123
|
+
define_method(sym){@prop[sym]}
|
124
|
+
end
|
125
|
+
|
126
|
+
def c_var
|
127
|
+
"c#{@idx}"
|
128
|
+
end
|
129
|
+
|
130
|
+
def c_arg
|
131
|
+
(@pass == :pointer) ? "&"+c_var : c_var
|
132
|
+
end
|
133
|
+
|
134
|
+
def v_var
|
135
|
+
if @func.n_arg < 0
|
136
|
+
"v[#{@idx}]"
|
137
|
+
else
|
138
|
+
"v#{@idx}"
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
def ain_def
|
143
|
+
"{#{na_type},0}"
|
144
|
+
end
|
145
|
+
|
146
|
+
def aout_def
|
147
|
+
case @type
|
148
|
+
when "gsl_sf_result_e10 *"
|
149
|
+
return "{cDF,0},{cDF,0},{cI,0}"
|
150
|
+
when "gsl_sf_result *"
|
151
|
+
return "{cDF,0},{cDF,0}"
|
152
|
+
end
|
153
|
+
case @pass
|
154
|
+
when :array
|
155
|
+
"{#{na_type},1,shape}"
|
156
|
+
when :pointer,:return
|
157
|
+
"{#{na_type},0}"
|
158
|
+
else
|
159
|
+
raise "no aout_def for #{self.inspect}"
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
def na_type
|
164
|
+
TYPEMAP[@type] || TYPEMAP[@type2]
|
165
|
+
end
|
166
|
+
|
167
|
+
def na_class
|
168
|
+
NACLASSMAP[@type] || NACLASSMAP[@type2]
|
169
|
+
end
|
170
|
+
|
171
|
+
def rb_class
|
172
|
+
RBCLASSMAP[@type] || RBCLASSMAP[@type2]
|
173
|
+
end
|
174
|
+
|
175
|
+
def ret_val
|
176
|
+
case @type
|
177
|
+
when "gsl_sf_result *"
|
178
|
+
[@name+".val",@name+".err"]
|
179
|
+
when "gsl_sf_result_e10 *"
|
180
|
+
[@name+".val",@name+".err",@name+".e10"]
|
181
|
+
else
|
182
|
+
@name
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
def def_var
|
187
|
+
if @prop[:param]
|
188
|
+
"#{@type} #{c_var};"
|
189
|
+
elsif @prop[:input]
|
190
|
+
"#{@type} #{c_var};"
|
191
|
+
elsif @pass == :array
|
192
|
+
"#{@type} *#{c_var};"
|
193
|
+
elsif @pass == :pointer
|
194
|
+
"#{@type2} #{c_var};"
|
195
|
+
elsif @pass == :return
|
196
|
+
"#{@type} #{c_var};"
|
197
|
+
else
|
198
|
+
raise "no variable definition"
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
def def_value
|
203
|
+
"VALUE #{v_var};"
|
204
|
+
end
|
205
|
+
|
206
|
+
def set_value
|
207
|
+
NUM2DATA[@type].gsub(/%1/,v_var).sub(/%2/,c_var)+";"
|
208
|
+
end
|
209
|
+
|
210
|
+
def get_value
|
211
|
+
case a = DATA2NUM[@type]
|
212
|
+
when String
|
213
|
+
a.gsub(/%1/,c_var)
|
214
|
+
when Array
|
215
|
+
a.map{|s| s.gsub(/%1/,c_var)}
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
def store_to_array(va)
|
220
|
+
a = get_value
|
221
|
+
a = [a] unless Array === a
|
222
|
+
a.map{|x|"rb_ary_push(#{va},#{x});"}.join("\n"+" "*8)
|
223
|
+
end
|
224
|
+
|
225
|
+
def set_param(opt)
|
226
|
+
n = @func.n_input
|
227
|
+
if @type == "gsl_mode_t" && n == @idx+1
|
228
|
+
return <<EOL
|
229
|
+
if (argc==#{@idx}) {
|
230
|
+
#{c_var} = GSL_MODE_DEFAULT;
|
231
|
+
} else if (argc==#{@idx+1}) {
|
232
|
+
#{set_value}
|
233
|
+
} else {
|
234
|
+
rb_raise(rb_eArgError,"invalid number of argument: %d for #{n-1} or #{n}",argc);
|
235
|
+
}
|
236
|
+
#{opt} = &#{c_var}; //#{@name}
|
237
|
+
EOL
|
238
|
+
else
|
239
|
+
return "#{set_value} #{opt} = &#{c_var}; //#{@name}"
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
def get_param(opt)
|
244
|
+
"#{c_var} = *(#{@type}*)(#{opt}); //#{@name}"
|
245
|
+
end
|
246
|
+
|
247
|
+
def get_data(lp)
|
248
|
+
"#{c_var} = *(#{@ctype}*)GET_PTR(#{lp},#{cnt}); //#{@name}"
|
249
|
+
end
|
250
|
+
|
251
|
+
def get_ptr(lp)
|
252
|
+
if @pass == :array
|
253
|
+
"#{c_var} = (#{@ctype}*)GET_PTR(#{lp},#{cnt}); //#{@name}"
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
def set_data(lp)
|
258
|
+
if @pass != :array
|
259
|
+
if "gsl_sf_result_e10 *" == @type
|
260
|
+
"*(double*)GET_PTR(#{lp},#{cnt}) = #{c_var}.val; "+
|
261
|
+
"*(double*)GET_PTR(#{lp},#{cnt}) = #{c_var}.err; "+
|
262
|
+
"*(int*)GET_PTR(#{lp},#{cnt}) = #{c_var}.e10; //#{@name}"
|
263
|
+
elsif "gsl_sf_result *" == @type
|
264
|
+
"*(double*)GET_PTR(#{lp},#{cnt}) = #{c_var}.val; "+
|
265
|
+
"*(double*)GET_PTR(#{lp},#{cnt}) = #{c_var}.err; //#{@name}"
|
266
|
+
else
|
267
|
+
"*(#{@ctype}*)GET_PTR(#{lp},#{cnt}) = #{c_var}; //#{@name}"
|
268
|
+
end
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
272
|
+
def cnt
|
273
|
+
@func.counter.inc
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
#----------------------------------------------------------
|
278
|
+
|
279
|
+
class FuncMatch
|
280
|
+
|
281
|
+
def initialize(*args,type:nil,name:nil)
|
282
|
+
@func_type = type
|
283
|
+
@func_name = name
|
284
|
+
@args = args
|
285
|
+
end
|
286
|
+
|
287
|
+
def ===(h)
|
288
|
+
if /These functions are now deprecated/m =~ h[:desc]
|
289
|
+
$stderr.puts "depricated: #{h[:func_name]}"
|
290
|
+
return false
|
291
|
+
end
|
292
|
+
if /This function is now deprecated/m =~ h[:desc]
|
293
|
+
$stderr.puts "depricated: #{h[:func_name]}"
|
294
|
+
return false
|
295
|
+
end
|
296
|
+
if @func_type
|
297
|
+
return false unless t = h[:func_type]
|
298
|
+
t.sub!(/^const\s+/,"")
|
299
|
+
#$stderr.puts [t,@func_type].inspect
|
300
|
+
return false unless @func_type === t
|
301
|
+
end
|
302
|
+
if @func_name
|
303
|
+
return false unless @func_name === h[:func_name]
|
304
|
+
end
|
305
|
+
if @args
|
306
|
+
return false unless h_args = h[:args]
|
307
|
+
#$stderr.puts [@args,h_args].inspect
|
308
|
+
return false unless @args.size == 0 || @args.size == h_args.size
|
309
|
+
@args.each_with_index do |a,i|
|
310
|
+
#$stderr.puts [a,h_args[i]].inspect
|
311
|
+
return false unless h_a = h_args[i]
|
312
|
+
case a
|
313
|
+
when Array
|
314
|
+
if a[0] # C type
|
315
|
+
return false unless t = h_a[0]
|
316
|
+
t.sub!(/^const\s+/,"")
|
317
|
+
return false unless a[0] === t
|
318
|
+
end
|
319
|
+
if a[1] # var name
|
320
|
+
return false unless a[1] === h_a[1]
|
321
|
+
end
|
322
|
+
else # String or Regexp
|
323
|
+
#$stderr.puts [a,h_a[0]].inspect
|
324
|
+
return false unless t = h_a[0]
|
325
|
+
t.sub!(/^const\s+/,"")
|
326
|
+
#$stderr.puts [a,t].inspect
|
327
|
+
return false unless a === t
|
328
|
+
end
|
329
|
+
end
|
330
|
+
end
|
331
|
+
#$stderr.puts self.inspect
|
332
|
+
true
|
333
|
+
end
|
334
|
+
|
335
|
+
end
|
336
|
+
|
337
|
+
class Counter
|
338
|
+
def initialize
|
339
|
+
@i = 0
|
340
|
+
end
|
341
|
+
def inc
|
342
|
+
i = @i
|
343
|
+
@i += 1
|
344
|
+
i
|
345
|
+
end
|
346
|
+
end
|
347
|
+
|
348
|
+
#----------------------------------------------------------
|
349
|
+
|
350
|
+
module FuncParser
|
351
|
+
|
352
|
+
def self.lookup(h)
|
353
|
+
false
|
354
|
+
end
|
355
|
+
|
356
|
+
PARAM_DESC = {}
|
357
|
+
PARAM_NAMES = {}
|
358
|
+
|
359
|
+
def param_desc
|
360
|
+
self.class::PARAM_DESC
|
361
|
+
end
|
362
|
+
|
363
|
+
def param_names
|
364
|
+
self.class::PARAM_NAMES
|
365
|
+
end
|
366
|
+
|
367
|
+
def parse_args(h)
|
368
|
+
i = 0
|
369
|
+
@parsed_args = []
|
370
|
+
h[:args].each do |type,name|
|
371
|
+
type = type.sub(/^const\s+/,"").strip
|
372
|
+
if /_array$/ =~ name && /(.+)\*$/ =~ type
|
373
|
+
type = $1.strip
|
374
|
+
name = name+"[]"
|
375
|
+
end
|
376
|
+
prop = argument_property(type,name)
|
377
|
+
@parsed_args << Argument.new(self,i,type,name,prop)
|
378
|
+
i += 1
|
379
|
+
end
|
380
|
+
t = h[:func_type]
|
381
|
+
if t != "void"
|
382
|
+
prop = argument_property(t,"return")
|
383
|
+
@parsed_args << Argument.new(self,i,t,"return",prop)
|
384
|
+
end
|
385
|
+
#
|
386
|
+
@args_param = @parsed_args.select{|a|a.param}
|
387
|
+
@args_input = @parsed_args.select{|a|a.input}
|
388
|
+
@args_in = @parsed_args.select{|a|a.narray && a.input}
|
389
|
+
@args_out = @parsed_args.select{|a|a.narray && a.output}
|
390
|
+
@parsed_args.each do |a|
|
391
|
+
if a.pass == :array
|
392
|
+
@generate_array = true
|
393
|
+
break
|
394
|
+
end
|
395
|
+
end
|
396
|
+
@counter = Counter.new
|
397
|
+
if @args_param.any?{|a| a.type=="gsl_mode_t"}
|
398
|
+
set n_arg: -1
|
399
|
+
else
|
400
|
+
set n_arg: @args_param.size+@args_in.size
|
401
|
+
end
|
402
|
+
end
|
403
|
+
|
404
|
+
#attr_reader :name
|
405
|
+
attr_reader :args_out, :args_in, :args_param
|
406
|
+
attr_reader :generate_array
|
407
|
+
attr_reader :counter
|
408
|
+
|
409
|
+
def argument_property(type,name)
|
410
|
+
if name == "return"
|
411
|
+
{output:true, narray:true, pass: :return}
|
412
|
+
elsif /\[\]$/ =~ name
|
413
|
+
{output:true, narray:true, pass: :array}
|
414
|
+
elsif is_param(type,name)
|
415
|
+
{input:true, param:true}
|
416
|
+
elsif /\*$/ =~ type
|
417
|
+
{output:true, narray:true, pass: :pointer}
|
418
|
+
else
|
419
|
+
{input:true, narray:true}
|
420
|
+
end
|
421
|
+
end
|
422
|
+
|
423
|
+
def is_param(tp,nm)
|
424
|
+
#$stderr.puts "type='#{tp}' name='#{nm}'"
|
425
|
+
a = self.class::PARAM_NAMES[tp]
|
426
|
+
case a
|
427
|
+
when Array
|
428
|
+
a.include?(nm)
|
429
|
+
else
|
430
|
+
a
|
431
|
+
end
|
432
|
+
end
|
433
|
+
|
434
|
+
def n_param
|
435
|
+
@args_param.size
|
436
|
+
end
|
437
|
+
|
438
|
+
def n_in
|
439
|
+
@args_in.size
|
440
|
+
end
|
441
|
+
|
442
|
+
def n_input
|
443
|
+
@args_input.size
|
444
|
+
end
|
445
|
+
|
446
|
+
def n_out
|
447
|
+
n = 0
|
448
|
+
@args_out.each{|a| n+=a.n_out}
|
449
|
+
n
|
450
|
+
end
|
451
|
+
|
452
|
+
def def_ain
|
453
|
+
@args_in.map{|a| a.ain_def}.join(",")
|
454
|
+
end
|
455
|
+
|
456
|
+
def def_aout
|
457
|
+
@args_out.map{|a| a.aout_def}.join(",")
|
458
|
+
end
|
459
|
+
|
460
|
+
def find_name(name)
|
461
|
+
@parsed_args.find{|a| a.name==name}
|
462
|
+
end
|
463
|
+
|
464
|
+
def c_args
|
465
|
+
@parsed_args.select{|a| a.pass != :return}.
|
466
|
+
map{|a| a.c_arg}.join(",")
|
467
|
+
end
|
468
|
+
|
469
|
+
def recv
|
470
|
+
a = args_out.last
|
471
|
+
if a && a.pass == :return
|
472
|
+
a.c_var + " = "
|
473
|
+
else
|
474
|
+
""
|
475
|
+
end
|
476
|
+
end
|
477
|
+
|
478
|
+
def method_args
|
479
|
+
s = @args_input.map{|a| a.name}.join(",")
|
480
|
+
s.sub(/,mode$/,",[mode]")
|
481
|
+
end
|
482
|
+
|
483
|
+
def cdef_args
|
484
|
+
if n_arg == -1
|
485
|
+
"int argc, VALUE *v, VALUE mod"
|
486
|
+
else
|
487
|
+
"VALUE mod," +
|
488
|
+
@args_input.map{|a|"VALUE #{a.v_var}"}.join(",")
|
489
|
+
end
|
490
|
+
end
|
491
|
+
|
492
|
+
def ndl_args
|
493
|
+
@args_in.map{|a| a.v_var}.join(",")
|
494
|
+
end
|
495
|
+
|
496
|
+
def desc_param
|
497
|
+
#t = (["Numo::DFloat"]*n_out).join(",")
|
498
|
+
t = @args_out.map{|a| a.na_class}.flatten.join(", ")
|
499
|
+
v = @args_out.map{|a| a.ret_val}.flatten.join(", ")
|
500
|
+
if n_out > 1
|
501
|
+
r = "@return [[#{t}]] array of [#{v}]"
|
502
|
+
else
|
503
|
+
r = "@return [#{t}] #{v}"
|
504
|
+
end
|
505
|
+
@args_input.map{|a| a.description}+[r]
|
506
|
+
end
|
507
|
+
|
508
|
+
def desc_param_scalar
|
509
|
+
#t = (["Numo::DFloat"]*n_out).join(",")
|
510
|
+
t = @args_out.map{|a| a.rb_class}.flatten.join(", ")
|
511
|
+
v = @args_out.map{|a| a.ret_val}.flatten.join(", ")
|
512
|
+
if n_out > 1
|
513
|
+
r = "@return [[#{t}]] array of [#{v}]"
|
514
|
+
else
|
515
|
+
r = "@return [#{t}] #{v}"
|
516
|
+
end
|
517
|
+
@args_input.map{|a| a.description}+[r]
|
518
|
+
end
|
519
|
+
|
520
|
+
end
|