Sha256: fb91b2147c53f4457707f7d59fcf25c78edbc8c2b3f3dd67f522b28eb2827ba2

Contents?: true

Size: 1.06 KB

Versions: 12

Compression:

Stored size: 1.06 KB

Contents

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

    CUMO_INIT_COUNTER(lp, i);
    CUMO_INIT_PTR_IDX(lp, 0, p1, s1, idx1);

    CUMO_SHOW_SYNCHRONIZE_WARNING_ONCE("<%=name%>", "<%=type_name%>");
    cumo_cuda_runtime_check_status(cudaDeviceSynchronize());

    if (idx1) {
        for (; i--;) {
            CUMO_GET_DATA_INDEX(p1,idx1,dtype,x);
            y = m_data_to_num(x);
            rb_yield(y);
        }
    } else {
        for (; i--;) {
            CUMO_GET_DATA_STRIDE(p1,s1,dtype,x);
            y = m_data_to_num(x);
            rb_yield(y);
        }
    }
}

/*
  Calls the given block once for each element in self,
  passing that element as a parameter.
  @overload <%=name%>
  @return [Cumo::NArray] self
  For a block {|x| ... }
  @yield [x]  x is element of NArray.
*/
static VALUE
<%=c_func(0)%>(VALUE self)
{
    cumo_ndfunc_arg_in_t ain[1] = {{Qnil,0}};
    cumo_ndfunc_t ndf = {<%=c_iter%>, CUMO_FULL_LOOP_NIP, 1,0, ain,0};

    cumo_na_ndloop(&ndf, 1, self);
    return self;
}

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
cumo-0.3.2 ext/cumo/narray/gen/tmpl/each.c
cumo-0.3.1 ext/cumo/narray/gen/tmpl/each.c
cumo-0.3.0 ext/cumo/narray/gen/tmpl/each.c
cumo-0.3.0.pre1 ext/cumo/narray/gen/tmpl/each.c
cumo-0.2.5 ext/cumo/narray/gen/tmpl/each.c
cumo-0.2.4 ext/cumo/narray/gen/tmpl/each.c
cumo-0.2.3 ext/cumo/narray/gen/tmpl/each.c
cumo-0.2.2 ext/cumo/narray/gen/tmpl/each.c
cumo-0.2.1 ext/cumo/narray/gen/tmpl/each.c
cumo-0.2.0 ext/cumo/narray/gen/tmpl/each.c
cumo-0.1.2 ext/cumo/narray/gen/tmpl/each.c
cumo-0.1.1 ext/cumo/narray/gen/tmpl/each.c