Repository navigation
fix: match SciPy rfft2 positional argument order - #419
Open
vera-rubin wants to merge 1 commit into
Open
vera-rubin wants to merge 1 commit into
vera-rubin wants to merge 1 commit into
Conversation
vera-rubin
requested review from
antonwolfy,
jharlow-intel,
ndgrigorian,
vlad-perevezentsev and
xaleryb
as code owners
December 4, 2026 01:45
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.
Description
mkl_fft.interfaces.scipy_fft.rfft2declaresoverwrite_xbeforenorm, whilescipy.fft.rfft2isrfft2(x, s=None, axes=(-2, -1), norm=None, overwrite_x=False, workers=None, *, plan=None). A call that passesnormpositionally, as SciPy allows, binds the string tooverwrite_xand the normalization is silently ignored. For a 2x2 array of ones this returns(4+0j)instead of SciPy's(2+0j):The fix puts
normbeforeoverwrite_x, as in SciPy and as the other functions in this module already do (rfft2was the only one with the two swapped). A regression test compares the positional call withscipy.fft.rfft2for all fournormvalues and both real precisions; it fails for"forward"and"ortho"without the fix and passes with it.Verification
Linux x86_64, Python 3.12.3, NumPy 2.5.5, SciPy 1.18.1, MKL 2026.2, built with
pip install -e . --no-build-isolationon master 84ce3f4.python -m pytest mkl_fft/tests -q: 2817 passed, 2 skipped (without the fix: the 4 newforward/orthocases fail, everything else passes).Not verified
Pre-commit hooks, Windows and macOS: left to CI.
Checklist
mkl_fft/tests/; bug fixes have a regression test.CHANGELOG.mdupdated under## [dev]with a[gh-NNN]link, or the change isn't user-visible. (Entry added under### Fixed; the link will be added once this PR has a number.)ChipLab's AI agents
Nathan Chandrasekar