Skip to content

BUG: behavioral change of numpy.fft.rfft with numpy 2.x #26349

@serge-sans-paille

Description

@serge-sans-paille

Describe the issue:

With numpy 2.x:

% python -c 'import numpy as np; print(np.version.version); x = np.arange(8.) ; print(np.fft.rfft(x, 4))' 
2.1.0.dev0+git20240423.ef5f10d
[ 6.+0.j -2.+2.j -2.+4.j]

with numpy 1.26.4:

% python -c 'import numpy as np; print(np.version.version); x = np.arange(8.) ; print(np.fft.rfft(x, 4))'
1.26.4
[ 6.+0.j -2.+2.j -2.+0.j]

that's a notable output difference, maybe introduced by the vectorized form of pocketfft?

Reproduce the code example:

import numpy as np
x = np.arange(8.)
print(np.fft.rfft(x, 4))

Error message:

No response

Python and NumPy Versions:

2.1.0.dev0+git20240423.ef5f10d
3.12.2 (main, Feb 21 2024, 00:00:00) [GCC 13.2.1 20231205 (Red Hat 13.2.1-6)]

Runtime Environment:

No response

Context for the issue:

Difference found while porting pythran to numpy 2.x, as pythran mimics the 'legacy' behavior.
I'm unsure whether the new behavior is intended or not, at least it's not documented in the git log as far as I can tell (?)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions