Free Access Week - Data Engineering + BI
Data Engineering and BI courses are free this week!
Free Access Week - Jun 2-8

matrixcalc (version 1.0-5)

commutation.matrix: Commutation matrix for r by c numeric matrices

Description

This function returns a square matrix of order p = r * c that, for an r by c matrix A, transforms vec(A) to vec(A') where prime denotes transpose.

Usage

commutation.matrix(r, c=r)

Value

An order (rc) matrix.

Arguments

r

a positive integer integer row dimension

c

a positive integer integer column dimension

Author

Frederick Novomestky fnovomes@poly.edu

Details

This function is a wrapper function that uses the function K.matrix to do the actual work. The r×c matrices Hi,j constructed by the function H.matrices are combined using direct product to generate the commutation product with the following formula Kr,c=i=1rj=1c(Hi,jHi,j)

References

Magnus, J. R. and H. Neudecker (1979). The commutation matrix: some properties and applications, The Annals of Statistics, 7(2), 381-394.

Magnus, J. R. and H. Neudecker (1999) Matrix Differential Calculus with Applications in Statistics and Econometrics, Second Edition, John Wiley.

See Also

H.matrices, K.matrix

Examples

Run this code
K <- commutation.matrix( 3, 4 )
A <- matrix( seq( 1, 12, 1 ), nrow=3, byrow=TRUE )
vecA <- vec( A )
vecAt <- vec( t( A ) )
print( K %*% vecA )
print( vecAt )

Run the code above in your browser using DataLab