Refactored get_combinatorial_pairs_nmatrix