Ejemplo n.º 1
0
def impl_myarray(context, builder, sig, args):
    from numba.np.arrayobj import make_array, populate_array

    srcaryty = sig.args[-1]
    shape, dtype, buf = args

    srcary = make_array(srcaryty)(context, builder, value=buf)
    # Copy source array and remove the parent field to avoid boxer re-using
    # the original ndarray instance.
    retary = make_array(sig.return_type)(context, builder)
    populate_array(retary,
                   data=srcary.data,
                   shape=srcary.shape,
                   strides=srcary.strides,
                   itemsize=srcary.itemsize,
                   meminfo=srcary.meminfo)

    ret = retary._getvalue()
    context.nrt.incref(builder, sig.return_type, ret)
    return ret
Ejemplo n.º 2
0
 def populate_array(self, arr, **kwargs):
     """
     Populate array structure.
     """
     from numba.np import arrayobj
     return arrayobj.populate_array(arr, **kwargs)
Ejemplo n.º 3
0
 def populate_array(self, arr, **kwargs):
     """
     Populate array structure.
     """
     return arrayobj.populate_array(arr, **kwargs)