Sha256: 40763ddf1603c4d9436c3112cc64ff710470415e0665f1a9df41aef500f87d63

Contents?: true

Size: 771 Bytes

Versions: 19

Compression:

Stored size: 771 Bytes

Contents

/*
  Extract an element only if self is a dimensionless NArray.
  @overload extract_cpu
  @return [Numeric,Cumo::NArray]
  --- Extract element value as Ruby Object if self is a dimensionless NArray,
  otherwise returns self.
  This method is compatible with Numo NArray's `extract` method.
*/
static VALUE
<%=c_func(0)%>(VALUE self)
{
    volatile VALUE v;
    char *ptr;
    cumo_narray_t *na;
    CumoGetNArray(self,na);

    if (na->ndim==0) {
        ptr = cumo_na_get_pointer_for_read(self) + cumo_na_get_offset(self);
        CUMO_SHOW_SYNCHRONIZE_WARNING_ONCE("<%=name%>", "<%=type_name%>");
        cumo_cuda_runtime_check_status(cudaDeviceSynchronize());
        v = m_extract(ptr);
        cumo_na_release_lock(self);
        return v;
    }
    return self;
}

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
cumo-0.4.3 ext/cumo/narray/gen/tmpl/extract_cpu.c
cumo-0.4.2 ext/cumo/narray/gen/tmpl/extract_cpu.c
cumo-0.4.1 ext/cumo/narray/gen/tmpl/extract_cpu.c
cumo-0.4.0 ext/cumo/narray/gen/tmpl/extract_cpu.c
cumo-0.3.5 ext/cumo/narray/gen/tmpl/extract_cpu.c
cumo-0.3.4 ext/cumo/narray/gen/tmpl/extract_cpu.c
cumo-0.3.3 ext/cumo/narray/gen/tmpl/extract_cpu.c
cumo-0.3.2 ext/cumo/narray/gen/tmpl/extract_cpu.c
cumo-0.3.1 ext/cumo/narray/gen/tmpl/extract_cpu.c
cumo-0.3.0 ext/cumo/narray/gen/tmpl/extract_cpu.c
cumo-0.3.0.pre1 ext/cumo/narray/gen/tmpl/extract_cpu.c
cumo-0.2.5 ext/cumo/narray/gen/tmpl/extract_cpu.c
cumo-0.2.4 ext/cumo/narray/gen/tmpl/extract_cpu.c
cumo-0.2.3 ext/cumo/narray/gen/tmpl/extract_cpu.c
cumo-0.2.2 ext/cumo/narray/gen/tmpl/extract_cpu.c
cumo-0.2.1 ext/cumo/narray/gen/tmpl/extract_cpu.c
cumo-0.2.0 ext/cumo/narray/gen/tmpl/extract_cpu.c
cumo-0.1.2 ext/cumo/narray/gen/tmpl/extract_cpu.c
cumo-0.1.1 ext/cumo/narray/gen/tmpl/extract_cpu.c