Sha256: 53b7a9510d71841dae1e496d3cea3a882562f343550d39a7f1ac0b45dd36404e

Contents?: true

Size: 1.3 KB

Versions: 9

Compression:

Stored size: 1.3 KB

Contents

#define func_p <%=func_name%>_p

static <%=func_name%>_t func_p = 0;

<% if /^(cs|zd)scal/ =~ name %>
#define scal_t rtype
<% else %>
#define scal_t dtype
<% end %>

static void
<%=c_iter%>(na_loop_t *const lp)
{
    char *p1;
    size_t n;
    ssize_t s1;
    scal_t *g;

    INIT_COUNTER(lp,n);
    INIT_PTR(lp,0,p1,s1);
    g = (scal_t*)(lp->opt_ptr);

  <% if /^[cz]scal/ =~ name %>
    (*func_p)(n, g, (dtype*)p1, s1/sizeof(dtype));
  <% else %>
    (*func_p)(n, *g, (dtype*)p1, s1/sizeof(dtype));
  <% end %>
}

/*<%
 params = [
   vec("x"),
 ].select{|x| x}.join("\n  ")
%>
  @overload <%=name%>( a, x )
  @param [Float]        a  scale factor
  <%=params%>
  @return [<%=class_name%>] returns a*x.

<%=description%>

 */
static VALUE
<%=c_func(2)%>(VALUE mod, VALUE a, VALUE x)
{
    scal_t g[1];
    narray_t *na1;
    ndfunc_arg_in_t ain[1] = {{OVERWRITE,0}};
    ndfunc_t ndf = {<%=c_iter%>, STRIDE_LOOP, 1,0, ain,0};

    CHECK_FUNC(func_p,"<%=func_name%>");

  <% if /^(cs|zd)scal/ =~ name %>
    if (RTEST(a)) {g[0] = NUM2DBL(a);} else {g[0]=1;}
  <% else %>
    if (RTEST(a)) {g[0] = m_num_to_data(a);} else {g[0]=m_one;}
  <% end %>
    COPY_OR_CAST_TO(x,cT);
    GetNArray(x,na1);
    CHECK_DIM_GE(na1,1);
    CHECK_NON_EMPTY(na1);

    na_ndloop3(&ndf, g, 1, x);

    return x;
}

#undef func_p
#undef scal_t

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
numo-linalg-0.1.7 ext/numo/linalg/blas/tmpl/scal.c
numo-linalg-0.1.6 ext/numo/linalg/blas/tmpl/scal.c
numo-linalg-0.1.5 ext/numo/linalg/blas/tmpl/scal.c
numo-linalg-0.1.4 ext/numo/linalg/blas/tmpl/scal.c
numo-linalg-0.1.3 ext/numo/linalg/blas/tmpl/scal.c
numo-linalg-0.1.2 ext/numo/linalg/blas/tmpl/scal.c
numo-linalg-0.1.1 ext/numo/linalg/blas/tmpl/scal.c
numo-linalg-0.1.0 ext/numo/linalg/blas/tmpl/scal.c
numo-linalg-0.0.1 ext/numo/linalg/blas/tmpl/scal.c