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

Specify output shapes for fft functions #718

Closed
asmeurer opened this issue Dec 6, 2023 · 1 comment · Fixed by #720
Closed

Specify output shapes for fft functions #718

asmeurer opened this issue Dec 6, 2023 · 1 comment · Fixed by #720
Labels
topic: FFT Fast Fourier transforms.
Milestone

Comments

@asmeurer
Copy link
Member

asmeurer commented Dec 6, 2023

The fft functions do not specify what the output axis size should be. This is not necessarily always the same as the input axis size (or n).

For example, NumPy's ihfft uses an output shape of n//2 + 1 (https://numpy.org/doc/stable/reference/generated/numpy.fft.ihfft.html). This size is not mentioned anywhere in the spec.

@leofang
Copy link
Contributor

leofang commented Dec 6, 2023

Yes, I think it'd be nice to mention this for rfft, rfftn, and ihfft. Usually, the n or s input argument defines the length of the output along the transformed axis (and other axes have the same lengths), but for the 3 APIs doing R2C transform, n/s is for the input not output.

@kgryte kgryte added this to the v2023 milestone Dec 6, 2023
asmeurer added a commit to asmeurer/array-api that referenced this issue Dec 12, 2023
Also cleanup some wording for consistency.

This fixes the incorrect output shape for ihfft.

Fixes data-apis#718.
@rgommers rgommers added the topic: FFT Fast Fourier transforms. label Jan 11, 2024
@kgryte kgryte closed this as completed in 937d3b8 Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: FFT Fast Fourier transforms.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants