2
$\begingroup$

I want to implement Fast Hartley Transform in a script file in MATLAB. Does anyone know have a reference implementation of this in MATLAB or another language so that a complete novice can understand it?

$\endgroup$
  • 3
    $\begingroup$ if you ask me, that makes little to no sense. The fact that you can save quite a few operation with the FHT will be immensely outweighed by the fact that you're doing this within matlab's interpreter – which is notoriously slow. Things like the FFT are implemented in highly-optimized native code, not in matlab scripts. Any matlab-script FFT would be much, much slower than just doing the DFT naively by multiplying with a DFT matrix (because matrix multiplication is, again, implemented natively). takeaway:matlab itself is very slow.If you need fast,implement natively and call from within matlab. $\endgroup$ – Marcus Müller Jan 7 '17 at 23:32
3
$\begingroup$

For the standard algorithmic version, you can get information in An Algorithm for the Fast Hartley transform, R. F. Ulmann (with Fortran versions). A Matlab version of the FHT is provided by Lars Gregersen, exactly as given by @MaximilianMatthé, except that it checks for a real signal input. C++ and C# versions can also be found in ALGLIB: Fast Hartley transform.

For improved versions, that can provide speed-up beyond algorithmic optimization, one can consider other factors, such as memory tricks, hardware optimization, use of binary inputs/outputs, higher-dimension extensions. You can check for instance:

$\endgroup$
2
$\begingroup$

You can resort to the properties of the DHT with the DFT, given in the wikipedia article. For a real-valued function $f$, its DHT in terms of the DFT is given by

$$ \mathcal{H}f = \Re\{\mathcal{F}f\}-\Im\{\mathcal{F}f\}. $$

So, a function for fast Hartley transform can be given by

function Hf = fht(f)
F = fft(f);
Hf = real(F) - imag(F);
end

Though, you need to take care of the normalization factors, and tdhis is up to you and how you define the scale factors of the DHT.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.