Library fourpack

Library fourpack provides a convenient and uniform interface to Fast Fourier Transform implemented in Intel Mathematical Kernel Library and FFTW and for computing fast spherical harmonics transform.

Library FOURPACK was developed for

  1. Implementing fast spherical harmonics transform, direct and inverse, as well as computation of a function with a given set of spherical harmonics at a point with a given longitude and latitude. Fast computation of the derivatives over longitudinal and latitudinal directions is also supported. For dimensions less than 2700 algorithm of Holmes and Featherstone (2002) is used. For dimensions higher than 2700 the algebra of X-number introduced by Fukushima (2012) is used on order to avoid numerical catastrophe at the polar regions related to the insufficient range of double precision numbers. Spherical harmonics transform of degree/order as high as 65536 is supported, although in practice it is limited by the amount of available RAM. The algorithm complexity is O3.

    The following spherical harmonics transform routines are implemented

  2. Providing a convenient interface to fast Fourier transform (FFT). Although the FFT algorithm can be implemented in less than 50 lines, the highly optimized version of FFT may have more than 100 000 lines of code and a rather complicated interface. The optimized routines usually runs one order of magnitude faster, so using them brings tangible benefits.

    The following FFT routines are implemented:

    Program for automatic generation so-called plan for FFT optimization is implemented.

  3. Implementing a digital linear filter in frequency domain. A filter of this kind involves three operations: forward FFT, multiplication the spectrum by a bandpass function, backward FFT.
Package FOURPACK supports parallelization. Fast Fourier Transform and fast spherical harmonics transform are computed in parallel at multicore computers using OpenMP threads. License: GNU Public License.


The latest version fourpack-20200501.tar.bz2



  1. Fourpack library Installation instruction
  2. Fourpack library User guide.
  3. Fourpack library Timing test.


Mark A. Wieczorek
Leonid Petrov


This work was supported by NASA Earth Surface & Interior program, grant NNX12AQ29G.

Back to Astrogeo Center main page.
This web page was prepared by Leonid Petrov ()
Last update: 2020.11.11_12:54:39