76 __typeof__(a) _a = (a); \
77 __typeof__(b) _b = (b); \
83 __typeof__(a) _a = (a); \
84 __typeof__(b) _b = (b); \
112 int flag_nocomputeedges = 1;
113 int offset_edges = 0;
115 int distcorrmin = lambda - 1;
117 if (flag_nocomputeedges == 1) offset_edges = distcorrmin;
120 for (k = 0; k < m; k++) {
122 #pragma omp parallel for shared(k, lambda, n) private(i, j, j_first, j_last, \
124 for (i = 0 + offset_edges; i < n - offset_edges; i++) {
126 (*TV)[i + k * n] = 0;
127 j_first = max(i - (lambda - 1), 0);
128 j_last = min(i + lambda, n);
130 for (j = j_first; j < j_last; j++) {
132 (*TV)[i + k * n] += T[Tid] * (*V)[j + k * n];
157 int lambda,
int nfft,
int flag_offset) {
163 int distcorrmin = lambda - 1;
169 if (flag_offset == 1)
170 nbloc = ceil((1.0 * (n - 2 * distcorrmin)) / blocksize_eff);
172 nbloc = ceil((1.0 * n) / blocksize_eff);
175 double *V_bloc, *TV_bloc;
176 V_bloc = (
double *) calloc(blocksize * m,
sizeof(
double));
177 TV_bloc = (
double *) calloc(blocksize * m,
sizeof(
double));
178 if ((V_bloc == 0) || (TV_bloc == 0))
182 if (flag_offset == 1) offset = distcorrmin;
190 currentsize = min(blocksize - distcorrmin + offset, n - iV);
194 copy_block(n, m, *V, blocksize, m, V_bloc, 0, 0, currentsize, m,
195 distcorrmin - offset, 0, 1.0, 0);
201 printf(
"Error in stmm_core.");
207 iV = blocksize_eff - distcorrmin + offset;
210 currentsize = min(blocksize, n - iV);
215 copy_block(n, m, *V, blocksize, m, V_bloc, iV, 0, currentsize, m, 0, 0,
220 currentsize = min(blocksize_eff, n - iTV);
221 copy_block(blocksize, m, TV_bloc, n, m, *V, distcorrmin, 0, currentsize, m,
225 iTV += blocksize_eff;
227 for (k = 1; k < nbloc; k++) {
231 if (status != 0)
break;
235 if (k != nbloc - 1) {
236 currentsize = min(blocksize, n - iV);
239 (currentsize != blocksize);
241 copy_block(n, m, *V, blocksize, m, V_bloc, iV, 0, currentsize, m, 0,
242 0, 1.0, flag_resetk);
246 currentsize = min(blocksize_eff, n - iTV);
247 copy_block(blocksize, m, TV_bloc, n, m, *V, distcorrmin, 0, currentsize,
249 iTV += blocksize_eff;
int print_error_message(int error_number, char const *file, int line)
Prints error message corresponding to an error number.
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)
int stmm_simple_core(double **V, int n, int m, double *T, int blocksize, int lambda, int nfft, int flag_offset)
int stmm_simple_basic(double **V, int n, int m, double *T, int lambda, double **TV)
Perform the product of a Toeplitz matrix by a matrix without using FFT's.