Displaying 1 result from an estimated 1 matches for "vkron".
Did you mean:
varon
2009 Feb 23
1
trade-off between speed and storage in matrix multiplications
...s
m <- 10
n <- 15
# A-matrix
rnA <- runif(m*m)
A <- matrix(rnA, m, m)
# vector
v <- runif(n)
# B-matrix
rnB <- runif(m*n)
B <- matrix(rnB, m, n)
# first solution: vectorize B + kronecker product => faster but storage
issues
system.time(
for(i in 1:100){
b <- c(B)
vKron.A <- kronecker(diag(v), A)
SOL1 <- vKron.A %*% b
})
# second solution: orig. dims + apply + mapply => slower, but w/o
storage issues
system.time(
for(i in 1:100){
Av <- outer(A, v, FUN="*")
Av.df1 <- apply(Av, 3, as.data.frame)
Av.df2 <- lapply(X=Av.df1,...