Skip to content

Commit 6e7b9f7

Browse files
Update lu_factor tests by using dpnp.allclose
1 parent 12909fd commit 6e7b9f7

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

dpnp/tests/test_linalg.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1911,7 +1911,7 @@ def test_lu_factor(self, shape, order, dtype):
19111911
A_cast = a_dp.astype(LU.dtype, copy=False)
19121912
PA = self._apply_pivots_rows(A_cast, piv)
19131913

1914-
assert_allclose(LU, PA, rtol=1e-6, atol=1e-6)
1914+
assert dpnp.allclose(LU, PA, rtol=1e-6, atol=1e-6)
19151915

19161916
@pytest.mark.parametrize("dtype", get_float_complex_dtypes())
19171917
def test_overwrite_inplace(self, dtype):
@@ -1928,7 +1928,7 @@ def test_overwrite_inplace(self, dtype):
19281928
PA = self._apply_pivots_rows(a_dp_orig, piv)
19291929
LU = L @ U
19301930

1931-
assert_allclose(LU, PA, rtol=1e-6, atol=1e-6)
1931+
assert dpnp.allclose(LU, PA, rtol=1e-6, atol=1e-6)
19321932

19331933
@pytest.mark.parametrize("dtype", get_float_complex_dtypes())
19341934
def test_overwrite_copy(self, dtype):
@@ -1945,7 +1945,7 @@ def test_overwrite_copy(self, dtype):
19451945
PA = self._apply_pivots_rows(a_dp_orig, piv)
19461946
LU = L @ U
19471947

1948-
assert_allclose(LU, PA, rtol=1e-6, atol=1e-6)
1948+
assert dpnp.allclose(LU, PA, rtol=1e-6, atol=1e-6)
19491949

19501950
def test_overwrite_copy_special(self):
19511951
# F-contig but dtype != res_type
@@ -1972,7 +1972,7 @@ def test_overwrite_copy_special(self):
19721972
a_orig.astype(L.dtype, copy=False), piv
19731973
)
19741974
LU = L @ U
1975-
assert_allclose(LU, PA, rtol=1e-6, atol=1e-6)
1975+
assert dpnp.allclose(LU, PA, rtol=1e-6, atol=1e-6)
19761976

19771977
@pytest.mark.parametrize("shape", [(0, 0), (0, 2), (2, 0)])
19781978
def test_empty_inputs(self, shape):
@@ -2003,7 +2003,7 @@ def test_strided(self, sl):
20032003
PA = self._apply_pivots_rows(a_dp, piv)
20042004
LU = L @ U
20052005

2006-
assert_allclose(LU, PA, rtol=1e-6, atol=1e-6)
2006+
assert dpnp.allclose(LU, PA, rtol=1e-6, atol=1e-6)
20072007

20082008
def test_singular_matrix(self):
20092009
a_dp = dpnp.array([[1.0, 2.0], [2.0, 4.0]])
@@ -2070,7 +2070,7 @@ def test_lu_factor_batched(self, shape, order, dtype):
20702070
L, U = self._split_lu(lu_3d[i], m, n)
20712071
A_cast = a_3d[i].astype(L.dtype, copy=False)
20722072
PA = self._apply_pivots_rows(A_cast, piv_2d[i])
2073-
assert_allclose(L @ U, PA, rtol=1e-6, atol=1e-6)
2073+
assert dpnp.allclose(L @ U, PA, rtol=1e-6, atol=1e-6)
20742074

20752075
@pytest.mark.parametrize("dtype", get_float_complex_dtypes())
20762076
@pytest.mark.parametrize("order", ["C", "F"])
@@ -2082,7 +2082,7 @@ def test_overwrite(self, dtype, order):
20822082
)
20832083

20842084
assert lu is not a_dp
2085-
assert_allclose(a_dp, a_dp_orig)
2085+
assert dpnp.allclose(a_dp, a_dp_orig)
20862086

20872087
m = n = 2
20882088
lu_3d = lu.reshape((-1, m, n))
@@ -2092,7 +2092,7 @@ def test_overwrite(self, dtype, order):
20922092
L, U = self._split_lu(lu_3d[i], m, n)
20932093
A_cast = a_3d[i].astype(L.dtype, copy=False)
20942094
PA = self._apply_pivots_rows(A_cast, piv_2d[i])
2095-
assert_allclose(L @ U, PA, rtol=1e-6, atol=1e-6)
2095+
assert dpnp.allclose(L @ U, PA, rtol=1e-6, atol=1e-6)
20962096

20972097
@pytest.mark.parametrize(
20982098
"shape", [(0, 2, 2), (2, 0, 2), (2, 2, 0), (0, 0, 0)]
@@ -2119,7 +2119,7 @@ def test_strided(self):
21192119
PA = self._apply_pivots_rows(
21202120
a_stride[i].astype(L.dtype, copy=False), piv[i]
21212121
)
2122-
assert_allclose(L @ U, PA, rtol=1e-6, atol=1e-6)
2122+
assert dpnp.allclose(L @ U, PA, rtol=1e-6, atol=1e-6)
21232123

21242124
def test_singular_matrix(self):
21252125
a = dpnp.zeros((3, 2, 2), dtype=dpnp.default_float_type())

0 commit comments

Comments
 (0)