DSP.jl icon indicating copy to clipboard operation
DSP.jl copied to clipboard

Add FFT convolution kernels

Open wheeheee opened this issue 5 months ago • 1 comments

This is a draft for adding FFT convolution kernels (that are also plans), which are useful for repeated convolutions. A lot has been adapted from the code here, courtesy of @JanJereczek Here's what I have done so far:

  • created an abstract type for FFT convolution kernels tentatively named FFTConvKernel, subtypes R/CFFTConvKernel
  • working code for real and complex FFT convolution kernels and Array, FFTW flag defaults to FFTW.MEASURE
  • in the process, found that we don't check if the output indices are valid (i.e. out[output_indices] doesn't throw) before doing work except for :direct, so I added that. Don't remember if we have discussed this before, so left it in just in case
  • IIUC the kernel/plans can be reused for smaller x, maybe larger depending on nffts
  • not very tested, will add tests later if the feature is wanted

A typical workflow goes like this:

  1. Calculate outsize, the size of the intended output size(out) .+ size(ker) .- 1
  2. Create kernel with RFFTConvKernel or CFFTConvKernel(kernel, outsize)
  3. Run something like conv!(out[i], arrs[i], kernel) in a loop

Feedback would be much appreciated

wheeheee avatar Jul 03 '25 10:07 wheeheee

Codecov Report

:x: Patch coverage is 15.21739% with 39 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 96.98%. Comparing base (7fc3842) to head (0aafe1a).

Files with missing lines Patch % Lines
src/dspbase.jl 15.21% 39 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #638      +/-   ##
==========================================
- Coverage   98.13%   96.98%   -1.16%     
==========================================
  Files          19       19              
  Lines        3277     3320      +43     
==========================================
+ Hits         3216     3220       +4     
- Misses         61      100      +39     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Jul 03 '25 10:07 codecov[bot]