[SciPy-Dev] Rank and Unrank functions

rlucas7 at vt.edu rlucas7 at vt.edu
Sun May 10 08:08:57 EDT 2020


Hi Joe, 

Do you have references that include applications? 

The application I’m seeing on the wiki links relates to sampling k sets from a set of N elements without a full table scan.

Are there other applications besides sampling? 

Sincerely, 

-Lucas Roberts 

> On May 9, 2020, at 11:38 PM, Joseph Fox-Rabinovitz <jfoxrabinovitz at gmail.com> wrote:
> 
> 
> 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
> _______________________________________________
> 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/20200510/d3ba3597/attachment.html>


More information about the SciPy-Dev mailing list