Added a helper function for fft.