Sha256: 4b1264b0c3c2b8c8a3f37dacd953719e131ae695f5419c09462fdb3b54d6a7ed
Contents?: true
Size: 1.93 KB
Versions: 9
Compression:
Stored size: 1.93 KB
Contents
static void <%=c_iter%>(na_loop_t *const lp) { size_t i; char *p1, *p2, *p3; ssize_t s1, s2, s3; dtype x, y; INIT_COUNTER(lp, i); INIT_PTR(lp, 0, p1, s1); INIT_PTR(lp, 1, p2, s2); INIT_PTR(lp, 2, p3, s3); for (; i--;) { GET_DATA_STRIDE(p1,s1,dtype,x); GET_DATA_STRIDE(p2,s2,dtype,y); x = m_pow(x,y); SET_DATA_STRIDE(p3,s3,dtype,x); } } static void <%=c_iter%>_int32(na_loop_t *const lp) { size_t i; char *p1, *p2, *p3; ssize_t s1, s2, s3; dtype x; int32_t y; INIT_COUNTER(lp, i); INIT_PTR(lp, 0, p1, s1); INIT_PTR(lp, 1, p2, s2); INIT_PTR(lp, 2, p3, s3); for (; i--;) { GET_DATA_STRIDE(p1,s1,dtype,x); GET_DATA_STRIDE(p2,s2,int32_t,y); x = m_pow_int(x,y); SET_DATA_STRIDE(p3,s3,dtype,x); } } static VALUE <%=c_func%>_self(VALUE self, VALUE other) { ndfunc_arg_in_t ain[2] = {{cT,0},{cT,0}}; ndfunc_arg_in_t ain_i[2] = {{cT,0},{numo_cInt32,0}}; ndfunc_arg_out_t aout[1] = {{cT,0}}; ndfunc_t ndf = { <%=c_iter%>, STRIDE_LOOP, 2, 1, ain, aout }; ndfunc_t ndf_i = { <%=c_iter%>_int32, STRIDE_LOOP, 2, 1, ain_i, aout }; // fixme : use na.integer? if (FIXNUM_P(other) || rb_obj_is_kind_of(other,numo_cInt32)) { return na_ndloop(&ndf_i, 2, self, other); } else { return na_ndloop(&ndf, 2, self, other); } } /* Binary power. @overload <%=op_map%> other @param [Numo::NArray,Numeric] other @return [Numo::NArray] self to the other-th power. */ static VALUE <%=c_func(1)%>(VALUE self, VALUE other) { <% if is_object %> return <%=c_func%>_self(self,other); <% else %> VALUE klass, v; klass = na_upcast(rb_obj_class(self),rb_obj_class(other)); if (klass==cT) { return <%=c_func%>_self(self,other); } else { v = rb_funcall(klass, id_cast, 1, self); return rb_funcall(v, id_pow, 1, other); } <% end %> }
Version data entries
9 entries across 9 versions & 1 rubygems