Sha256: 95d1969afc077056584aea61fb0f53ef303abdd1d1d5362fc1d571bc5ff012c4

Contents?: true

Size: 900 Bytes

Versions: 7

Compression:

Stored size: 900 Bytes

Contents

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

    INIT_COUNTER(lp, i);
    INIT_PTR_IDX(lp, 0, p1, s1, idx1);
    if (idx1) {
        for (; i--;) {
            GET_DATA_INDEX(p1,idx1,dtype,x);
            y = m_data_to_num(x);
            rb_yield(y);
        }
    } else {
        for (; i--;) {
            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 <%=method%>
  @return [Numo::NArray] self
  For a block {|x| ... }
  @yield [x]  x is element of NArray.
*/
static VALUE
<%=c_func%>(VALUE self)
{
    ndfunc_arg_in_t ain[1] = {{Qnil,0}};
    ndfunc_t ndf = {<%=c_iter%>, FULL_LOOP_NIP, 1,0, ain,0};

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
numo-narray-0.9.0.4 ext/numo/narray/gen/tmpl/each.c
numo-narray-0.9.0.3-x86-mingw32 ext/numo/narray/gen/tmpl/each.c
numo-narray-0.9.0.3-x64-mingw32 ext/numo/narray/gen/tmpl/each.c
numo-narray-0.9.0.3 ext/numo/narray/gen/tmpl/each.c
numo-narray-0.9.0.1-x64-mingw32 ext/numo/narray/gen/tmpl/each.c
numo-narray-0.9.0.1 ext/numo/narray/gen/tmpl/each.c
numo-narray-0.9.0.1-x86-mingw32 ext/numo/narray/gen/tmpl/each.c