SHTns 3.7
Using SHTns in a C program

To make SHTns known by your C program, add

#include <fftw3.h>
#include <shtns.h>
shtns.h is the definition file for SHTns : include this file in your source code to use SHTns.

in the preamble of your source file.

First of all you need to initialize SHTns. There are two ways to do this :

Multi-threaded transforms can be enabled (if available, see Compiling and installing SHTns) by a call to shtns_use_threads before shtns_init or shtns_create.

Then you must allocate some memory (with fftw_malloc so that the memory is properly aligned for vectorized code), and finally you can perform some spherical harmonic transforms.

See also
Look at shtns.h for the function definitions and documentation.
See the C example for a simple usage of SHTns in a C program.

When your program is ready, compile it adding these options to the compiler (gcc) :

-L/path/to/lib/ -I/path/to/include/ -lshtns -lfftw3 -lm