(x: Array, /)
| 221 | # Note: this function is new in the array API spec. Unlike transpose, it only |
| 222 | # transposes the last two axes. |
| 223 | def matrix_transpose(x: Array, /) -> Array: |
| 224 | if x.ndim < 2: |
| 225 | raise ValueError("x must be at least 2-dimensional for matrix_transpose") |
| 226 | return Array._new(np.swapaxes(x._array, -1, -2)) |
| 227 | |
| 228 | # Note: outer is the numpy top-level namespace, not np.linalg |
| 229 | def outer(x1: Array, x2: Array, /) -> Array: |