MCPcopy Index your code
hub / github.com/numpy/numpy / test_vdot_uncontiguous

Method test_vdot_uncontiguous

numpy/_core/tests/test_multiarray.py:7442–7462  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

7440 assert_equal(np.vdot(b, b), res)
7441
7442 def test_vdot_uncontiguous(self):
7443 for size in [2, 1000]:
7444 # Different sizes match different branches in vdot.
7445 a = np.zeros((size, 2, 2))
7446 b = np.zeros((size, 2, 2))
7447 a[:, 0, 0] = np.arange(size)
7448 b[:, 0, 0] = np.arange(size) + 1
7449 # Make a and b uncontiguous:
7450 a = a[..., 0]
7451 b = b[..., 0]
7452
7453 assert_equal(np.vdot(a, b),
7454 np.vdot(a.flatten(), b.flatten()))
7455 assert_equal(np.vdot(a, b.copy()),
7456 np.vdot(a.flatten(), b.flatten()))
7457 assert_equal(np.vdot(a.copy(), b),
7458 np.vdot(a.flatten(), b.flatten()))
7459 assert_equal(np.vdot(a.copy('F'), b),
7460 np.vdot(a.flatten(), b.flatten()))
7461 assert_equal(np.vdot(a, b.copy('F')),
7462 np.vdot(a.flatten(), b.flatten()))
7463
7464
7465class TestDot:

Callers

nothing calls this directly

Calls 3

assert_equalFunction · 0.90
flattenMethod · 0.80
copyMethod · 0.45

Tested by

no test coverage detected