S2kit  1.1
Toolkit for working with functions defined on the sphere
test_s2_semi_fly.c File Reference

Example of source code to computie spherical harmonic transform using the seminaive and naive algorithms. More...

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <fftw3.h>
#include "s2kit/FST_semi_fly.h"
#include "s2kit/weights.h"
#include "s2kit/util.h"
#include "util/csecond.h"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Example of source code to computie spherical harmonic transform using the seminaive and naive algorithms.

The code will compute associated Legendre functions on the fly. This will be part of what's being timed.

In its current state, assuming that will seminaive at all orders. If you wish to change this, modify the cutoff variable in this file, i.e. cutoff = ... at what order to switch from seminaive to naive algorithm.

Idea is to record the execution time for the spectral -> grid -> spectral roundtrip.
The strategy is to generate random coefficients representing a complete spherical harmonic series of funcions Y(m,l). The ordering of the these coefficients is assumed to be the same as an output of the FSTSemiFly() function, namely:

f(0,0) f(0,1) f(0,2) ... f(0,bw-1)
f(1,1) f(1,2) ... f(1,bw-1)
etc.
f(bw-2,bw-2) f(bw-2,bw-1)
f(bw-1,bw-1)
f(-(bw-1),bw-1)
f(-(bw-2),bw-2) f(-(bw-2),bw-1)
etc.
f(-2,2) ... f(-2,bw-1)
f(-1,1) f(-1,2) ... f(-1,bw-1)

This means that there are (bw*bw) coefficients.

Once the coefficients are generated, the corresponding function is synthesized using InvFSTSemiFly(), then transformed (analyzed) using FSTSemiFly(). Then timing data will be printed.

Sample call:

test_s2_semi_fly bw loops [error_file]
Note
In this program, the coefficients generated are such that the grid points (sample values) produced are real. InvFSTSemiFly() and FSTSemiFly() will take advantage of this. If you wish to change this, change the data_format argument of each function further down from REAL to COMPLEX. This is also documented in the file FST_semi_fly.c

Definition in file test_s2_semi_fly.c.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 59 of file test_s2_semi_fly.c.