Python program to compute Spearman and Pearson Correlation on matrices with restricted permutations