Sha256: 82b3bc45a2a4aaafe284edf0f194489d9070f1616237e0f6ad8dbe848c77538f

Contents?: true

Size: 1.2 KB

Versions: 3

Compression:

Stored size: 1.2 KB

Contents

static void
iter_<%=c_func%>(na_loop_t *const lp)
{
    size_t   i;
    char    *p1, *p2;
    ssize_t  s1, s2;
    unsigned int x;
    double   y;
    char *opt;
    double c1;
    unsigned int c2;

    INIT_COUNTER(lp, i);
    INIT_PTR(lp, 0, p1, s1);
    INIT_PTR(lp, 1, p2, s2);

    opt = (char*)(lp->opt_ptr);
    c1 = *(double*)opt;
    c2 = *(unsigned int*)(opt+sizeof(double));

    for (; i--;) {
        GET_DATA_STRIDE(p1,s1,double,x);
        y = <%=func_name%>(x, c1, c2);
        SET_DATA_STRIDE(p2,s2,double,y);
    }
}

/*
  @overload <%=name%>(<%=args.map{|a| a[1]}.join(",")%>)
  @param  [UInt]     <%=args[0][1]%>
  @param  [Integer]  <%=args[1][1]%> parameter
  @param  [Float]    <%=args[2][1]%> parameter
  @return [DFloat]   result

  <%= description %>
*/
static VALUE
<%=c_func(3)%>(VALUE mod, VALUE v0, VALUE v1, VALUE v2)
{
    ndfunc_arg_in_t ain[1] = {{cUI,0}};
    ndfunc_arg_out_t aout[1] = {{cDF,0}};
    ndfunc_t ndf = {iter_<%=c_func%>, STRIDE_LOOP|NDF_EXTRACT, 1,1, ain,aout};
    char *opt;
    opt = ALLOCA_N(char,sizeof(double)+sizeof(unsigned int));

    *(double*)opt = NUM2DBL(v1);
    *(unsigned int*)(opt+sizeof(double)) = NUM2UINT(v2);

    return na_ndloop3(&ndf, opt, 1, v0);
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
numo-gsl-0.1.2 ext/numo/gsl/gen/tmpl/m_DFloat_f_UInt_double_uint.c
numo-gsl-0.1.1 ext/numo/gsl/gen/tmpl/m_DFloat_f_UInt_double_uint.c
numo-gsl-0.1.0 ext/numo/gsl/gen/tmpl/m_DFloat_f_UInt_double_uint.c