Suppose I have two dense matrices A and B of dimension 252 and 308. C is a diagonal matrix with elements 1s and 0s.
I want to calculate C(A \otimes B)C. If I calculate
C %*% (A %x% B) %*% C
I get cannot allocate vector of size 44.9 Gb. Is there an efficient way to calculate this matrix.