NFFT 3.5.3alpha
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
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
64extern "C"
65{
66#endif /* __cplusplus */
67
68typedef 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
82typedef 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
137
154void 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
169void 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
180void fastsum_init_guru_source_nodes(fastsum_plan *ths, int N_total, int nn_oversampled, int m);
181
190void fastsum_init_guru_target_nodes(fastsum_plan *ths, int M_total, int nn_oversampled, int m);
191
197
203
209
215
220void fastsum_exact(fastsum_plan *ths);
221
227
233
239
244void fastsum_trafo(fastsum_plan *ths);
245/* \} */
246
247C regkern(kernel k, R xx, int p, const R *param, R a, R b);
248
250C 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 N_total
number of source knots
Definition fastsum.h:88
void fastsum_precompute(fastsum_plan *ths)
precomputation for fastsum
Definition fastsum.c:1173
int M_total
number of target knots
Definition fastsum.h:89
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
int p
degree of smoothness of regularization
Definition fastsum.h:112
int n
FS__ - fast summation.
Definition fastsum.h:108
int Ad
near field
Definition fastsum.h:120
R * kernel_param
parameters for kernel function
Definition fastsum.h:98
void fastsum_finalize_target_nodes(fastsum_plan *ths)
finalization of fastsum plan
Definition fastsum.c:1020
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
R * x
source knots in d-ball with radius 1/4-eps_b/2
Definition fastsum.h:94
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
C * f_hat
Fourier coefficients of nfft plans.
Definition fastsum.h:110
R MEASURE_TIME_t[8]
Measured time for each step if MEASURE_TIME is set.
Definition fastsum.h:134
C * b
expansion coefficients
Definition fastsum.h:109
struct fastsum_plan_ fastsum_plan
plan for fast summation algorithm
#define X(name)
Include header for C99 complex datatype.
Definition fastsum.h:57
C * f
target evaluations
Definition fastsum.h:92
C * alpha
source coefficients
Definition fastsum.h:91
R eps_B
outer boundary
Definition fastsum.h:114
void fastsum_precompute_target_nodes(fastsum_plan *ths)
precomputation for fastsum
Definition fastsum.c:1141
void fastsum_precompute_source_nodes(fastsum_plan *ths)
precomputation for fastsum
Definition fastsum.c:1086
void fastsum_trafo(fastsum_plan *ths)
fast NFFT-based summation
Definition fastsum.c:1180
void fastsum_exact(fastsum_plan *ths)
direct computation of sums
Definition fastsum.c:1056
kernel k
kernel function
Definition fastsum.h:97
void fastsum_finalize_kernel(fastsum_plan *ths)
finalization of fastsum plan
Definition fastsum.c:1029
unsigned flags
flags precomp.
Definition fastsum.h:100
void fastsum_finalize(fastsum_plan *ths)
finalization of fastsum plan
Definition fastsum.c:1048
C * pre_K
internal
Definition fastsum.h:105
C * Add
spline values
Definition fastsum.h:121
int * permutation_x_alpha
permutation vector of source nodes if STORE_PERMUTATION_X_ALPHA is set
Definition fastsum.h:132
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 d
api
Definition fastsum.h:86
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
void fastsum_finalize_source_nodes(fastsum_plan *ths)
finalization of fastsum plan
Definition fastsum.c:996
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
R * y
target knots in d-ball with radius 1/4-eps_b/2
Definition fastsum.h:95
R eps_I
inner boundary
Definition fastsum.h:113
Internal header file for auxiliary definitions and functions.
Header file for the nfft3 library.
plan for fast summation algorithm
Definition fastsum.h:83