[Numpy-discussion] Low-level API for Random

Robert Kern robert.kern at gmail.com
Wed Sep 25 14:05:54 EDT 2019


On Wed, Sep 25, 2019, 12:56 PM Stefan van der Walt <stefanv at berkeley.edu>
wrote:

> On Fri, Sep 20, 2019, at 21:30, Robert Kern wrote:
>
> Given the prevalence of Cython, it's actually really easy to use the
> Python API pretty easily in "C", so it's actually a huge waste if the C API
> matches the Python API too closely. The power and utility of the C API will
> be in how it *differs* from the Python API. For the distribution methods,
> this is largely in how it lets you sample one number at a time without
> bothering with the numpy and broadcasting overhead. That's the driving
> motivation for having a C API for the distributions, and the algorithms
> that we choose have consequences for the C API that will best satisfy that
> motivation.
>
>
> I'd like to clarify what exactly we mean by exposing a C API.  Do we have
> in mind that our random number generators can be used from standalone C
> code, or via Cython `cimport` like with the current numpy.pxd?
>

Cython is the priority. Numba and cffi/ctypes are also desired and
relatively easy to do with capsules. Pure C (via #include) is desired, but
can be added later because doing that is more annoying.

It sounds like we want to expose the highest level generators; do we also
> want to provide access to the bit streams?
>

100%
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20190925/57871f40/attachment.html>


More information about the NumPy-Discussion mailing list