This function seems unnecessarily slow when computing pairwise correlations on matrix with missing entries.