fastsum.h
Go to the documentation of this file.
/*
* Copyright (c) 2002, 2017 Jens Keiner, Stefan Kunis, Daniel Potts
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef fastsum_h_inc
#define fastsum_h_inc
#include "config.h"
#ifdef HAVE_COMPLEX_H
#include <complex.h>
#endif
#include "nfft3.h"
#include "infft.h"
#undef X
#define X(name) NFFT(name)
#if !(defined(NF_LIN) || defined(NF_QUADR) || defined(NF_KUB))
#define NF_KUB
#endif
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
typedef C (*kernel)(R , int , const R *);
#define EXACT_NEARFIELD (1U<< 0)
#define NEARFIELD_BOXES (1U<< 1)
#define STORE_PERMUTATION_X_ALPHA (1U<< 2)
typedef struct fastsum_plan_
{
int d;
int N_total;
int M_total;
C *alpha;
C *f;
R *x;
R *y;
kernel k;
R *kernel_param;
unsigned flags;
C *pre_K;
int n;
C *b;
C *f_hat;
int p;
R eps_I; /* fixed to p/n so far */
R eps_B; /* fixed to 1/16 so far */
X(plan) mv1;
X(plan) mv2;
int Ad;
C *Add;
/* things for computing *b - are they used only once?? */
FFTW(plan) fft_plan;
int box_count;
int box_count_per_dim;
int *box_offset;
R *box_x;
C *box_alpha;
int *permutation_x_alpha;
R MEASURE_TIME_t[8];
} fastsum_plan;
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);
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);
void fastsum_init_guru_source_nodes(fastsum_plan *ths, int N_total, int nn_oversampled, int m);
void fastsum_init_guru_target_nodes(fastsum_plan *ths, int M_total, int nn_oversampled, int m);
void fastsum_finalize(fastsum_plan *ths);
void fastsum_finalize_source_nodes(fastsum_plan *ths);
void fastsum_finalize_target_nodes(fastsum_plan *ths);
void fastsum_finalize_kernel(fastsum_plan *ths);
void fastsum_exact(fastsum_plan *ths);
void fastsum_precompute_source_nodes(fastsum_plan *ths);
void fastsum_precompute_target_nodes(fastsum_plan *ths);
void fastsum_precompute(fastsum_plan *ths);
void fastsum_trafo(fastsum_plan *ths);
/* \} */
C regkern(kernel k, R xx, int p, const R *param, R a, R b);
C kubintkern(const R x, const C *Add,
const int Ad, const R a);
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif
/* fastsum.h */
fastsum_plan_::M_total
int M_total
number of target knots
Definition: fastsum.h:89
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_::permutation_x_alpha
int * permutation_x_alpha
permutation vector of source nodes if STORE_PERMUTATION_X_ALPHA is set
Definition: fastsum.h:132
fastsum_plan_::eps_B
R eps_B
outer boundary
Definition: fastsum.h:114
fastsum_plan_::kernel_param
R * kernel_param
parameters for kernel function
Definition: fastsum.h:98
fastsum_init_guru_source_nodes
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
fastsum_plan_::Add
C * Add
spline values
Definition: fastsum.h:121
fastsum_plan_::f_hat
C * f_hat
Fourier coefficients of nfft plans.
Definition: fastsum.h:110
fastsum_plan_::pre_K
C * pre_K
internal
Definition: fastsum.h:105
fastsum_finalize_kernel
void fastsum_finalize_kernel(fastsum_plan *ths)
finalization of fastsum plan
Definition: fastsum.c:1029
fastsum_plan_::Ad
int Ad
near field
Definition: fastsum.h:120
fastsum_plan_
plan for fast summation algorithm
Definition: fastsum.h:82
fastsum_plan_::b
C * b
expansion coefficients
Definition: fastsum.h:109
fastsum_precompute_source_nodes
void fastsum_precompute_source_nodes(fastsum_plan *ths)
precomputation for fastsum
Definition: fastsum.c:1086
fastsum_plan_::alpha
C * alpha
source coefficients
Definition: fastsum.h:91
fastsum_plan_::flags
unsigned flags
flags precomp.
Definition: fastsum.h:100
fastsum_trafo
void fastsum_trafo(fastsum_plan *ths)
fast NFFT-based summation
Definition: fastsum.c:1180
fastsum_plan_::d
int d
api
Definition: fastsum.h:86
fastsum_precompute
void fastsum_precompute(fastsum_plan *ths)
precomputation for fastsum
Definition: fastsum.c:1173
fastsum_plan_::N_total
int N_total
number of source knots
Definition: fastsum.h:88
X
#define X(name)
Include header for C99 complex datatype.
Definition: fastsum.h:57
fastsum_finalize_target_nodes
void fastsum_finalize_target_nodes(fastsum_plan *ths)
finalization of fastsum plan
Definition: fastsum.c:1020
fastsum_plan_::MEASURE_TIME_t
R MEASURE_TIME_t[8]
Measured time for each step if MEASURE_TIME is set.
Definition: fastsum.h:134
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:987
fastsum_plan_::f
C * f
target evaluations
Definition: fastsum.h:92
fastsum_precompute_target_nodes
void fastsum_precompute_target_nodes(fastsum_plan *ths)
precomputation for fastsum
Definition: fastsum.c:1141
fastsum_finalize_source_nodes
void fastsum_finalize_source_nodes(fastsum_plan *ths)
finalization of fastsum plan
Definition: fastsum.c:996
fastsum_plan_::k
kernel k
kernel function
Definition: fastsum.h:97
fastsum_plan_::y
R * y
target knots in d-ball with radius 1/4-eps_b/2
Definition: fastsum.h:95
kubintkern
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
fastsum_plan_::n
int n
FS__ - fast summation.
Definition: fastsum.h:108
fastsum_init_guru_kernel
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
fastsum_init_guru_target_nodes
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
nfft3.h
Header file for the nfft3 library.
fastsum_plan_::p
int p
degree of smoothness of regularization
Definition: fastsum.h:112
fastsum_plan_::eps_I
R eps_I
inner boundary
Definition: fastsum.h:113
fastsum_finalize
void fastsum_finalize(fastsum_plan *ths)
finalization of fastsum plan
Definition: fastsum.c:1048
fastsum_exact
void fastsum_exact(fastsum_plan *ths)
direct computation of sums
Definition: fastsum.c:1056
fastsum_plan_::x
R * x
source knots in d-ball with radius 1/4-eps_b/2
Definition: fastsum.h:94