MIDAPACK - MIcrowave Data Analysis PACKage  1.1b
Parallel software tools for high performance CMB DA analysis
 All Data Structures Files Functions Variables Typedefs Groups Pages
toeplitz_gappy_seq.dev.h
Go to the documentation of this file.
1 
2 #ifndef TOEPLITZ_H_
3 #define TOEPLITZ_H_
4 
5 #ifdef MPI
6 #include <mpi.h>
7 #endif
8 
9 #include <fftw3.h>
10 #include <omp.h>
11 #include <stdlib.h>
12 #include <stdio.h>
13 #include <math.h>
14 #include <string.h>
15 
16 //=========================================================================
17 //Basic functions definition
18 #define max(a,b) (((a) > (b)) ? (a) : (b))
19 #define min(a,b) (((a) < (b)) ? (a) : (b))
20 
21 //=========================================================================
22 //Fixed parameters
23 
25 
27 #ifndef VERBOSE
28 #define VERBOSE 0
29 #endif
30 
32 
34 #ifndef MPI_USER_TAG
35 #define MPI_USER_TAG 123
36 #endif
37 
38 
39 //=========================================================================
40 // User routines definition
41 
42 //Sequential routines (11)
43 int tpltz_init(int n, int lambda, int *nfft, int *blocksize, fftw_complex **T_fft, double *T, fftw_complex **V_fft, double **V_rfft, fftw_plan *plan_f, fftw_plan *plan_b);
44 
45 int tpltz_cleanup(fftw_complex **T_fft, fftw_complex **V_fft, double **V_rfft,fftw_plan *plan_f, fftw_plan *plan_b);
46 
47 int stmm_core(double **V, int n, int m, fftw_complex *T_fft, int blocksize, int lambda, fftw_complex *V_fft, double *V_rfft, int nfft, fftw_plan plan_f, fftw_plan plan_b, int flag_offset);
48 
49 int stmm(double **V, int n, int m, int id0, int l, fftw_complex *T_fft, int lambda, fftw_complex *V_fft, double *V_rfft, fftw_plan plan_f, fftw_plan plan_b, int blocksize, int nfft);
50 
51 int gstmm(double **V, int n, int m, int id0, int l, fftw_complex *T_fft, int lambda, fftw_complex *V_fft, double *V_rfft, fftw_plan plan_f, fftw_plan plan_b, int blocksize, int nfft, int *id0gap, int *lgap, int ngap);
52 
53 //int stbmm(double **V, int *n, int m, int nrow, double *T, int nb_blocks_local, int nb_blocks_all, int *lambda, int *idv, int idp, int local_V_size);
54 
55 //int gstbmm(double **V, int *n, int m, int nrow, double *T, int nb_blocks_local, int nb_blocks_all, int *lambda, int *idv, int id0p, int local_V_size, int *id0gap, int *lgap, int ngap);
56 
57 int gap_masking(double **V, int l, int *id0gap, int *lgap, int ngap);
58 
59 int gap_filling(double **V, int l, int *id0gap, int *lgap, int ngap);
60 
61 int reset_gaps(double **V, int id0,int local_V_size, int m, int nrow, int *id0gap, int *lgap, int ngap);
62 
63 
64 //Mpi routines (12)
65 #ifdef MPI
66 int mpi_stmm(double **V, int n, int m, int id0, int l, double *T, int lambda, MPI_Comm comm);
67 
68 int mpi_stbmm(double **V, int *n, int m, int nrow, double *T, int nb_blocks_local, int nb_blocks_all, int *lambda, int *idv, int idp, int local_V_size, MPI_Comm comm);
69 
70 int mpi_gstbmm(double **V, int *n, int m, int nrow, double *T, int nb_blocks_local, int nb_blocks_all, int *lambda, int *idv, int id0p, int local_V_size, int *id0gap, int *lgap, int ngap, MPI_Comm comm);
71 
72 #endif
73 
74 
75 //=========================================================================
76 // User routines definition
77 
78 //Low level routines (21)
79 int optimal_blocksize(int n, int lambda, int bs_flag);
80 
82 
83 int rhs_init_fftw(int *nfft, int fft_size, fftw_complex **V_fft, double **V_rfft, fftw_plan *plan_f, fftw_plan *plan_b, int fftw_flag);
84 
85 int circ_init_fftw(double *T, int fft_size, int lambda, fftw_complex **T_fft);
86 
87 int scmm_direct(int fft_size, fftw_complex *C_fft, int ncol, double *V_rfft, double **CV, fftw_complex *V_fft, fftw_plan plan_f_V, fftw_plan plan_b_CV);
88 
89 int scmm_basic(double **V, int blocksize, int m, fftw_complex *C_fft, int lambda, double **CV, fftw_complex *V_fft, double *V_rfft, int nfft, fftw_plan plan_f_V, fftw_plan plan_b_CV);
90 
91 int stmm_reshape(double **V, int n, int m, int id0, int l, fftw_complex *T_fft, int lambda, fftw_complex *V_fft, double *V_rfft, fftw_plan plan_f, fftw_plan plan_b, int blocksize, int nfft);
92 
93 int build_gappy_blocks(int *n, int m, int nrow, double *T, int nb_blocks_local, int nb_blocks_all, int *lambda, int *idv, int *id0gap, int *lgap, int ngap, int *nb_blocks_gappy_final, double *Tgappy, int *idvgappy, int *ngappy, int *lambdagappy, int flag_param_distmin_fixed);
94 
95 
96 //Internal routines (22)
97 int print_error_message(int error_number, char const *file, int line);
98 
99 int copy_block(int ninrow, int nincol, double *Vin, int noutrow, int noutcol, double *Vout, int inrow, int incol, int nblockrow, int nblockcol, int outrow, int outcol, double norm, int set_zero_flag);
100 
101 int vect2nfftblock(double *V1, int v1_size, double *V2, int fft_size, int nfft, int lambda);
102 
103 int nfftblock2vect(double *V2, int fft_size, int nfft, int lambda, double *V1, int v1_size);
104 
105 int gap_reduce(double **V, int id0, int l, int lambda, int *id0gap, int *lgap, int ngap, int *newl, int id0out);
106 
107 int get_overlapping_blocks_params(int nbloc, int *idv, int *n, int local_V_size, int nrow, int idp, int *idpnew, int *local_V_size_new, int *nnew, int *ifirstBlock, int *ilastBlock);
108 
109 
110 //=========================================================================
111 #endif /* !TOEPLITZ_H_ */
112 
113