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

BUG: FFT operation returns C_CONTIGUOUS even if input is F_CONTUGIOUS #26777

Open
vahidmech opened this issue Jun 21, 2024 · 5 comments · May be fixed by #26795
Open

BUG: FFT operation returns C_CONTIGUOUS even if input is F_CONTUGIOUS #26777

vahidmech opened this issue Jun 21, 2024 · 5 comments · May be fixed by #26795

Comments

@vahidmech
Copy link

Describe the issue:

In Numpy_2, FFT operation returns C_CONTIGUOUS even if input is F_CONTIGUOUS while In NumPy 1.26 output was F_CONTIGUOUS for F_CONTIGUOUS input.

Reproduce the code example:

>>> import numpy as np
>>> a = np.ones((10,10), dtype=numpy.complex64, order="F")
>>> numpy.fft.fft(a).flags
  C_CONTIGUOUS : True
  F_CONTIGUOUS : False
  OWNDATA : True
  WRITEABLE : True
  ALIGNED : True
  WRITEBACKIFCOPY : False

Error message:

No response

Python and NumPy Versions:

2.0.0
3.12.4 | packaged by conda-forge | (main, Jun 17 2024, 10:13:44) [Clang 16.0.6 ]

Runtime Environment:

No response

Context for the issue:

No response

@charris charris added this to the 2.0.1 release milestone Jun 21, 2024
@ngoldbaum
Copy link
Member

Ping @mhvk this smells related to the pocketfft changes.

@mhvk
Copy link
Contributor

mhvk commented Jun 22, 2024

Hmm, I don't think that is a conscious choice, but rather something the gufunc machinery does automatically. I'm not sure how easy it is to set that - @seberg?

@mhvk
Copy link
Contributor

mhvk commented Jun 22, 2024

p.s. Am on holidays so will not be able to react very quickly.

@vahidmech
Copy link
Author

Hmm, I don't think that is a conscious choice, but rather something the gufunc machinery does automatically. I'm not sure how easy it is to set that - @seberg?

Isn't it because here out array is defined with default order="C"?
https://github.com/numpy/numpy/blob/main/numpy/fft/_pocketfft.py#L88
out = empty(a.shape[:axis] + (n_out,) + a.shape[axis+1:], dtype=out_dtype)

If an appropriate order is passed, it might work fine.

@mhvk
Copy link
Contributor

mhvk commented Jun 22, 2024

@vahidmech - indeed, that seems plausible! Maybe that should just become an empty_like, so that only shape and dtype are overridden? Do you want to try and make a quick PR if it works? (I'm on holidays myself so it will be a bit before I get around to it.)

vahidmech pushed a commit to vahidmech/numpy that referenced this issue Jun 25, 2024
@vahidmech vahidmech linked a pull request Jun 25, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants