NFFT Logo 3.1.1 API Reference

nfft3util.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2002, 2009 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 
00019 /* $Id: nfft3util.h 3198 2009-05-27 14:16:50Z keiner $ */
00020 
00024 #ifndef __UTIL_H__
00025 #define __UTIL_H__
00026 
00028 #include <fftw3.h>
00029 
00030 /*###########################################################################*/
00031 /*###########################################################################*/
00032 /*###########################################################################*/
00033 
00051 #ifdef MEASURE_TIME
00052  int MEASURE_TIME_r;
00053  double MEASURE_TIME_tt;
00054 
00055 #define TIC(a)                                                                \
00056   ths->MEASURE_TIME_t[(a)]=0;                                                 \
00057   MEASURE_TIME_r=0;                                                           \
00058   while(ths->MEASURE_TIME_t[(a)]<0.01)                                        \
00059     {                                                                         \
00060       MEASURE_TIME_r++;                                                       \
00061       MEASURE_TIME_tt=nfft_second();                                          \
00062 
00063 /* THE MEASURED FUNCTION IS CALLED REPEATEDLY */
00064 
00065 #define TOC(a)                                                                \
00066       MEASURE_TIME_tt=nfft_second()-MEASURE_TIME_tt;                          \
00067       ths->MEASURE_TIME_t[(a)]+=MEASURE_TIME_tt;                              \
00068     }                                                                         \
00069   ths->MEASURE_TIME_t[(a)]/=MEASURE_TIME_r;                                   \
00070 
00071 #else
00072 #define TIC(a)
00073 #define TOC(a)
00074 #endif
00075 
00076 #ifdef MEASURE_TIME_FFTW
00077 #define TIC_FFTW(a) TIC(a)
00078 #define TOC_FFTW(a) TOC(a)
00079 #else
00080 #define TIC_FFTW(a)
00081 #define TOC_FFTW(a)
00082 #endif
00083 
00084 
00087 #define NFFT_SWAP_complex(x,y) {fftw_complex* NFFT_SWAP_temp__; \
00088   NFFT_SWAP_temp__=(x); (x)=(y); (y)=NFFT_SWAP_temp__;}
00089 
00092 #define NFFT_SWAP_double(x,y) {double* NFFT_SWAP_temp__; NFFT_SWAP_temp__=(x); \
00093   (x)=(y); (y)=NFFT_SWAP_temp__;}
00094 
00097 #define PI 3.141592653589793238462643383279502884197169399375105820974944592
00098 #define PI2 6.283185307179586476925286766559005768394338798750211641949889185
00099 #define PI4 12.56637061435917295385057353311801153678867759750042328389977837
00100 
00103 #define NFFT_MAX(a,b) ((a)>(b)? (a) : (b))
00104 
00107 #define NFFT_MIN(a,b) ((a)<(b)? (a) : (b))
00108 
00109 /* ######################################################################### */
00110 /* ########## Little helpers ############################################### */
00111 /* ######################################################################### */
00112 
00115 double nfft_second(void);
00116 
00119 int nfft_total_used_memory(void);
00120 
00123 int nfft_ld(int m);
00124 
00127 int nfft_int_2_pow(int a);
00128 
00131 int nfft_next_power_of_2(int N);
00132 
00135 void nfft_next_power_of_2_exp(int N, int *N2, int *t);
00136 
00137 /* ######################################################################### */
00138 /* ########## Window function related ###################################### */
00139 /* ######################################################################### */
00140 
00143 double nfft_sinc(double x);
00144 
00147 double nfft_bspline_old(int k,double x,double *A);
00148 
00152 double nfft_bspline(int k, double x, double *scratch);
00153 
00157 double nfft_i0(double x);
00158 
00159 /* ######################################################################### */
00160 /* ########## Vector routines ############################################## */
00161 /* ######################################################################### */
00162 
00165 int nfft_prod_int(int *vec, int d);
00166 
00169 int nfct_prod_int(int *vec, int d);
00170 
00173 int nfst_prod_minus_a_int(int *vec, int a, int d);
00174 
00177 int nfft_plain_loop(int *idx,int *N,int d);
00178 
00181 double nfft_prod_real(double *vec,int d);
00182 
00185 double nfft_dot_complex(fftw_complex* x, int n);
00186 
00189 double nfft_dot_double( double*  x, int n);
00190 
00193 double nfft_dot_w_complex(fftw_complex* x, double* w, int n);
00194 
00197 double nfft_dot_w_double( double*  x, double* w, int n);
00198 
00202 double nfft_dot_w_w2_complex(fftw_complex* x, double* w, double* w2, int n);
00203 
00207 double nfft_dot_w2_complex(fftw_complex* x, double* w2, int n);
00208 
00211 void nfft_cp_complex(fftw_complex* x, fftw_complex* y, int n);
00212 
00215 void nfft_cp_double( double*  x, double*  y, int n);
00216 
00219 void nfft_cp_a_complex(fftw_complex* x, double a, fftw_complex* y, int n);
00220 
00223 void nfft_cp_w_complex(fftw_complex* x, double* w, fftw_complex* y, int n);
00224 
00227 void nfft_cp_w_double( double*  x, double* w, double*  y, int n);
00228 
00231 void nfft_upd_axpy_complex(fftw_complex* x, double a, fftw_complex* y, int n);
00232 
00235 void nfft_upd_axpy_double( double*  x, double a, double*  y, int n);
00236 
00239 void nfft_upd_xpay_complex(fftw_complex* x, double a, fftw_complex* y, int n);
00240 
00243 void nfft_upd_xpay_double( double*  x, double a, double*  y, int n);
00244 
00247 void nfft_upd_axpby_complex(fftw_complex* x, double a, fftw_complex* y, double b, int n);
00248 
00251 void nfft_upd_axpby_double(  double* x, double a, double*  y, double b, int n);
00252 
00255 void nfft_upd_xpawy_complex(fftw_complex* x, double a, double* w, fftw_complex* y, int n);
00256 
00259 void nfft_upd_xpawy_double( double*  x, double a, double* w, double*  y, int n);
00260 
00263 void nfft_upd_axpwy_complex(fftw_complex* x, double a, double* w, fftw_complex* y, int n);
00264 
00267 void nfft_upd_axpwy_double( double*  x, double a, double* w, double*  y, int n);
00268 
00271 void nfft_fftshift_complex(fftw_complex *x, int d, int* N);
00272 
00275 double nfft_error_l_infty_complex(fftw_complex *x, fftw_complex *y, int n);
00276 
00279 double nfft_error_l_infty_double(double *x, double *y, int n);
00280 
00283 double nfft_error_l_infty_1_complex(fftw_complex *x, fftw_complex *y, int n, fftw_complex *z,
00284                                int m);
00285 
00288 double nfft_error_l_infty_1_double(double *x, double *y, int n, double *z,
00289             int m);
00290 
00293 double nfft_error_l_2_complex(fftw_complex *x, fftw_complex *y, int n);
00294 
00297 double  nfft_error_l_2_double(double *x, double *y, int n);
00298 
00301 void nfft_vpr_int(int *x, int n, char *text);
00302 
00305 void nfft_vpr_double(double *x, int n, const char *text);
00306 
00309 void nfft_vpr_complex(fftw_complex *x, int n, const char *text);
00310 
00313 void nfft_vrand_unit_complex(fftw_complex *x, int n);
00314 
00317 void nfft_vrand_shifted_unit_double(double *x, int n);
00318 
00319 /* ######################################################################### */
00320 /* ########## Helpers for inverse transforms ############################### */
00321 /* ######################################################################### */
00322 
00324 void nfft_voronoi_weights_1d(double *w, double *x, int M);
00325 
00327 void nfft_voronoi_weights_S2(double *w, double *xi, int M);
00328 
00332 double nfft_modified_fejer(int N,int kk);
00333 
00336 double nfft_modified_jackson2(int N,int kk);
00337 
00340 double nfft_modified_jackson4(int N,int kk);
00341 
00344 double nfft_modified_sobolev(double mu,int kk);
00345 
00348 double nfft_modified_multiquadric(double mu,double c,int kk);
00349 
00350 int nfft_smbi(const double x, const double alpha, const int nb, const int ize,
00351   double *b);
00352 
00362 double nfft_lambda(const double z, const double eps);
00363 
00364 double nfft_lambda2(const double mu, const double nu);
00365 
00368 #endif

Generated on 17 Aug 2009 by Doxygen 1.5.3