File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -322,11 +322,21 @@ def test_matrix_rank(x, kw):
322
322
pass
323
323
324
324
@given (
325
- x = xps .arrays (dtype = xps . floating_dtypes () , shape = shapes ),
325
+ x = xps .arrays (dtype = dtypes , shape = matrix_shapes ),
326
326
)
327
327
def test_matrix_transpose (x ):
328
- # res = linalg.matrix_transpose(x)
329
- pass
328
+ res = linalg .matrix_transpose (x )
329
+ true_val = lambda a : _array_module .asarray ([[a [i , j ] for i in
330
+ range (a .shape [0 ])] for j in
331
+ range (a .shape [1 ])],
332
+ dtype = a .dtype )
333
+ shape = list (x .shape )
334
+ shape [- 1 ], shape [- 2 ] = shape [- 2 ], shape [- 1 ]
335
+ shape = tuple (shape )
336
+ assert res .shape == shape , "matrix_transpose() did not return the correct shape"
337
+ assert res .dtype == x .dtype , "matrix_transpose() did not return the correct dtype"
338
+
339
+ _test_stacks (linalg .matrix_transpose , x , res = res , true_val = true_val )
330
340
331
341
@given (
332
342
x1 = xps .arrays (dtype = xps .floating_dtypes (), shape = shapes ),
You can’t perform that action at this time.
0 commit comments