I want to multiply the rows of the matrix by EVERY row (element) of the vector, and not the whole vector (as another question has already said).
for example, I want to use these two matrices (or oo is a vector, since it is one column)
oo=matrix(1:3,3,1)
oop=matrix(1:9,3,3,byrow=TRUE)
for conclusion
1 2 3
8 10 12
21 24 27
I need to do this VERY efficiently, since I need to do this with a huge amount of data thousands of times. I used
diag(as.vector(oo))%*%oop
but it is too slow.
source
share