8000 BUG: array_api: fix cholesky upper decomp for complex dtypes · numpy/numpy@999f530 · GitHub
[go: up one dir, main page]

Skip to content

Commit 999f530

Browse files
lucascolleycharris
authored andcommitted
BUG: array_api: fix cholesky upper decomp for complex dtypes
[skip travis] [skip azp] [skip circle] [skip cirrus]
1 parent b5fbbdc commit 999f530

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

numpy/array_api/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 ..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)
0