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,41 @@
|
|
1
|
+
static void
|
2
|
+
iter_<%=c_func%>(na_loop_t *const lp)
|
3
|
+
{
|
4
|
+
int c0;
|
5
|
+
double c1;
|
6
|
+
double *c2;
|
7
|
+
int c3;
|
8
|
+
void **opt = (void**)(lp->opt_ptr);
|
9
|
+
|
10
|
+
c0 = *(int*)(opt[0]); //<%=args[0][1]%>
|
11
|
+
c1 = *(double*)GET_PTR(lp,0); //<%=args[1][1]%>
|
12
|
+
c2 = (double*)GET_PTR(lp,1); //<%=args[2][1]%>
|
13
|
+
c3 = <%=func_name%>(c0,c1,c2);
|
14
|
+
*(int*)GET_PTR(lp,2) = c3; //return
|
15
|
+
}
|
16
|
+
|
17
|
+
/*
|
18
|
+
@overload <%=name%>(<%=args.map{|a| a[1]}.join(",")%>)
|
19
|
+
|
20
|
+
@param [Integer] <%=args[0][1]%>
|
21
|
+
@param [Numo::DFloat] <%=args[1][1]%>
|
22
|
+
@return [[Numo::DFloat, Numo::Int32]] array of [<%=args[2][1]%>, return]
|
23
|
+
|
24
|
+
<%= description %>
|
25
|
+
*/
|
26
|
+
static VALUE
|
27
|
+
<%=c_func(2)%>(VALUE mod, VALUE v0, VALUE v1)
|
28
|
+
{
|
29
|
+
int c0;
|
30
|
+
size_t shape[1];
|
31
|
+
ndfunc_arg_in_t ain[1] = {{cDF,0}};
|
32
|
+
ndfunc_arg_out_t aout[2] = {{cDF,1,shape},{cI,0}};
|
33
|
+
ndfunc_t ndf = {iter_<%=c_func%>,STRIDE_LOOP|NDF_EXTRACT,1,2,ain,aout};
|
34
|
+
|
35
|
+
c0 = NUM2INT(v0);
|
36
|
+
if (c0 < 0) {
|
37
|
+
rb_raise(rb_eArgError,"should be lmax>=0");
|
38
|
+
}
|
39
|
+
shape[0] = c0 + 1;
|
40
|
+
return na_ndloop3(&ndf,&c0,1,v1);
|
41
|
+
}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
static void
|
2
|
+
iter_<%=c_func%>(na_loop_t *const lp)
|
3
|
+
{
|
4
|
+
int c0;
|
5
|
+
int c1;
|
6
|
+
double c2;
|
7
|
+
double *c3;
|
8
|
+
int c4;
|
9
|
+
void **opt = (void**)(lp->opt_ptr);
|
10
|
+
|
11
|
+
c0 = *(int*)(opt[0]); //<%=args[0][1]%>
|
12
|
+
c1 = *(int*)(opt[1]); //<%=args[1][1]%>
|
13
|
+
c2 = *(double*)GET_PTR(lp,0); //<%=args[2][1]%>
|
14
|
+
c3 = (double*)GET_PTR(lp,1); //<%=args[3][1]%>
|
15
|
+
c4 = <%=func_name%>(c0,c1,c2,c3);
|
16
|
+
*(int*)GET_PTR(lp,2) = c4; //return
|
17
|
+
}
|
18
|
+
|
19
|
+
/*
|
20
|
+
@overload <%=name%>(<%=args.map{|a| a[1]}.join(",")%>)
|
21
|
+
|
22
|
+
@param [Integer] <%=args[0][1]%>
|
23
|
+
@param [Integer] <%=args[1][1]%>
|
24
|
+
@param [Numo::DFloat] <%=args[2][1]%>
|
25
|
+
@return [[Numo::DFloat, Numo::Int32]] array of [<%=args[3][1]%>, return]
|
26
|
+
|
27
|
+
<%= description %>
|
28
|
+
*/
|
29
|
+
static VALUE
|
30
|
+
<%=c_func(3)%>(VALUE mod, VALUE v0, VALUE v1, VALUE v2)
|
31
|
+
{
|
32
|
+
int c0;
|
33
|
+
int c1;
|
34
|
+
size_t shape[1];
|
35
|
+
ndfunc_arg_in_t ain[1] = {{cDF,0}};
|
36
|
+
ndfunc_arg_out_t aout[2] = {{cDF,1,shape},{cI,0}};
|
37
|
+
ndfunc_t ndf = {iter_<%=c_func%>,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,1,2,ain,aout};
|
38
|
+
void *opt[2];
|
39
|
+
|
40
|
+
c0 = NUM2INT(v0);
|
41
|
+
c1 = NUM2INT(v1);
|
42
|
+
opt[0] = &c0; //nmin
|
43
|
+
opt[1] = &c1; //nmax
|
44
|
+
if (c0<0 || c1<0 || c0>c1) {
|
45
|
+
rb_raise(rb_eArgError,"should be nmin>=0 && nmax>=0 && nmin<=nmax");
|
46
|
+
}
|
47
|
+
shape[0] = c1-c0+1;
|
48
|
+
return na_ndloop3(&ndf,opt,1,v2);
|
49
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
COGEN=ruby erbpp_spmatrix.rb
|
2
|
+
GENSRC=gsl_spmatrix.c
|
3
|
+
GENDEPS=erbpp_spmatrix.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,100 @@
|
|
1
|
+
require_relative "parse_spmatrix"
|
2
|
+
require "erbpp/line_number"
|
3
|
+
|
4
|
+
class_list = [
|
5
|
+
["SpMatrix","spmatrix",[]],
|
6
|
+
["SpBlas","spblas",[]],
|
7
|
+
["IterSolve","splinalg_itersolve",[]],
|
8
|
+
]
|
9
|
+
list = {}
|
10
|
+
ErbppGsl.read_func_pattern(*class_list.map{|name,base|
|
11
|
+
[/gsl_#{base}_/, list[name]=[]]
|
12
|
+
})
|
13
|
+
const_list = ErbppGsl.read_const
|
14
|
+
|
15
|
+
DefLib.new do
|
16
|
+
set erb_dir: %w[tmpl ../gen/tmpl]
|
17
|
+
set erb_suffix: ".c"
|
18
|
+
set ns_var: "mG"
|
19
|
+
|
20
|
+
ErbPP.new(self,"cast_1d_contiguous")
|
21
|
+
ErbPP.new(self,"cast_2d_contiguous")
|
22
|
+
|
23
|
+
cname = "SpMatrix"
|
24
|
+
cbase = cname.downcase
|
25
|
+
set file_name: "gsl_#{cname}.c"
|
26
|
+
set include_files: %w[gsl/gsl_spmatrix.h gsl/gsl_spblas.h gsl/gsl_splinalg.h]
|
27
|
+
set lib_name: cname.downcase
|
28
|
+
|
29
|
+
DefSpMatrix.new(self) do
|
30
|
+
name = cname
|
31
|
+
base = cbase
|
32
|
+
set name: base
|
33
|
+
set class_name: name
|
34
|
+
set class_var: "c"+name
|
35
|
+
set full_class_name: "Numo::GSL::"+name
|
36
|
+
set struct: "gsl_"+base
|
37
|
+
|
38
|
+
const_list.each do |a|
|
39
|
+
m = a[0].sub(/^GSL_SPMATRIX_/,"")
|
40
|
+
v = "INT2FIX(#{a[0]})"
|
41
|
+
def_const(m, v, desc:a[1]||"")
|
42
|
+
end
|
43
|
+
|
44
|
+
undef_alloc_func
|
45
|
+
list[name].each do |h|
|
46
|
+
check_func(h)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
DefSpBlas.new(self) do
|
51
|
+
name = "SpBlas"
|
52
|
+
base = name.downcase
|
53
|
+
set name: base
|
54
|
+
set module_name: name
|
55
|
+
set module_var: "m"+name
|
56
|
+
set full_module_name: "Numo::GSL::"+name
|
57
|
+
set struct: "gsl_spmatrix"
|
58
|
+
|
59
|
+
set class_name: cname
|
60
|
+
set class_var: "c"+cname
|
61
|
+
set full_class_name: "Numo::GSL::"+cname
|
62
|
+
set data_type_var: cbase+"_data_type"
|
63
|
+
|
64
|
+
def_const "NOTRANS", "INT2FIX(CblasNoTrans)"
|
65
|
+
def_const "TRANS", "INT2FIX(CblasTrans)"
|
66
|
+
|
67
|
+
list[name].each do |h|
|
68
|
+
check_func(h)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def_module do
|
73
|
+
name = "SpLinalg"
|
74
|
+
base = name.downcase
|
75
|
+
set name: base
|
76
|
+
set module_name: name
|
77
|
+
set module_var: "m"+name
|
78
|
+
set full_module_name: "Numo::GSL::"+name
|
79
|
+
|
80
|
+
DefIterSolve.new(self) do
|
81
|
+
set ns_var: "mSpLinalg"
|
82
|
+
name = "IterSolve"
|
83
|
+
base = "splinalg_itersolve"
|
84
|
+
set name: base
|
85
|
+
set class_name: name
|
86
|
+
set class_var: "c"+name
|
87
|
+
set full_class_name: "Numo::GSL::SpLinalg::"+name
|
88
|
+
set struct: "gsl_"+base
|
89
|
+
|
90
|
+
set sm_struct: "gsl_"+cbase
|
91
|
+
set sm_data_type_var: cbase+"_data_type"
|
92
|
+
|
93
|
+
undef_alloc_func
|
94
|
+
list[name].each do |h|
|
95
|
+
check_func(h)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
end.run
|
@@ -0,0 +1,297 @@
|
|
1
|
+
[{:func_name=>"gsl_spmatrix_alloc",
|
2
|
+
:func_type=>"gsl_spmatrix *",
|
3
|
+
:args=>[["const size_t", "n1"], ["const size_t", "n2"]],
|
4
|
+
:desc=>
|
5
|
+
"This function allocates a sparse matrix of size n1-by-n2 and\n" +
|
6
|
+
"initializes it to all zeros. If the size of the matrix is not known at allocation\n" +
|
7
|
+
"time, both n1 and n2 may be set to 1, and they will automatically\n" +
|
8
|
+
"grow as elements are added to the matrix. This function sets the\n" +
|
9
|
+
"matrix to the triplet representation, which is the easiest for adding\n" +
|
10
|
+
"and accessing matrix elements. This function tries to make a reasonable guess\n" +
|
11
|
+
"for the number of non-zero elements (nzmax) which will be added to the matrix by\n" +
|
12
|
+
"assuming a sparse density of 10\\%. The function\n" +
|
13
|
+
"gsl_spmatrix_alloc_nzmax can be used if this number is known more\n" +
|
14
|
+
"accurately. The workspace is of size O(nzmax)."},
|
15
|
+
{:func_name=>"gsl_spmatrix_alloc_nzmax",
|
16
|
+
:func_type=>"gsl_spmatrix *",
|
17
|
+
:args=>
|
18
|
+
[["const size_t", "n1"],
|
19
|
+
["const size_t", "n2"],
|
20
|
+
["const size_t", "nzmax"],
|
21
|
+
["const size_t", "sptype"]],
|
22
|
+
:desc=>
|
23
|
+
"This function allocates a sparse matrix of size n1-by-n2 and\n" +
|
24
|
+
"initializes it to all zeros. If the size of the matrix is not known at allocation\n" +
|
25
|
+
"time, both n1 and n2 may be set to 1, and they will automatically\n" +
|
26
|
+
"grow as elements are added to the matrix. The parameter nzmax specifies\n" +
|
27
|
+
"the maximum number of non-zero elements which will be added to the matrix.\n" +
|
28
|
+
"It does not need to be precisely known in advance, since storage space will \n" +
|
29
|
+
"automatically grow using gsl_spmatrix_realloc if nzmax is not\n" +
|
30
|
+
"large enough. Accurate knowledge of this parameter reduces the number of\n" +
|
31
|
+
"reallocation calls required. The parameter sptype specifies the\n" +
|
32
|
+
"storage format of the sparse matrix. Possible values are\n" +
|
33
|
+
"The allocated gsl_spmatrix structure is of size O(nzmax)."},
|
34
|
+
{:func_name=>"gsl_spmatrix_realloc",
|
35
|
+
:func_type=>"int",
|
36
|
+
:args=>[["const size_t", "nzmax"], ["gsl_spmatrix *", "m"]],
|
37
|
+
:desc=>
|
38
|
+
"This function reallocates the storage space for m to accomodate\n" +
|
39
|
+
"nzmax non-zero elements. It is typically called internally by\n" +
|
40
|
+
"gsl_spmatrix_set if the user wants to add more elements to the\n" +
|
41
|
+
"sparse matrix than the previously specified nzmax."},
|
42
|
+
{:func_name=>"gsl_spmatrix_free",
|
43
|
+
:func_type=>"void",
|
44
|
+
:args=>[["gsl_spmatrix *", "m"]],
|
45
|
+
:desc=>
|
46
|
+
"This function frees the memory associated with the sparse matrix m."},
|
47
|
+
{:func_name=>"gsl_spmatrix_get",
|
48
|
+
:func_type=>"double",
|
49
|
+
:args=>
|
50
|
+
[["const gsl_spmatrix *", "m"],
|
51
|
+
["const size_t", "i"],
|
52
|
+
["const size_t", "j"]],
|
53
|
+
:desc=>
|
54
|
+
"This function returns element (i,j) of the matrix m.\n" +
|
55
|
+
"The matrix may be in triplet or compressed format."},
|
56
|
+
{:func_name=>"gsl_spmatrix_set",
|
57
|
+
:func_type=>"int",
|
58
|
+
:args=>
|
59
|
+
[["gsl_spmatrix *", "m"],
|
60
|
+
["const size_t", "i"],
|
61
|
+
["const size_t", "j"],
|
62
|
+
["const double", "x"]],
|
63
|
+
:desc=>
|
64
|
+
"This function sets element (i,j) of the matrix m to\n" +
|
65
|
+
"the value x. The matrix must be in triplet representation."},
|
66
|
+
{:func_name=>"gsl_spmatrix_ptr",
|
67
|
+
:func_type=>"double *",
|
68
|
+
:args=>
|
69
|
+
[["gsl_spmatrix *", "m"], ["const size_t", "i"], ["const size_t", "j"]],
|
70
|
+
:desc=>
|
71
|
+
"This function returns a pointer to the (i,j) element of the matrix m.\n" +
|
72
|
+
"If the (i,j) element is not explicitly stored in the matrix,\n" +
|
73
|
+
"a null pointer is returned."},
|
74
|
+
{:func_name=>"gsl_spmatrix_set_zero",
|
75
|
+
:func_type=>"int",
|
76
|
+
:args=>[["gsl_spmatrix *", "m"]],
|
77
|
+
:desc=>
|
78
|
+
"This function sets (or resets) all the elements of the matrix m to zero."},
|
79
|
+
{:func_name=>"gsl_spmatrix_fwrite",
|
80
|
+
:func_type=>"int",
|
81
|
+
:args=>[["FILE *", "stream"], ["const gsl_spmatrix *", "m"]],
|
82
|
+
:desc=>
|
83
|
+
"This function writes the elements of the matrix m to the stream\n" +
|
84
|
+
"stream in binary format. The return value is 0 for success and\n" +
|
85
|
+
"GSL_EFAILED if there was a problem writing to the file. Since the\n" +
|
86
|
+
"data is written in the native binary format it may not be portable\n" +
|
87
|
+
"between different architectures."},
|
88
|
+
{:func_name=>"gsl_spmatrix_fread",
|
89
|
+
:func_type=>"int",
|
90
|
+
:args=>[["FILE *", "stream"], ["gsl_spmatrix *", "m"]],
|
91
|
+
:desc=>
|
92
|
+
"This function reads into the matrix m from the open stream\n" +
|
93
|
+
"stream in binary format. The matrix m must be preallocated\n" +
|
94
|
+
"with the correct storage format, dimensions and have a sufficiently large nzmax\n" +
|
95
|
+
"in order to read in all matrix elements, otherwise GSL_EBADLEN\n" +
|
96
|
+
"is returned. The return value is 0 for success and\n" +
|
97
|
+
"GSL_EFAILED if there was a problem reading from the file. The\n" +
|
98
|
+
"data is assumed to have been written in the native binary format on the\n" +
|
99
|
+
"same architecture."},
|
100
|
+
{:func_name=>"gsl_spmatrix_fprintf",
|
101
|
+
:func_type=>"int",
|
102
|
+
:args=>
|
103
|
+
[["FILE *", "stream"],
|
104
|
+
["const gsl_spmatrix *", "m"],
|
105
|
+
["const char *", "format"]],
|
106
|
+
:desc=>
|
107
|
+
"This function writes the elements of the matrix m line-by-line to\n" +
|
108
|
+
"the stream stream using the format specifier format, which\n" +
|
109
|
+
"should be one of the %g, %e or %f formats for\n" +
|
110
|
+
"floating point numbers. The function returns 0 for success and\n" +
|
111
|
+
"GSL_EFAILED if there was a problem writing to the file. The\n" +
|
112
|
+
"input matrix m may be in any storage format, and the output file\n" +
|
113
|
+
"will be written in MatrixMarket format."},
|
114
|
+
{:func_name=>"gsl_spmatrix_fscanf",
|
115
|
+
:func_type=>"gsl_spmatrix *",
|
116
|
+
:args=>[["FILE *", "stream"]],
|
117
|
+
:desc=>
|
118
|
+
"This function reads sparse matrix data in the MatrixMarket format\n" +
|
119
|
+
"from the stream stream and stores it in a newly allocated matrix\n" +
|
120
|
+
"which is returned in triplet format. The function returns 0 for success and\n" +
|
121
|
+
"GSL_EFAILED if there was a problem reading from the file. The\n" +
|
122
|
+
"user should free the returned matrix when it is no longer needed."},
|
123
|
+
{:func_name=>"gsl_spmatrix_memcpy",
|
124
|
+
:func_type=>"int",
|
125
|
+
:args=>[["gsl_spmatrix *", "dest"], ["const gsl_spmatrix *", "src"]],
|
126
|
+
:desc=>
|
127
|
+
"This function copies the elements of the sparse matrix src into\n" +
|
128
|
+
"dest. The two matrices must have the same dimensions and be in the\n" +
|
129
|
+
"same storage format."},
|
130
|
+
{:func_name=>"gsl_spmatrix_transpose_memcpy",
|
131
|
+
:func_type=>"int",
|
132
|
+
:args=>[["gsl_spmatrix *", "dest"], ["const gsl_spmatrix *", "src"]],
|
133
|
+
:desc=>
|
134
|
+
"This function copies the transpose of the sparse matrix src into\n" +
|
135
|
+
"dest. The dimensions of dest must match the transpose of the\n" +
|
136
|
+
"matrix src. Also, both matrices must use the same sparse storage\n" +
|
137
|
+
"format."},
|
138
|
+
{:func_name=>"gsl_spmatrix_transpose",
|
139
|
+
:func_type=>"int",
|
140
|
+
:args=>[["gsl_spmatrix *", "m"]],
|
141
|
+
:desc=>
|
142
|
+
"This function replaces the matrix m by its transpose,\n" +
|
143
|
+
"preserving the storage format of the input matrix. Currently,\n" +
|
144
|
+
"only triplet matrix inputs are supported."},
|
145
|
+
{:func_name=>"gsl_spmatrix_transpose2",
|
146
|
+
:func_type=>"int",
|
147
|
+
:args=>[["gsl_spmatrix *", "m"]],
|
148
|
+
:desc=>
|
149
|
+
"This function replaces the matrix m by its transpose, but\n" +
|
150
|
+
"changes the storage format for compressed matrix inputs. Since\n" +
|
151
|
+
"compressed column storage is the transpose of compressed row storage,\n" +
|
152
|
+
"this function simply converts a CCS matrix to CRS and vice versa.\n" +
|
153
|
+
"This is the most efficient way to transpose a compressed storage\n" +
|
154
|
+
"matrix, but the user should note that the storage format of their\n" +
|
155
|
+
"compressed matrix will change on output. For triplet matrices,\n" +
|
156
|
+
"the output matrix is also in triplet storage."},
|
157
|
+
{:func_name=>"gsl_spmatrix_add",
|
158
|
+
:func_type=>"int",
|
159
|
+
:args=>
|
160
|
+
[["gsl_spmatrix *", "c"],
|
161
|
+
["const gsl_spmatrix *", "a"],
|
162
|
+
["const gsl_spmatrix *", "b"]],
|
163
|
+
:desc=>
|
164
|
+
"This function computes the sum c = a + b. The three matrices must\n" +
|
165
|
+
"have the same dimensions and be stored in a compressed format."},
|
166
|
+
{:func_name=>"gsl_spmatrix_scale",
|
167
|
+
:func_type=>"int",
|
168
|
+
:args=>[["gsl_spmatrix *", "m"], ["const double", "x"]],
|
169
|
+
:desc=>
|
170
|
+
"This function scales all elements of the matrix m by the constant\n" +
|
171
|
+
"factor x. The result m(i,j) \\leftarrow x m(i,j) is stored in m."},
|
172
|
+
{:func_name=>"gsl_spmatrix_nnz",
|
173
|
+
:func_type=>"size_t",
|
174
|
+
:args=>[["const gsl_spmatrix *", "m"]],
|
175
|
+
:desc=>"This function returns the number of non-zero elements in m."},
|
176
|
+
{:func_name=>"gsl_spmatrix_equal",
|
177
|
+
:func_type=>"int",
|
178
|
+
:args=>[["const gsl_spmatrix *", "a"], ["const gsl_spmatrix *", "b"]],
|
179
|
+
:desc=>
|
180
|
+
"This function returns 1 if the matrices a and b are equal (by comparison of\n" +
|
181
|
+
"element values) and 0 otherwise. The matrices a and b must be in the same\n" +
|
182
|
+
"sparse storage format for comparison."},
|
183
|
+
{:func_name=>"gsl_spmatrix_minmax",
|
184
|
+
:func_type=>"int",
|
185
|
+
:args=>
|
186
|
+
[["const gsl_spmatrix *", "m"],
|
187
|
+
["double *", "min_out"],
|
188
|
+
["double *", "max_out"]],
|
189
|
+
:desc=>
|
190
|
+
"This function returns the minimum and maximum elements of the matrix\n" +
|
191
|
+
"m, storing them in min_out and max_out, and searching\n" +
|
192
|
+
"only the non-zero values."},
|
193
|
+
{:func_name=>"gsl_spmatrix_ccs",
|
194
|
+
:func_type=>"gsl_spmatrix *",
|
195
|
+
:args=>[["const gsl_spmatrix *", "T"]],
|
196
|
+
:desc=>
|
197
|
+
"This function creates a sparse matrix in compressed column format\n" +
|
198
|
+
"from the input sparse matrix T which must be in triplet format.\n" +
|
199
|
+
"A pointer to a newly allocated matrix is returned. The calling function\n" +
|
200
|
+
"should free the newly allocated matrix when it is no longer needed."},
|
201
|
+
{:func_name=>"gsl_spmatrix_crs",
|
202
|
+
:func_type=>"gsl_spmatrix *",
|
203
|
+
:args=>[["const gsl_spmatrix *", "T"]],
|
204
|
+
:desc=>
|
205
|
+
"This function creates a sparse matrix in compressed row format\n" +
|
206
|
+
"from the input sparse matrix T which must be in triplet format.\n" +
|
207
|
+
"A pointer to a newly allocated matrix is returned. The calling function\n" +
|
208
|
+
"should free the newly allocated matrix when it is no longer needed."},
|
209
|
+
{:func_name=>"gsl_spmatrix_d2sp",
|
210
|
+
:func_type=>"int",
|
211
|
+
:args=>[["gsl_spmatrix *", "S"], ["const gsl_matrix *", "A"]],
|
212
|
+
:desc=>
|
213
|
+
"This function converts the dense matrix A into sparse triplet format\n" +
|
214
|
+
"and stores the result in S."},
|
215
|
+
{:func_name=>"gsl_spmatrix_sp2d",
|
216
|
+
:func_type=>"int",
|
217
|
+
:args=>[["gsl_matrix *", "A"], ["const gsl_spmatrix *", "S"]],
|
218
|
+
:desc=>
|
219
|
+
"This function converts the sparse matrix S into a dense matrix and\n" +
|
220
|
+
"stores the result in A. S must be in triplet format."},
|
221
|
+
{:func_name=>"gsl_spblas_dgemv",
|
222
|
+
:func_type=>"int",
|
223
|
+
:args=>
|
224
|
+
[["const CBLAS_TRANSPOSE_t", "TransA"],
|
225
|
+
["const double", "alpha"],
|
226
|
+
["const gsl_spmatrix *", "A"],
|
227
|
+
["const gsl_vector *", "x"],
|
228
|
+
["const double", "beta"],
|
229
|
+
["gsl_vector *", "y"]],
|
230
|
+
:desc=>
|
231
|
+
"This function computes the matrix-vector product and sum\n" +
|
232
|
+
"y \\leftarrow \\alpha op(A) x + \\beta y, where\n" +
|
233
|
+
"op(A) = A, A^T for TransA = CblasNoTrans,\n" +
|
234
|
+
"CblasTrans. In-place computations are not supported, so\n" +
|
235
|
+
"x and y must be distinct vectors.\n" +
|
236
|
+
"The matrix A may be in triplet or compressed format."},
|
237
|
+
{:func_name=>"gsl_spblas_dgemm",
|
238
|
+
:func_type=>"int",
|
239
|
+
:args=>
|
240
|
+
[["const double", "alpha"],
|
241
|
+
["const gsl_spmatrix *", "A"],
|
242
|
+
["const gsl_spmatrix *", "B"],
|
243
|
+
["gsl_spmatrix *", "C"]],
|
244
|
+
:desc=>
|
245
|
+
"This function computes the sparse matrix-matrix product\n" +
|
246
|
+
"C = \\alpha A B. The matrices must be in compressed format."},
|
247
|
+
{:func_name=>"gsl_splinalg_itersolve_alloc",
|
248
|
+
:func_type=>"gsl_splinalg_itersolve *",
|
249
|
+
:args=>
|
250
|
+
[["const gsl_splinalg_itersolve_type *", "T"],
|
251
|
+
["const size_t", "n"],
|
252
|
+
["const size_t", "m"]],
|
253
|
+
:desc=>
|
254
|
+
"This function allocates a workspace for the iterative solution of\n" +
|
255
|
+
"n-by-n sparse matrix systems. The iterative solver type\n" +
|
256
|
+
"is specified by T. The argument m specifies the size\n" +
|
257
|
+
"of the solution candidate subspace {\\cal K}_m. The dimension\n" +
|
258
|
+
"m may be set to 0 in which case a reasonable default value is used."},
|
259
|
+
{:func_name=>"gsl_splinalg_itersolve_free",
|
260
|
+
:func_type=>"void",
|
261
|
+
:args=>[["gsl_splinalg_itersolve *", "w"]],
|
262
|
+
:desc=>"This function frees the memory associated with the workspace w."},
|
263
|
+
{:func_name=>"gsl_splinalg_itersolve_name",
|
264
|
+
:func_type=>"const char *",
|
265
|
+
:args=>[["const gsl_splinalg_itersolve *", "w"]],
|
266
|
+
:desc=>"This function returns a string pointer to the name of the solver."},
|
267
|
+
{:func_name=>"gsl_splinalg_itersolve_iterate",
|
268
|
+
:func_type=>"int",
|
269
|
+
:args=>
|
270
|
+
[["const gsl_spmatrix *", "A"],
|
271
|
+
["const gsl_vector *", "b"],
|
272
|
+
["const double", "tol"],
|
273
|
+
["gsl_vector *", "x"],
|
274
|
+
["gsl_splinalg_itersolve *", "w"]],
|
275
|
+
:desc=>
|
276
|
+
"This function performs one iteration of the iterative method for\n" +
|
277
|
+
"the sparse linear system specfied by the matrix A, right hand\n" +
|
278
|
+
"side vector b and solution vector x. On input, x\n" +
|
279
|
+
"must be set to an initial guess for the solution. On output,\n" +
|
280
|
+
"x is updated to give the current solution estimate. The\n" +
|
281
|
+
"parameter tol specifies the relative tolerance between the residual\n" +
|
282
|
+
"norm and norm of b in order to check for convergence.\n" +
|
283
|
+
"When the following condition is satisfied:\n" +
|
284
|
+
"|| A x - b || <= tol * || b ||\n" +
|
285
|
+
"the method has converged, the function returns GSL_SUCCESS and\n" +
|
286
|
+
"the final solution is provided in x. Otherwise, the function\n" +
|
287
|
+
"returns GSL_CONTINUE to signal that more iterations are\n" +
|
288
|
+
"required. Here, || \\cdot || represents the Euclidean norm.\n" +
|
289
|
+
"The input matrix A may be in triplet or compressed column\n" +
|
290
|
+
"format."},
|
291
|
+
{:func_name=>"gsl_splinalg_itersolve_normr",
|
292
|
+
:func_type=>"double",
|
293
|
+
:args=>[["const gsl_splinalg_itersolve *", "w"]],
|
294
|
+
:desc=>
|
295
|
+
"This function returns the current residual norm\n" +
|
296
|
+
"||r|| = ||A x - b||, which is updated after each call to\n" +
|
297
|
+
"gsl_splinalg_itersolve_iterate."}]
|