9 #if defined(Add_) || defined(f77IsF2C)
10 #define fortran_mr2d pctrmr2do_
11 #define fortran_mr2dnew pctrmr2d_
13 #define fortran_mr2dnew PCTRMR2D
14 #define fortran_mr2d PCTRMR2DO
16 #define clacpy_ CLACPY
18 #define fortran_mr2d pctrmr2do
19 #define fortran_mr2dnew pctrmr2d
21 #define clacpy_ clacpy
23 #define Clacpy Cctrlacpy
39 #define BLOCK_CYCLIC_2D 1
44 #define SHIFT(row,sprow,nbrow) ((row)-(sprow)+ ((row) >= (sprow) ? 0 : (nbrow)))
45 #define max(A,B) ((A)>(B)?(A):(B))
46 #define min(A,B) ((A)>(B)?(B):(A))
47 #define DIVUP(a,b) ( ((a)-1) /(b)+1)
48 #define ROUNDUP(a,b) (DIVUP(a,b)*(b))
50 #define malloc mymalloc
52 #define realloc myrealloc
85 #define scanD0 ctrscanD0
86 #define dispmat ctrdispmat
87 #define setmemory ctrsetmemory
88 #define freememory ctrfreememory
89 #define scan_intervals ctrscan_intervals
120 assert(blocksize >= 0);
121 if (blocksize == 0) {
134 if (ptrtobefreed == NULL)
136 free((
char *) ptrtobefreed);
150 assert(j >= 0 && j < n);
152 if (toupper(*uplo) ==
'U') {
156 virtualnbline =
max(m - n, 0) + j + (toupper(*diag) ==
'N');
157 nbline =
min(virtualnbline, m);
165 diagcol =
max(n - m, 0);;
166 virtualline = j - diagcol + (toupper(*diag) ==
'U');
167 firstline =
max(0, virtualline);
168 off =
max(firstline - i, 0);
182 ptrsizebuff, pptrbuff, ptrblock,
184 ma, ia, ja, templateheight0, templatewidth0,
185 mb, ib, jb, templateheight1, templatewidth1)
186 int action, *ptrsizebuff;
189 int templateheight0, templatewidth0;
190 int templateheight1, templatewidth1;
192 int ia, ja, ib, jb, m, n;
204 assert(j >= 0 && j < n);
206 insidemat(uplo, diag, start, j, m, n, &offset);
212 intervalsize =
min(end - start, nbline);
213 (*ptrsizebuff) += intervalsize;
216 ptrstart = ptrblock +
localindice(start + ia, j + ja,
217 templateheight0, templatewidth0, ma);
218 memcpy((
char *) (*pptrbuff), (
char *) ptrstart,
219 intervalsize *
sizeof(
complex));
222 (*pptrbuff) += intervalsize;
225 ptrstart = ptrblock +
localindice(start + ib, j + jb,
226 templateheight1, templatewidth1, mb);
227 memcpy((
char *) ptrstart, (
char *) (*pptrbuff),
228 intervalsize *
sizeof(
complex));
231 (*pptrbuff) += intervalsize;
236 printf(
"action is %d outside the scope of the case [0..2] !! \n ", action);
246 scan_intervals(type, ja, jb, n, ma, mb, q0, q1, col0, col1,
249 int ja, jb, n, q0, q1, col0, col1;
253 int offset, j0, j1, templatewidth0, templatewidth1, nbcol0, nbcol1;
255 assert(type ==
'c' || type ==
'r');
256 nbcol0 = (type ==
'c' ? ma->
nbcol : ma->
nbrow);
257 nbcol1 = (type ==
'c' ? mb->
nbcol : mb->
nbrow);
258 templatewidth0 = q0 * nbcol0;
259 templatewidth1 = q1 * nbcol1;
261 int sp0 = (type ==
'c' ? ma->
spcol : ma->
sprow);
262 int sp1 = (type ==
'c' ? mb->
spcol : mb->
sprow);
263 j0 =
SHIFT(col0, sp0, q0) * nbcol0 - ja;
264 j1 =
SHIFT(col1, sp1, q1) * nbcol1 - jb;
271 assert(j0 + nbcol0 > 0);
272 assert(j1 + nbcol1 > 0);
273 while ((j0 < n) && (j1 < n)) {
279 j0 += templatewidth0;
284 j1 += templatewidth1;
289 start =
max(start, 0);
291 result[offset].
gstart = start;
292 end =
min(end0, end1);
294 j0 += templatewidth0;
298 j1 += templatewidth1;
308 result[offset].
len = end - start;
316 scanD0(uplo, diag, action, ptrbuff, ptrsizebuff,
330 IDESC *v_inter, *h_inter;
331 int vinter_nb, hinter_nb;
338 int templateheight1, templatewidth1;
339 int templateheight0, templatewidth0;
342 templateheight1 = p1 * mb->
nbrow;
343 templateheight0 = p0 * ma->
nbrow;
344 templatewidth1 = q1 * mb->
nbcol;
345 templatewidth0 = q0 * ma->
nbcol;
350 for (h = 0; h < hinter_nb; h++)
351 for (v = 0; v < vinter_nb; v++) {
353 for (j = 0; j < h_inter[h].
len; j++)
354 intersect(uplo, diag, j + h_inter[h].gstart,
355 v_inter[v].gstart, v_inter[v].gstart + v_inter[v].len,
356 action, ptrsizebuff, &ptrbuff, ptrblock, m, n,
357 ma, ia, ja, templateheight0, templatewidth0,
358 mb, ib, jb, templateheight1, templatewidth1);