83 int distcorrmin = lambda - 1;
86 if (i == -1)
return (-1);
89 I = (i + rfirst) % (n + distcorrmin);
90 J = (i + rfirst) / (n + distcorrmin);
92 if (I < n) i_out = I - rfirst + J * n;
103 int distcorrmin = lambda - 1;
104 int rfirst = id0 % n;
106 if (i == -1) i_out = -1;
108 I = (i + rfirst) % (n);
109 J = (i + rfirst) / (n);
111 i_out = I - rfirst + J * (n + distcorrmin);
118 int *nocol,
int nbcol) {
120 int distcorrmin = lambda - 1;
121 int rfirst = id0 % n;
123 if (i == -1)
return (-1);
125 if (i >= lconc)
return (-2);
127 I = (i + rfirst) % (n);
128 J = (i + rfirst) / (n);
130 i_out = I - rfirst + nocol[J] * (n);
138 int lambda,
int *nocol_inv,
int nbcol) {
140 int distcorrmin = lambda - 1;
141 int rfirst = id0 % n;
143 if (i == -1)
return (-1);
145 if (i >= l)
return (-2);
147 I = (i + rfirst) % (n);
148 J = (i + rfirst) / (n);
150 if (nocol_inv[J] == (-1)) i_out = -1;
152 i_out = I - rfirst + nocol_inv[J] * (n);
163 int distcorrmin = lambda - 1;
165 if (i == -1)
return (-1);
167 I = (i) % (fft_size);
168 J = (i) / (fft_size);
170 i_out = (I - distcorrmin) + J * (fft_size - 2 * distcorrmin);
172 if (i_out < 0 || i_out >= v1_size) i_out = -1;
182 for (i = 1; i < nbcol; i++) {
183 if (nocol[i] != (ip + i))
return 1;
195 int distcorrmin = lambda - 1;
197 if (i < 0 || i >= v1_size)
return (-2);
199 I = (i) % (fft_size - 2 * distcorrmin);
200 J = (i) / (fft_size - 2 * distcorrmin);
202 i_out = (I + distcorrmin) + J * (fft_size);
209 int vedge_size,
int *nrshp,
int *mrshp,
int *lrshp) {
211 if (flag_format_rshp == 2) {
214 *lrshp = (*nrshp) * (*mrshp);
215 }
else if (flag_format_rshp == 1) {
218 *lrshp = (*nrshp) * (*mrshp);
219 }
else if (flag_format_rshp
236 nocol_inv = (
int *) calloc(m,
sizeof(
double));
238 for (i = 0; i < m; i++) nocol_inv[i] = -1;
239 for (i = 0; i < nbcol; i++) nocol_inv[nocol[i]] = i;
246 int build_reshape(
double *Vin,
int *nocol,
int nbcol,
int lconc,
int n,
int m,
247 int id0,
int l,
int lambda,
int nfft,
double *Vrshp,
248 int nrshp,
int mrshp,
int lrshp,
int flag_format_rshp) {
251 int rfirst = id0 % n;
252 int i_out1, i_out2, i_out3;
253 int distcorrmin = lambda - 1;
258 int idf = id0 + l - 1;
264 v1_size = lconc + (distcorrmin) * (nbcol - 1);
265 fft_size = ceil(1.0 * v1_size / nfft) + 2 * distcorrmin;
269 fprintf(file,
"fctid_concatcol: \t %d\n",
271 fprintf(file,
"fctid_mat2vect: \t %d\n", (nbcol > 1));
272 fprintf(file,
"fctid_vect2nfftblock \t %d\n", (nfft > 1));
276 for (i = 0; i < lrshp; i++) {
283 if (nbcol > 1) i_out2 =
fctid_mat2vect(i_out1, rfirst, n, lambda);
294 if (i_out3 == -1) Vrshp[i] = 0;
296 Vrshp[i] = Vin[i_out3];
306 int id0,
int l,
int lambda,
int nfft,
double *Vrshp,
307 int nrshp,
int mrshp,
int lrshp,
int flag_format_rshp) {
310 int rfirst = id0 % n;
311 int i_out1, i_out2, i_out3;
313 int distcorrmin = lambda - 1;
321 v1_size = lconc + (distcorrmin) * (nbcol - 1);
322 fft_size = ceil(1.0 * v1_size / nfft) + 2 * distcorrmin;
326 fprintf(file,
"fctid_concatcol: \t %d\n",
328 fprintf(file,
"fctid_mat2vect: \t %d\n", (nbcol > 1));
329 fprintf(file,
"fctid_vect2nfftblock \t %d\n", (nfft > 1));
335 for (i = 0; i < lconc; i++) {
353 if (i_out3 == -1) Vout[i] = -1;
354 else if (i_out3 == -2)
357 Vout[i_in1] = Vrshp[i_out3];
int build_reshape(double *Vin, int *nocol, int nbcol, int lconc, int n, int m, int id0, int l, int lambda, int nfft, double *Vrshp, int nrshp, int mrshp, int lrshp, int flag_format_rshp)
int define_rshp_size(int flag_format_rshp, int fft_size, int nfft, int v1_size, int vedge_size, int *nrshp, int *mrshp, int *lrshp)
int is_needconcat(int *nocol, int nbcol)
int build_nocol_inv(int *nocol, int nbcol, int m)
int fctid_vect2nfftblock_inv(int i, int v1_size, int fft_size, int nfft, int lambda)
int fctid_concatcol_inv(int i, int id0, int n, int m, int l, int lconc, int lambda, int *nocol_inv, int nbcol)
int fctid_concatcol(int i, int id0, int n, int m, int l, int lconc, int lambda, int *nocol, int nbcol)
int extract_result(double *Vout, int *nocol, int nbcol, int lconc, int n, int m, int id0, int l, int lambda, int nfft, double *Vrshp, int nrshp, int mrshp, int lrshp, int flag_format_rshp)
int fctid_mat2vect(int i, int id0, int n, int lambda)
int fctid_vect2nfftblock(int i, int v1_size, int fft_size, int nfft, int lambda)
int fctid_mat2vect_inv(int i, int id0, int n, int lambda)