<s>
In	O
mathematics	O
,	O
especially	O
in	O
linear	B-Language
algebra	I-Language
and	O
matrix	B-Architecture
theory	I-Architecture
,	O
the	O
commutation	B-Algorithm
matrix	I-Algorithm
is	O
used	O
for	O
transforming	O
the	O
vectorized	B-Algorithm
form	O
of	O
a	O
matrix	B-Architecture
into	O
the	O
vectorized	B-Algorithm
form	O
of	O
its	O
transpose	O
.	O
</s>
<s>
Specifically	O
,	O
the	O
commutation	B-Algorithm
matrix	I-Algorithm
K(m,n )	O
is	O
the	O
nm	O
×	O
mn	O
matrix	B-Architecture
which	O
,	O
for	O
any	O
m	O
×	O
n	O
matrix	B-Architecture
A	O
,	O
transforms	O
vec(A )	O
into	O
vec(AT )	O
:	O
</s>
<s>
In	O
other	O
words	O
,	O
vec(A )	O
is	O
the	O
vector	O
obtained	O
by	O
vectorizing	O
A	O
in	O
column-major	B-Data_Structure
order	I-Data_Structure
.	O
</s>
<s>
Similarly	O
,	O
vec(AT )	O
is	O
the	O
vector	O
obtaining	O
by	O
vectorizing	O
A	O
in	O
row-major	B-Data_Structure
order	I-Data_Structure
.	O
</s>
<s>
The	O
commutation	B-Algorithm
matrix	I-Algorithm
is	O
a	O
special	O
type	O
of	O
permutation	B-Algorithm
matrix	I-Algorithm
,	O
and	O
is	O
therefore	O
orthogonal	B-Algorithm
.	O
</s>
<s>
Replacing	O
A	O
with	O
AT	O
in	O
the	O
definition	O
of	O
the	O
commutation	B-Algorithm
matrix	I-Algorithm
shows	O
that	O
Therefore	O
in	O
the	O
special	O
case	O
of	O
m	O
=	O
n	O
the	O
commutation	B-Algorithm
matrix	I-Algorithm
is	O
an	O
involution	O
and	O
symmetric	B-Algorithm
.	O
</s>
<s>
The	O
main	O
use	O
of	O
the	O
commutation	B-Algorithm
matrix	I-Algorithm
,	O
and	O
the	O
source	O
of	O
its	O
name	O
,	O
is	O
to	O
commute	O
the	O
Kronecker	O
product	O
:	O
for	O
every	O
m	O
×	O
n	O
matrix	B-Architecture
A	O
and	O
every	O
r	O
×	O
q	O
matrix	B-Architecture
B	O
,	O
</s>
<s>
This	O
property	O
is	O
the	O
reason	O
that	O
this	O
matrix	B-Architecture
is	O
referred	O
to	O
as	O
the	O
"	O
swap	O
operator	O
"	O
in	O
the	O
context	O
of	O
quantum	O
information	O
theory	O
.	O
</s>
<s>
Two	O
explicit	O
forms	O
for	O
the	O
commutation	B-Algorithm
matrix	I-Algorithm
are	O
as	O
follows	O
:	O
if	O
er	O
,	O
j	O
denotes	O
the	O
j-th	O
canonical	O
vector	O
of	O
dimension	O
r	O
(	O
i.e.	O
</s>
<s>
The	O
commutation	B-Algorithm
matrix	I-Algorithm
may	O
be	O
expressed	O
as	O
the	O
following	O
block	O
matrix	B-Architecture
:	O
</s>
<s>
For	O
both	O
square	O
and	O
rectangular	O
matrices	O
of	O
m	O
rows	O
and	O
n	O
columns	O
,	O
the	O
commutation	B-Algorithm
matrix	I-Algorithm
can	O
be	O
generated	O
by	O
the	O
code	O
below	O
.	O
</s>
<s>
Let	O
denote	O
the	O
following	O
matrix	B-Architecture
:	O
</s>
<s>
has	O
the	O
following	O
column-major	O
and	O
row-major	B-Data_Structure
vectorizations	B-Algorithm
(	O
respectively	O
)	O
:	O
</s>
