def test_concatenate_large_2(self, xp, dtype): a = testing.shaped_arange((2, 3, 4), xp, dtype) b = testing.shaped_reverse_arange((2, 3, 2), xp, dtype) c = testing.shaped_arange((2, 3, 3), xp, dtype) d = testing.shaped_arange((2, 3, 5), xp, dtype) e = testing.shaped_arange((2, 3, 2), xp, dtype) return xp.concatenate((a, b, c, d, e) * 2, axis=-1)
def check_binary(self, name, xp, dtype, no_complex=False): if no_complex: if numpy.dtype(dtype).kind == 'c': return xp.array(True) a = testing.shaped_arange(self.shape, xp, dtype) b = testing.shaped_reverse_arange(self.shape, xp, dtype) return getattr(xp, name)(a, b)
def test_nextafter_float(self, xp, dtype): a = testing.shaped_arange(self.shape, xp, dtype) - 3 b = testing.shaped_reverse_arange(self.shape, xp, dtype) - 3 b[0] = -xp.inf b[-1] = xp.inf a = a[:, None] b = b[None, :] return xp.nextafter(a, b)
def test_concatenate_large_3(self, xp, dtype): a = testing.shaped_arange((2, 3, 1), xp, dtype) b = testing.shaped_reverse_arange((2, 3, 1), xp, dtype) return xp.concatenate((a, b) * 10, axis=-1)
def test_concatenate2(self, xp, dtype): a = testing.shaped_arange((2, 3, 4), xp, dtype) b = testing.shaped_reverse_arange((2, 3, 2), xp, dtype) c = testing.shaped_arange((2, 3, 3), xp, dtype) return xp.concatenate((a, b, c), axis=-1)
def check_binary(self, name, xp, dtype, no_bool=False): if no_bool and numpy.dtype(dtype).char == '?': return numpy.int_(0) a = testing.shaped_arange(self.shape, xp, dtype) b = testing.shaped_reverse_arange(self.shape, xp, dtype) return getattr(xp, name)(a, b)
def check_binary(self, name, xp, dtype): a = testing.shaped_arange(self.shape, xp, dtype) b = testing.shaped_reverse_arange(self.shape, xp, dtype) return getattr(xp, name)(a, b)
@testing.for_complex_dtypes() @testing.numpy_nlcpy_array_equal() def test_real_setter_array(self, xp, dtype): x = testing.shaped_arange((2, 3), xp, dtype=dtype) y = testing.shaped_arange((2, 3), xp, dtype=float) x.real = y return x @testing.parameterize(*(testing.product({ 'arg1': [ testing.shaped_arange(s, numpy, dtype=d) for s, d in itertools.product(shapes, no_bool_no_uint_types) ] + [0, 0.0, 0j, 2, 2.0, 2j], 'arg2': [ testing.shaped_reverse_arange(s, numpy, dtype=d) for s, d in itertools.product(shapes, no_bool_no_uint_types) ] + [0, 0.0, 0j, 2, 2.0, 2j], 'name': ['add', 'multiply', 'subtract'], }) + testing.product({ 'arg1': [ numpy.array(v, dtype=d) for v, d in itertools.product(values, negative_types) ] + [0, 0.0, 0j, 2, 2.0, 2j, -2, -2.0, -2j, True, False], 'arg2': [ numpy.array(v, dtype=d) for v, d in itertools.product(values, negative_types) ] + [0, 0.0, 0j, 2, 2.0, 2j, -2, -2.0, -2j, True, False], 'name': ['divide', 'true_divide', 'subtract'], }) + testing.product({ 'arg1': [
def test_nextafter_combination(self, xp, dtype_a, dtype_b): a = testing.shaped_arange(self.shape, xp, dtype_a) b = testing.shaped_reverse_arange(self.shape, xp, dtype_b) return xp.nextafter(a, b)
def test_ldexp(self, xp, ftype, itype): a = testing.shaped_arange(self.shape, xp, ftype) b = testing.shaped_reverse_arange(self.shape, xp, itype) return xp.ldexp(a, b)
def test_copysign_combination(self, xp, dtype_a, dtype_b): a = testing.shaped_arange(self.shape, xp, dtype_a) b = testing.shaped_reverse_arange(self.shape, xp, dtype_b) return xp.copysign(a, b)