Skip to content
Prev 175825 / 398503 Next

Matrix multiplication - code problem

Hi again...
I will get an array with 5 matrix 2x2, with dimension 2x2x5
This code below works fine... And I am applying the same procedure...
The problem might be when I do the permutation of the array, but I checked
the dimension and its all right...

array1 <- array(1:30,dim=c(3,2,5))
array2 <- array(1:20,dim=c(2,2,5))
result <- array(dim=c(dim(array1)[1], dim(array2)[2], dim(array1)[3]))
for (i in 1: dim(array1)[3]){
result[,,i] <- array1[,,i]%*%array2[,,i] 
}

Thanks...
Ben Bolker wrote: