Suppose I have a 2d array ma with shape (n_rows_ma,n_cols_ma),and a 2d array mb with shape (n_rows_mb,n_cols_mb).Now I want to calculate the correlation between every row in ma and every row in mb. The easiest way may be
import numpy as np
correlation = np.corrcoef(ma,mb)[:n_rows_ma,n_rows_ma:]
But this is too inefficient.So I wonder if there is a more efficient way?