Sha256: e35ca674def121bd105b2ff49dad899cff2078136a137444c0f0fee4990d17aa

Contents?: true

Size: 752 Bytes

Versions: 3

Compression:

Stored size: 752 Bytes

Contents

/*
  @overload <%=name%>([shape])
  @param  [Array or Integer]  shape (optional) shape for result NArray
  @return [Float or DFloat]  returns random number

  <%= desc %>
*/
static VALUE
<%=c_func(-1)%>(int argc, VALUE *argv, VALUE self)
{
    VALUE vshape, vna;
    size_t i, size;
    double *ptr;
    <%=struct%> *r;

    TypedData_Get_Struct(self, <%=struct%>, &<%=data_type_var%>, r);

    if (rb_scan_args(argc, argv, "01", &vshape) == 0) {
        return rb_float_new(<%=func_name%>(r));
    } else {
        vna = create_new_narray(cDF,vshape);
        ptr = (double*)na_get_pointer_for_write(vna);
        size = RNARRAY_SIZE(vna);
        for (i=0; i<size; i++) {
            ptr[i] = <%=func_name%>(r);
        }
        return vna;
    }
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
numo-gsl-0.1.2 ext/numo/gsl/rng/tmpl/rng_DFloat.c
numo-gsl-0.1.1 ext/numo/gsl/rng/tmpl/rng_DFloat.c
numo-gsl-0.1.0 ext/numo/gsl/rng/tmpl/rng_DFloat.c