NFFT  3.4.1
fastsum.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002, 2017 Jens Keiner, Stefan Kunis, Daniel Potts
3  *
4  * This program is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU General Public License as published by the Free Software
6  * Foundation; either version 2 of the License, or (at your option) any later
7  * version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12  * details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc., 51
16  * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18 
42 #ifndef fastsum_h_inc
43 #define fastsum_h_inc
44 
45 #include "config.h"
46 
48 #ifdef HAVE_COMPLEX_H
49 #include <complex.h>
50 #endif
51 
53 #include "nfft3.h"
54 #include "infft.h"
55 
56 #undef X
57 #define X(name) NFFT(name)
58 
59 #if !(defined(NF_LIN) || defined(NF_QUADR) || defined(NF_KUB))
60  #define NF_KUB
61 #endif
62 
63 #ifdef __cplusplus
64 extern "C"
65 {
66 #endif /* __cplusplus */
67 
68 typedef C (*kernel)(R , int , const R *);
69 
73 #define EXACT_NEARFIELD (1U<< 0)
74 
75 #define NEARFIELD_BOXES (1U<< 1)
76 
77 #define STORE_PERMUTATION_X_ALPHA (1U<< 2)
78 
80 typedef struct fastsum_plan_
81 {
84  int d;
86  int N_total;
87  int M_total;
89  C *alpha;
90  C *f;
92  R *x;
93  R *y;
95  kernel k;
98  unsigned flags;
103  C *pre_K;
106  int n;
107  C *b;
108  C *f_hat;
110  int p;
111  R eps_I; /* fixed to p/n so far */
112  R eps_B; /* fixed to 1/16 so far */
113 
114  X(plan) mv1;
115  X(plan) mv2;
118  int Ad;
119  C *Add;
121  /* things for computing *b - are they used only once?? */
122  FFTW(plan) fft_plan;
123 
124  int box_count;
125  int box_count_per_dim;
126  int *box_offset;
127  R *box_x;
128  C *box_alpha;
129 
134 } fastsum_plan;
135 
152 void fastsum_init_guru(fastsum_plan *ths, int d, int N_total, int M_total, kernel k, R *param, unsigned flags, int nn, int m, int p, R eps_I, R eps_B);
153 
167 void fastsum_init_guru_kernel(fastsum_plan *ths, int d, kernel k, R *param,
168  unsigned flags, int nn, int p, R eps_I, R eps_B);
169 
178 void fastsum_init_guru_source_nodes(fastsum_plan *ths, int N_total, int nn_oversampled, int m);
179 
188 void fastsum_init_guru_target_nodes(fastsum_plan *ths, int M_total, int nn_oversampled, int m);
189 
194 void fastsum_finalize(fastsum_plan *ths);
195 
201 
207 
213 
218 void fastsum_exact(fastsum_plan *ths);
219 
225 
231 
237 
242 void fastsum_trafo(fastsum_plan *ths);
243 /* \} */
244 
245 C regkern(kernel k, R xx, int p, const R *param, R a, R b);
246 
248 C kubintkern(const R x, const C *Add,
249  const int Ad, const R a);
250 
251 #ifdef __cplusplus
252 } /* extern "C" */
253 #endif /* __cplusplus */
254 
255 #endif
256 /* fastsum.h */
int M_total
number of target knots
Definition: fastsum.h:87
C regkern(kernel k, R xx, int p, const R *param, R a, R b)
regularized kernel with K_I arbitrary and K_B smooth to zero
Definition: fastsum.c:81
int * permutation_x_alpha
permutation vector of source nodes if STORE_PERMUTATION_X_ALPHA is set
Definition: fastsum.h:130
R eps_B
outer boundary
Definition: fastsum.h:112
R * kernel_param
parameters for kernel function
Definition: fastsum.h:96
void fastsum_init_guru_source_nodes(fastsum_plan *ths, int N_total, int nn_oversampled, int m)
initialize source nodes dependent part of fast summation plan
Definition: fastsum.c:887
C * Add
spline values
Definition: fastsum.h:119
C * f_hat
Fourier coefficients of nfft plans.
Definition: fastsum.h:108
C * pre_K
internal
Definition: fastsum.h:103
void fastsum_finalize_kernel(fastsum_plan *ths)
finalization of fastsum plan
Definition: fastsum.c:1020
int Ad
near field
Definition: fastsum.h:118
plan for fast summation algorithm
Definition: fastsum.h:80
C * b
expansion coefficients
Definition: fastsum.h:107
void fastsum_precompute_source_nodes(fastsum_plan *ths)
precomputation for fastsum
Definition: fastsum.c:1077
C * alpha
source coefficients
Definition: fastsum.h:89
unsigned flags
flags precomp.
Definition: fastsum.h:98
void fastsum_trafo(fastsum_plan *ths)
fast NFFT-based summation
Definition: fastsum.c:1173
int d
api
Definition: fastsum.h:84
void fastsum_precompute(fastsum_plan *ths)
precomputation for fastsum
Definition: fastsum.c:1166
int N_total
number of source knots
Definition: fastsum.h:86
#define X(name)
Include header for C99 complex datatype.
Definition: fastsum.h:57
void fastsum_finalize_target_nodes(fastsum_plan *ths)
finalization of fastsum plan
Definition: fastsum.c:1011
R MEASURE_TIME_t[8]
Measured time for each step if MEASURE_TIME is set.
Definition: fastsum.h:132
void fastsum_init_guru(fastsum_plan *ths, int d, int N_total, int M_total, kernel k, R *param, unsigned flags, int nn, int m, int p, R eps_I, R eps_B)
initialization of fastsum plan
Definition: fastsum.c:981
C * f
target evaluations
Definition: fastsum.h:90
void fastsum_precompute_target_nodes(fastsum_plan *ths)
precomputation for fastsum
Definition: fastsum.c:1134
void fastsum_finalize_source_nodes(fastsum_plan *ths)
finalization of fastsum plan
Definition: fastsum.c:990
kernel k
kernel function
Definition: fastsum.h:95
R * y
target knots in d-ball with radius 1/4-eps_b/2
Definition: fastsum.h:93
C kubintkern(const R x, const C *Add, const int Ad, const R a)
cubic spline interpolation in near field with even kernels
Definition: fastsum.c:318
int n
FS__ - fast summation.
Definition: fastsum.h:106
void fastsum_init_guru_kernel(fastsum_plan *ths, int d, kernel k, R *param, unsigned flags, int nn, int p, R eps_I, R eps_B)
initialize node independent part of fast summation plan
Definition: fastsum.c:779
void fastsum_init_guru_target_nodes(fastsum_plan *ths, int M_total, int nn_oversampled, int m)
initialize target nodes dependent part of fast summation plan
Definition: fastsum.c:949
Header file for the nfft3 library.
int p
degree of smoothness of regularization
Definition: fastsum.h:110
R eps_I
inner boundary
Definition: fastsum.h:111
void fastsum_finalize(fastsum_plan *ths)
finalization of fastsum plan
Definition: fastsum.c:1039
void fastsum_exact(fastsum_plan *ths)
direct computation of sums
Definition: fastsum.c:1047
R * x
source knots in d-ball with radius 1/4-eps_b/2
Definition: fastsum.h:92