Sha256: 736d96bee7b72cd6deee0721b96a946ba302e3a35798b9787998c4581b7a4ad8
Contents?: true
Size: 955 Bytes
Versions: 1
Compression:
Stored size: 955 Bytes
Contents
static VALUE <%=c_func(0)%>(VALUE self) { narray_t *na; void *ptr; GetNArray(self,na); switch(NA_TYPE(na)) { case NARRAY_DATA_T: ptr = NA_DATA_PTR(na); if (na->size > 0 && ptr == NULL) { <% if is_object %> ptr = xmalloc(sizeof(dtype) * na->size); { size_t i; VALUE *a = (VALUE*)ptr; for (i=na->size; i--;) { *a++ = Qnil; } } <% else %> ptr = cumo_cuda_runtime_malloc(sizeof(dtype) * na->size); <% end %> NA_DATA_PTR(na) = ptr; } break; case NARRAY_VIEW_T: rb_funcall(NA_VIEW_DATA(na), rb_intern("allocate"), 0); break; case NARRAY_FILEMAP_T: //ptr = ((narray_filemap_t*)na)->ptr; // to be implemented default: rb_bug("invalid narray type : %d",NA_TYPE(na)); } return self; }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cumo-0.1.0 | ext/cumo/narray/gen/tmpl/allocate.c |