transpose

x'

transpose(x)

Try it yourself:


transpose(): swap matrix rows and columns

transpose(A) turns rows into columns. A matrix with shape m×n becomes n×m.

Example

The transpose of [[1,2,3],[4,5,6]] is [[1,4],[2,5],[3,6]]. It is central to dot products, covariance, and matrix factorization.

Related functions

Use multiply() for matrix products, trace() for diagonal sums, inv() for inverses, and svd() for decomposition. size() verifies the changed shape.

Caveat

Transpose does not conjugate complex entries; use a conjugate-transpose operation when that is required.

All functions