diff options
author | Matti Picus <matti.picus@gmail.com> | 2020-03-17 00:02:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-16 17:02:06 -0500 |
commit | 4f2b219647ae6a7928590be2b709894ae2403274 (patch) | |
tree | 5448d5f350fdcbc2546f82dfe80bd4d3e0665ada /doc/source/reference/random/extending.rst | |
parent | f77c5e83c07985aacbddb89525785a3f66ce1b3b (diff) | |
download | numpy-4f2b219647ae6a7928590be2b709894ae2403274.tar.gz |
BUG: add missing c_distributions.pxd, enables cython use of random C-API (gh-15463)
xref gh-14778
As pointed out in the comment by @jamesthomasgriffin, we did not include a pxd file to expose the distribution functions documented in the random c-api. This PR adds a c_distributions.pxd file that exposes them.
Squashed commits:
* BUG: add missing c_distributions.pxd to enable cython use of random C-API
* ENH, TST: add npyrandom library like npymath, test cython use of it
* BUG: actually prefix f-string with f
* MAINT: fixes from review, add _bit_generato_bit_generator.pxd
* STY: fixes from review
* BLD: don't use nprandom library for mtrand legacy build
* TST: WindowsPath cannot be used in subprocess's list2cmdline
* MAINT, API: move _bit_generator to bit_generator
* DOC: add release note about moving bit_generator
* DOC, MAINT: fixes from review
* MAINT: redo dtype determination from review
Diffstat (limited to 'doc/source/reference/random/extending.rst')
-rw-r--r-- | doc/source/reference/random/extending.rst | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/doc/source/reference/random/extending.rst b/doc/source/reference/random/extending.rst index 52063ae5b..2c506e943 100644 --- a/doc/source/reference/random/extending.rst +++ b/doc/source/reference/random/extending.rst @@ -47,9 +47,18 @@ struct. .. literalinclude:: ../../../../numpy/random/_examples/cython/extending_distributions.pyx :language: cython :start-after: example 2 + :end-before: example 3 -See :ref:`extending_cython_example` for a complete working example including a -minimal setup and cython files. +Cython can be used to directly access the functions in +``numpy/random/c_distributions.pxd``. This requires linking with the +``npyrandom`` library located in ``numpy/random/lib``. + +.. literalinclude:: ../../../../numpy/random/_examples/cython/extending_distributions.pyx + :language: cython + :start-after: example 3 + +See :ref:`extending_cython_example` for the complete listings of these examples +and a minimal ``setup.py`` to build the c-extension modules. CFFI ==== |