This is a pre-release version (2.5.0.dev0+git20251130.2de293a). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy 2.5.0.dev0+git20251130.2de293a / numpy / linalg / matrix_transpose

_ArrayFunctionDispatcher

numpy.linalg:matrix_transpose

source: build-install/usr/lib/python3.14/site-packages/numpy/linalg/_linalg.py :3428

Signature

def   matrix_transpose ( x / )

Summary

Transposes a matrix (or a stack of matrices) x.

Extended Summary

This function is Array API compatible.

Parameters

x : array_like

Input array having shape (..., M, N) and whose two innermost dimensions form MxN matrices.

Returns

out : ndarray

An array containing the transpose for each matrix and having shape (..., N, M).

Notes

This function is an alias of numpy.matrix_transpose.

Examples

import numpy as np
np.matrix_transpose([[1, 2], [3, 4]])
np.matrix_transpose([[[1, 2], [3, 4]], [[5, 6], [7, 8]]])

See also

transpose

Generic transpose method.

Aliases

  • numpy.linalg.matrix_transpose

Referenced by