Contents
Commutation matrix
In mathematics, especially in linear algebra and matrix theory, the commutation matrix is used for transforming the vectorized form of a matrix into the vectorized form of its transpose. Specifically, the commutation matrix K(m,n) is the nm × mn matrix which, for any m × n matrix A, transforms vec(A) into vec(AT): Here vec(A) is the mn × 1 column vector obtain by stacking the columns of A on top of one another: where A = [Ai,j]. In other words, vec(A) is the vector obtained by vectorizing A in column-major order. Similarly, vec(AT) is the vector obtaining by vectorizing A in row-major order. In the context of quantum information theory, the commutation matrix is sometimes referred to as the swap matrix or swap operator
Properties
Code
For both square and rectangular matrices of rows and columns, the commutation matrix can be generated by the code below.
Python
Alternatively, a version without imports:
MATLAB
R
Example
Let A denote the following 3 \times 2 matrix: A has the following column-major and row-major vectorizations (respectively): The associated commutation matrix is (where each \cdot denotes a zero). As expected, the following holds:
This article is derived from Wikipedia and licensed under CC BY-SA 4.0. View the original article.
Wikipedia® is a registered trademark of the
Wikimedia Foundation, Inc.
Bliptext is not
affiliated with or endorsed by Wikipedia or the
Wikimedia Foundation.