cov = np.dot(x, y.T) - n * np.dot(mu_x[:, (np.newaxis)], mu_y[(np.newaxis), :])
return cov / np.dot(s_x[:, (np.newaxis)], s_y[(np.newaxis), :])
Computing the correlation coefficient between two multi-dimensional arrays