In the oceanFFT sample of the CUDA devkit, does anyone understands why the even indices of the cufftPlan2d have their signs switched after the CUFFT_C2C transform is applied on the Phillips spectrum?
// update height map values based on output of FFT
global void updateHeightmapKernel(float heightMap,
float2 ht,
unsigned int width)
{
unsigned int x = blockIdx.xblockDim.x + threadIdx.x;
unsigned int y = blockIdx.yblockDim.y + threadIdx.y;
unsigned int i = y*width+x;
// cos(pi * (m1 + m2))
float sign_correction = ((x + y) & 0x01) ? -1.0f : 1.0f;
heightMap[i] = ht[i].x * sign_correction;
}
Thanks,
Jp