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

Example of source code to convolve two real-valued functions defined on the 2-sphere. Uses seminaive algorithms. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fftw3.h>
#include "s2kit/FST_semi_memo.h"
#include "s2kit/cospml.h"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Example of source code to convolve two real-valued functions defined on the 2-sphere. Uses seminaive algorithms.

Precomputes all necessary data in memory prior to transforming.
Reads in a function and filter from files specified at shell level, and dumps output into a specified file.

Note
Both function and filter must be 4*bw*bw arrays.

Sample call:

test_conv_semi_memo signal_file filter_file output_file bandwidth
test_conv_semi_memo s64.dat f64.dat o64.dat 64

In this example, the signal and filter function samples are stored in the files:
s64.dat (signal for bandwidth = 64)
f64.dat (filter for bandwidth = 64)
s128.dat (signal for bandwidth = 128)
f128.dat (filter for bandwidth = 128)
The signal is a "noisy" bump on the sphere, and the filter is a smooth, symmetric bump at the north pole.

The samples for each are stored in "latitude-major" format. I.e.

(theta_0, phi_0)
(theta_0, phi_1)
(theta_0, phi_2)
...
(theta_0, phi_{bw-1})
(theta_1, phi_0)
(theta_1, phi_1)
...
(theta_{bw-1}, phi_{bw-1})
where theta_k = pi*(2*j+1)/(4*bw)
phi_j = 2*pi*k/(2*bw)

The location of the maximum value in the output file tells us where the bump is.

Definition in file test_conv_semi_memo.c.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 53 of file test_conv_semi_memo.c.