def operator_ipow(size): a = Array(size, 'int32') b = Array(size, 'int32') for i in range(size): a[i] = nb_types.int32(i+1) b[i] = nb_types.int32(size-i) operator.ipow(a, b) return a
def operator_itruediv(size): a = Array(size, 'int32') b = Array(size, 'int32') for i in range(size): a[i] = nb_types.int32(i+10) b[i] = nb_types.int32(i+3) operator.itruediv(a, b) return a
def operator_irshift(size): a = Array(size, 'int32') b = Array(size, 'int32') for i in range(size): a[i] = nb_types.int32(i) b[i] = nb_types.int32(size-i-1) operator.irshift(a, b) return a
def operator_iadd(size): a = Array(size, 'int32') b = Array(size, 'int32') for i in range(size): a[i] = nb_types.int32(i) b[i] = nb_types.int32(1) operator.iadd(a, b) return a
def operator_itruediv2(size): a = Array(size, 'double') b = Array(size, 'double') for i in range(size): a[i] = nb_types.double(i+10) b[i] = nb_types.double(i+3) operator.itruediv(a, b) return a
def array_noreturn(size): a = Array(size, nb_types.float64) b = Array(size, nb_types.float64) c = Array(size, nb_types.float64) for i in range(size): a[i] = b[i] = c[i] = i + 3.0 s = 0.0 for i in range(size): s += a[i] + b[i] + c[i] - a[i] * b[i] return s
def array_return(size): printf("entering array_return(%i)\n", size) a = Array(size, nb_types.float64) b = Array(size, nb_types.float64) for i in range(size): a[i] = float(i) b[i] = float(size - i - 1) if size % 2: c = a else: c = b printf("returning array with length %i\n", len(c)) return c
def impl(a): sz = len(a) x = Array(sz, nb_dtype) for i in range(sz): # Convert the value to type "typ" cast = typ(a[i]) x[i] = nb_dtype(ufunc(cast)) return x
def binary_impl(a, b, nb_dtype): sz = len(a) x = Array(sz, nb_dtype) for i in range(sz): cast_a = typA(a[i]) cast_b = typB(b[i]) x[i] = nb_dtype(ufunc(cast_a, cast_b)) return x
def array_len(size): a = Array(size, nb_types.float64) return len(a)
def impl(x1, x2): sz = len(x1) r = Array(sz, nb_dtype) for i in range(sz): r[i] = heaviside(x1[i], x2) # noqa: F821 return r
def array_is_null(size): a = Array(size, 'double') return a.is_null()
def array_ptr(size, pos): a = Array(size, np.double) for i in range(size): a[i] = i + 0.0 return a[pos]
def operator_countOf(size, fill_value, b): a = Array(size, 'int64') for i in range(size): a[i] = fill_value return operator.countOf(a, b)
def issue109(size): a = Array(5, 'double') for i in range(5): a[i] = nb_types.double(i) return a
def broadcast(e, sz, dtype): b = Array(sz, dtype) b.fill(e) return b
def operator_not_in(size, v): a = Array(size, 'int32') for i in range(size): a[i] = nb_types.int32(i) return v not in a
def operator_ne_array(size, v): a = Array(size, 'int32') for i in range(size): a[i] = nb_types.int32(i) return a != a
def operator_is(size, v): a = Array(size, 'int32') a.fill(v) return a is a
def issue77(): a = Array(5, 'int64') a.fill(1) return a
def operator_is_not2(size, v): a = Array(size, 'int32') a.fill(v) b = Array(size, 'int32') b.fill(v) return a is not b
def ndarray_min(size, v): a = Array(size, 'double') a.fill(v) return a.min()
def operator_neg(size): a = Array(size, 'int32') for i in range(size): a[i] = nb_types.int32(i) return operator.neg(a)
def ndarray_sum(size, v): a = Array(size, 'double') a.fill(v) return a.sum()
def operator_abs(size): a = Array(size, 'int32') for i in range(size): a[i] = nb_types.int32(-i) return abs(a)
def ndarray_prod(size, v): a = Array(size, 'double') a.fill(v) return a.prod()