fbpx
Wikipedia

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 a 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 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 .

Illustration video of vectorized addition

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,

 

for matrices A, B, and C of dimensions k×l, l×m, and m×n.[1] 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 Cn2 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 Cn2 :

 

where the superscript T 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 m × n matrix that we want to vectorize, and let ei be the i-th canonical basis vector for the n-dimensional space, that is  . Let Bi be a (mn) × m block matrix defined as follows:

 

Bi consists of n block matrices of size m × m, stacked column-wise, and all these matrices are all-zero except for the i-th one, which is a m × m identity matrix Im.

Then the vectorized version of X can be expressed as follows:

 

Multiplication of X by ei extracts the i-th column, while multiplication by Bi puts it into the desired position in the final vector.

Alternatively, the linear sum can be expressed using the Kronecker product:

 

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 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:

 

For example, for the 2×2 matrix  , the half-vectorization is  .

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[1], while in R the desired effect can be achieved via the c() or as.vector() functions. In R, function vec() of package 'ks' allows vectorization and function vech() implemented in both packages 'ks' and 'sn' allows half-vectorization.[2][3][4]

Notes

1.^ ^ The identity for row-major vectorization is  .

See also

References

  1. ^ Macedo, H. D.; Oliveira, J. N. (2013). "Typing Linear Algebra: A Biproduct-oriented Approach". Science of Computer Programming. 78 (11): 2160–2191. arXiv:1312.4818. doi:10.1016/j.scico.2012.07.012. S2CID 9846072.
  2. ^ Duong, Tarn (2018). "ks: Kernel Smoothing". R package version 1.11.0.
  3. ^ Azzalini, Adelchi (2017). "The R package 'sn': The Skew-Normal and Related Distributions such as the Skew-t". R package version 1.5.1.
  4. ^ Vinod, Hrishikesh D. (2011). "Simultaneous Reduction and Vec Stacking". Hands-on Matrix Algebra Using R: Active and Motivated Learning with Applications. Singapore: World Scientific. pp. 233–248. ISBN 978-981-4313-69-8 – via Google Books.
  • Jan R. Magnus and Heinz Neudecker (1999), Matrix Differential Calculus with Applications in Statistics and Econometrics, 2nd Ed., Wiley. ISBN 0-471-98633-X.

