Sha256: fe0cd29a61123eb27aaad0f20fd30ffd39ae6c2aeb45af7cdf1668f1d8669abe

Contents?: true

Size: 1.12 KB

Versions: 14

Compression:

Stored size: 1.12 KB

Contents

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

    CUMO_INIT_COUNTER(lp, i);
    CUMO_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--;) {
            CUMO_GET_DATA_INDEX(p1,idx1,dtype,x);
            y = m_data_to_num(x);
            rb_ary_push(a,y);
        }
    } else {
        for (; i--;) {
            CUMO_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)
{
    cumo_ndfunc_arg_in_t ain[3] = {{Qnil,0},{cumo_sym_loop_opt},{cumo_sym_option}};
    cumo_ndfunc_arg_out_t aout[1] = {{rb_cArray,0}}; // dummy?
    cumo_ndfunc_t ndf = { <%=c_iter%>, CUMO_FULL_LOOP_NIP, 3, 1, ain, aout };
    CUMO_SHOW_SYNCHRONIZE_WARNING_ONCE("<%=name%>", "<%=type_name%>");
    cumo_cuda_runtime_check_status(cudaDeviceSynchronize());
    return cumo_na_ndloop_cast_narray_to_rarray(&ndf, self, Qnil);
}

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
cumo-0.4.3 ext/cumo/narray/gen/tmpl/to_a.c
cumo-0.4.2 ext/cumo/narray/gen/tmpl/to_a.c
cumo-0.4.1 ext/cumo/narray/gen/tmpl/to_a.c
cumo-0.4.0 ext/cumo/narray/gen/tmpl/to_a.c
cumo-0.3.5 ext/cumo/narray/gen/tmpl/to_a.c
cumo-0.3.4 ext/cumo/narray/gen/tmpl/to_a.c
cumo-0.3.3 ext/cumo/narray/gen/tmpl/to_a.c
cumo-0.3.2 ext/cumo/narray/gen/tmpl/to_a.c
cumo-0.3.1 ext/cumo/narray/gen/tmpl/to_a.c
cumo-0.3.0 ext/cumo/narray/gen/tmpl/to_a.c
cumo-0.3.0.pre1 ext/cumo/narray/gen/tmpl/to_a.c
cumo-0.2.5 ext/cumo/narray/gen/tmpl/to_a.c
cumo-0.2.4 ext/cumo/narray/gen/tmpl/to_a.c
cumo-0.2.3 ext/cumo/narray/gen/tmpl/to_a.c