Skip to content

Commit 811870a

Browse files
committed
[documentation] Improve the matrix-free example with FFT
1 parent d5e89aa commit 811870a

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

docs/src/matrix_free.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,16 @@ This transforms the Poisson equation $\frac{d^2 u(x)}{dx^2} = f(x)$ into an alge
181181
-k^2 \hat{u}_k = \hat{f}_k.
182182
```
183183

184-
By solving for $\hat{u}_k$ and applying the inverse FFT, we can recover the solution $u(x)$ efficiently.
184+
By solving for $\hat{u}_k$ and applying the IFFT, we can recover the solution $u(x)$ efficiently.
185185

186-
The inverse FFT (IFFT) is used to convert data from the frequency domain back to the spatial domain.
187-
Once the solution in frequency space is obtained by dividing the Fourier coefficients $\hat{f}_k$ by $-k^2$, the IFFT is applied to transform the result back to the original grid points in the spatial domain.
186+
The inverse FFT is used to convert data from the frequency domain back to the spatial domain.
187+
Once the solution in frequency space is obtained by dividing the Fourier coefficients $\hat{f}_k$ by $-k^2$,
188+
the IFFT is applied to transform the result back to the original grid points in the spatial domain.
189+
190+
In some cases, even though the FFT provides an efficient way to apply differential operators (such as the Laplacian)
191+
in the frequency domain, a direct solution may not be feasible due to complex boundary conditions,
192+
variable coefficients, or grid irregularities.
193+
In these situations, the FFT must be coupled with a Krylov method to iteratively solve the problem.
188194

189195
This example consists of solving the 1D Poisson equation on a periodic domain $[0, 4\pi]$:
190196

@@ -195,6 +201,9 @@ This example consists of solving the 1D Poisson equation on a periodic domain $[
195201
where $u(x)$ is the unknown solution, and $f(x)$ is the given source term.
196202
We solve this equation using [FFTW.jl](https://github.com/JuliaMath/FFTW.jl) to compute the matrix-free action of the Laplacian within the conjugate gradient solver.
197203

204+
Note that while a direct FFT-based approach can be used here due to the simplicity of the periodic boundary conditions,
205+
this example illustrates how a Krylov method can be employed to solve more challenging problems.
206+
198207
```@example fft_poisson
199208
using FFTW, Krylov, LinearAlgebra
200209

0 commit comments

Comments
 (0)