Skip to content

Commit 20c70f1

Browse files
committed
BUG: array_api: fix cholesky upper decomp for complex dtypes
[skip travis] [skip azp] [skip circle] [skip cirrus] Original NumPy Commit: b8257e597a92eed91a2b2227d692f4bcad860f17
1 parent c53f903 commit 20c70f1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

array_api_strict/linalg.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
complex128
1010
)
1111
from ._manipulation_functions import reshape
12+
from ._elementwise_functions import conj
1213
from ._array_object import Array
1314

1415
from numpy.core.numeric import normalize_axis_tuple
@@ -53,7 +54,10 @@ def cholesky(x: Array, /, *, upper: bool = False) -> Array:
5354
raise TypeError('Only floating-point dtypes are allowed in cholesky')
5455
L = np.linalg.cholesky(x._array)
5556
if upper:
56-
return Array._new(L).mT
57+
U = Array._new(L).mT
58+
if U.dtype in [complex64, complex128]:
59+
U = conj(U)
60+
return U
5761
return Array._new(L)
5862

5963
# Note: cross is the numpy top-level namespace, not np.linalg

0 commit comments

Comments
 (0)