Skip to content

Add batched and multi-dimensional rfft/irfft support#60

Open
jamesquinlan wants to merge 1 commit into
JuliaApproximation:mainfrom
jamesquinlan:main
Open

Add batched and multi-dimensional rfft/irfft support#60
jamesquinlan wants to merge 1 commit into
JuliaApproximation:mainfrom
jamesquinlan:main

Conversation

@jamesquinlan
Copy link
Copy Markdown

Motivation: add support for AbstractMatrix and higher-dim AbstractArray types in rfft and irfft. It was needed to support workflows in SpeedyTransforms.jl which call plans on 2d views. Previously, generic_rfft only handled AbstractVector giving a MehtodError for matrces.

New Features:

  • Batched 1d transfomrs: Compute rffts along any dimension of an array.
  • Support transforms over regions (aligns with AbstractFFTs interface.
  • Handle plan inversions between real and complex types

Minor Bug Fixes & Improvements:

  • plan_rfft stores length of the tranformed dimension instead of the total array length
  • Fixed double-scaling bug when normalizing multi-dims array
  • Lossened pinv in DummyPlan to allow real-input plans to store complex-output inverses.

Verification:

  • added set of tests in test/fft_tests.jl of batached 1d rfft/irfft along different dimensions
  • 2d rffts
  • plan inversion
  • all existing tests passed (with a relaxation of tol = 100eps

Signed-off-by: jamesquinlan <james@stillwater-sc.com>
@milankl
Copy link
Copy Markdown
Collaborator

milankl commented May 26, 2026

Awesome thanks for this effort! Feel free to keep @maximilian-gelbrecht and me updated about this progress. We have recently implemented MatrixSpectralTransform in SpeedyTransforms as it's fast at low resolutions with the side effect of being more type flexible as it only needs a matrix vector multiplication. But being able to use GenericFFT is also great!

@codecov
Copy link
Copy Markdown

codecov Bot commented May 26, 2026

Codecov Report

❌ Patch coverage is 85.36585% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.82%. Comparing base (eaae4c0) to head (645f59c).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
src/fft.jl 85.36% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #60      +/-   ##
==========================================
+ Coverage   76.05%   80.82%   +4.77%     
==========================================
  Files           2        2              
  Lines         213      266      +53     
==========================================
+ Hits          162      215      +53     
  Misses         51       51              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants