Sha256: 3126038c9d2a515c34c86668eafaab87f6a805e9d5c9c97ba0ecbe09be91e677

Contents?: true

Size: 949 Bytes

Versions: 8

Compression:

Stored size: 949 Bytes

Contents

void
<%=c_iter%>(na_loop_t *const lp)
{
    size_t i, s1;
    char *p1;
    size_t *idx1;
    dtype x;
    volatile VALUE a, y;

    INIT_COUNTER(lp, i);
    INIT_PTR_IDX(lp, 0, p1, s1, idx1);
    a = rb_ary_new2(i);
    rb_ary_push(lp->args[1].value, a);
    if (idx1) {
        for (; i--;) {
            GET_DATA_INDEX(p1,idx1,dtype,x);
            y = m_data_to_num(x);
            rb_ary_push(a,y);
        }
    } else {
        for (; i--;) {
            GET_DATA_STRIDE(p1,s1,dtype,x);
            y = m_data_to_num(x);
            rb_ary_push(a,y);
        }
    }
}

/*
  Convert self to Array.
  @overload <%=name%>
  @return [Array]
*/
static VALUE
<%=c_func(0)%>(VALUE self)
{
    ndfunc_arg_in_t ain[3] = {{Qnil,0},{sym_loop_opt},{sym_option}};
    ndfunc_arg_out_t aout[1] = {{rb_cArray,0}}; // dummy?
    ndfunc_t ndf = { <%=c_iter%>, FULL_LOOP_NIP, 3, 1, ain, aout };
    return na_ndloop_cast_narray_to_rarray(&ndf, self, Qnil);
}

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
numo-narray-0.9.1.2 ext/numo/narray/gen/tmpl/to_a.c
numo-narray-0.9.1.1 ext/numo/narray/gen/tmpl/to_a.c
numo-narray-0.9.1.0 ext/numo/narray/gen/tmpl/to_a.c
numo-narray-0.9.0.9 ext/numo/narray/gen/tmpl/to_a.c
numo-narray-0.9.0.8 ext/numo/narray/gen/tmpl/to_a.c
numo-narray-0.9.0.7 ext/numo/narray/gen/tmpl/to_a.c
numo-narray-0.9.0.6 ext/numo/narray/gen/tmpl/to_a.c
numo-narray-0.9.0.5 ext/numo/narray/gen/tmpl/to_a.c