Kmat {lazy.mat}R Documentation

Commutation Matrix

Description

Commutation Matrix

Usage

Kmat(nr, nc, method = 1)

Arguments

nr

# of rows

nc

# of columns

method

= 1 to use vecvecindex function
= 2 to use standard basis vectors and Kronecker product

Details

vec(t(A)) == Kmat(nr,nc) %*% vec(A)

References

https://en.wikipedia.org/wiki/Commutation_matrix

Examples

nr <- 3
nc <- 2
A <- demomat(nr,nc)
Print( vec(A), vec(t(A)),  Kmat(nr,nc)%*%vec(A) )
Print( vec(A), vec(t(A)),  t(Kmat(nr,nc))%*%vec(t(A)) )


[Package lazy.mat version 0.1.4 Index]