Generalized #get_combinatorial_pairs_nmatrix so that it works with higher-dimensional nmatrixes