<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
vectorization	B-Algorithm
of	O
a	O
matrix	B-Architecture
is	O
a	O
linear	B-Architecture
transformation	I-Architecture
which	O
converts	O
the	O
matrix	B-Architecture
into	O
a	O
vector	O
.	O
</s>
<s>
Specifically	O
,	O
the	O
vectorization	B-Algorithm
of	O
a	O
matrix	B-Architecture
A	O
,	O
denoted	O
vec(A )	O
,	O
is	O
the	O
column	O
vector	O
obtained	O
by	O
stacking	O
the	O
columns	O
of	O
the	O
matrix	B-Architecture
A	O
on	O
top	O
of	O
one	O
another	O
:	O
</s>
<s>
Vectorization	B-Algorithm
expresses	O
,	O
through	O
coordinates	O
,	O
the	O
isomorphism	O
between	O
these	O
(	O
i.e.	O
,	O
of	O
matrices	O
and	O
vectors	O
)	O
as	O
vector	O
spaces	O
.	O
</s>
<s>
For	O
example	O
,	O
for	O
the	O
2×2	O
matrix	B-Architecture
,	O
the	O
vectorization	B-Algorithm
is	O
.	O
</s>
<s>
The	O
connection	O
between	O
the	O
vectorization	B-Algorithm
of	O
A	O
and	O
the	O
vectorization	B-Algorithm
of	O
its	O
transpose	O
is	O
given	O
by	O
the	O
commutation	B-Algorithm
matrix	I-Algorithm
.	O
</s>
<s>
The	O
vectorization	B-Algorithm
is	O
frequently	O
used	O
together	O
with	O
the	O
Kronecker	O
product	O
to	O
express	O
matrix	B-Architecture
multiplication	O
as	O
a	O
linear	B-Architecture
transformation	I-Architecture
on	O
matrices	O
.	O
</s>
<s>
For	O
example	O
,	O
if	O
(	O
the	O
adjoint	O
endomorphism	O
of	O
the	O
Lie	O
algebra	O
of	O
all	O
n×n	O
matrices	O
with	O
complex	O
entries	O
)	O
,	O
then	O
,	O
where	O
is	O
the	O
n×n	O
identity	B-Algorithm
matrix	I-Algorithm
.	O
</s>
<s>
More	O
generally	O
,	O
it	O
has	O
been	O
shown	O
that	O
vectorization	B-Algorithm
is	O
a	O
self-adjunction	O
in	O
the	O
monoidal	O
closed	O
structure	O
of	O
any	O
category	O
of	O
matrices	O
.	O
</s>
<s>
Vectorization	B-Algorithm
is	O
an	O
algebra	O
homomorphism	O
from	O
the	O
space	O
of	O
matrices	O
with	O
the	O
Hadamard	O
(	O
entrywise	O
)	O
product	O
to	O
Cn2	O
with	O
its	O
Hadamard	O
product	O
:	O
</s>
<s>
Vectorization	B-Algorithm
is	O
a	O
unitary	B-Algorithm
transformation	I-Algorithm
from	O
the	O
space	O
of	O
n×n	O
matrices	O
with	O
the	O
Frobenius	O
(	O
or	O
Hilbert	O
–	O
Schmidt	O
)	O
inner	O
product	O
to	O
Cn2	O
:	O
</s>
<s>
where	O
the	O
superscript	O
†	O
denotes	O
the	O
conjugate	B-Algorithm
transpose	I-Algorithm
.	O
</s>
<s>
The	O
matrix	B-Architecture
vectorization	B-Algorithm
operation	O
can	O
be	O
written	O
in	O
terms	O
of	O
a	O
linear	O
sum	O
.	O
</s>
<s>
Let	O
X	O
be	O
an	O
matrix	B-Architecture
that	O
we	O
want	O
to	O
vectorize	O
,	O
and	O
let	O
ei	O
be	O
the	O
i-th	O
canonical	O
basis	O
vector	O
for	O
the	O
n-dimensional	O
space	O
,	O
that	O
is	O
.	O
</s>
<s>
Let	O
Bi	O
be	O
a	O
block	O
matrix	B-Architecture
defined	O
as	O
follows	O
:	O
</s>
<s>
Bi	O
consists	O
of	O
n	O
block	O
matrices	O
of	O
size	O
,	O
stacked	O
column-wise	O
,	O
and	O
all	O
these	O
matrices	O
are	O
all-zero	O
except	O
for	O
the	O
i-th	O
one	O
,	O
which	O
is	O
a	O
identity	B-Algorithm
matrix	I-Algorithm
Im	O
.	O
</s>
<s>
For	O
a	O
symmetric	B-Algorithm
matrix	I-Algorithm
A	O
,	O
the	O
vector	O
vec(A )	O
contains	O
more	O
information	O
than	O
is	O
strictly	O
necessary	O
,	O
since	O
the	O
matrix	B-Architecture
is	O
completely	O
determined	O
by	O
the	O
symmetry	O
together	O
with	O
the	O
lower	B-Algorithm
triangular	I-Algorithm
portion	O
,	O
that	O
is	O
,	O
the	O
entries	O
on	O
and	O
below	O
the	O
main	B-Algorithm
diagonal	I-Algorithm
.	O
</s>
<s>
For	O
such	O
matrices	O
,	O
the	O
half-vectorization	O
is	O
sometimes	O
more	O
useful	O
than	O
the	O
vectorization	B-Algorithm
.	O
</s>
<s>
The	O
half-vectorization	O
,	O
vech(A )	O
,	O
of	O
a	O
symmetric	B-Algorithm
matrix	B-Architecture
A	O
is	O
the	O
column	O
vector	O
obtained	O
by	O
vectorizing	O
only	O
the	O
lower	B-Algorithm
triangular	I-Algorithm
part	O
of	O
A	O
:	O
</s>
<s>
For	O
example	O
,	O
for	O
the	O
2×2	O
matrix	B-Architecture
,	O
the	O
half-vectorization	O
is	O
.	O
</s>
<s>
There	O
exist	O
unique	O
matrices	O
transforming	O
the	O
half-vectorization	O
of	O
a	O
matrix	B-Architecture
to	O
its	O
vectorization	B-Algorithm
and	O
vice	O
versa	O
called	O
,	O
respectively	O
,	O
the	O
duplication	B-Algorithm
matrix	I-Algorithm
and	O
the	O
elimination	B-Algorithm
matrix	I-Algorithm
.	O
</s>
<s>
Programming	O
languages	O
that	O
implement	O
matrices	O
may	O
have	O
easy	O
means	O
for	O
vectorization	B-Algorithm
.	O
</s>
<s>
In	O
Matlab/GNU	O
Octave	O
a	O
matrix	B-Architecture
A	O
can	O
be	O
vectorized	O
by	O
A( 	O
:	O
)	O
.	O
</s>
<s>
GNU	B-Language
Octave	I-Language
also	O
allows	O
vectorization	B-Algorithm
and	O
half-vectorization	O
with	O
vec(A )	O
and	O
vech(A )	O
respectively	O
.	O
</s>
<s>
Julia	B-Application
has	O
the	O
vec(A )	O
function	O
as	O
well	O
.	O
</s>
<s>
In	O
Python	B-Language
NumPy	B-Application
arrays	O
implement	O
the	O
flatten	O
method	O
,	O
while	O
in	O
R	B-Language
the	O
desired	O
effect	O
can	O
be	O
achieved	O
via	O
the	O
c( )	O
or	O
as.vector( )	O
functions	O
.	O
</s>
<s>
In	O
R	B-Language
,	O
function	O
vec( )	O
of	O
package	O
'	O
ks	O
 '	O
allows	O
vectorization	B-Algorithm
and	O
function	O
vech( )	O
implemented	O
in	O
both	O
packages	O
'	O
ks	O
 '	O
and	O
'	O
sn	O
 '	O
allows	O
half-vectorization	O
.	O
</s>
