Sha256: f1a4ec313efe7d21b3adde7ab0c71877bd6c5ac2e8297e275347cc077e388485

Contents?: true

Size: 1.44 KB

Versions: 15

Compression:

Stored size: 1.44 KB

Contents

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

    CUMO_INIT_COUNTER(lp, n);
    CUMO_INIT_PTR(lp, 0, ptr, step);
    CUMO_SHOW_SYNCHRONIZE_FIXME_WARNING_ONCE("<%=name%>", "<%=type_name%>");
    cumo_cuda_runtime_check_status(cudaDeviceSynchronize());
    <%=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 [Cumo::<%=class_name%>] returns result of <%=name%>.
  @example
      Cumo::DFloat[3,4,1,2].sort => Cumo::DFloat[1,2,3,4]
*/
static VALUE
<%=c_func(-1)%>(int argc, VALUE *argv, VALUE self)
{
    VALUE reduce;
    cumo_ndfunc_arg_in_t ain[2] = {{CUMO_OVERWRITE,0},{cumo_sym_reduce,0}};
    cumo_ndfunc_t ndf = {0, CUMO_STRIDE_LOOP|CUMO_NDF_FLAT_REDUCE, 2,0, ain,0};

    if (!CUMO_TEST_INPLACE(self)) {
        self = cumo_na_copy(self);
    }
  <% if is_float %>
    ndf.func = <%=c_iter%>_ignan;
    reduce = cumo_na_reduce_dimension(argc, argv, 1, &self, &ndf, <%=c_iter%>_prnan);
  <% else %>
    ndf.func = <%=c_iter%>;
    reduce = cumo_na_reduce_dimension(argc, argv, 1, &self, &ndf, 0);
  <% end %>
    cumo_na_ndloop(&ndf, 2, self, reduce);
    return self;
}

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
cumo-0.4.3 ext/cumo/narray/gen/tmpl/sort.c
cumo-0.4.2 ext/cumo/narray/gen/tmpl/sort.c
cumo-0.4.1 ext/cumo/narray/gen/tmpl/sort.c
cumo-0.4.0 ext/cumo/narray/gen/tmpl/sort.c
cumo-0.3.5 ext/cumo/narray/gen/tmpl/sort.c
cumo-0.3.4 ext/cumo/narray/gen/tmpl/sort.c
cumo-0.3.3 ext/cumo/narray/gen/tmpl/sort.c
cumo-0.3.2 ext/cumo/narray/gen/tmpl/sort.c
cumo-0.3.1 ext/cumo/narray/gen/tmpl/sort.c
cumo-0.3.0 ext/cumo/narray/gen/tmpl/sort.c
cumo-0.3.0.pre1 ext/cumo/narray/gen/tmpl/sort.c
cumo-0.2.5 ext/cumo/narray/gen/tmpl/sort.c
cumo-0.2.4 ext/cumo/narray/gen/tmpl/sort.c
cumo-0.2.3 ext/cumo/narray/gen/tmpl/sort.c
cumo-0.2.2 ext/cumo/narray/gen/tmpl/sort.c