Vectorization (mathematics)
   HOME

TheInfoList



OR:

In
mathematics Mathematics is a field of study that discovers and organizes methods, Mathematical theory, theories and theorems that are developed and Mathematical proof, proved for the needs of empirical sciences and mathematics itself. There are many ar ...
, especially in linear algebra and matrix theory, the vectorization of a matrix is a linear transformation which converts the matrix into a vector. Specifically, the vectorization of a matrix ''A'', denoted vec(''A''), is the column vector obtained by stacking the columns of the matrix ''A'' on top of one another: \operatorname(A) = _, \ldots, a_, a_, \ldots, a_, \ldots, a_, \ldots, a_\mathrm Here, a_ represents the element in the ''i''-th row and ''j''-th column of ''A'', and the superscript ^\mathrm denotes the transpose. Vectorization expresses, through coordinates, the isomorphism \mathbf^ := \mathbf^m \otimes \mathbf^n \cong \mathbf^ between these (i.e., of matrices and vectors) as vector spaces. For example, for the 2×2 matrix A = \begin a & b \\ c & d \end, the vectorization is \operatorname(A) = \begin a \\ c \\ b \\ d \end. The connection between the vectorization of ''A'' and the vectorization of its transpose is given by the commutation matrix.


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, \operatorname(ABC) = (C^\mathrm\otimes A) \operatorname(B) for matrices ''A'', ''B'', and ''C'' of dimensions ''k''×''l'', ''l''×''m'', and ''m''×''n''.The identity for row-major vectorization is \operatorname(ABC) = (A \otimes C^\mathrm)\operatorname(B). For example, if \operatorname_A(X) = AX-XA (the adjoint endomorphism of the
Lie algebra In mathematics, a Lie algebra (pronounced ) is a vector space \mathfrak g together with an operation called the Lie bracket, an alternating bilinear map \mathfrak g \times \mathfrak g \rightarrow \mathfrak g, that satisfies the Jacobi ident ...
of all ''n''×''n'' matrices with complex entries), then \operatorname(\operatorname_A(X)) = (A \otimes I_n - I_n \otimes A^\mathrm) \text(X), where I_n is the ''n''×''n'' identity matrix. There are two other useful formulations: \begin \operatorname(ABC) &= (I_n\otimes AB)\operatorname(C) = (C^\mathrmB^\mathrm\otimes I_k) \operatorname(A) \\ \operatorname(AB) &= (I_m \otimes A) \operatorname(B) = (B^\mathrm\otimes I_k) \operatorname(A) \end If ''B'' is a
diagonal matrix In linear algebra, a diagonal matrix is a matrix in which the entries outside the main diagonal are all zero; the term usually refers to square matrices. Elements of the main diagonal can either be zero or nonzero. An example of a 2×2 diagon ...
(i.e., B = \operatorname(b_1, \dots, b_n)), the vectorization can be written using the column-wise Kronecker product \ast (see Khatri-Rao product) and the main diagonal b = \begin b_1, \dots, b_n \end^\mathrm T of ''B'': \operatorname(ABC) = (C^\mathrm \ast A) b More generally, it has been shown that vectorization is a self-adjunction in the monoidal closed structure of any category of matrices.


Compatibility with Hadamard products

Vectorization is an algebra homomorphism from the space of matrices with the Hadamard (entrywise) product to C''n''2 with its Hadamard product: \operatorname(A \circ B) = \operatorname(A) \circ \operatorname(B) .


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 C''n''2: \operatorname(A^\dagger B) = \operatorname(A)^\dagger \operatorname(B), where the superscript denotes the conjugate transpose.


Vectorization as a linear sum

The matrix vectorization operation can be written in terms of a linear sum. Let X be an matrix that we want to vectorize, and let e''i'' be the ''i''-th canonical basis vector for the ''n''-dimensional space, that is \mathbf_i=\left ,\dots,0,1,0,\dots,0\right\mathrm. Let B''i'' be a block matrix defined as follows: \mathbf_i = \begin \mathbf \\ \vdots \\ \mathbf \\ \mathbf_m \\ \mathbf \\ \vdots \\ \mathbf \end = \mathbf_i \otimes \mathbf_m B''i'' consists of ''n'' block matrices of size , stacked column-wise, and all these matrices are all-zero except for the ''i''-th one, which is a identity matrix I''m''. Then the vectorized version of X can be expressed as follows: \operatorname(\mathbf) = \sum_^n \mathbf_i \mathbf \mathbf_i Multiplication of X by e''i'' extracts the ''i''-th column, while multiplication by B''i'' puts it into the desired position in the final vector. Alternatively, the linear sum can be expressed using the Kronecker product: \operatorname(\mathbf) = \sum_^n \mathbf_i \otimes \mathbf \mathbf_i


Half-vectorization

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 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 matrix ''A'' is the column vector obtained by vectorizing only the lower triangular part of ''A'': \operatorname(A) = _, \ldots, A_, A_, \ldots, A_, \ldots, A_, A_, A_\mathrm. For example, for the 2×2 matrix A = \begin a & b \\ b & d \end, the half-vectorization is \operatorname(A) = \begin a \\ b \\ d \end. 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 or, more efficiently, by removing the dimensions attribute of a matrix A with dim(A) <- NULL. In R, function vec() of package 'ks' allows vectorization and function vech() implemented in both packages 'ks' and 'sn' allows half-vectorization.


Applications

Vectorization is used in matrix calculus and its applications in establishing e.g., moments of random vectors and matrices, asymptotics, as well as Jacobian and Hessian matrices. It is also used in local sensitivity and statistical diagnostics.


Notes


See also

* Duplication and elimination matrices * Voigt notation * Packed storage matrix * Column-major order * Matricization


References

{{Reflist Linear algebra Matrices (mathematics)