14
14
from .helper import (
15
15
assert_dtype_allclose ,
16
16
get_all_dtypes ,
17
- get_complex_dtypes ,
18
17
get_float_complex_dtypes ,
19
18
has_support_aspect64 ,
20
19
is_cpu_device ,
@@ -679,6 +678,11 @@ def test_norm3(array, ord, axis):
679
678
680
679
681
680
class TestQr :
681
+ # Set numpy.random.seed for test methods to prevent
682
+ # random generation of the input singular matrix
683
+ def setup_method (self ):
684
+ numpy .random .seed (76 )
685
+
682
686
# TODO: New packages that fix issue CMPLRLLVM-53771 are only available in internal CI.
683
687
# Skip the tests on cpu until these packages are available for the external CI.
684
688
# Specifically dpcpp_linux-64>=2024.1.0
@@ -703,7 +707,6 @@ class TestQr:
703
707
ids = ["r" , "raw" , "complete" , "reduced" ],
704
708
)
705
709
def test_qr (self , dtype , shape , mode ):
706
- numpy .random .seed (76 )
707
710
a = numpy .random .randn (* shape ).astype (dtype )
708
711
if numpy .issubdtype (dtype , numpy .complexfloating ):
709
712
a += 1j * numpy .random .randn (* shape )
@@ -776,7 +779,6 @@ def test_qr_empty(self, dtype, shape, mode):
776
779
ids = ["r" , "raw" , "complete" , "reduced" ],
777
780
)
778
781
def test_qr_strides (self , mode ):
779
- numpy .random .seed (76 )
780
782
a = numpy .random .randn (5 , 5 )
781
783
ia = inp .array (a )
782
784
@@ -1037,6 +1039,11 @@ def test_slogdet_errors(self):
1037
1039
1038
1040
1039
1041
class TestSvd :
1042
+ # Set numpy.random.seed for test methods to prevent
1043
+ # random generation of the input singular matrix
1044
+ def setup_method (self ):
1045
+ numpy .random .seed (76 )
1046
+
1040
1047
def get_tol (self , dtype ):
1041
1048
tol = 1e-06
1042
1049
if dtype in (inp .float32 , inp .complex64 ):
@@ -1134,7 +1141,6 @@ def test_svd(self, dtype, shape):
1134
1141
ids = ["(2, 2)" , "(16, 16)" ],
1135
1142
)
1136
1143
def test_svd_hermitian (self , dtype , compute_vt , shape ):
1137
- numpy .random .seed (76 )
1138
1144
a = numpy .random .randn (* shape ).astype (dtype )
1139
1145
if numpy .issubdtype (dtype , numpy .complexfloating ):
1140
1146
a += 1j * numpy .random .randn (* shape )
@@ -1177,6 +1183,11 @@ def test_svd_errors(self):
1177
1183
1178
1184
1179
1185
class TestPinv :
1186
+ # Set numpy.random.seed for test methods to prevent
1187
+ # random generation of the input singular matrix
1188
+ def setup_method (self ):
1189
+ numpy .random .seed (76 )
1190
+
1180
1191
def get_tol (self , dtype ):
1181
1192
tol = 1e-06
1182
1193
if dtype in (inp .float32 , inp .complex64 ):
@@ -1212,7 +1223,6 @@ def check_types_shapes(self, dp_B, np_B):
1212
1223
],
1213
1224
)
1214
1225
def test_pinv (self , dtype , shape ):
1215
- numpy .random .seed (76 )
1216
1226
a = numpy .random .randn (* shape ).astype (dtype )
1217
1227
if numpy .issubdtype (dtype , numpy .complexfloating ):
1218
1228
a += 1j * numpy .random .randn (* shape )
@@ -1240,7 +1250,6 @@ def test_pinv(self, dtype, shape):
1240
1250
ids = ["(2, 2)" , "(16, 16)" ],
1241
1251
)
1242
1252
def test_pinv_hermitian (self , dtype , shape ):
1243
- numpy .random .seed (76 )
1244
1253
a = numpy .random .randn (* shape ).astype (dtype )
1245
1254
if numpy .issubdtype (dtype , numpy .complexfloating ):
1246
1255
a += 1j * numpy .random .randn (* shape )
@@ -1281,7 +1290,6 @@ def test_pinv_empty(self, dtype, shape):
1281
1290
assert_dtype_allclose (B_dp , B )
1282
1291
1283
1292
def test_pinv_strides (self ):
1284
- numpy .random .seed (76 )
1285
1293
a = numpy .random .randn (5 , 5 )
1286
1294
a_dp = inp .array (a )
1287
1295
0 commit comments