diff options
author | John Kirkham <kirkhamj@janelia.hhmi.org> | 2016-01-09 14:16:35 -0500 |
---|---|---|
committer | John Kirkham <kirkhamj@janelia.hhmi.org> | 2016-01-09 15:24:08 -0500 |
commit | e1b77f1323e9e981b907390508883d9bccff3ebf (patch) | |
tree | ea8892b8763a0f87d86ccce5bb8323911a36fd1b /numpy | |
parent | dccda3fc9acd6c1f1d3084cffb4fe6f65c007275 (diff) | |
download | numpy-e1b77f1323e9e981b907390508883d9bccff3ebf.tar.gz |
TST: Try using `inner` with some different orderings for matrix and vector products. Add some tests for matrix products. Include a `syrk` vs. `gemm` test case.
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/tests/test_multiarray.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py index c66e49e5f..6fa4b6bbb 100644 --- a/numpy/core/tests/test_multiarray.py +++ b/numpy/core/tests/test_multiarray.py @@ -4849,7 +4849,16 @@ class TestInner(TestCase): C = np.array([1, 1], dtype=dt) desired = np.array([4, 6], dtype=dt) assert_equal(np.inner(A.T, C), desired) + assert_equal(np.inner(C, A.T), desired) assert_equal(np.inner(B, C), desired) + assert_equal(np.inner(C, B), desired) + # check a matrix product + desired = np.array([[7, 10], [15, 22]], dtype=dt) + assert_equal(np.inner(A, B), desired) + # check the syrk vs. gemm paths + desired = np.array([[5, 11], [11, 25]], dtype=dt) + assert_equal(np.inner(A, A), desired) + assert_equal(np.inner(A, A.copy()), desired) # check an inner product involving an aliased and reversed view a = np.arange(5).astype(dt) b = a[::-1] |