a%*%b does not work because the dimension of c is 6 by 5.
- user1690124
1 Answers
4
votes
Here is my version:
c1 = a[ rep(1:nrow(a), each = nrow(b)), ] *
b[ rep(1:nrow(b), times = nrow(a)), ];
all.equal(c, c1);
> TRUE
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkRead more
A %*% BIf you want fast matrix multiplication you could use Strassen's algorithm: en.wikipedia.org/wiki/Strassen_algorithm - Spencer Wieczorek