Suppose I have a 1 x matrix mat=matrix(1,1,13)
I also have an array that is 13 x 1000 x 10.
dfarray = array(1:(13*1000*10),dim=c(13,1000,10))
Without looping, I want to return the results of this loop
dfarray2=array(NA,dim=c(1,1000,10))
for(i in 1:10){
dfarray2[,,i]=mat%*%dfarray[,,i]
}
One possibility: deform the
dfarray
to usual matrix, multiply and transform back to 3d array.