# Hermitian FFT vs discrete Fourier transform. Python's $\tt hfft$ vs $\tt fft$

What is the difference between the Hermitian FFT and DFT? Particularly in Python, there are two functions fft and hfft.

numpy.fft.hfft(signal) vs numpy.fft.fft(signal)


What I simply could find out is: The Hermitian has to do something with symmetry and needs 50 times longer to calculate, while producing a 'slightly' different result than the 'discrete' FFT. (tested on an audio file of machinery sounds and length of 1.5 sec).

You have to understand that fft is the general function, which always works. hfft, fftr and their derivatives are optimized for special signal constellations and should either be faster or more accurate (if this is at all necessary with modern floating point accuracy).

The hfft function is used, when you expect the spectrum to be real-valued. This happens, if your input signal has even symmetry. I doubt that your audio signal does have this property. Have you been looking for fftr (i.e. fft for a real-valued signal)?

In case your input signal has the even symmetry property, the output of fft and hfft should be exactly the same (up to numerical residual errors). Also, hfft should be a bit faster in this case (otherwise, it would make no sense to use it).

• hfft is basically the same as irfft (just with different sign convention). – Are you sure these are ever faster or more accurate? Actually I'd suspect they're all implemented with the same fft primitive and just automatically take care of adding/removing the symmetry-redundant parts of the signal or imaginary parts of the spectrum. – leftaroundabout Mar 28 '17 at 14:40
• @leftaroundabout Hm, I'm not sure. I have followed the source code of the various fft functions until github.com/numpy/numpy/blob/v1.12.0/numpy/fft/fftpack.c where still different implementations for fft and rfft etc. are there. So, I'm not sure, if it is just the plain fft with some post-processing. – Maximilian Matthé Mar 28 '17 at 15:26
• i never heard it called "hfft()" – robert bristow-johnson Mar 29 '17 at 7:03