Sha256: 77e4009cd8ea7a1b2a783e6bcebb951560bc06980dca08e18120c656eedb7e9c

Contents?: true

Size: 1.24 KB

Versions: 9

Compression:

Stored size: 1.24 KB

Contents

<% (is_float ? ["_ignan","_prnan"] : [""]).each do |j| %>
static void
<%=c_iter%><%=j%>(na_loop_t *const lp)
{
    size_t n;
    char *ptr;
    ssize_t step;

    INIT_COUNTER(lp, n);
    INIT_PTR(lp, 0, ptr, step);
    <%=type_name%>_qsort<%=j%>(ptr, n, step);
}
<% end %>

/*
  <%=name%> of self.
<% if is_float %>
  @overload <%=name%>(axis:nil, nan:false)
  @param [TrueClass] nan  If true, propagete NaN. If false, ignore NaN.
<% else %>
  @overload <%=name%>(axis:nil)
<% end %>
  @param [Numeric,Array,Range] axis  Affected dimensions.
  @return [Numo::<%=class_name%>] returns result of <%=name%>.
  @example
      Numo::DFloat[3,4,1,2].sort => Numo::DFloat[1,2,3,4]
*/
static VALUE
<%=c_func(-1)%>(int argc, VALUE *argv, VALUE self)
{
    VALUE reduce;
    ndfunc_arg_in_t ain[2] = {{OVERWRITE,0},{sym_reduce,0}};
    ndfunc_t ndf = {0, STRIDE_LOOP|NDF_FLAT_REDUCE, 2,0, ain,0};

    if (!TEST_INPLACE(self)) {
        self = na_copy(self);
    }
  <% if is_float %>
    ndf.func = <%=c_iter%>_ignan;
    reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, <%=c_iter%>_prnan);
  <% else %>
    ndf.func = <%=c_iter%>;
    reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, 0);
  <% end %>
    na_ndloop(&ndf, 2, self, reduce);
    return self;
}

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
numo-narray-0.9.1.4 ext/numo/narray/gen/tmpl/sort.c
numo-narray-0.9.1.3 ext/numo/narray/gen/tmpl/sort.c
numo-narray-0.9.1.2 ext/numo/narray/gen/tmpl/sort.c
numo-narray-0.9.1.1 ext/numo/narray/gen/tmpl/sort.c
numo-narray-0.9.1.0 ext/numo/narray/gen/tmpl/sort.c
numo-narray-0.9.0.9 ext/numo/narray/gen/tmpl/sort.c
numo-narray-0.9.0.8 ext/numo/narray/gen/tmpl/sort.c
numo-narray-0.9.0.7 ext/numo/narray/gen/tmpl/sort.c
numo-narray-0.9.0.6 ext/numo/narray/gen/tmpl/sort.c