From cf1c38462d31511a9d71ca6a94ec902dd421ad34 Mon Sep 17 00:00:00 2001 From: Fabian Joswig Date: Thu, 18 Nov 2021 11:02:31 +0000 Subject: [PATCH] test: test for jack_matmul with multiple operands added --- tests/linalg_test.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/linalg_test.py b/tests/linalg_test.py index 4cfa9107..58c876ee 100644 --- a/tests/linalg_test.py +++ b/tests/linalg_test.py @@ -92,6 +92,17 @@ def test_multi_dot(): assert e.is_zero(), t +def test_jack_multi_dot(): + for dim in [2, 4, 8]: + my_array = get_real_matrix(dim) + + tt = pe.linalg.jack_matmul(my_array, my_array, my_array) - pe.linalg.matmul(my_array, my_array, my_array) + + for t, e in np.ndenumerate(tt): + assert e.is_zero(atol=1e-1), t + assert np.isclose(e.value, 0.0) + + def test_matmul_irregular_histories(): dim = 2 length = 500