File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -2109,6 +2109,27 @@ def test_matrix_rank_errors(self):
2109
2109
)
2110
2110
2111
2111
2112
+ # numpy.linalg.matrix_transpose() is available since numpy >= 2.0
2113
+ @testing .with_requires ("numpy>=2.0" )
2114
+ # dpnp.linalg.matrix_transpose() calls dpnp.matrix_transpose()
2115
+ # 1 test to increase code coverage
2116
+ def test_matrix_transpose ():
2117
+ a = numpy .arange (6 ).reshape ((2 , 3 ))
2118
+ a_dp = inp .array (a )
2119
+
2120
+ expected = numpy .linalg .matrix_transpose (a )
2121
+ result = inp .linalg .matrix_transpose (a_dp )
2122
+
2123
+ assert_allclose (expected , result )
2124
+
2125
+ with assert_raises_regex (
2126
+ ValueError , "array must be at least 2-dimensional"
2127
+ ):
2128
+ inp .linalg .matrix_transpose (a_dp [:, 0 ])
2129
+
2130
+ assert_raises (ValueError , inp .linalg .matrix_transpose , a_dp [:, 0 ])
2131
+
2132
+
2112
2133
class TestNorm :
2113
2134
def setup_method (self ):
2114
2135
numpy .random .seed (42 )
You can’t perform that action at this time.
0 commit comments