Reputation: 133
I'm coding lattice gauge theory simulation in C++ and to compute observable i need to calculate green's function of 3d laplace operator of the photon field A_mu with anti-periodic boundary conditions. So allowed set of anti-periodic momenta is (pi/L)(2k+1), k ∈ (0..L-1). I wrote the parallel code with fourier transform but it's too slow to be practical for calculations. I wonder can one use FFTW (and DFT in general) for this kind of task?
Upvotes: 0
Views: 336
Reputation: 60760
Double the size of your array, from L
to 2*L
, and fill the second half using the anti-periodic condition f(x+L) = -f(x)
. In a multi-dimensional setting you can do this for each dimension in turn. You can now compute the FFT, manipulate it as required, and compute the IFFT. The first half of the result is the part that corresponds to your domain, the other half you just ignore.
Depending on the operation you apply in the frequency domain, you might get away with a smaller transform size: If you operation needs, say, K
samples around each data point to get a reasonable approximation, then you can pad your data with K
samples on each side (the padding on the left can be put at the end of the array as well, as the FFT assumes periodicity). This leaves an edge effect from the leftmost value in the padded array to the rightmost one, but this edge effect happens K
samples away from your domain, and so should have little effect on it. If K
is close to L/2
, or larger, then doubling the array size is the simpler solution.
Upvotes: 0