Transpose each matrix in a stack of matrices. Unlike np.transpose, this only swaps the last two axes, rather than all of them Parameters ---------- a : (...,M,N) array_like Returns ------- aT : (...,N,M) ndarray
(a)
| 223 | |
| 224 | |
| 225 | def transpose(a): |
| 226 | """ |
| 227 | Transpose each matrix in a stack of matrices. |
| 228 | |
| 229 | Unlike np.transpose, this only swaps the last two axes, rather than all of |
| 230 | them |
| 231 | |
| 232 | Parameters |
| 233 | ---------- |
| 234 | a : (...,M,N) array_like |
| 235 | |
| 236 | Returns |
| 237 | ------- |
| 238 | aT : (...,N,M) ndarray |
| 239 | """ |
| 240 | return swapaxes(a, -1, -2) |
| 241 | |
| 242 | # Linear equations |
| 243 |