Skip to content

Commit 2852c13

Browse files
committed
Move factor_to_tol to keep lex order
1 parent cacc0d7 commit 2852c13

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

dpnp/tests/helper.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,19 @@ def assert_dtype_allclose(
108108
_assert_dtype(dpnp_arr.dtype, numpy_arr.dtype, check_only_type_kind)
109109

110110

111+
def factor_to_tol(dtype, factor):
112+
"""
113+
Calculate the tolerance for comparing floating point and complex arrays.
114+
The tolerance is based on the maximum resolution of the input dtype multiplied by the factor.
115+
"""
116+
117+
tol = 0
118+
if numpy.issubdtype(dtype, numpy.inexact):
119+
tol = numpy.finfo(dtype).resolution
120+
121+
return factor * tol
122+
123+
111124
def generate_random_numpy_array(
112125
shape,
113126
dtype=None,
@@ -206,19 +219,6 @@ def generate_random_numpy_array(
206219
return a
207220

208221

209-
def factor_to_tol(dtype, factor):
210-
"""
211-
Calculate the tolerance for comparing floating point and complex arrays.
212-
The tolerance is based on the maximum resolution of the input dtype multiplied by the factor.
213-
"""
214-
215-
tol = 0
216-
if numpy.issubdtype(dtype, numpy.inexact):
217-
tol = numpy.finfo(dtype).resolution
218-
219-
return factor * tol
220-
221-
222222
def get_abs_array(data, dtype=None):
223223
if numpy.issubdtype(dtype, numpy.unsignedinteger):
224224
data = numpy.abs(data)

0 commit comments

Comments
 (0)