-
Notifications
You must be signed in to change notification settings - Fork 22
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
Numpy FFT implementation? #39
Comments
@vade I have no plans to implement FFT for now, but maybe I can implement numpy's FFT to use some
What do you mean? I'm not good at English... lol |
Hi. We're (my company) is looking at using Matft library for usage in our product. We might want to sponsor some features, ie: pay you to do some work on Matft for the community under the same BSD license, so everyone can benefit and can be shared by all. Some things that could be awesome:
It would be really good for the Swift / ML / Ai / Computer Vision community to have a native, fast library similar to functionality to Numpy ! |
Really!? Anyway, I’ll try to implement some features you mentioned!
|
Hah! Glad you're feeling motivated. Before we all get carried away its helpful to align and set some expectations. I'll send you an email to the address on your git account. Look for an email from anton [at] :) Thanks! |
OK! Notice: |
numpy implementation code |
I've just implemented let a = MfArray([0, 1, 0, 0])
let real = MfArray([ 1, 0, -1])
let imag = MfArray([ 0, -1, 0])
XCTAssertEqual(Matft.fft.rfft(a), MfArray(real: real, imag: imag, mftype: .Float))
Its optimization may be different from numpy's one. |
Memo: https://tiny-wing.hatenablog.com/entry/2016/06/27/093809 |
Because vDSP needs the exponent of 2 as an argument, it seems vDSP function cannot calculate odd frequencies? |
* fft * implemented rfft backward forward (#39) * rfft_forward * passed real_forward * irfft * modified to_complex * implemented irfft but memory leak occurred... (#39) * passed rfft and irfft test (#39) * fixed bug (#42) * modified vDSP rFFT * add fft --------- Co-authored-by: jjjkkkjjj-mizuno <[email protected]>
I merged fft branch into master |
Hi there
Firstly, this library looks amazing. You've done a ton of work and it looks really promising. Thank you!
I was curious if there was any plans to implement Numpy's FFTs in vDSP? If not, do you do work for hire?
I did some work looking into this myself for work on porting OpenAI's Whisper to CoreML / Accelerate https://github.com/vade/OpenAI-Whisper-CoreML
And I documented some of my findings in this issue here: vade/OpenAI-Whisper-CoreML#1
It seems like Numpy, PyTorch, Rosa / RosaKit all use PocketFFT to do non power of 2 DFTs, which is why the output matches more or less exactly numerically.
PocketFFT doesn't use vDSP, but rather scalar - no simd acceleration.
Given the rest of MatFT's current implementation, doing the STFT and Log Mel work in MatFT would just work. The only missing piece is a numerically equivalent implementation of the Numpy / Torch 'real to complex' (rfft) logic.
Thank you again for all the work on Mattft!
The text was updated successfully, but these errors were encountered: