data-apis / array-api

RFC document, tooling and other content related to the array API standard
https://data-apis.github.io/array-api/latest/
MIT License
205 stars 42 forks source link

Specify output shapes for fft functions #718

Closed asmeurer closed 4 months ago

asmeurer commented 7 months ago

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 commented 7 months ago

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.