vectorization, mathematics, other, uses, vectorization, mathematics, especially, linear, algebra, matrix, theory, vectorization, matrix, linear, transformation, which, converts, matrix, into, column, vector, specifically, vectorization, matrix, denoted, column. For other uses see Vectorization 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 a 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 vec A a 1 1 a m 1 a 1 2 a m 2 a 1 n a m n T displaystyle operatorname vec A a 1 1 ldots a m 1 a 1 2 ldots a m 2 ldots a 1 n ldots a m n mathrm T Here a i j displaystyle a i j represents A i j displaystyle A i j and the superscript T displaystyle mathrm T denotes the transpose Vectorization expresses through coordinates the isomorphism R m n R m R n R m n displaystyle mathbf R m times n mathbf R m otimes mathbf R n cong mathbf R mn between these i e of matrices and vectors as vector spaces For example for the 2 2 matrix A a b c d displaystyle A begin bmatrix a amp b c amp d end bmatrix the vectorization is vec A a c b d displaystyle operatorname vec A begin bmatrix a c b d end bmatrix Illustration video of vectorized addition The connection between the vectorization of A and the vectorization of its transpose is given by the commutation matrix Contents 1 Compatibility with Kronecker products 2 Compatibility with Hadamard products 3 Compatibility with inner products 4 Vectorization as a linear sum 5 Half vectorization 6 Programming language 7 Notes 8 See also 9 ReferencesCompatibility with Kronecker products EditThe vectorization is frequently used together with the Kronecker product to express matrix multiplication as a linear transformation on matrices In particular vec A B C C T A vec B displaystyle operatorname vec ABC C mathrm T otimes A operatorname vec B for matrices A B and C of dimensions k l l m and m n 1 For example if ad A X A X X A displaystyle operatorname ad A X AX XA the adjoint endomorphism of the Lie algebra gl n C of all n n matrices with complex entries then vec ad A X I n A A T I n vec X displaystyle operatorname vec operatorname ad A X I n otimes A A mathrm T otimes I n text vec X where I n displaystyle I n is the n n identity matrix There are two other useful formulations vec A B C I n A B vec C C T B T I k vec A displaystyle operatorname vec ABC I n otimes AB operatorname vec C C mathrm T B mathrm T otimes I k operatorname vec A vec A B I m A vec B B T I k vec A displaystyle operatorname vec AB I m otimes A operatorname vec B B mathrm T otimes I k operatorname vec A 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 EditVectorization is an algebra homomorphism from the space of n n matrices with the Hadamard entrywise product to Cn2 with its Hadamard product vec A B vec A vec B displaystyle operatorname vec A circ B operatorname vec A circ operatorname vec B Compatibility with inner products EditVectorization is a unitary transformation from the space of n n matrices with the Frobenius or Hilbert Schmidt inner product to Cn2 tr A B vec A vec B vec B vec A displaystyle operatorname tr A top B operatorname vec A top operatorname vec B operatorname vec B top operatorname vec A where the superscript T denotes the conjugate transpose Vectorization as a linear sum EditThe matrix vectorization operation can be written in terms of a linear sum Let X be an m n matrix that we want to vectorize and let ei be the i th canonical basis vector for the n dimensional space that is e i 0 0 1 0 0 T textstyle mathbf e i left 0 0 1 0 0 right mathrm T Let Bi be a mn m block matrix defined as follows B i 0 0 I m 0 0 e i I m displaystyle mathbf B i begin bmatrix mathbf 0 vdots mathbf 0 mathbf I m mathbf 0 vdots mathbf 0 end bmatrix mathbf e i otimes mathbf I m Bi consists of n block matrices of size m m stacked column wise and all these matrices are all zero except for the i th one which is a m m identity matrix Im Then the vectorized version of X can be expressed as follows vec X i 1 n B i X e i displaystyle operatorname vec mathbf X sum i 1 n mathbf B i mathbf X mathbf e i Multiplication of X by ei extracts the i th column while multiplication by Bi puts it into the desired position in the final vector Alternatively the linear sum can be expressed using the Kronecker product vec X i 1 n e i X e i displaystyle operatorname vec mathbf X sum i 1 n mathbf e i otimes mathbf X mathbf e i Half vectorization EditFor 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 A 1 1 A n 1 A 2 2 A n 2 A n 1 n 1 A n n 1 A n n T displaystyle operatorname vech A A 1 1 ldots A n 1 A 2 2 ldots A n 2 ldots A n 1 n 1 A n n 1 A n n mathrm T For example for the 2 2 matrix A a b b d displaystyle A begin bmatrix a amp b b amp d end bmatrix the half vectorization is vech A a b d displaystyle operatorname vech A begin bmatrix a b d end bmatrix 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 EditProgramming 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 1 while in R the desired effect can be achieved via the c or as vector functions In R function vec of package ks allows vectorization and function vech implemented in both packages ks and sn allows half vectorization 2 3 4 Notes Edit1 The identity for row major vectorization is vec A B C A C T vec B displaystyle operatorname vec ABC A otimes C mathrm T operatorname vec B See also EditVoigt notation Packed storage matrix Column major order MatricizationReferences Edit Macedo H D Oliveira J N 2013 Typing Linear Algebra A Biproduct oriented Approach Science of Computer Programming 78 11 2160 2191 arXiv 1312 4818 doi 10 1016 j scico 2012 07 012 S2CID 9846072 Duong Tarn 2018 ks Kernel Smoothing R package version 1 11 0 Azzalini Adelchi 2017 The R package sn The Skew Normal and Related Distributions such as the Skew t R package version 1 5 1 Vinod Hrishikesh D 2011 Simultaneous Reduction and Vec Stacking Hands on Matrix Algebra Using R Active and Motivated Learning with Applications Singapore World Scientific pp 233 248 ISBN 978 981 4313 69 8 via Google Books Jan R Magnus and Heinz Neudecker 1999 Matrix Differential Calculus with Applications in Statistics and Econometrics 2nd Ed Wiley ISBN 0 471 98633 X Retrieved from https en wikipedia org w index php title Vectorization mathematics amp oldid 1095754114, wikipedia, wiki, book, books, library,

article

, read, download, free, free download, mp3, video, mp4, 3gp, jpg, jpeg, gif, png, picture, music, song, movie, book, game, games.