mathjs icon indicating copy to clipboard operation
mathjs copied to clipboard

FFT support for arbitrary size matrices

Open HanchaiN opened this issue 3 years ago • 1 comments

Currently, math.fft and math.ifft only deal with arrays with power-of-two size. However, there are other algorithms such as Bluestein's algorithm that work with the compound- and/or prime-sized arrays which will make evaluating the FFT on any data size.

Originally posted by @HanchaiN in https://github.com/josdejong/mathjs/issues/46#issuecomment-1136624658

HanchaiN avatar May 25 '22 15:05 HanchaiN

Thanks for opening this feature request 👍

josdejong avatar May 27 '22 11:05 josdejong

hello, I have implemented a Chirp-z Transform function inside fft.js to calculate non-power-of-2 FFT. I have also added test cases in fft.test.js ( I used scipy.fft and scipy.fft2 to compare results)

I was able to run npm run test and npm run build. Do I just go ahead to create a pull request? thanks

the fork is here:

https://github.com/cyavictor88/mathjs/tree/non-power-of-2-FFT

cyavictor88 avatar Feb 15 '23 08:02 cyavictor88

That sounds promising @cyavictor88 , thanks! Yes please open a PR with your implementation.

josdejong avatar Feb 16 '23 16:02 josdejong

Addressed via #2900.

josdejong avatar Feb 23 '23 14:02 josdejong

Published now in v11.6.0.

josdejong avatar Feb 24 '23 09:02 josdejong