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

Default output size for irfft(n) #10251

Open
peterbell10 opened this issue Jun 3, 2019 · 1 comment
Open

Default output size for irfft(n) #10251

peterbell10 opened this issue Jun 3, 2019 · 1 comment
Labels
needs-decision Items that need further discussion before they are merged or closed scipy.fft

Comments

@peterbell10
Copy link
Member

peterbell10 commented Jun 3, 2019

Related to #10238

In numpy/numpy#13357, @mreineck notes that numpy.irfft will fail for inputs of length 1 because the default size of 2*(len-1) is 0. The alternative default is 2*len - 1 which will never truncate the input array.

The current behaviour loses information: rfft(irfft(x)) != x for all inputs. In general, it is a bad idea to use irfft without specifying the size and will only behave properly for even length inputs.

scipy.fft will of course have to match numpy.fft, so any change in behavior needs to be coordinated. Possibly by deprecating the default value, or at least providing a warning.

@rgommers
Copy link
Member

rgommers commented Jun 4, 2019

scipy.fft will of course have to match numpy.fft, so any change in behavior needs to be coordinated. Possibly by deprecating the default value, or at least providing a warning.

If the behavior is bad for length 1 arrays and, more importantly, odd-length arrays then I think it's fine to deviate from numpy I'd say. I suggest to open a doc PR for numpy at least. That will get us some feedback on whether numpy wants to just document or deprecate some behavior.

@larsoner larsoner added the needs-decision Items that need further discussion before they are merged or closed label Jul 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-decision Items that need further discussion before they are merged or closed scipy.fft
Projects
None yet
Development

No branches or pull requests

3 participants