Sha256: 9aaa4bbfbf77ae72af641d93b533b2875ddb0efba8d5950a562dd30afe37db99

Contents?: true

Size: 1.48 KB

Versions: 15

Compression:

Stored size: 1.48 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(p1+*idx1,dtype,x);
                GET_DATA_INDEX(p2,idx2,<%=dtype%>,y);
                x = m_<%=name%>(x,y);
                SET_DATA_INDEX(p1,idx1,dtype,x);
            }
        } else {
            for (; i--;) {
                GET_DATA(p1+*idx1,dtype,x);
                GET_DATA_STRIDE(p2,s2,<%=dtype%>,y);
                x = m_<%=name%>(x,y);
                SET_DATA_INDEX(p1,idx1,dtype,x);
            }
        }
    } else {
        if (idx2) {
            for (; i--;) {
                GET_DATA(p1,dtype,x);
                GET_DATA_INDEX(p2,idx2,<%=dtype%>,y);
                x = m_<%=name%>(x,y);
                SET_DATA_STRIDE(p1,s1,dtype,x);
            }
        } else {
            for (; i--;) {
                GET_DATA(p1,dtype,x);
                GET_DATA_STRIDE(p2,s2,<%=dtype%>,y);
                x = m_<%=name%>(x,y);
                SET_DATA_STRIDE(p1,s1,dtype,x);
            }
        }
    }
}

static VALUE
<%=c_func(1)%>(VALUE self, VALUE a1)
{
    ndfunc_arg_in_t ain[2] = {{OVERWRITE,0},{<%=result_class%>,0}};
    ndfunc_t ndf = { <%=c_iter%>, FULL_LOOP, 2, 0, ain, 0 };

    na_ndloop(&ndf, 2, self, a1);
    return a1;
}

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
numo-narray-0.9.2.1 ext/numo/narray/gen/tmpl/set2.c
numo-narray-0.9.2.0 ext/numo/narray/gen/tmpl/set2.c
numo-narray-0.9.1.9 ext/numo/narray/gen/tmpl/set2.c
numo-narray-0.9.1.8 ext/numo/narray/gen/tmpl/set2.c
numo-narray-0.9.1.7 ext/numo/narray/gen/tmpl/set2.c
numo-narray-0.9.1.6 ext/numo/narray/gen/tmpl/set2.c
numo-narray-0.9.1.5 ext/numo/narray/gen/tmpl/set2.c
numo-narray-0.9.1.4 ext/numo/narray/gen/tmpl/set2.c
numo-narray-0.9.1.3 ext/numo/narray/gen/tmpl/set2.c
numo-narray-0.9.1.2 ext/numo/narray/gen/tmpl/set2.c
numo-narray-0.9.1.1 ext/numo/narray/gen/tmpl/set2.c
numo-narray-0.9.1.0 ext/numo/narray/gen/tmpl/set2.c
numo-narray-0.9.0.9 ext/numo/narray/gen/tmpl/set2.c
numo-narray-0.9.0.8 ext/numo/narray/gen/tmpl/set2.c
numo-narray-0.9.0.7 ext/numo/narray/gen/tmpl/set2.c