Skip to content

MAINT cython typedefs in sparsefuncs_fast #27333

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 6 commits into from
Sep 14, 2023

Conversation

lorentzenchr
Copy link
Member

Reference Issues/PRs

Related to #25572.

What does this implement/fix? Explain your changes.

Any other comments?

@github-actions
Copy link

github-actions bot commented Sep 10, 2023

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: 9fa055e. Link to the linter CI: here

Copy link
Contributor

@OmarManzoor OmarManzoor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @lorentzenchr

@@ -15,6 +15,8 @@
# use these consistently throughout the codebase.
# NOTE: Extend this list as needed when converting more cython extensions.
ctypedef unsigned char uint8_t
ctypedef unsigned int uint32_t
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has also been added in #27334

@glemaitre glemaitre self-requested a review September 11, 2023 15:38
Copy link
Member

@glemaitre glemaitre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I solved the conflicts. LGTM.

Copy link
Member

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this looks like a net improvement. However I think we could be more specific for the types of scipy CSR indices (see comment below).

But we can leave that for a follow-up PR if needed.

/cc @jjerphan before merging.

@@ -7,18 +7,21 @@
# License: BSD 3 clause

from libc.math cimport fabs, sqrt, isnan
from libc.stdint cimport intptr_t
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this or better use our intp_t instead?

Copy link
Member

@jjerphan jjerphan Sep 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intp_t aliases npy_intp which aliases Py_intptr_t which aliases intptr_t

I think we better use intp_t for consistency. WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think. I‘m confused and would prefer C/C++ over Cython, but that’s another story.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or can someone tell what the difference between inp_t alias Py_ssize_t and intptr_t alias ssize_t is?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jjerphan If this point is clear then maybe we can merge this PR?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, here this choice is safe, but I think we could clarify types for indices in another PR.

@jjerphan jjerphan merged commit b13e859 into scikit-learn:main Sep 14, 2023
@lorentzenchr lorentzenchr deleted the mnt_sparsefuncs_cython_types branch September 14, 2023 09:55
REDVM pushed a commit to REDVM/scikit-learn that referenced this pull request Nov 16, 2023
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants