Skip to content

Commit 101365d

Browse files
committed
Always return a real dtype from dpnp.linalg.cond
1 parent 30918e4 commit 101365d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

dpnp/linalg/dpnp_utils_linalg.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1976,13 +1976,15 @@ def dpnp_cond(x, p=None):
19761976
else:
19771977
r = s[..., 0] / s[..., -1]
19781978
else:
1979-
result_t = _common_type(x)
19801979
# The result array will contain nans in the entries
19811980
# where inversion failed
19821981
invx = dpnp.linalg.inv(x)
19831982
r = dpnp.linalg.norm(x, p, axis=(-2, -1)) * dpnp.linalg.norm(
19841983
invx, p, axis=(-2, -1)
19851984
)
1985+
1986+
# condition number is always real
1987+
result_t = _real_type(_common_type(x), device=x.sycl_queue)
19861988
r = r.astype(result_t, copy=False)
19871989

19881990
# Convert nans to infs unless the original array had nan entries

0 commit comments

Comments
 (0)