Sha256: 89464b49fbaf9a48d240d9e425449efe822873a1c200e4a9b598b91e69b9ba7b

Contents?: true

Size: 1.34 KB

Versions: 19

Compression:

Stored size: 1.34 KB

Contents

static void
<%=c_iter%>(cumo_na_loop_t *const lp)
{
    size_t  i;
    char   *p1;
    ssize_t s1;
    size_t *idx1;
    dtype *x;
    VALUE y;
    volatile VALUE a;
    VALUE fmt = lp->option;
    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);
    //CUMO_SHOW_SYNCHRONIZE_FIXME_WARNING_ONCE("<%=name%>", "<%=type_name%>");
    if (idx1) {
        for (; i--;) {
            x = (dtype*)(p1 + *idx1);  idx1++;
            y = format_<%=type_name%>(fmt, x);
            rb_ary_push(a,y);
        }
    } else {
        for (; i--;) {
            x = (dtype*)p1;  p1+=s1;
            y = format_<%=type_name%>(fmt, x);
            rb_ary_push(a,y);
        }
    }
}

/*
  Format elements into strings.
  @overload <%=name%> format
  @param [String] format
  @return [Array] array of formated strings.
*/
static VALUE
<%=c_func(-1)%>(int argc, VALUE *argv, VALUE self)
{
    VALUE fmt=Qnil;
    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 };

    rb_scan_args(argc, argv, "01", &fmt);
    cumo_cuda_runtime_check_status(cudaDeviceSynchronize());
    return cumo_na_ndloop_cast_narray_to_rarray(&ndf, self, fmt);
}

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
cumo-0.4.3 ext/cumo/narray/gen/tmpl/format_to_a.c
cumo-0.4.2 ext/cumo/narray/gen/tmpl/format_to_a.c
cumo-0.4.1 ext/cumo/narray/gen/tmpl/format_to_a.c
cumo-0.4.0 ext/cumo/narray/gen/tmpl/format_to_a.c
cumo-0.3.5 ext/cumo/narray/gen/tmpl/format_to_a.c
cumo-0.3.4 ext/cumo/narray/gen/tmpl/format_to_a.c
cumo-0.3.3 ext/cumo/narray/gen/tmpl/format_to_a.c
cumo-0.3.2 ext/cumo/narray/gen/tmpl/format_to_a.c
cumo-0.3.1 ext/cumo/narray/gen/tmpl/format_to_a.c
cumo-0.3.0 ext/cumo/narray/gen/tmpl/format_to_a.c
cumo-0.3.0.pre1 ext/cumo/narray/gen/tmpl/format_to_a.c
cumo-0.2.5 ext/cumo/narray/gen/tmpl/format_to_a.c
cumo-0.2.4 ext/cumo/narray/gen/tmpl/format_to_a.c
cumo-0.2.3 ext/cumo/narray/gen/tmpl/format_to_a.c
cumo-0.2.2 ext/cumo/narray/gen/tmpl/format_to_a.c
cumo-0.2.1 ext/cumo/narray/gen/tmpl/format_to_a.c
cumo-0.2.0 ext/cumo/narray/gen/tmpl/format_to_a.c
cumo-0.1.2 ext/cumo/narray/gen/tmpl/format_to_a.c
cumo-0.1.1 ext/cumo/narray/gen/tmpl/format_to_a.c