Sha256: 5cf76a1b8f28aafa84f46f85634c4178943c832f818c2efc69a059daa07824bb
Contents?: true
Size: 884 Bytes
Versions: 19
Compression:
Stored size: 884 Bytes
Contents
/* Extract an element only if self is a dimensionless NArray. @overload extract @return [Numeric,Cumo::NArray] --- Extract element value as Ruby Object if self is a dimensionless NArray, otherwise returns self. */ // TODO(sonots): Return Cumo::Bit instead of ruby built-in object to avoid synchronization static VALUE <%=c_func(0)%>(VALUE self) { CUMO_BIT_DIGIT *ptr, val; size_t pos; cumo_narray_t *na; CumoGetNArray(self,na); if (na->ndim==0) { pos = cumo_na_get_offset(self); ptr = (CUMO_BIT_DIGIT*)cumo_na_get_pointer_for_read(self); CUMO_SHOW_SYNCHRONIZE_WARNING_ONCE("<%=name%>", "<%=type_name%>"); cumo_cuda_runtime_check_status(cudaDeviceSynchronize()); val = ((*((ptr)+(pos)/CUMO_NB)) >> ((pos)%CUMO_NB)) & 1u; cumo_na_release_lock(self); return INT2FIX(val); } return self; }
Version data entries
19 entries across 19 versions & 1 rubygems