Sha256: f9dc5513e24c022a3b227db10cb0dc9ecd862d74af7e777d55c80acaa82d2a25

Contents?: true

Size: 1.43 KB

Versions: 8

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

/*
  Calculate <%=name%>(x).
  @overload <%=name%>(x)
  @param [Numo::NArray,Numeric] x  input value
  @return [Numo::<%=class_name%>] result of <%=name%>(x).
*/
static VALUE
<%=c_func(1)%>(VALUE mod, VALUE a1)
{
    ndfunc_arg_in_t ain[1] = {{cT,0}};
    ndfunc_arg_out_t aout[1] = {{cT,0}};
    ndfunc_t ndf = { <%=c_iter%>, FULL_LOOP, 1, 1, ain, aout };

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
numo-narray-0.9.1.2 ext/numo/narray/gen/tmpl/unary_s.c
numo-narray-0.9.1.1 ext/numo/narray/gen/tmpl/unary_s.c
numo-narray-0.9.1.0 ext/numo/narray/gen/tmpl/unary_s.c
numo-narray-0.9.0.9 ext/numo/narray/gen/tmpl/unary_s.c
numo-narray-0.9.0.8 ext/numo/narray/gen/tmpl/unary_s.c
numo-narray-0.9.0.7 ext/numo/narray/gen/tmpl/unary_s.c
numo-narray-0.9.0.6 ext/numo/narray/gen/tmpl/unary_s.c
numo-narray-0.9.0.5 ext/numo/narray/gen/tmpl/unary_s.c