NFFT  3.3.2alpha
fastsum.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002, 2016 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 
36 #ifndef fastsum_h_inc
37 #define fastsum_h_inc
38 
39 #include "config.h"
40 
42 #ifdef HAVE_COMPLEX_H
43 #include <complex.h>
44 #endif
45 
47 #include "nfft3.h"
48 #include "infft.h"
49 
50 #undef X
51 #define X(name) NFFT(name)
52 
53 #if !(defined(NF_LIN) || defined(NF_QUADR) || defined(NF_KUB))
54  #define NF_KUB
55 #endif
56 
57 #ifdef __cplusplus
58 extern "C"
59 {
60 #endif /* __cplusplus */
61 
62 typedef C (*kernel)(R , int , const R *);
63 
67 #define EXACT_NEARFIELD (1U<< 0)
68 
69 #define NEARFIELD_BOXES (1U<< 1)
70 
72 typedef struct fastsum_plan_
73 {
76  int d;
78  int N_total;
79  int M_total;
81  C *alpha;
82  C *f;
84  R *x;
85  R *y;
87  kernel k;
90  unsigned flags;
95  C *pre_K;
98  int n;
99  C *b;
101  int p;
102  R eps_I; /* fixed to p/n so far */
103  R eps_B; /* fixed to 1/16 so far */
104 
105  X(plan) mv1;
106  X(plan) mv2;
109  int Ad;
110  C *Add;
112  /* things for computing *b - are they used only once?? */
113  FFTW(plan) fft_plan;
114 
115  int box_count;
116  int box_count_per_dim;
117  int *box_offset;
118  R *box_x;
119  C *box_alpha;
120 
122 } fastsum_plan;
123 
140 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);
141 
146 void fastsum_finalize(fastsum_plan *ths);
147 
152 void fastsum_exact(fastsum_plan *ths);
153 
159 
164 void fastsum_trafo(fastsum_plan *ths);
165 /* \} */
166 
167 C regkern(kernel k, R xx, int p, const R *param, R a, R b);
168 
170 C kubintkern(const R x, const C *Add,
171  const int Ad, const R a);
172 
173 #ifdef __cplusplus
174 } /* extern "C" */
175 #endif /* __cplusplus */
176 
177 #endif
178 /* fastsum.h */
fastsum_plan_::Add
C * Add
spline values
Definition: fastsum.h:110
fastsum_plan_::pre_K
C * pre_K
internal
Definition: fastsum.h:95
fastsum_plan_::f
C * f
target evaluations
Definition: fastsum.h:82
fastsum_plan_::y
R * y
target knots in d-ball with radius 1/4-eps_b/2
Definition: fastsum.h:85
fastsum_plan_::x
R * x
source knots in d-ball with radius 1/4-eps_b/2
Definition: fastsum.h:84
fastsum_plan_::alpha
C * alpha
source coefficients
Definition: fastsum.h:81
kubintkern
C kubintkern(const R x, const C *Add, const int Ad, const R a)
linear spline interpolation in near field with even kernels
Definition: fastsum.c:318
fastsum_plan_::flags
unsigned flags
flags precomp.
Definition: fastsum.h:90
fastsum_plan_::eps_I
R eps_I
inner boundary
Definition: fastsum.h:102
regkern
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
fastsum_plan_::d
int d
api
Definition: fastsum.h:76
fastsum_plan_
plan for fast summation algorithm
Definition: fastsum.h:72
fastsum_plan_::p
int p
degree of smoothness of regularization
Definition: fastsum.h:101
fastsum_init_guru
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:691
fastsum_finalize
void fastsum_finalize(fastsum_plan *ths)
finalization of fastsum plan
Definition: fastsum.c:844
fastsum_plan
struct fastsum_plan_ fastsum_plan
plan for fast summation algorithm
fastsum_trafo
void fastsum_trafo(fastsum_plan *ths)
fast NFFT-based summation
Definition: fastsum.c:1055
fastsum_plan_::k
kernel k
kernel function
Definition: fastsum.h:87
fastsum_plan_::eps_B
R eps_B
outer boundary
Definition: fastsum.h:103
fastsum_plan_::n
int n
FS__ - fast summation.
Definition: fastsum.h:98
fastsum_plan_::MEASURE_TIME_t
R MEASURE_TIME_t[8]
Measured time for each step if MEASURE_TIME is set.
Definition: fastsum.h:121
fastsum_plan_::N_total
int N_total
number of source knots
Definition: fastsum.h:78
fastsum_plan_::Ad
int Ad
near field
Definition: fastsum.h:109
fastsum_plan_::kernel_param
R * kernel_param
parameters for kernel function
Definition: fastsum.h:88
fastsum_plan_::b
C * b
expansion coefficients
Definition: fastsum.h:99
X
#define X(name)
Include header for C99 complex datatype.
Definition: fastsum.h:51
nfft3.h
fastsum_exact
void fastsum_exact(fastsum_plan *ths)
direct computation of sums
Definition: fastsum.c:877
fastsum_precompute
void fastsum_precompute(fastsum_plan *ths)
precomputation for fastsum
Definition: fastsum.c:907
fastsum_plan_::M_total
int M_total
number of target knots
Definition: fastsum.h:79