def test_binop_signature(self, space): ar = SingleDimArray(10) v1 = ar.descr_add(space, ar) v2 = ar.descr_add(space, FloatWrapper(2.0)) assert v1.signature is not v2.signature v3 = ar.descr_add(space, FloatWrapper(1.0)) assert v2.signature is v3.signature v4 = ar.descr_add(space, ar) assert v1.signature is v4.signature
def f(i): ar = SingleDimArray(i, dtype=NonConstant(float64_dtype)) j = 0 while j < i: ar.get_concrete().setitem(j, float64_dtype.box(1.0)) j += 1 return ar.descr_add(space, ar).descr_all(space).boolval
def f(i): ar = SingleDimArray(i) j = 0 while j < i: ar.get_concrete().storage[j] = float(j) j += 1 return ar.descr_add(space, ar).descr_min(space)
def f(i): step = NonConstant(3) ar = SingleDimArray(step*i, dtype=float64_dtype) ar2 = SingleDimArray(i, dtype=float64_dtype) ar2.get_concrete().setitem(1, float64_dtype.box(5.5)) arg = ar2.descr_add(space, ar2) ar.setslice(space, 0, step*i, step, i, arg) return ar.get_concrete().eval(3).val
def f(i): if NonConstant(False): dtype = int64_dtype else: dtype = float64_dtype ar = SingleDimArray(i, dtype=dtype) v = ar.descr_add(space, ar).descr_prod(space) assert isinstance(v, FloatObject) return v.floatval
def test_slice_signature(self, space): ar = SingleDimArray(10) v1 = ar.descr_getitem(space, space.wrap(slice(1, 5, 1))) v2 = ar.descr_getitem(space, space.wrap(slice(4, 6, 1))) assert v1.signature is v2.signature v3 = ar.descr_add(space, v1) v4 = ar.descr_add(space, v2) assert v3.signature is v4.signature
def f(i): step = NonConstant(3) ar = SingleDimArray(step*i) ar2 = SingleDimArray(i) ar2.storage[1] = 5.5 if NonConstant(False): arg = ar2 else: arg = ar2.descr_add(space, ar2) ar.setslice(space, 0, step*i, step, i, arg) return ar.get_concrete().storage[3]
def f(i): if NonConstant(False): dtype = int64_dtype else: dtype = float64_dtype ar = SingleDimArray(i, dtype=dtype) j = 0 while j < i: ar.get_concrete().setitem(j, float64_dtype.box(float(j))) j += 1 v = ar.descr_add(space, ar).descr_max(space) assert isinstance(v, FloatObject) return v.floatval
def f(n): if NonConstant(False): dtype = float64_dtype else: dtype = int32_dtype ar = SingleDimArray(n, dtype=dtype) i = 0 while i < n: ar.get_concrete().setitem(i, int32_dtype.box(7)) i += 1 v = ar.descr_add(space, ar).descr_sum(space) assert isinstance(v, IntObject) return v.intval
def f(i): ar = SingleDimArray(i, dtype=NonConstant(float64_dtype)) return ar.descr_add(space, ar).descr_any(space).boolval
def f(i): ar = SingleDimArray(i) return ar.descr_add(space, ar).descr_prod(space)