Cube multiply over first dimension
The result is transposed since that is what apply will give you
arma_mult_cube_vec(cub, v)
cub |
A cube (3D array) |
v |
A vector |
Transpose of multiplication over first dimension of cub time v
d1 <- 10 d2 <- 1e2 d3 <- 2e2 aa <- array(data = rnorm(d1*d2*d3), dim = c(d1, d2, d3)) bb <- rnorm(d3) t1 <- apply(aa, 1, function(U) {U%*%bb}) t2 <- arma_mult_cube_vec(aa, bb) dd <- t1 - t2 summary(dd) image(dd) table(dd) # microbenchmark::microbenchmark(apply(aa, 1, function(U) {U%*%bb}), # arma_mult_cube_vec(aa, bb))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.