Skip to content

Fix spectralConvolution3dLayer to include low negative frequencies.#22

Open
bwdGitHub wants to merge 1 commit into
mainfrom
fix_battery_fno_example
Open

Fix spectralConvolution3dLayer to include low negative frequencies.#22
bwdGitHub wants to merge 1 commit into
mainfrom
fix_battery_fno_example

Conversation

@bwdGitHub
Copy link
Copy Markdown
Collaborator

This fix is for the spectralConvolution3dLayer. The previous version had 2 related bugs:

  1. It only preserved the low positive frequency modes, which is sufficient in 1d, but not in higher dimensions. In higher dimensions there are frequencies which have low negative frequency in one dimension, that aren't just a conjugate symmetric pair of some all positive low frequency mode.
  2. It was assumed that the sequential ifft operations were all symmetric, in the "complex-to-real FFT" sense. This isn't correct, the first fft is real-to-complex and subsequent fft-s are complex-to-complex. The conjugate-symmetry in higher dimensions is described in the ifftn doc page algorithms section.

I re-ran the example and the results were comparable.

This fix should bring the custom spectralConvolution3dLayer on this repo in line with the R2026a feature spectralConvolution3dLayer

@bwdGitHub bwdGitHub requested a review from conordaly0 May 11, 2026 12:36
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.

1 participant