ENH: add Chebyshev (cosine) transforms implemented via FFTs #16999
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.
ENH: add Chebyshev (cosine) transforms implemented via FFTs
This PR adds the two 1D Chebyshev transform functions
chebyfft
andichebyfft
into thenumpy.fft
module, utilizing the real FFTsrfft
andirfft
, respectively. As far as I understand,pockefft
does not support cosine transforms natively; for this reason, an even extension of the input vector is constructed, whose real FFT corresponds to a cosine transform.The motivation behind these two additions is the ability to quickly perform direct and inverse Chebyshev transforms with
numpy
, without the need to write scripts that do the necessary (although minor) modifications. Chebyshev transforms are used often e.g. in the spectral integration of PDE problems; thus, I believe having them implemented innumpy
would be useful to many people in the community.I will also post a message to the mailing list to probe interest and gather feedback from more people that are potentially interested in such a feature. In addition, proper tests should be included to make sure the functions work properly, something that I haven't done yet.
@seberg @peterbell10 @leofang @grlee77