BUG: Fix rfft for even input length.#26354
Merged
charris merged 3 commits intonumpy:mainfrom Apr 27, 2024
Merged
Conversation
Member
|
mac failure is an unrelated heisenbug |
charris
reviewed
Apr 27, 2024
numpy/fft/tests/test_pocketfft.py
Outdated
| def test_rfft_even(self): | ||
| x = np.arange(8) | ||
| y = np.fft.rfft(x, 4) | ||
| assert_allclose(y, [6.0, -2.0+2.0j, -2.0], rtol=1e-14) |
Member
There was a problem hiding this comment.
Could use the same sort of test as for the odd case, I like comparing to the full complex fft case.
Member
|
Thanks Warren. |
mhvk
reviewed
Apr 27, 2024
| * for npts odd only). To make unpacking easy, we place the real data | ||
| * offset by one in the buffer, so that we just have to move R0 and | ||
| * create I0=0. Note that copy_data will zero the In component for | ||
| * create I0=0. Note that copy_input will zero the In component for |
Contributor
There was a problem hiding this comment.
This is weird - so, the statement I made in the comment is not true? I'll try to have a quick look, but in any case the fix clearly works.
Contributor
|
#26359 does a follow-up that ensures the code actually does what the comment states. Would be nice to have both this one and #26359 be in 2.0.0.... Must admit that overall rewriting the fft routines in terms of ufuncs has been more of an experience in how hard it is to write bug-free code than I would have liked... Sorry all! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes gh-26349