Skip to content

BUG: np.fft.hfft results differ from previous release when n > len(arr) #25679

@jakevdp

Description

@jakevdp

Describe the issue:

I'm not sure whether this is related to #25661, but this is an incorrect output rather than a segfault, so I thought I'd file a separate issue.

Reproduce the code example:

import numpy as np
print(f"{np.__version__=}")

x = np.arange(5) + 1j * np.ones(5)
print(np.fft.hfft(x, n=10))

Error message:

Output with numpy 1.23.5

np.__version__='1.23.5'
[ 20.           0.68323112  -5.           4.92522101  -5.
   4.          -5.           2.0190509   -5.         -11.62750303]

Output with recent nightly build:

np.__version__='2.0.0.dev0+git20240123.877ca75'
[ 20.          -0.49233939  -3.09788697   3.02310798  -3.8244295
   4.          -6.1755705    3.92116393  -6.90211303 -10.45193252]

I would expect these outputs to be consistent across numpy versions.

Python and NumPy Versions:

>>> import sys, numpy; print(numpy.__version__); print(sys.version)
2.0.0.dev0+git20240120.6bd3abf
3.9.6 (default, May  7 2023, 23:32:44) 
[Clang 14.0.3 (clang-1403.0.22.14.1)]

Runtime Environment:

>>> import numpy; print(numpy.show_runtime())
[{'numpy_version': '2.0.0.dev0+git20240120.6bd3abf',
  'python': '3.9.6 (default, May  7 2023, 23:32:44) \n'
            '[Clang 14.0.3 (clang-1403.0.22.14.1)]',
  'uname': uname_result(system='Darwin', node='jmdg-macbookpro.roam.internal', release='23.2.0', version='Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000', machine='arm64')},
 {'simd_extensions': {'baseline': ['NEON', 'NEON_FP16', 'NEON_VFPV4', 'ASIMD'],
                      'found': ['ASIMDHP'],
                      'not_found': ['ASIMDFHM']}}]

Context for the issue:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy