Sha256: d610a1125fd1b13e970468c68b47c9d33804cb816e5d7aa9cbb321c56210d14e

Contents?: true

Size: 1.54 KB

Versions: 3

Compression:

Stored size: 1.54 KB

Contents

static void
iter_<%=c_func%>(na_loop_t *const lp)
{
    size_t   n;
    char    *p1,*p2;
    double  *p3,*p4,*p5,*p6,*p7,*p8;
    ssize_t  s1, s2;

    n = lp->args[0].shape[0];
    INIT_PTR(lp, 0, p1, s1);
    INIT_PTR(lp, 1, p2, s2);
    p3 = (double*)GET_PTR(lp,2);
    p4 = (double*)GET_PTR(lp,3);
    p5 = (double*)GET_PTR(lp,4);
    p6 = (double*)GET_PTR(lp,5);
    p7 = (double*)GET_PTR(lp,6);
    p8 = (double*)GET_PTR(lp,7);

    <%=func_name%>((double*)p1,s1/sizeof(double),
                   (double*)p2,s2/sizeof(double),
                   n,p3,p4,p5,p6,p7,p8);
}

/*
  @overload <%=name%>(<%=args[0][1]%>,<%=args[2][1]%>)
  @param  [DFloat]    <%=args[0][1]%> (input array)
  @param  [DFloat]    <%=args[2][1]%> (input array)
  @return [GSL::Fit::<%=result_class%>] result Struct with members: <%=args[5][1]%>, <%=args[6][1]%>, <%=args[7][1]%>, <%=args[8][1]%>, <%=args[9][1]%>, <%=args[10][1]%>.

  <%=desc%>

*/
static VALUE
<%=c_func(2)%>(VALUE mod, VALUE v1, VALUE v2)
{
    VALUE r, result;
    ndfunc_arg_in_t ain[2] = {{cDF,1},{cDF,1}};
    ndfunc_arg_out_t aout[6] = {{cDF,0},{cDF,0},{cDF,0},{cDF,0},{cDF,0},{cDF,0}};
    ndfunc_t ndf = { iter_<%=c_func%>, NO_LOOP|NDF_EXTRACT,
                     2, 6, ain, aout };
    narray_t *x, *y;

    GetNArray(v1,x);
    GetNArray(v2,y);
    CHECK_GE_1D(x);
    CHECK_GE_1D(y);
    CHECK_SIZE_EQ(VEC_SIZE(x),VEC_SIZE(y),"x size does not match y size");

    r = na_ndloop(&ndf, 2, v1, v2);
    result = rb_class_new_instance(6, RARRAY_PTR(r), c<%=result_class%>);
    RB_GC_GUARD(r);
    return result;
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
numo-gsl-0.1.2 ext/numo/gsl/fit/tmpl/fit_linear.c
numo-gsl-0.1.1 ext/numo/gsl/fit/tmpl/fit_linear.c
numo-gsl-0.1.0 ext/numo/gsl/fit/tmpl/fit_linear.c