Harminv is a free program (and accompanying library) to solve the problem of harmonic inversion – given a discrete-time, finite-length signal that consists of a sum of finitely-many sinusoids (possibly exponentially decaying) in a given bandwidth, it determines the frequencies, decay constants, amplitudes, and phases of those sinusoids.

It can, in principle, provide much better accuracy than straightforwardly extracting FFT peaks, essentially because it assumes a specific form for the signal. (Fourier transforms, in contrast, attempt to represent any data as a sum of sinusoidal components, and are thus limited by the uncertainty principle.) It is also often more robust than directly least-squares fitting the data (which can have problematic convergence), since it re-expresses the problem in terms of simply finding the eigenvalues of a small matrix.

User instructions

Harminv is available via the modules system. To add it and its associated libraries to your environment run:

$ module load harminv/1.4.1

The main program is called ‘harminv’. Please see the man page, links and references contained in the man page and the harminv wiki for user instructions. There is also a library (and associated header files) for using harminv from within your own program.

The harminv wiki states:

“It would be courteous of you to cite Harminv and its author in any publication for which you find it useful, in addition to citing a Mandelshtam reference.”


GNU General Public License.

Admin notes

Harminv was installed mainly as it is recommended for use with Meep. Given it can be used as a library, I compiled it with both intel and gcc compilers. The build system uses a standard autoconf approach.

mkdir build-intel2017; cd build-intel2017
ml purge; ml intel mkl
../harminv-1.4.1/configure --prefix=/common/debian/9.1/Compiler/intel/2017.4/harminv/harminv-1.4.1 CC=icc CXX=icpc F77=ifort LDFLAGS='-mkl' CFLAGS='-fPIC' FFLAGS='-fPIC'
make install

cd ..; mkdir build-gcc63; cd build-gcc63
ml gcc
module load mkl/2015.3/187
../harminv-1.4.1/configure --prefix=/common/debian/9.1/Compiler/gcc/6.3/harminv/harminv-1.4.1 LDFLAGS='-Wl,--start-group -lmkl_gf_lp64 -lmkl_sequential -lmkl_core -Wl,--end-group -lpthread -lm'
make install