def generic_homog(self, args, kws): if args: raise NumbaAssertionError("args not supported") if kws: raise NumbaAssertionError("kws not supported") return signature(self.this.dtype, recvr=self.this)
def generic_expand_cumulative(self, args, kws): if args: raise NumbaAssertionError("args unsupported") if kws: raise NumbaAssertionError("kwargs unsupported") assert isinstance(self.this, types.Array) return_type = types.Array(dtype=_expand_integer(self.this.dtype), ndim=1, layout='C') return signature(return_type, recvr=self.this)
def generic(self, args, kws): if kws: raise NumbaAssertionError("kws not supported") if len(args) != 2: raise NumbaAssertionError("two arguments are required") arr, ind = args if isinstance(ind, types.Number): retty = arr.dtype elif isinstance(ind, types.Array): retty = types.Array(ndim=ind.ndim, dtype=arr.dtype, layout='C') elif isinstance(ind, types.List): retty = types.Array(ndim=1, dtype=arr.dtype, layout='C') elif isinstance(ind, types.BaseTuple): retty = types.Array(ndim=np.ndim(ind), dtype=arr.dtype, layout='C') else: return None return signature(retty, *args)
def resolve_take(self, ary, args, kws): if kws: raise NumbaAssertionError("kws not supported") argty, = args if isinstance(argty, types.Integer): sig = signature(ary.dtype, *args) elif isinstance(argty, types.Array): sig = signature(argty.copy(layout='C', dtype=ary.dtype), *args) elif isinstance(argty, types.List): # 1d lists only sig = signature(types.Array(ary.dtype, 1, 'C'), *args) elif isinstance(argty, types.BaseTuple): sig = signature(types.Array(ary.dtype, np.ndim(argty), 'C'), *args) else: raise TypeError("take(%s) not supported for %s" % argty) return sig