NFFT  3.3.2
fastsum.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2002, 2016 Jens Keiner, Stefan Kunis, Daniel Potts
00003  *
00004  * This program is free software; you can redistribute it and/or modify it under
00005  * the terms of the GNU General Public License as published by the Free Software
00006  * Foundation; either version 2 of the License, or (at your option) any later
00007  * version.
00008  *
00009  * This program is distributed in the hope that it will be useful, but WITHOUT
00010  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00011  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00012  * details.
00013  *
00014  * You should have received a copy of the GNU General Public License along with
00015  * this program; if not, write to the Free Software Foundation, Inc., 51
00016  * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  */
00018 
00036 #ifndef fastsum_h_inc
00037 #define fastsum_h_inc
00038 
00039 #include "config.h"
00040 
00042 #ifdef HAVE_COMPLEX_H
00043 #include <complex.h>
00044 #endif
00045 
00047 #include "nfft3.h"
00048 #include "infft.h"
00049 
00050 #undef X
00051 #define X(name) NFFT(name)
00052 
00053 #if !(defined(NF_LIN) || defined(NF_QUADR) || defined(NF_KUB))
00054   #define NF_KUB
00055 #endif
00056 
00057 #ifdef __cplusplus
00058 extern "C"
00059 {
00060 #endif /* __cplusplus */
00061 
00062 typedef C (*kernel)(R , int , const R *);
00063 
00067 #define EXACT_NEARFIELD  (1U<< 0)
00068 
00069 #define NEARFIELD_BOXES (1U<< 1)
00070 
00072 typedef struct fastsum_plan_
00073 {
00076   int d;                                
00078   int N_total;                          
00079   int M_total;                          
00081   C *alpha;                       
00082   C *f;                           
00084   R *x;                            
00085   R *y;                            
00087   kernel k;  
00088   R *kernel_param;                 
00090   unsigned flags;                       
00095   C *pre_K;                       
00098   int n;                                
00099   C *b;                      
00101   int p;                                
00102   R eps_I;                           /* fixed to p/n so far  */
00103   R eps_B;                           /* fixed to 1/16 so far */
00104 
00105   X(plan) mv1;                        
00106   X(plan) mv2;                        
00109   int Ad;                               
00110   C *Add;                 
00112   /* things for computing *b - are they used only once?? */
00113   FFTW(plan) fft_plan;
00114 
00115   int box_count;
00116   int box_count_per_dim;
00117   int *box_offset;
00118   R *box_x;
00119   C *box_alpha;
00120 
00121   R MEASURE_TIME_t[8]; 
00122 } fastsum_plan;
00123 
00140 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);
00141 
00146 void fastsum_finalize(fastsum_plan *ths);
00147 
00152 void fastsum_exact(fastsum_plan *ths);
00153 
00158 void fastsum_precompute(fastsum_plan *ths);
00159 
00164 void fastsum_trafo(fastsum_plan *ths);
00165 /* \} */
00166 
00167 C regkern(kernel k, R xx, int p, const R *param, R a, R b);
00168 
00170 C kubintkern(const R x, const C *Add,
00171   const int Ad, const R a);
00172 
00173 #ifdef __cplusplus
00174 }  /* extern "C" */
00175 #endif /* __cplusplus */
00176 
00177 #endif
00178 /* fastsum.h */