/// <summary>Computes the inverse Discrete Fourier Transform of a float2 vector x whose length is a power of 4. /// x = { Re[x0] Im[x0] Re[x1] Im[x1] ... Re[xn] Im[xn] }, n = power of 4 (Length = 2*pow(4,n))</summary> public static CLCalc.Program.Variable iFFT4(CLCalc.Program.Variable CLx) { if (CLScale == null) CLScale = new CLCalc.Program.Variable(new float[1]); //Trick: DFT-1 (x) = DFT(x*)*/N; //Conjugate float[] vx = new float[CLx.OriginalVarLength]; CLx.ReadFromDeviceTo(vx); float[] scale = new float[] { 1 }; CLScale.WriteToDevice(scale); kernelConjugate.Execute(new CLCalc.Program.Variable[] { CLx, CLScale }, CLx.OriginalVarLength >> 1); CLx.ReadFromDeviceTo(vx); CLy = FFT4(ref CLx); scale[0] = 1 / (float)(CLx.OriginalVarLength >> 1); CLScale.WriteToDevice(scale); kernelConjugate.Execute(new CLCalc.Program.Variable[] { CLy, CLScale }, CLy.OriginalVarLength >> 1); return CLy; }