Skip to content

Commit 522750a

Browse files
Update test_eigenvalue in test_sycl_queue.py
1 parent acccdcd commit 522750a

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

tests/test_sycl_queue.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1264,7 +1264,19 @@ def test_eigenvalue(func, shape, device):
12641264
dp_val, dp_vec = dpnp.linalg.eigh(dp_a)
12651265
np_val, np_vec = numpy.linalg.eigh(a)
12661266

1267-
assert_allclose(dp_vec, np_vec, rtol=1e-05, atol=1e-05)
1267+
# Check the eigenvalue decomposition
1268+
if a.ndim == 2:
1269+
assert_allclose(
1270+
a @ np_vec, dp_vec @ dpnp.diag(dp_val), rtol=1e-5, atol=1e-5
1271+
)
1272+
else: # a.ndim == 3
1273+
for i in range(a.shape[0]):
1274+
assert_allclose(
1275+
a[i].dot(np_vec[i]),
1276+
dp_val[i] * dp_vec[i],
1277+
rtol=1e-5,
1278+
atol=1e-5,
1279+
)
12681280
assert dp_vec.shape == np_vec.shape
12691281
assert dp_vec.dtype == np_vec.dtype
12701282

0 commit comments

Comments
 (0)