def test_multiply_scalar(array, val, data_type, val_type): np_a = numpy.array(array, dtype=data_type) dpnp_a = dpnp.array(array, dtype=data_type) val_ = val_type(val) result = dpnp.multiply(np_a, val_) expected = numpy.multiply(dpnp_a, val_) numpy.testing.assert_array_equal(result, expected) result = dpnp.multiply(val_, np_a) expected = numpy.multiply(val_, dpnp_a) numpy.testing.assert_array_equal(result, expected)
def test_multiply_scalar(array, val, data_type, val_type): a = numpy.array(array, dtype=data_type) ia = inp.array(a) val_ = val_type(val) result = inp.multiply(a, val_) expected = numpy.multiply(ia, val_) numpy.testing.assert_array_equal(result, expected) result = inp.multiply(val_, a) expected = numpy.multiply(val_, ia) numpy.testing.assert_array_equal(result, expected)
def test_multiply_complex(data): a = numpy.array(data) ia = inp.array(data) result = inp.multiply(ia, ia) expected = numpy.multiply(a, a) numpy.testing.assert_array_equal(result, expected) result = inp.multiply(ia, 0.5j) expected = numpy.multiply(a, 0.5j) numpy.testing.assert_array_equal(result, expected) result = inp.multiply(0.5j, ia) expected = numpy.multiply(0.5j, a) numpy.testing.assert_array_equal(result, expected)
def test_multiply_complex(data): np_a = numpy.array(data) dpnp_a = dpnp.array(data) result = dpnp.multiply(dpnp_a, dpnp_a) expected = numpy.multiply(np_a, np_a) numpy.testing.assert_array_equal(result, expected) result = dpnp.multiply(dpnp_a, 0.5j) expected = numpy.multiply(np_a, 0.5j) numpy.testing.assert_array_equal(result, expected) result = dpnp.multiply(0.5j, dpnp_a) expected = numpy.multiply(0.5j, np_a) numpy.testing.assert_array_equal(result, expected)
def test_multiply(array, val, data_type, val_type): a = numpy.array(array, dtype=data_type) ia = inp.array(a) val_ = val_type(val) result = inp.multiply(ia, val_) expected = numpy.multiply(ia, val_) numpy.testing.assert_array_equal(expected, result)
def __rmul__(self, other): return dpnp.multiply(other, self)
def __mul__(self, other): return dpnp.multiply(self, other)