[SciPy-Dev] Rank and Unrank functions

Joseph Fox-Rabinovitz jfoxrabinovitz at gmail.com
Sat May 9 23:38:07 EDT 2020


Josh,

I'm referring to a combinatorial number system:
https://en.m.wikipedia.org/wiki/Combinatorial_number_system. Also mentioned
here: https://en.m.wikipedia.org/wiki/Combination#Enumerating_k-combinations
.

This is something I've made small utilitity functions for a couple of
times. For a formal implementation, I've got a couple of peer reviewed
papers for reference, and some different options for features, like with
and without repetition. I'd prefer not to do the extra work if this is too
niche though.

Regards,

Joe



On Sat, May 9, 2020, 11:02 Joshua Wilson <josh.craig.wilson at gmail.com>
wrote:

> > but no rank and unrank to convert linear indices to combination or
> permutation
>
> Could you point to a definition of these functions? I'm actually not
> sure what you mean.
>
> - Josh
>
> On Fri, May 8, 2020 at 12:12 PM Joseph Fox-Rabinovitz
> <jfoxrabinovitz at gmail.com> wrote:
> >
> > Scipy.special has the functions comb and perm but no rank and unrank to
> convert linear indices to combination or permutation. These are fairly
> useful for generating random sequences from large sets. Is there any
> objection to a PR implementing these functions?
> >
> > The signatures I had in mind are
> >
> > perm_rank(indices, n, k)
> > perm_unrank(index, n, k)
> > comb_rank(indices, n, k)
> > comb_unrank(index, n, k)
> >
> > Regards,
> >
> > Joe
> > _______________________________________________
> > SciPy-Dev mailing list
> > SciPy-Dev at python.org
> > https://mail.python.org/mailman/listinfo/scipy-dev
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at python.org
> https://mail.python.org/mailman/listinfo/scipy-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20200509/93f40b83/attachment.html>


More information about the SciPy-Dev mailing list