NFFT Logo 3.0 API Reference
Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals

nfft3.h

Go to the documentation of this file.
00001 
00004 #ifndef NFFT3_H
00005 #define NFFT3_H
00006 
00008 #include <complex.h>
00009 
00011 #include <fftw3.h>
00012 
00014 #define MACRO_MV_PLAN(float_type)                                             \
00015   int N_total;                          \
00017   int M_total;                          \
00018                                                                               \
00019   float_type *f_hat;                    \
00021   float_type *f;                        \
00023 
00024 /*###########################################################################*/
00025 /*###########################################################################*/
00026 /*###########################################################################*/
00027 
00075 /* Planner flags, i.e. constant symbols for precomputation and memory usage */
00076 
00087 #define PRE_PHI_HUT      (1U<< 0)
00088 
00100 #define FG_PSI           (1U<< 1)
00101 
00117 #define PRE_LIN_PSI      (1U<< 2)
00118 
00130 #define PRE_FG_PSI       (1U<< 3)
00131 
00142 #define PRE_PSI          (1U<< 4)
00143 
00155 #define PRE_FULL_PSI     (1U<< 5)
00156 
00166 #define MALLOC_X         (1U<< 6)
00167 
00178 #define MALLOC_F_HAT     (1U<< 7)
00179 
00189 #define MALLOC_F         (1U<< 8)
00190 
00200 #define FFT_OUT_OF_PLACE (1U<< 9)
00201 
00211 #define FFTW_INIT        (1U<< 10)
00212 
00226 #define PRE_ONE_PSI (PRE_LIN_PSI| PRE_FG_PSI| PRE_PSI| PRE_FULL_PSI)
00227 
00229 typedef struct
00230 {
00231   /* api */
00232   MACRO_MV_PLAN(double complex)
00233 
00234   int d;                                
00235   int *N;                               
00236   double *sigma;                        
00237   int *n;                               
00240   int n_total;                          
00241   int m;                                
00247   double *b;                            
00249   int K;                                
00253   unsigned nfft_flags;                  
00260   unsigned fftw_flags;                  
00264   double *x;                            
00267   double MEASURE_TIME_t[3];             
00270   /* internal*/
00271   fftw_plan  my_fftw_plan1;             
00272   fftw_plan  my_fftw_plan2;             
00274   double **c_phi_inv;                   
00277   double *psi;                          
00280   int *psi_index_g;                     
00282   int *psi_index_f;                     
00285   double complex *g;                    
00288   double complex *g_hat;                
00291   double complex *g1;                   
00292   double complex *g2;                   
00294   double *spline_coeffs;                
00297 } nfft_plan;
00298 
00299 
00307 void ndft_trafo(nfft_plan *ths);
00308 
00316 void ndft_adjoint(nfft_plan *ths);
00317 
00325 void nfft_trafo(nfft_plan *ths);
00326 
00334 void nfft_adjoint(nfft_plan *ths);
00335 
00345 void nfft_init_1d(nfft_plan *ths, int N1, int M);
00346 
00357 void nfft_init_2d(nfft_plan *ths, int N1, int N2, int M);
00358 
00370 void nfft_init_3d(nfft_plan *ths, int N1, int N2, int N3, int M);
00371 
00382 void nfft_init(nfft_plan *ths, int d, int *N, int M);
00383 
00397 void nfft_init_advanced(nfft_plan *ths, int d, int *N, int M,
00398                         unsigned nfft_flags_on, unsigned nfft_flags_off);
00399 
00414 void nfft_init_guru(nfft_plan *ths, int d, int *N, int M, int *n,
00415                     int m, unsigned nfft_flags, unsigned fftw_flags);
00416 
00417 
00430 void nfft_precompute_one_psi(nfft_plan *ths);
00431 
00436 void nfft_precompute_full_psi(nfft_plan *ths);
00437 
00442 void nfft_precompute_psi(nfft_plan *ths);
00443 
00448 void nfft_precompute_lin_psi(nfft_plan *ths);
00449 
00457 void nfft_check(nfft_plan *ths);
00458 
00466 void nfft_finalize(nfft_plan *ths);
00467 
00471 /*###########################################################################*/
00472 /*###########################################################################*/
00473 /*###########################################################################*/
00474 
00482 typedef struct
00483 {
00484   /* api */
00485   MACRO_MV_PLAN(double)
00486 
00487   int d;                                
00488   int *N;                               
00489   int *n;                               
00490   double *sigma;                        
00491   int m;                                
00493   double nfct_full_psi_eps;
00494   double *b;                            
00496   unsigned nfct_flags;                  
00497   unsigned fftw_flags;                  
00499   double *x;                            
00501   double MEASURE_TIME_t[3];             
00504   fftw_plan  my_fftw_r2r_plan;          
00505   fftw_r2r_kind *r2r_kind;              
00507   double **c_phi_inv;                   
00508   double *psi;                          
00509   int size_psi;                         
00510   int *psi_index_g;                     
00511   int *psi_index_f;                     
00513   double *g;
00514   double *g_hat;
00515   double *g1;                           
00516   double *g2;                           
00518   double *spline_coeffs;                
00520 } nfct_plan;
00521 
00522 
00532 void nfct_init_1d( nfct_plan *ths_plan, int N0, int M_total);
00533 
00544 void nfct_init_2d( nfct_plan *ths_plan, int N0, int N1, int M_total);
00545 
00557 void nfct_init_3d( nfct_plan *ths_plan, int N0, int N1, int N2, int M_total);
00558 
00569 void nfct_init( nfct_plan *ths_plan, int d, int *N, int M_total);
00570 
00585 void nfct_init_guru( nfct_plan *ths_plan, int d, int *N, int M_total, int *n,
00586                          int m, unsigned nfct_flags, unsigned fftw_flags);
00587 
00597 void nfct_precompute_psi( nfct_plan *ths_plan);
00598 
00599 
00608 void nfct_trafo( nfct_plan *ths_plan);
00609 
00618 void ndct_trafo( nfct_plan *ths_plan);
00619 
00628 void nfct_adjoint( nfct_plan *ths_plan);
00629 
00638 void ndct_adjoint( nfct_plan *ths_plan);
00639 
00647 void nfct_finalize( nfct_plan *ths_plan);
00648 
00658 double nfct_phi_hut( nfct_plan *ths_plan, int k, int d);
00659 
00669 double nfct_phi ( nfct_plan *ths_plan, double x, int d);
00670 
00678 int nfct_fftw_2N( int n);
00679 
00687 int nfct_fftw_2N_rev(int n);
00688 
00689 /*###########################################################################*/
00690 
00692 typedef struct
00693 {
00694   /* api */
00695   MACRO_MV_PLAN(double)
00696 
00697   int d;                                
00698   int *N;                               
00699   int *n;                               
00700   double *sigma;                        
00701   int m;                                
00703   double nfst_full_psi_eps;
00704   double *b;                            
00706   unsigned nfst_flags;                  
00707   unsigned fftw_flags;                  
00709   double *x;                            
00711   double MEASURE_TIME_t[3];             
00714   fftw_plan  my_fftw_r2r_plan;         
00715   fftw_r2r_kind *r2r_kind;              
00717   double **c_phi_inv;                   
00718   double *psi;                          
00719   int size_psi;                         
00720   int *psi_index_g;                     
00721   int *psi_index_f;                     
00724   double *g;
00725   double *g_hat;
00726   double *g1;                           
00727   double *g2;                           
00729   double *spline_coeffs;                
00731 } nfst_plan;
00732 
00733 
00743 void nfst_init_1d( nfst_plan *ths_plan, int N0, int M_total);
00744 
00755 void nfst_init_2d( nfst_plan *ths_plan, int N0, int N1, int M_total);
00756 
00768 void nfst_init_3d( nfst_plan *ths_plan, int N0, int N1, int N2, int M_total);
00769 
00780 void nfst_init( nfst_plan *ths_plan, int d, int *N, int M_total);
00781 
00794 void nfst_init_m( nfst_plan *ths_plan, int d, int *N, int M_total, int m);
00795 
00810 void nfst_init_guru( nfst_plan *ths_plan, int d, int *N, int M_total, int *n,
00811                      int m, unsigned nfst_flags, unsigned fftw_flags);
00812 
00822 void nfst_precompute_psi( nfst_plan *ths_plan);
00823 
00832 void nfst_trafo( nfst_plan *ths_plan);
00833 
00842 void ndst_trafo( nfst_plan *ths_plan);
00843 
00844 
00845 
00854 void nfst_adjoint( nfst_plan *ths_plan);
00855 
00864 void ndst_adjoint( nfst_plan *ths_plan);
00865 
00873 void nfst_finalize( nfst_plan *ths_plan);
00874 
00881 void nfst_full_psi( nfst_plan *ths_plan, double eps);
00882 
00892 double nfst_phi_hut( nfst_plan *ths_plan, int k, int d);
00893 
00903 double nfst_phi ( nfst_plan *ths_plan, double x, int d);
00904 
00912 int nfst_fftw_2N( int n);
00913 
00921 int nfst_fftw_2N_rev( int n);
00922 
00926 /*###########################################################################*/
00927 /*###########################################################################*/
00928 /*###########################################################################*/
00929 
00944 #define MALLOC_V         (1U<< 11)
00945 
00947 typedef struct
00948 {
00949   /* api */
00950   MACRO_MV_PLAN(double complex)
00951 
00952   int d;                                
00953   double *sigma;                        
00954   double *a;                            
00955   int *N;                               
00956   int *N1;                              
00957   int *aN1;                             
00958   int m;                                
00959   double *b;                            
00960   int K;                                
00962   int aN1_total;                        
00964   nfft_plan *direct_plan;               
00965   unsigned nnfft_flags;                 
00966   int *n;                               
00968   double *x;                            
00969   double *v;                            
00971   double *c_phi_inv;                    
00972   double *psi;                          
00973   int size_psi;                         
00974   int *psi_index_g;                     
00975   int *psi_index_f;                     
00976   double complex *F;
00977 
00978   double *spline_coeffs;                
00980 } nnfft_plan;
00981 
00982 
00994 void nnfft_init(nnfft_plan *ths_plan, int d, int N_total, int M_total, int *N);
00995 
01010 void nnfft_init_guru(nnfft_plan *ths_plan, int d, int N_total, int M_total,
01011                      int *N, int *N1, int m, unsigned nnfft_flags);
01012 
01024 void nndft_trafo(nnfft_plan *ths_plan);
01025 
01037 void nndft_adjoint(nnfft_plan *ths_plan);
01038 
01050 void nnfft_trafo(nnfft_plan *ths_plan);
01051 
01063 void nnfft_adjoint(nnfft_plan *ths_plan);
01064 
01076 void nnfft_precompute_lin_psi(nnfft_plan *ths_plan);
01077 
01090 void nnfft_precompute_psi(nnfft_plan *ths_plan);
01091 
01105 void nnfft_precompute_full_psi(nnfft_plan *ths_plan);
01106 
01119 void nnfft_precompute_phi_hut(nnfft_plan *ths_plan);
01120 
01128 void nnfft_finalize(nnfft_plan *ths_plan);
01129 
01133 /*###########################################################################*/
01134 /*###########################################################################*/
01135 /*###########################################################################*/
01136 
01151 #define NSDFT            (1U<< 12)
01152 
01154 typedef struct
01155 {
01156   MACRO_MV_PLAN(double complex)
01157 
01158   int d;                                
01159   int J;                                
01163   int sigma;                            
01165   unsigned flags;                       
01167   int *index_sparse_to_full;            
01170   int r_act_nfft_plan;                  
01171   nfft_plan *act_nfft_plan;             
01172   nfft_plan *center_nfft_plan;          
01174   fftw_plan* set_fftw_plan1;            
01175   fftw_plan* set_fftw_plan2;            
01177   nfft_plan *set_nfft_plan_1d;          
01178   nfft_plan *set_nfft_plan_2d;          
01180   double *x_transposed;                 
01181   double *x_102,*x_201,*x_120,*x_021;   
01183 } nsfft_plan;
01184 
01195 void nsdft_trafo(nsfft_plan *ths);
01196 
01207 void nsdft_adjoint(nsfft_plan *ths);
01208 
01220 void nsfft_trafo(nsfft_plan *ths);
01221 
01233 void nsfft_adjoint(nsfft_plan *ths);
01234 
01242 void nsfft_cp(nsfft_plan *ths, nfft_plan *ths_nfft);
01243 
01251 void nsfft_init_random_nodes_coeffs(nsfft_plan *ths);
01252 
01265 void nsfft_init(nsfft_plan *ths, int d, int J, int M, int m, unsigned flags);
01266 
01274 void nsfft_finalize(nsfft_plan *ths);
01275 
01279 /*###########################################################################*/
01280 /*###########################################################################*/
01281 /*###########################################################################*/
01282 
01290 typedef struct
01291 {
01292   /* api */
01293   MACRO_MV_PLAN(double complex)
01294 
01295   nfft_plan plan;
01296 
01297   int N3;
01298   double sigma3;
01299   double *t;
01300   double *w;
01301 } mri_inh_2d1d_plan;
01302 
01306 typedef struct
01307 {
01308   /* api */
01309   MACRO_MV_PLAN(double complex)
01310 
01311   nfft_plan plan;
01312 
01313   int N3;
01314   double sigma3;
01315   double *t;
01316   double *w;
01317 } mri_inh_3d_plan;
01318 
01319 
01332 void mri_inh_2d1d_trafo(mri_inh_2d1d_plan *ths);
01333 
01346 void mri_inh_2d1d_adjoint(mri_inh_2d1d_plan *ths);
01347 
01361 void mri_inh_2d1d_init_guru(mri_inh_2d1d_plan *ths, int *N, int M, int *n,
01362                     int m, double sigma, unsigned nfft_flags, unsigned fftw_flags);
01363 
01371 void mri_inh_2d1d_finalize(mri_inh_2d1d_plan *ths);
01372 
01385 void mri_inh_3d_trafo(mri_inh_3d_plan *ths);
01386 
01399 void mri_inh_3d_adjoint(mri_inh_3d_plan *ths);
01400 
01401 void mri_inh_3d_init_guru(mri_inh_3d_plan *ths, int *N, int M, int *n,
01402                     int m, double sigma, unsigned nfft_flags, unsigned fftw_flags);
01403 
01411 void mri_inh_3d_finalize(mri_inh_3d_plan *ths);
01412 
01416 /*###########################################################################*/
01417 /*###########################################################################*/
01418 /*###########################################################################*/
01419 
01671 /* Planner flags */
01672 
01692 #define NFSFT_NORMALIZED    (1U << 0)
01693 
01704 #define NFSFT_USE_NDFT      (1U << 1)
01705 
01717 #define NFSFT_USE_DPT       (1U << 2)
01718 
01732 #define NFSFT_MALLOC_X      (1U << 3)
01733 
01747 #define NFSFT_MALLOC_F_HAT  (1U << 5)
01748 
01762 #define NFSFT_MALLOC_F      (1U << 6)
01763 
01774 #define NFSFT_PRESERVE_F_HAT (1U << 7)
01775 
01787 #define NFSFT_PRESERVE_X     (1U << 8)
01788 
01799 #define NFSFT_PRESERVE_F     (1U << 9)
01800 
01810 #define NFSFT_DESTROY_F_HAT    (1U << 10)
01811 
01822 #define NFSFT_DESTROY_X      (1U << 11)
01823 
01833 #define NFSFT_DESTROY_F      (1U << 12)
01834 
01835 /* Precomputation flags */
01836 
01846 #define NFSFT_NO_DIRECT_ALGORITHM    (1U << 13)
01847 
01857 #define NFSFT_NO_FAST_ALGORITHM      (1U << 14)
01858 
01866 #define NFSFT_ZERO_F_HAT             (1U << 16)
01867 
01868 /* */
01869 
01878 #define NFSFT_INDEX(k,n,plan)        ((2*(plan)->N+2)*((plan)->N-n+1)+(plan)->N+k+1)
01879 
01884 #define NFSFT_F_HAT_SIZE(N)          ((2*N+2)*(2*N+2))
01885 
01887 typedef struct
01888 {
01890   MACRO_MV_PLAN(double complex)
01891 
01892   /* Public members */
01893   int N;                              
01894   double *x;                          
01901   /* Private members */
01902   /*int NPT;*/                        
01904   int t;                              
01906   unsigned int flags;                 
01907   nfft_plan plan_nfft;                
01908   double complex *f_hat_intern;              
01910 } nfsft_plan;
01911 
01921 void nfsft_init(nfsft_plan *plan, int N, int M);
01922 
01933 void nfsft_init_advanced(nfsft_plan* plan, int N, int M, unsigned int
01934                          nfsft_flags);
01935 
01947 void nfsft_init_guru(nfsft_plan *plan, int N, int M, unsigned int nfsft_flags,
01948   int nfft_flags, int nfft_cutoff);
01949 
01962 void nfsft_precompute(int N, double kappa, unsigned int nfsft_flags,
01963   unsigned int fpt_flags);
01964 
01970 void nfsft_forget();
01971 
01983 void ndsft_trafo(nfsft_plan* plan);
01984 
01997 void ndsft_adjoint(nfsft_plan* plan);
01998 
02010 void nfsft_trafo(nfsft_plan* plan);
02011 
02024 void nfsft_adjoint(nfsft_plan* plan);
02025 
02033 void nfsft_finalize(nfsft_plan* plan);
02034 
02035 void nfsft_precompute_x(nfsft_plan *plan);
02036 
02037 
02041 /*###########################################################################*/
02042 /*###########################################################################*/
02043 /*###########################################################################*/
02044 
02053 /* Flags for fpt_init() */
02054 #define FPT_NO_FAST_ALGORITHM (1U << 2) 
02055 #define FPT_NO_DIRECT_ALGORITHM (1U << 3) 
02056 #define FPT_NO_STABILIZATION  (1U << 0) 
02059 #define FPT_PERSISTENT_DATA   (1U << 4) 
02061 /* Flags for fpt_trafo(), dpt_transposed(), fpt_trafo(), fpt_transposed() */
02062 #define FPT_FUNCTION_VALUES   (1U << 5) 
02065 #define FPT_AL_SYMMETRY       (1U << 6) 
02067 /* Data structures */
02068 typedef struct fpt_set_s_ *fpt_set;     
02085 fpt_set fpt_init(const int M, const int t, const unsigned int flags);
02086 
02107 void fpt_precompute(fpt_set set, const int m, const double *alpha,
02108                     const double *beta, const double *gamma, int k_start,
02109                     const double threshold);
02110 
02121 void dpt_trafo(fpt_set set, const int m, const double complex *x, double complex *y,
02122   const int k_end, const unsigned int flags);
02123 
02134 void fpt_trafo(fpt_set set, const int m, const double complex *x, double complex *y,
02135   const int k_end, const unsigned int flags);
02136 
02147 void dpt_transposed(fpt_set set, const int m, double complex *x, 
02148   double complex *y, const int k_end, const unsigned int flags);
02149 
02160 void fpt_transposed(fpt_set set, const int m, double complex *x, 
02161   const double complex *y, const int k_end, const unsigned int flags);
02162 
02163 void fpt_finalize(fpt_set set);
02164 
02168 /*###########################################################################*/
02169 /*###########################################################################*/
02170 /*###########################################################################*/
02171 
02176 /* Planner flags, i.e. constant symbols for methods */
02177 
02184 #define LANDWEBER             (1U<< 0)
02185 
02192 #define STEEPEST_DESCENT      (1U<< 1)
02193 
02201 #define CGNR                  (1U<< 2)
02202 
02210 #define CGNE                  (1U<< 3)
02211 
02218 #define NORMS_FOR_LANDWEBER   (1U<< 4)
02219 
02226 #define PRECOMPUTE_WEIGHT     (1U<< 5)
02227 
02234 #define PRECOMPUTE_DAMP       (1U<< 6)
02235 
02245 #define MACRO_SOLVER_PLAN(MV, FLT, FLT_TYPE)                                  \
02246                                                                               \                               \
02248 typedef struct                                                                \
02249 {                                                                             \
02250   MV ## _plan *mv;                      \
02251   unsigned flags;                       \
02252                                                                               \
02253   double *w;                            \
02254   double *w_hat;                        \
02255                                                                               \
02256   FLT_TYPE *y;                          \
02257                                                                               \
02258   FLT_TYPE *f_hat_iter;                 \
02259                                                                               \
02260   FLT_TYPE *r_iter;                     \
02261   FLT_TYPE *z_hat_iter;                 \
02263   FLT_TYPE *p_hat_iter;                 \
02264   FLT_TYPE *v_iter;                     \
02265                                                                               \
02266   double alpha_iter;                    \
02267   double beta_iter;                     \
02268                                                                               \
02269   double dot_r_iter;                    \
02270   double dot_r_iter_old;                \
02271   double dot_z_hat_iter;                \
02273   double dot_z_hat_iter_old;            \
02274   double dot_p_hat_iter;                \
02276   double dot_v_iter;                    \
02277 } i ## MV ## _plan;                                                           \
02278                                                                               \                                                 \
02280 void i ## MV ## _init(i ## MV ## _plan *ths, MV ## _plan *mv);                \                                               \
02282 void i ## MV ## _init_advanced(i ## MV ## _plan *ths, MV ## _plan *mv,        \
02283                                unsigned i ## MV ## _flags);                   \                      \
02285 void i ## MV ## _before_loop(i ## MV ## _plan *ths);                          \                                       \
02287 void i ## MV ## _loop_one_step(i ## MV ## _plan *ths);                        \                           \
02289 void i ## MV ## _finalize(i ## MV ## _plan *ths);                             \
02290 
02291 /* previous function declarations didn't work with doxygen ....
02292   F(MV, FLT, FLT_TYPE, init,    i ## MV ## _plan *ths, MV ## _plan *mv);
02293   F(MV, FLT, FLT_TYPE, init_advanced, i ## MV ## _plan *ths, MV ## _plan *mv,
02294                                       unsigned i ## MV ## _flags);
02295   F(MV, FLT, FLT_TYPE, before_loop,   i ## MV ## _plan *ths);
02296   F(MV, FLT, FLT_TYPE, loop_one_step, i ## MV ## _plan *ths);
02297   F(MV, FLT, FLT_TYPE, finalize,      i ## MV ## _plan *ths);
02298 */
02299 
02300 
02301 MACRO_SOLVER_PLAN(nfft, complex, double complex)
02302 MACRO_SOLVER_PLAN(nfct, double, double)
02303 MACRO_SOLVER_PLAN(nfst, double, double)
02304 MACRO_SOLVER_PLAN(nnfft, complex, double complex)
02305 MACRO_SOLVER_PLAN(mri_inh_2d1d, complex, double complex)
02306 MACRO_SOLVER_PLAN(mri_inh_3d, complex, double complex)
02307 MACRO_SOLVER_PLAN(nfsft, complex, double complex)
02311 #endif
02312 /* nfft3.h */

Generated on 1 Nov 2006 by Doxygen 1.4.4