Sha256: ad4ebd33df4f9f2b5d36359e9d6c1567f74087f8bb3b059262c685572183291e

Contents?: true

Size: 978 Bytes

Versions: 6

Compression:

Stored size: 978 Bytes

Contents

static void
<%=c_iter%>(na_loop_t *const lp)
{
    size_t   i;
    char    *p1;
    ssize_t  s1;
    size_t  *idx1;
    dtype    y;
    dtype    a[2];

    INIT_COUNTER(lp, i);
    INIT_PTR_IDX(lp, 0, p1, s1, idx1);
    if (idx1) {
        for (; i>1; i-=2) {
            m_rand_norm(a);
            *(dtype*)(p1+*idx1)     = a[0];
            *(dtype*)(p1+*(idx1+1)) = a[1];
            idx1 += 2;
        }
        if (i>0) {
            m_rand_norm(a);
            *(dtype*)(p1+*idx1) = a[0];
        }
    } else {
        for (; i>1; i-=2) {
            m_rand_norm(a);
            *(dtype*)(p1)    = a[0];
            *(dtype*)(p1+s1) = a[1];
            p1 += s1*2;
        }
        if (i>0) {
            m_rand_norm(a);
            *(dtype*)(p1) = a[0];
        }
    }
}

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

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

Version data entries

6 entries across 6 versions & 1 rubygems

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