Sha256: 13d9589f06fba02ad4765714e3d523018a8a3d3f3b72c417f7f16e96f2314d57

Contents?: true

Size: 1.4 KB

Versions: 9

Compression:

Stored size: 1.4 KB

Contents

<% (is_float ? ["","_nan"] : [""]).each do |j| %>
static void
<%=c_iter%><%=j%>(na_loop_t *const lp)
{
    size_t   i;
    char    *p1, *p2;
    ssize_t  s1, s2;
    dtype    x, y;

    INIT_COUNTER(lp, i);
    INIT_PTR(lp, 0, p1, s1);
    INIT_PTR(lp, 1, p2, s2);
    //printf("i=%lu p1=%lx s1=%lu p2=%lx s2=%lu\n",i,(size_t)p1,s1,(size_t)p2,s2);

    GET_DATA_STRIDE(p1,s1,dtype,x);
    SET_DATA_STRIDE(p2,s2,dtype,x);
    //printf("i=%lu x=%f\n",i,x);
    for (i--; i--;) {
        GET_DATA_STRIDE(p1,s1,dtype,y);
        m_<%=name%><%=j%>(x,y);
        SET_DATA_STRIDE(p2,s2,dtype,x);
        //printf("i=%lu x=%f\n",i,x);
    }
}
<% end %>

/*
  <%=name%> of self.
  @overload <%=name%>(axis:nil, nan:false)
  @param [Numeric,Array,Range] axis  Affected dimensions.
  @param [TrueClass] nan  If true, apply NaN-aware algorithm (avoid NaN if exists).
  @return [Numo::<%=class_name%>] <%=name%> of self.
*/
static VALUE
<%=c_func(-1)%>(int argc, VALUE *argv, VALUE self)
{
    VALUE reduce;
    ndfunc_arg_in_t ain[2] = {{cT,0},{sym_reduce,0}};
    ndfunc_arg_out_t aout[1] = {{cT,0}};
    ndfunc_t ndf = { <%=c_iter%>, STRIDE_LOOP|NDF_FLAT_REDUCE|NDF_CUM,
                     2, 1, ain, aout };

  <% if is_float %>
    reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, <%=c_iter%>_nan);
  <% else %>
    reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, 0);
  <% end %>
    return na_ndloop(&ndf, 2, self, reduce);
}

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
numo-narray-0.9.1.4 ext/numo/narray/gen/tmpl/cum.c
numo-narray-0.9.1.3 ext/numo/narray/gen/tmpl/cum.c
numo-narray-0.9.1.2 ext/numo/narray/gen/tmpl/cum.c
numo-narray-0.9.1.1 ext/numo/narray/gen/tmpl/cum.c
numo-narray-0.9.1.0 ext/numo/narray/gen/tmpl/cum.c
numo-narray-0.9.0.9 ext/numo/narray/gen/tmpl/cum.c
numo-narray-0.9.0.8 ext/numo/narray/gen/tmpl/cum.c
numo-narray-0.9.0.7 ext/numo/narray/gen/tmpl/cum.c
numo-narray-0.9.0.6 ext/numo/narray/gen/tmpl/cum.c