I have two matrices where the variables are the columns , and both matrices have the same number of samples.
One matrix is 800 by 200, and the other is 800 by 100000. I want to compute the correlation matrix between the columns of these matrices so I've tried this:
import numpy as np
def matcor(x, y):
xc = x.shape[1]
return np.corrcoef(x, y, rowvar=False)[xc:, :xc]
xy_cor = matcor(X, Y)
However this ends up taking a large amount of memory, I get a memory error at around 64GB of memory used, and it might end up taking up more than that. Is there a memory efficient way to compute this ?