Skip to content

Commit 6256e0c

Browse files
committed
Ensure a.mT works even if the linalg extension is disabled
1 parent e5225ed commit 6256e0c

File tree

4 files changed

+3
-2
lines changed

4 files changed

+3
-2
lines changed

array_api_strict/_array_object.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1159,7 +1159,7 @@ def device(self) -> Device:
11591159
# Note: mT is new in array API spec (see matrix_transpose)
11601160
@property
11611161
def mT(self) -> Array:
1162-
from .linalg import matrix_transpose
1162+
from ._linear_algebra_functions import matrix_transpose
11631163
return matrix_transpose(self)
11641164

11651165
@property
File renamed without changes.
File renamed without changes.

array_api_strict/tests/test_flags.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,10 @@ def test_boolean_indexing():
184184
'matrix_transpose': lambda: xp.matrix_transpose(xp.eye(3)),
185185
'tensordot': lambda: xp.tensordot(xp.eye(3), xp.eye(3)),
186186
'vecdot': lambda: xp.vecdot(xp.asarray([1, 2, 3]), xp.asarray([4, 5, 6])),
187+
'mT': lambda: xp.eye(3).mT,
187188
}
188189

189-
assert set(linalg_main_namespace_examples) == set(xp.__all__) & set(xp.linalg.__all__)
190+
assert set(linalg_main_namespace_examples) == (set(xp.__all__) & set(xp.linalg.__all__)) | {"mT"}
190191

191192
@pytest.mark.parametrize('func_name', linalg_examples.keys())
192193
def test_linalg(func_name):

0 commit comments

Comments
 (0)