feat: implement mlx.core.blackman#3136
Conversation
angeloskath
left a comment
There was a problem hiding this comment.
Looks good as well.
Feel free to fix the conflicts and then I can run the tests and merge.
4279cea to
dd96ab7
Compare
|
Thanks |
dd96ab7 to
f24b4c4
Compare
|
Hi team! 👋 |
f24b4c4 to
0f57dbd
Compare
|
Hi @Vlor999, sorry for the delay. Out of curiosity is there a specific project that needs these window functions? They are becoming a bit complicated and I am wondering if they are worth it. Looking for instance at the i0 function and the Kaiser window 🤔 |
I'm currently building a fully GPU-accelerated STFT (Short-Time Fourier Transform) pipeline MLX. The goal is to provide a fast, autograd-compatible alternative to CPU-bound libraries like librosa or scipy. By keeping the framing, windowing, and mx.fft operations entirely within the MLX graph, this will enable highly parallelized audio preprocessing directly integrated into neural network training loops. |
Description
This PR implements the Blackman window function (
mlx.core.blackman), completing the standard trio of window functions (Hanning, Hamming, Blackman) and improving feature parity with NumPy.Implementation Details
mlx/ops.cpp.cosoperation followed by cheap polynomial arithmetic (M < 1(empty) andM = 1(returns[1.0]), matching NumPy's behavior exactly.nanobindwithnb::sigfor proper type hinting and full LaTeX documentation.Test Plan
Verified locally against NumPy for numerical accuracy and edge cases.
Verification script:
Unit Tests:
Added
test_blackmaninpython/tests/test_ops.py.Checklist
Put an
xin the boxes that apply.pre-commit run --all-filesto format my code / installed pre-commit prior to committing changes