MCPcopy Create free account
hub / github.com/numpy/numpy / test_dot_out_mem_overlap

Method test_dot_out_mem_overlap

numpy/core/tests/test_multiarray.py:3271–3291  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3269 assert_raises(TypeError, np.dot, A, c)
3270
3271 def test_dot_out_mem_overlap(self):
3272 np.random.seed(1)
3273
3274 # Test BLAS and non-BLAS code paths, including all dtypes
3275 # that dot() supports
3276 dtypes = [np.dtype(code) for code in np.typecodes['All']
3277 if code not in 'USVM']
3278 for dtype in dtypes:
3279 a = np.random.rand(3, 3).astype(dtype)
3280
3281 # Valid dot() output arrays must be aligned
3282 b = _aligned_zeros((3, 3), dtype=dtype)
3283 b[...] = np.random.rand(3, 3)
3284
3285 y = np.dot(a, b)
3286 x = np.dot(a, b, out=b)
3287 assert_equal(x, y, err_msg=repr(dtype))
3288
3289 # Check invalid output array
3290 assert_raises(ValueError, np.dot, a, b, out=b[::2])
3291 assert_raises(ValueError, np.dot, a, b, out=b.T)
3292
3293 def test_dot_matmul_out(self):
3294 # gh-9641

Callers

nothing calls this directly

Calls 6

assert_equalFunction · 0.90
assert_raisesFunction · 0.90
_aligned_zerosFunction · 0.85
astypeMethod · 0.80
dotMethod · 0.80
dtypeMethod · 0.45

Tested by

no test coverage detected