z <- commutation(m = 100, condensed = TRUE)
object.size(z) # 40.6 Kb of storage
z <- commutation(m = 100, condensed = FALSE)
object.size(z) # 80.7 Kb of storage
K100 <- commutation(m = 100, matrix = TRUE) # time: < 2 secs
object.size(K100) # 400 Mb of storage, do not request this matrix!
# a small example
K32 <- commutation(m = 3, n = 2, matrix = TRUE)
a <- matrix(1:6, ncol = 2)
v <- K32 %*% vec(a)
all(vec(t(a)) == as.vector(v)) # vectors are equal!
Run the code above in your browser using DataLab