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

Better solution when using guvectorize #18

Open
HannoSpreeuw opened this issue Aug 25, 2023 · 0 comments
Open

Better solution when using guvectorize #18

HannoSpreeuw opened this issue Aug 25, 2023 · 0 comments
Assignees

Comments

@HannoSpreeuw
Copy link

The solution posted here :

@guvectorize([(complex128[:, :], int64, int64[:, :])],
             "(n,m),()->(n,m)",
             nopython=True)

uses 2D arrays - complex128[:,:] - while guvectorize will turn a function for 1D arrays into a function suitable for 2D arrays when a 2D argument is used in the call.

So the function and its decorator should be written as operating on 1D arrays.
Or written for 2D and use a 3D argument in the call.

See the example from the Numba documentation:

The nice thing is that NumPy will automatically dispatch over more complicated inputs, depending on their shapes:
@HannoSpreeuw HannoSpreeuw changed the title Better solution for guvectorize Better solution when using guvectorize Aug 25, 2023
@HannoSpreeuw HannoSpreeuw self-assigned this Nov 28, 2024
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

1 participant