NFFT Logo 3.2.3
nfft3util.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002, 2012 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 
19 /* $Id: nfft3util.h 3896 2012-10-10 12:19:26Z tovo $ */
20 
24 #ifndef __UTIL_H__
25 #define __UTIL_H__
26 
28 #include <fftw3.h>
29 
30 #ifdef __cplusplus
31 extern "C"
32 {
33 #endif /* __cplusplus */
34 
35 /*###########################################################################*/
36 /*###########################################################################*/
37 /*###########################################################################*/
38 
52 #define NFFT_SWAP_complex(x,y) {fftw_complex* NFFT_SWAP_temp__; \
53  NFFT_SWAP_temp__=(x); (x)=(y); (y)=NFFT_SWAP_temp__;}
54 
57 #define NFFT_SWAP_double(x,y) {double* NFFT_SWAP_temp__; NFFT_SWAP_temp__=(x); \
58  (x)=(y); (y)=NFFT_SWAP_temp__;}
59 
62 #define PI 3.141592653589793238462643383279502884197169399375105820974944592
63 #define PI2 6.283185307179586476925286766559005768394338798750211641949889185
64 #define PI4 12.56637061435917295385057353311801153678867759750042328389977837
65 
68 #define NFFT_MAX(a,b) ((a)>(b)? (a) : (b))
69 
72 #define NFFT_MIN(a,b) ((a)<(b)? (a) : (b))
73 
74 /* ######################################################################### */
75 /* ########## Window function related ###################################### */
76 /* ######################################################################### */
77 
80 double nfft_bspline_old(int k,double x,double *A);
81 
85 double nfft_bspline(int k, double x, double *scratch);
86 
87 /* ######################################################################### */
88 /* ########## Vector routines ############################################## */
89 /* ######################################################################### */
90 
93 int nfft_prod_int(int *vec, int d);
94 
97 int nfst_prod_minus_a_int(int *vec, int a, int d);
98 
101 int nfft_plain_loop(int *idx,int *N,int d);
102 
105 double nfft_prod_real(double *vec,int d);
106 
109 double nfft_dot_complex(fftw_complex* x, int n);
110 
113 double nfft_dot_double( double* x, int n);
114 
117 double nfft_dot_w_complex(fftw_complex* x, double* w, int n);
118 
121 double nfft_dot_w_double( double* x, double* w, int n);
122 
126 double nfft_dot_w_w2_complex(fftw_complex* x, double* w, double* w2, int n);
127 
131 double nfft_dot_w2_complex(fftw_complex* x, double* w2, int n);
132 
135 void nfft_cp_complex(fftw_complex* x, fftw_complex* y, int n);
136 
139 void nfft_cp_double( double* x, double* y, int n);
140 
143 void nfft_cp_a_complex(fftw_complex* x, double a, fftw_complex* y, int n);
144 
147 void nfft_cp_a_double(double *x, double a, double *y, int n);
148 
151 void nfft_cp_w_complex(fftw_complex* x, double* w, fftw_complex* y, int n);
152 
155 void nfft_cp_w_double( double* x, double* w, double* y, int n);
156 
159 void nfft_upd_axpy_complex(fftw_complex* x, double a, fftw_complex* y, int n);
160 
163 void nfft_upd_axpy_double( double* x, double a, double* y, int n);
164 
167 void nfft_upd_xpay_complex(fftw_complex* x, double a, fftw_complex* y, int n);
168 
171 void nfft_upd_xpay_double( double* x, double a, double* y, int n);
172 
175 void nfft_upd_axpby_complex(fftw_complex* x, double a, fftw_complex* y, double b, int n);
176 
179 void nfft_upd_axpby_double( double* x, double a, double* y, double b, int n);
180 
183 void nfft_upd_xpawy_complex(fftw_complex* x, double a, double* w, fftw_complex* y, int n);
184 
187 void nfft_upd_xpawy_double( double* x, double a, double* w, double* y, int n);
188 
191 void nfft_upd_axpwy_complex(fftw_complex* x, double a, double* w, fftw_complex* y, int n);
192 
195 void nfft_upd_axpwy_double( double* x, double a, double* w, double* y, int n);
196 
199 void nfft_fftshift_complex(fftw_complex *x, int d, int* N);
200 
203 void nfft_vpr_int(int *x, int n, char *text);
204 
207 void nfft_vpr_double(double *x, int n, const char *text);
208 
211 void nfft_vpr_complex(fftw_complex *x, int n, const char *text);
212 
215 void nfft_vrand_unit_complex(fftw_complex *x, int n);
216 
219 void nfft_vrand_shifted_unit_double(double *x, int n);
220 
221 /* ######################################################################### */
222 /* ########## Helpers for inverse transforms ############################### */
223 /* ######################################################################### */
224 
226 void nfft_voronoi_weights_1d(double *w, double *x, int M);
227 
229 void nfft_voronoi_weights_S2(double *w, double *xi, int M);
230 
234 double nfft_modified_fejer(int N,int kk);
235 
238 double nfft_modified_jackson2(int N,int kk);
239 
242 double nfft_modified_jackson4(int N,int kk);
243 
246 double nfft_modified_sobolev(double mu,int kk);
247 
250 double nfft_modified_multiquadric(double mu,double c,int kk);
251 
252 int nfft_smbi(const double x, const double alpha, const int nb, const int ize,
253  double *b);
254 
255 double nfft_drand48(void);
256 
257 void nfft_srand48(long int seed);
258 
261 void nfft_sort_node_indices_radix_lsdf(int n, int *keys0, int *keys1, int rhigh);
262 
265 void nfft_sort_node_indices_radix_msdf(int n, int *keys0, int *keys1, int rhigh);
266 
267 int nfft_get_num_threads(void);
268 
269 #ifdef _OPENMP
270 int nfft_get_omp_num_threads(void);
271 #endif
272 
273 #ifdef __cplusplus
274 } /* extern "C" */
275 #endif /* __cplusplus */
276 
279 #endif

Generated on Tue Apr 30 2013 by Doxygen 1.8.1