NFFT  3.5.0
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 
79 #define STORE_PERMUTATION_X_ALPHA (1U<< 2)
80 
82 typedef struct fastsum_plan_
83 {
86  int d;
88  int N_total;
89  int M_total;
91  C *alpha;
92  C *f;
94  R *x;
95  R *y;
97  kernel k;
100  unsigned flags;
105  C *pre_K;
108  int n;
109  C *b;
110  C *f_hat;
112  int p;
113  R eps_I; /* fixed to p/n so far */
114  R eps_B; /* fixed to 1/16 so far */
115 
116  X(plan) mv1;
117  X(plan) mv2;
120  int Ad;
121  C *Add;
123  /* things for computing *b - are they used only once?? */
124  FFTW(plan) fft_plan;
125 
126  int box_count;
127  int box_count_per_dim;
128  int *box_offset;
129  R *box_x;
130  C *box_alpha;
131 
136 } fastsum_plan;
137 
154 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);
155 
169 void fastsum_init_guru_kernel(fastsum_plan *ths, int d, kernel k, R *param,
170  unsigned flags, int nn, int p, R eps_I, R eps_B);
171 
180 void fastsum_init_guru_source_nodes(fastsum_plan *ths, int N_total, int nn_oversampled, int m);
181 
190 void fastsum_init_guru_target_nodes(fastsum_plan *ths, int M_total, int nn_oversampled, int m);
191 
196 void fastsum_finalize(fastsum_plan *ths);
197 
203 
209 
215 
220 void fastsum_exact(fastsum_plan *ths);
221 
227 
233 
239 
244 void fastsum_trafo(fastsum_plan *ths);
245 /* \} */
246 
247 C regkern(kernel k, R xx, int p, const R *param, R a, R b);
248 
250 C kubintkern(const R x, const C *Add,
251  const int Ad, const R a);
252 
253 #ifdef __cplusplus
254 } /* extern "C" */
255 #endif /* __cplusplus */
256 
257 #endif
258 /* fastsum.h */
int M_total
number of target knots
Definition: fastsum.h:89
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:132
R eps_B
outer boundary
Definition: fastsum.h:114
R * kernel_param
parameters for kernel function
Definition: fastsum.h:98
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:121
C * f_hat
Fourier coefficients of nfft plans.
Definition: fastsum.h:110
C * pre_K
internal
Definition: fastsum.h:105
void fastsum_finalize_kernel(fastsum_plan *ths)
finalization of fastsum plan
Definition: fastsum.c:1029
int Ad
near field
Definition: fastsum.h:120
plan for fast summation algorithm
Definition: fastsum.h:82
C * b
expansion coefficients
Definition: fastsum.h:109
void fastsum_precompute_source_nodes(fastsum_plan *ths)
precomputation for fastsum
Definition: fastsum.c:1086
C * alpha
source coefficients
Definition: fastsum.h:91
unsigned flags
flags precomp.
Definition: fastsum.h:100
void fastsum_trafo(fastsum_plan *ths)
fast NFFT-based summation
Definition: fastsum.c:1180
int d
api
Definition: fastsum.h:86
void fastsum_precompute(fastsum_plan *ths)
precomputation for fastsum
Definition: fastsum.c:1173
int N_total
number of source knots
Definition: fastsum.h:88
#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:1020
R MEASURE_TIME_t[8]
Measured time for each step if MEASURE_TIME is set.
Definition: fastsum.h:134
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:987
C * f
target evaluations
Definition: fastsum.h:92
void fastsum_precompute_target_nodes(fastsum_plan *ths)
precomputation for fastsum
Definition: fastsum.c:1141
void fastsum_finalize_source_nodes(fastsum_plan *ths)
finalization of fastsum plan
Definition: fastsum.c:996
kernel k
kernel function
Definition: fastsum.h:97
R * y
target knots in d-ball with radius 1/4-eps_b/2
Definition: fastsum.h:95
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:108
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:955
Header file for the nfft3 library.
int p
degree of smoothness of regularization
Definition: fastsum.h:112
R eps_I
inner boundary
Definition: fastsum.h:113
void fastsum_finalize(fastsum_plan *ths)
finalization of fastsum plan
Definition: fastsum.c:1048
void fastsum_exact(fastsum_plan *ths)
direct computation of sums
Definition: fastsum.c:1056
R * x
source knots in d-ball with radius 1/4-eps_b/2
Definition: fastsum.h:94