Sha256: d6e399c55e3c1c7f3a8e7a8df850f8a0b5f491ab1771335092028eb18fc4be8e

Contents?: true

Size: 714 Bytes

Versions: 3

Compression:

Stored size: 714 Bytes

Contents

<%
set name: "new"
set singleton: true
set alloc_func: func_name.sub(/_init$/,"_alloc")
%>
/*
  :nodoc:
 */
static VALUE
<%=c_func(:nodef)%>(VALUE self, const gsl_interp_type *t, VALUE v1, VALUE v2)
{
    <%=struct%> *w;
    double *p1, *p2;
    size_t n1, n2, sz;

    v1 = cast_1d_contiguous(v1, cDF);
    v2 = cast_1d_contiguous(v2, cDF);
    n1 = RNARRAY_SIZE(v1);
    n2 = RNARRAY_SIZE(v2);
    sz = (n1 < n2) ? n1 : n2;
    w  = <%=alloc_func%>(t, sz);
    p1 = (double*)na_get_pointer_for_read(v1);
    p2 = (double*)na_get_pointer_for_read(v2);
    <%=func_name%>(w, p1, p2, sz);
    RB_GC_GUARD(v1);
    RB_GC_GUARD(v2);

    return TypedData_Wrap_Struct(<%=class_var%>, &<%=data_type_var%>, (void*)w);
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
numo-gsl-0.1.2 ext/numo/gsl/interp/tmpl/interp_new.c
numo-gsl-0.1.1 ext/numo/gsl/interp/tmpl/interp_new.c
numo-gsl-0.1.0 ext/numo/gsl/interp/tmpl/interp_new.c