7 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)
15 int clast_1 = (idf+1)/n;
16 int m_eff = clast - cfirst + 1 ;
34 nfullcol = (l-(n-id0%n)-(id0+l)%n)/n;
36 int ifirstgap, ilastgap;
47 if(lgap[k] != 0 && id0col < id0gap[k]+lgap[k])
break;
51 for(k=ngap-1;k>=0;k--) {
52 if(lgap[k] != 0 && id0gap[k] <= id0col)
break;
57 for (i=0 ; i<ngap; i++)
58 printf(
"id0gap[%d]=%d\n", i, id0gap[i]);
59 for (i=0 ; i<ngap; i++)
60 printf(
"lgap[%d]=%d\n", i, lgap[i]);
64 printf(
"lcol=%d\n", lcol);
65 for (i=0 ; i<lcol; i++)
66 printf(
"Vcol[%d]=%f\n", i, Vcol[i]);
69 gap_reduce(&Vcol, id0col, lcol, lambda, id0gap, lgap, ngap, &lcolnew, id0out);
75 for (i=0 ; i<lcol; i++)
76 printf(
"Vcolout[%d]=%f\n", i, Vcol[i]);
82 printf(
"(*V)[%d]=%f\n", i, (*V)[i]);
87 for (icol=0 ; icol<nfullcol; icol++) {
94 gap_reduce(&Vcol, id0col, lcol, lambda, id0gap, lgap, ngap, &lcolnew, id0out);
105 if (idf%n != n && m > 1) {
115 for(k=ngap-1;k>=0;k--) {
116 if(lgap[k] != 0 && id0gap[k] <= id0col)
break;
121 gap_reduce(&Vcol, id0col, lcol, lambda, id0gap, lgap, ngap, &lcolnew, id0out);
128 for (igap=0 ; igap<ngap; igap++)
129 nnew += id0gap[igap] - min(id0gap[igap], lambda);
132 for (i=nnew*m ; i<n*m; i++)
137 printf(
"(*V)[%d]=%f\n", i, (*V)[i]);
163 int gap_reduce(
double **V,
int id0,
int l,
int lambda,
int *id0gap,
int *lgap,
int ngap,
int *newl,
int id0out)
173 Vout =(*V)-(id0-id0out);
178 printf(
"lg=%d\n", lg);
179 memmove(&(Vout)[0], &(*V)[0], lg*
sizeof(
double));
183 int offset_first=id0gap[0]-id0+min(lambda,lgap[0]);
184 offset_first=max(0, offset_first);
190 printf(
"offset_first=%d\n", offset_first);
193 printf(
"(Vout)[%d]=%f\n", i, (Vout)[i]);
199 for (i=0 ; i<(ngap-1); i++) {
200 lg = id0gap[i+1]-id0-(id0gap[i]-id0+lgap[i]);
201 printf(
"lg=%d\n", lg);
202 memmove(&(Vout)[offset_first], &(*V)[id0gap[i]-id0+lgap[i]], lg*
sizeof(
double));
204 for (ii=0 ; ii<l; ii++)
205 printf(
"(Vout)[%d]=%f\n", ii, (Vout)[ii]);
207 newid0gap_ip1=offset_first+lg;
208 newlgap_ip1=min(lambda,lgap[i+1]);
209 for (k=newid0gap_ip1; k<newid0gap_ip1+newlgap_ip1; k++)
212 printf(
"lg=%d ; lambda=%d ; lgap[i+1]=%d\n", lg, lambda, lgap[i+1]);
213 offset_first += lg+min(lambda,lgap[i+1]);
217 printf(
"offset_first=%d\n", offset_first);
219 printf(
"(Vout)[%d]=%f\n", i, (Vout)[i]);
223 if (id0gap[i]-id0+lgap[i]<l) {
225 lg = l-(id0gap[i]-id0+lgap[i]);
226 memmove(&(Vout)[offset_first], &(*V)[id0gap[i]-id0+lgap[i]], lg*
sizeof(
double));
228 *newl = offset_first;
231 *newl = offset_first-min(lambda,lgap[ngap-1])+min( lambda, (id0+l-id0gap[ngap-1]) );
235 printf(
"l=%d, *newl=%d, offset_first=%d\n", l, *newl, offset_first);
237 for (i=offset_first ; i<l; i++)
240 printf(
"*newl=%d\n", *newl);
255 int gap_masking(
double **V,
int l,
int *id0gap,
int *lgap,
int ngap)
261 int offset_first=id0gap[0];
262 for (i=0 ; i<(ngap-1); i++) {
263 lg = id0gap[i+1]-(id0gap[i]+lgap[i]);
264 memmove(&(*V)[offset_first], &(*V)[id0gap[i]+lgap[i]], lg*
sizeof(
double));
269 lg = l-(id0gap[i]+lgap[i]);
271 memmove(&(*V)[offset_first], &(*V)[id0gap[i]+lgap[i]], lg*
sizeof(
double));
275 for (i=offset_first ; i<l; i++)
293 int gap_filling(
double **V,
int l,
int *id0gap,
int *lgap,
int ngap)
300 for (i=0 ; i<ngap; i++)
306 id0_Vmv = id0gap[ngap-1]+lgap[ngap-1];
307 offset_last = id0_Vmv - lgaptot;
311 memmove(&(*V)[id0_Vmv], &(*V)[offset_last], lg*
sizeof(
double));
313 for (i=ngap-2 ; i>=0; i--) {
314 id0_Vmv = id0gap[i]+lgap[i];
315 lg = id0gap[i+1]-id0_Vmv;
318 memmove(&(*V)[id0_Vmv], &(*V)[offset_last], lg*
sizeof(
double));
321 for (i=0 ; i<ngap; i++)
322 for (k=0 ; k<lgap[i]; k++)
323 (*V)[id0gap[i]+k] = 0;
330 int gap_masking_naive(
double **V,
int id0,
int local_V_size,
int m,
int nrow,
int *id0gap,
int *lgap,
int ngap)
338 for (i=0 ; i<local_V_size; i++) {
341 if ( icol<id0gap[k] ) {
342 (*V)[offsetV]=(*V)[i];
345 else if (icol>=id0gap[k]+lgap[k]) {