Sha256: 975f91228fe68c242eab16a91c3bac6962d623887c7aeaec0452d88b8dfbe50d

Contents?: true

Size: 1.34 KB

Versions: 3

Compression:

Stored size: 1.34 KB

Contents

static void
iter_<%=c_func%>(na_loop_t *const lp)
{
    size_t   n;
    char    *p1, *p2, *p3;
    ssize_t  s1, s2;
    double  *opt = (double*)(lp->opt_ptr);

    INIT_COUNTER(lp, n);
    INIT_PTR(lp, 0, p1, s1);
    INIT_PTR(lp, 1, p2, s2);
    p3 = lp->args[2].ptr + lp->args[2].iter[0].pos;

    *(double*)p3 = <%=func_name%>((double*)p1,s1/sizeof(double),
                                 (double*)p2,s2/sizeof(double),n,opt[0],opt[1]);
}

/*
  <%=desc%>
  @overload <%=name%>(<%=method_args%>, axis:nil, keepdims:false)
  <% desc_param.each do |x|%>
  <%=x%><% end %>
  @param [Numeric,Array,Range] axis (keyword) Axes along which the operation is performed.
  @param [TrueClass] keepdims (keyword) If true, the reduced axes are left in th*/
static VALUE
<%=c_func%>(int argc, VALUE *argv, VALUE mod)
{
    VALUE reduce;
    double opt[2];
    ndfunc_arg_in_t ain[3] = {{cDF,0},{cDF,0},{sym_reduce,0}};
    ndfunc_arg_out_t aout[1] = {{cDF,0}};
    ndfunc_t ndf = { iter_<%=c_func%>, STRIDE_LOOP_NIP|NDF_FLAT_REDUCE|NDF_EXTRACT,
                     3, 1, ain, aout };

    if (argc<4) {
        rb_raise(rb_eArgError,"wrong number of argument (%d for >=4)",argc);
    }

    opt[0] = NUM2DBL(argv[2]);
    opt[1] = NUM2DBL(argv[3]);

    reduce = nary_reduce_dimension(argc-4, argv+4, 2, argv, &ndf, 0);
    return na_ndloop3(&ndf, opt, 3, argv[0], argv[1], reduce);
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
numo-gsl-0.1.2 ext/numo/gsl/stats/tmpl/stats_2a2p.c
numo-gsl-0.1.1 ext/numo/gsl/stats/tmpl/stats_2a2p.c
numo-gsl-0.1.0 ext/numo/gsl/stats/tmpl/stats_2a2p.c