Sha256: 1f948424b116d002319a7cbeeb355d805ee440e3e5bbcdbc2af04bda76962d88

Contents?: true

Size: 1.43 KB

Versions: 7

Compression:

Stored size: 1.43 KB

Contents

static void
<%=c_iter%>(na_loop_t *const lp)
{
    size_t  i;
    char   *p1, *p2;
    ssize_t s1, s2;
    size_t *idx1, *idx2;
    dtype   x;
    <%=dtype%> y;
    INIT_COUNTER(lp, i);
    INIT_PTR_IDX(lp, 0, p1, s1, idx1);
    INIT_PTR_IDX(lp, 1, p2, s2, idx2);
    if (idx1) {
        if (idx2) {
            for (; i--;) {
                GET_DATA_INDEX(p1,idx1,dtype,x);
                y = m_<%=method%>(x);
                SET_DATA_INDEX(p2,idx2,<%=dtype%>,y);
            }
        } else {
            for (; i--;) {
                GET_DATA_INDEX(p1,idx1,dtype,x);
                y = m_<%=method%>(x);
                SET_DATA_STRIDE(p2,s2,<%=dtype%>,y);
            }
        }
    } else {
        if (idx2) {
            for (; i--;) {
                GET_DATA_STRIDE(p1,s1,dtype,x);
                y = m_<%=method%>(x);
                SET_DATA_INDEX(p2,idx2,<%=dtype%>,y);
            }
        } else {
            for (; i--;) {
                GET_DATA_STRIDE(p1,s1,dtype,x);
                y = m_<%=method%>(x);
                SET_DATA_STRIDE(p2,s2,<%=dtype%>,y);
            }
        }
    }
}


/*
  <%=method%> of self.
  @overload <%=method%>
  @return [Numo::<%=real_class_name%>] <%=method%> of self.
*/
static VALUE
<%=c_func%>(VALUE self)
{
    ndfunc_arg_in_t ain[1] = {{cT,0}};
    ndfunc_arg_out_t aout[1] = {{<%=tpclass%>,0}};
    ndfunc_t ndf = { <%=c_iter%>, FULL_LOOP, 1, 1, ain, aout };

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

Version data entries

7 entries across 7 versions & 1 rubygems

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