func BenchmarkFFTG(b *testing.B) { in := make([]complex128, N) out := make([]complex128, N) for i := 0; i < b.N; i++ { fft.FFT(in, out) } }
func FFTWSpec(c gospec.Context) { c.Specify("Check agains fftw", func() { N := 2 * 3 * 5 * 7 * 11 in := make([]complex128, N) out_fft := make([]complex128, N) out_fftw := make([]complex128, N) for i := range in { in[i] = complex(float64(i/1000-100), float64(i)/10) } fftw.PlanDft1d(in, out_fftw, fftw.Forward, fftw.Estimate).Execute() fft.FFT(in, out_fft) tolerance := 1e-5 for i := range out_fft { c.Expect(real(out_fft[i]), IsWithin(tolerance), real(out_fftw[i])) c.Expect(imag(out_fft[i]), IsWithin(tolerance), imag(out_fftw[i])) } }) }