Repository navigation
feat(fft): numpy.fft on arrays, over go-fft - #43
Merged
Merged
Conversation
Package fft applies go-fft's transforms along any axes of an array, with numpy's n/s, axes and norm: FFT/IFFT, RFFT/IRFFT, HFFT/IHFFT, the 2-D and N-D forms, FFTFreq/RFFTFreq and FFTShift/IFFTShift. As in NumPy 2, float32 and complex64 inputs stay in single precision; a complex input to a real transform is an error. An axis listed twice is transformed twice, in numpy's order (go-fft refuses it, so those calls run one axis at a time). Checked against numpy.fft 2.5.3: 617 cases over 5 dtypes, 4 shapes and 33 argument sets (110 of them errors in both), within 64 eps of the result's magnitude. Swapping hfft's scaling fails 20 of them. Coverage 100%. Also: README describes the dtypes and the fft package. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
numpy.ffton arrays: a newfftsubpackage applying go-fft v0.23.0's transforms along any axes of anArray, with numpy'sn/s,axesandnorm.What
FFT/IFFT,RFFT/IRFFT,HFFT/IHFFT,FFT2/IFFT2/RFFT2/IRFFT2,FFTN/IFFTN/RFFTN/IRFFTN(each with a...With(a, Options{S, Axes, Norm})form),FFTFreq/RFFTFreq,FFTShift/IFFTShift....32transforms); a complex input to a real transform is an error.github.com/go-fft/fft(zero dependencies of its own); only importers ofndarray/fftcompile it.Verification
fft/testdata/cases.py→cases.json(embedded): 617 numpy.fft 2.5.3 cases over 5 dtypes × 4 shapes × 33 argument sets, 110 of them errors in numpy that must be errors here. All pass: dtype and shape exact, values within 64 eps of the result's magnitude.hfftwith the unswapped norm fails 20 cases.🤖 Generated with Claude Code