| 1 |
fastsumS2 - Fast summation of radial functions on the sphere |
| 2 |
|
| 3 |
Introduction |
| 4 |
------------ |
| 5 |
This application deals with approximations to sums of the form |
| 6 |
|
| 7 |
L-1 |
| 8 |
- |
| 9 |
f(xi_d) = > b_l K(eta_l - xi_d) (d=0,...,D-1) (1) |
| 10 |
- |
| 11 |
l=0 |
| 12 |
|
| 13 |
where xi_d, eta_l are arbitrary nodes on the sphere S^2 given in spherical |
| 14 |
coordinates (theta,phi) from [0,pi] x [0,2pi), b_l are complex coefficients |
| 15 |
and K: [-1,1] -> C is a kernel function. Such kernels include the Abel-Poisson |
| 16 |
and singularity kernels as well as locally supported kernels and the spherical |
| 17 |
Gaussian kernel. In the following, we will assume that the reader is familiar |
| 18 |
with the general procedure. A detailed description can be found in [1]. |
| 19 |
|
| 20 |
The fast approximate algorithm usees the fast spherical Fourier transform for |
| 21 |
arbitrary nodes (NFSFT). For more information on this algorithm and notation |
| 22 |
in detail, we refer to [1] and [2]. Alternatively, one can replace the |
| 23 |
individual steps of the NFSFT algirithm by exact but asymptotically slower |
| 24 |
versions or use a direct evaluation and summation of the kernel functions in |
| 25 |
(1). |
| 26 |
|
| 27 |
Directory contents |
| 28 |
------------------ |
| 29 |
fastsumS2.c Example C program |
| 30 |
example.in Example input for fastsum.c |
| 31 |
example.out Example output of fastsum.c on input example.in |
| 32 |
README This file |
| 33 |
Makefile.am Automake template |
| 34 |
fastsumS2.m MATLAB example file that re-produces figures and tables from |
| 35 |
[1] using fastsumS2.c |
| 36 |
readTestcase.m MATLAB function that reads output of fastsumS2.c |
| 37 |
writeTestcase.m MATLAB function that writes input for fastsumS2.c |
| 38 |
|
| 39 |
fastsumS2.c |
| 40 |
----------- |
| 41 |
The C program fastsumS2.c computes approximations to the sums in (1) using the |
| 42 |
aforementioned different algorithms. It reads input from the standard input |
| 43 |
stream and writes output to the standard output stream. The input consists of |
| 44 |
one ore more testcases. Each testcase specifies |
| 45 |
- the algorithm(s) and corresponding parameters, |
| 46 |
- the kernel function and corresponding parameters, |
| 47 |
- the cut-off degree(s) M for the approximation to the kernel function, |
| 48 |
- the numbers D and L of nodes. |
| 49 |
The D and L nodes xi_d and eta_l in (1) are chosen uniformly randomly |
| 50 |
distributed over the sphere S^2. The coefficients b_l in (1) are chosen |
| 51 |
uniformly randomly distributed in the complex square [-1/2,1/2] x i[-1/2,1/2]. |
| 52 |
For more information, see the example input file example.in . |
| 53 |
|
| 54 |
Each parameter is specified by an assignment of the form 'name=value'. Each |
| 55 |
assignment is seperated from the others by at least one whitespace. All |
| 56 |
parameter values are integer or floating point numbers. There are obligatory |
| 57 |
parameters which have to be specified in every testcase and extra |
| 58 |
parameters which are only necessary if the parameters on which each of them |
| 59 |
depends take certain values. The parameters must be specified in the order as |
| 60 |
above. Every parameter has a range of admissible values. The behaviour of the |
| 61 |
program for illegal values of parameters is unspecified. The first parameter |
| 62 |
specification is 'testcases=...' which specifies the number of testcases to |
| 63 |
follow. Each testcase has the following parameters with extra parameters |
| 64 |
marked by an asterisk: |
| 65 |
- nfsft If set to 1, the NFSFT algorithm is used. If set to 0, the |
| 66 |
direct NDSFT algorithm is used. |
| 67 |
* nfft If set to 1, the NFSFT algorithm will internally use the NFFT |
| 68 |
algorithm. If set to 0, the NFSFT algorithm will instead use |
| 69 |
the direct NDSFT algorithm. Extra parameter. Specified only |
| 70 |
if nfsft=1. |
| 71 |
* cutoff An integer > 0 specifying the NFFT cut-off parameter. Extra |
| 72 |
parameter. Specified only if nfft=1. |
| 73 |
* fpt If set to 1, the NFSFT algorithm will internally use the fast |
| 74 |
polynomial transform algorithm (FPT). If set to 0, the NFSFT |
| 75 |
algorithm will instead use the direct discrete polynomial |
| 76 |
transform algorithm (direct DPT). Extra parameter. Specified |
| 77 |
only if nfsft=1. |
| 78 |
* threshold A floating point number > 0 specifying the threshold |
| 79 |
parameter for the FPT algorithm. Extra parameter. Specified |
| 80 |
only if fpt=1. |
| 81 |
- kernel An integer from {0,1,2,3} specifying the type of kernel |
| 82 |
function to be used. The different kernel functions available |
| 83 |
are |
| 84 |
+ the Abel-Poisson kernel Q_h with real parameter h from |
| 85 |
(0,1), |
| 86 |
+ the singularity kernel S_h with real parameter h from |
| 87 |
(0,1), |
| 88 |
+ the locally supported kernel L_h,lambda real parameter h |
| 89 |
from (-1,1) and integer parameter lambda >= 0. |
| 90 |
+ the spherical Gaussian kernel G_sigma with real parameter |
| 91 |
sigma > 0. |
| 92 |
- parameter_sets An integer > 0 specifying the number of parameter sets to |
| 93 |
follow for the chosen type of kernel function. In a testcase, |
| 94 |
the specified type of kernel function can be used with more |
| 95 |
than one set of distinct parameters to yield different kernel |
| 96 |
functions. |
| 97 |
- parameters An integer > 0 specifying the number of parameters that |
| 98 |
specifies each individual kernel function (one for |
| 99 |
Abel-Poisson, singularity and spherical Gaussian kernel, two |
| 100 |
for the locally supported kernel). The parameters' values are |
| 101 |
given afterwards a list floating point numbers order as in |
| 102 |
the description of the kernel functions above and grouped by |
| 103 |
kernel function instance. |
| 104 |
- bandwidths The number of different cut-off degrees M to be used in the |
| 105 |
approximation. There follows a list of positive integers |
| 106 |
specifying the distinct cut-off degrees. |
| 107 |
- node_sets An integer > 0 specifying the number of sets of nodes to |
| 108 |
follow |
| 109 |
- L An integer > 0 specifying the number of source nodes. |
| 110 |
- D An integer > 0 specifying the number of target nodes. |
| 111 |
- compare If set to 1, the result of the approximate algorithm is |
| 112 |
compared to the result of the direct evaluation. If set to 0, |
| 113 |
no comparison is performed. |
| 114 |
* precomputed If set to 1, all values in the sum (1) are precomputed and |
| 115 |
the time measurement for the direct evaluation only measures |
| 116 |
the time needed to sum up these values. Extra parameter. |
| 117 |
Specified only if compare=1. |
| 118 |
* repetitions An integer > 0 specifying the number of times the summation |
| 119 |
process is repeated. Time emasurements are averaged over all |
| 120 |
repetitions. This can be used to compensate for inaccuracies |
| 121 |
in the time measurements for very small computation times. |
| 122 |
|
| 123 |
The output of the program containes all the input but without the parameter |
| 124 |
names and, in addition, the results of time and error measurements after each |
| 125 |
testcase. See the file example.out for an example output on input the contents |
| 126 |
of example.in. |
| 127 |
|
| 128 |
To each combination of kernel function, cut-off degree, and node set |
| 129 |
corresponds a single run of the summation algorithm and therefore a set of |
| 130 |
six resulting values grouped together. These are |
| 131 |
- the time needed for direct evaluation of the sums (1), |
| 132 |
- the time needed for direct evaluation of the sums (1) with the values of |
| 133 |
the kernel functions precomputed, |
| 134 |
- the time needed by the fast summation algorithm using the direct NDSFT |
| 135 |
algorithm, |
| 136 |
- the time needed by the fast summation algorithm using the NFSFT algorithm, |
| 137 |
- the error E_infty for the fast summation algorithm using the direct NDSFT |
| 138 |
algorithm, |
| 139 |
- the error E_infty for the fast summation algorithm using the NFSFT |
| 140 |
algorithm. |
| 141 |
|
| 142 |
Here, the error E_infty is defined as ||f - f_M||_infty / ||b||_1 with the |
| 143 |
infinity norm ||.||_infty, the one norm ||.||_1, the vector f of function |
| 144 |
values computed by direct evaluation of the sums in (1), f_M the vector |
| 145 |
computed by the fast summation algorithm, using either the direct NDSFT or |
| 146 |
the NFSFT algorithm, and the vector b containing the coefficients b_l from |
| 147 |
(1). |
| 148 |
Depending on the parameter combination, some of these (always positive) values |
| 149 |
might be undefined. This indicated by setting these values to -1.0. |
| 150 |
The blocks of resulting values for a single run are grouped for each testcase |
| 151 |
first by the kernel parameters, second by the node sets and third by the |
| 152 |
cut-off bandwidths ordered as in the input. |
| 153 |
|
| 154 |
fastsumS2.m |
| 155 |
----------- |
| 156 |
This MATLAB function demonstrates the fast summation algorithm using the C |
| 157 |
program fastsumS2.c . It allows for selecting different testcases to reproduce |
| 158 |
the figures and tables from [1]. On choosing a testcase, input for the C |
| 159 |
program fastsumS2.c is generated and written to the file data.in , |
| 160 |
fastsumS2.c is called with the generated input writing the result to the file |
| 161 |
data.out where it is read again into MATLAB. In MATLAB, type "help fatsumS2" |
| 162 |
for more information. |
| 163 |
|
| 164 |
readTestcase.m |
| 165 |
-------------- |
| 166 |
This MATLAB function is used by fatsumS2.m and allows for reading testcase |
| 167 |
specifications and results from a file. In MATLAB, type "help readTestcase" |
| 168 |
for more information. |
| 169 |
|
| 170 |
writeTestcase.m |
| 171 |
--------------- |
| 172 |
This MATLAB function is used by fatsumS2.m and allows for writing testcase |
| 173 |
specifications to a file. In MATLAB, type "help readTestcase" for more |
| 174 |
information. |
| 175 |
|
| 176 |
References |
| 177 |
---------- |
| 178 |
[1] Keiner, J., Kunis, S. and Potts, D., Fast summation of radial functions |
| 179 |
on the sphere, Computing 78, 1-15 , 2006 |
| 180 |
|
| 181 |
[2] Kunis, S. and Potts, D., Fast spherical Fourier algorithms, J. Comput. |
| 182 |
Appl. Math. 161, 75-98, 2003 |
| 183 |
|
| 184 |
|
| 185 |
Feedback |
| 186 |
-------- |
| 187 |
If you have comments, questions, or suggestions regarding NFFT, don't |
| 188 |
hesitate to contact us. For more information, news and updates see the NFFT |
| 189 |
website at |
| 190 |
|
| 191 |
http://www.tu-chemnitz.de/~potts/nfft/ |