[SciPy-Dev] Rank and Unrank functions

Joseph Fox-Rabinovitz jfoxrabinovitz at gmail.com
Sun May 10 18:31:32 EDT 2020


Robert,

That sounds like a good compromise. I'll make a small cython or C
implementation. I'm not super familiar with with the former, so no promises
there. As long as there is some interest, I'll be happy to work on it.

Thanks,

Joe


On Sun, May 10, 2020, 18:27 Robert Kern <robert.kern at gmail.com> wrote:

> On Sun, May 10, 2020 at 10:03 AM Joseph Fox-Rabinovitz <
> jfoxrabinovitz at gmail.com> wrote:
>
>> Lucas,
>>
>> I'm unaware of any other computational application. Most of the
>> references I've read focus on the algorithm, implying that the uses are
>> self-evident. My use-case has always been combination and permutation
>> sampling for engineering applications, so I've never bothered to understand
>> the underlying mathematics too deeply, nor other possible applications.
>>
>> This in and of itself may mean that the functions are best left as
>> utilities. At the same time, I feel that if I'm using something fairly
>> frequently that doesn't have a "standard" implementation, I should at least
>> ask.
>>
>> I should also mention at some point that the implementation I have in
>> mind takes advantage of python's infinite precision integers. I'm currently
>> doing this in python, but it would be simple to implement in C to bypass
>> the loop and type checking overhead almost entirely.
>>
>
> Because of that, these functions are not the *best* fit for scipy.special,
> which usually provides ufuncs that operate on bounded-precision floats and
> integers. The few exact combinatorial functions that we do have are already
> kind of misfits anyways, and mostly exist so that it's easy to swap between
> the exact calculations and approximate floating-point calculations (e.g.
> approximating factorial with a gamma function). At the same time, a lot of
> the support that scipy.special would give you (some infrastructure for
> building ufuncs) is probably not that relevant to you.
>
> You've definitely piqued my interest with respect to sampling, so I'd love
> to see an implementation somewhere, but a small standalone Cython module
> might be the appropriate place for it. At least for now. We can always move
> stuff around later. It might even be easier to get stuff done in your own
> repo than trying to build all of scipy just to test your implementations
> during development.
>
> --
> Robert Kern
> _______________________________________________
> 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/d1b7823d/attachment.html>


More information about the SciPy-Dev mailing list