Skip to content

Commit

Permalink
Update _linear_algebra_functions.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Illviljan committed Sep 26, 2024
1 parent b8c4ba5 commit 31d8882
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions xarray/namedarray/_array_api/_linear_algebra_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,11 @@ def matrix_transpose(x: NamedArray[Any, Any], /) -> NamedArray[Any, Any]:
>>> xT = matrix_transpose(x)
>>> xT.dims, xT.shape
(('y', 'x'), (3, 2))
"""
xp = _get_data_namespace(x)
_data = xp.matrix_transpose(x._data)
d = x.dims
_dims = d[:-2] + d[-2:][::-1] # (..., M, N) -> (..., N, M)
return NamedArray(_dims, _data)


Expand Down

0 comments on commit 31d8882

Please sign in to comment.