Skip to content

DOC document cython typedefs #28865

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions doc/developers/cython.rst
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,16 @@ must be ``cimported`` from this module and not from the OpenMP library directly:

The parallel loop, `prange`, is already protected by cython and can be used directly
from `cython.parallel`.

Types
~~~~~

Cython code requires to use explicit types. This is one of the reasons you get a
performance boost. In order to avoid code duplication, we have a central place
for the most used types in
`sklearn/utils/_typedefs.pyd <https://github.com/scikit-learn/scikit-learn/blob/main/sklearn/utils/_typedefs.pyd>`_.
Ideally you start by having a look there and `cimport` types you need, for example

.. code-block:: cython

from sklear.utils._typedefs cimport float32, float64
Loading