From 8c7f5dea473c2497f0b998e6b26253969520ad84 Mon Sep 17 00:00:00 2001 From: Evgeni Burovski Date: Tue, 18 Feb 2025 13:50:14 +0100 Subject: [PATCH] ENH: test vectot conjugation A small no-hypothsis test to make sure vecdot conjugates its first argument --- array_api_tests/test_linalg.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/array_api_tests/test_linalg.py b/array_api_tests/test_linalg.py index c997948b..bbb44cdc 100644 --- a/array_api_tests/test_linalg.py +++ b/array_api_tests/test_linalg.py @@ -964,6 +964,16 @@ def test_vecdot(x1, x2, data): _test_vecdot(_array_module, x1, x2, data) +@pytest.mark.xp_extension('linalg') +def test_vecdot_conj(): + # no-hypothesis test to check that the 1st argument is in fact conjugated + x1 = xp.asarray([1j, 2j, 3j]) + x2 = xp.asarray([1, 2j, 3]) + + import cmath + assert cmath.isclose(complex(xp.linalg.vecdot(x1, x2)), 4 - 10j) + + # Insanely large orders might not work. There isn't a limit specified in the # spec, so we just limit to reasonable values here. max_ord = 100