Skip to content
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

Inquiry about future support for custom NumPy dtypes in Pythran #2186

Open
Ye980226 opened this issue Feb 29, 2024 · 1 comment
Open

Inquiry about future support for custom NumPy dtypes in Pythran #2186

Ye980226 opened this issue Feb 29, 2024 · 1 comment

Comments

@Ye980226
Copy link

I am an avid user of Pythran for accelerating numerical computations in Python and have greatly benefited from its ability to optimize NumPy operations. I have a question regarding the support for custom NumPy dtypes in Pythran.

I often use custom dtypes in NumPy for more complex data structures and was wondering if there are any plans to support custom NumPy dtypes in Pythran. This feature would be particularly useful for [describe your use case].

Here's an example of how I use custom dtypes in NumPy:

import numpy as np

# Example of a custom dtype
custom_dtype = np.dtype([('field1', np.float64), ('field2', np.int32)])

# Creating an array with the custom dtype
array = np.array([(1.0, 2), (3.0, 4)], dtype=custom_dtype)
@serge-sans-paille
Copy link
Owner

Hey @Ye980226 , from a typing point of view, it seems possible to build a custom dtype using pythran typing system. I am slightly less confident in the capability to convert that back to python mode (if you were to return that array), or to build generic field accessor (because you have a runtime value that would be part of the typing system).

I don't plan to support this any soon, it falls in the same category as user-defined classes, with an extra level of complexity and I like time (if not skill) to implement that in a proper way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants