Vectorization (mathematics)

In mathematics, especially in linear algebra and matrix theory, the vectorization of a matrix is a linear transformation which converts the matrix into a column vector. Specifically, the vectorization of an m × n matrix A, denoted vec(A), is the mn × 1 column vector obtained by stacking the columns of the matrix A on top of one another:

Here, represents the -th element of matrix and the superscript denotes the transpose. Vectorization expresses, through coordinates, the isomorphism between these (i.e., of matrices and vectors) as vector spaces.

For example, for the 2×2 matrix = , the vectorization is .

Compatibility with Kronecker products

The vectorization is frequently used together with the Kronecker product to express matrix multiplication as a linear transformation on matrices. In particular,

for matrices A, B, and C of dimensions k×l, l×m, and m×n. For example, if (the adjoint endomorphism of the Lie algebra gl(n, C) of all n×n matrices with complex entries), then , where is the n×n identity matrix.

There are two other useful formulations:

More generally, it has been shown that vectorization is a self-adjunction in the monoidal closed structure of any category of matrices.[1]

Compatibility with Hadamard products

Vectorization is an algebra homomorphism from the space of n × n matrices with the Hadamard (entrywise) product to Cn with its Hadamard product:

Compatibility with inner products

Vectorization is a unitary transformation from the space of n×n matrices with the Frobenius (or Hilbert–Schmidt) inner product to Cn :

tr(AH B) = vec(A)H vec(B)

where the superscript H denotes the conjugate transpose.


For a symmetric matrix A, the vector vec(A) contains more information than is strictly necessary, since the matrix is completely determined by the symmetry together with the lower triangular portion, that is, the n(n + 1)/2 entries on and below the main diagonal. For such matrices, the half-vectorization is sometimes more useful than the vectorization. The half-vectorization, vech(A), of a symmetric n × n matrix A is the n(n + 1)/2 × 1 column vector obtained by vectorizing only the lower triangular part of A:

vech(A) = [ A1,1, ..., An,1, A2,2, ..., An,2, ..., An1,n1,An,n1, An,n ]T.

For example, for the 2×2 matrix A = , the half-vectorization is vech(A) = .

There exist unique matrices transforming the half-vectorization of a matrix to its vectorization and vice versa called, respectively, the duplication matrix and the elimination matrix.

Programming language

Programming languages that implement matrices may have easy means for vectorization. In Matlab/GNU Octave a matrix A can be vectorized by A(:). GNU Octave also allows vectorization and half-vectorization with vec(A) and vech(A) respectively. Julia has the vec(A) function as well. In Python NumPy arrays implement the 'flatten' method, while in R the desired effect can be achieved via the 'c()' or 'as.vector()' functions.

See also


  1. H.D. Macedo, J.N. Oliveira, Typing linear algebra: A biproduct-oriented approach, Science of Computer Programming, Volume 78, Issue 11, 2013, Pages 2160-2191.
This article is issued from Wikipedia - version of the 11/28/2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.