9 #if defined(Add_) || defined(f77IsF2C)
10 #define fortran_mr2d pzgemr2do_
11 #define fortran_mr2dnew pzgemr2d_
13 #define fortran_mr2dnew PZGEMR2D
14 #define fortran_mr2d PZGEMR2DO
16 #define zlacpy_ ZLACPY
18 #define fortran_mr2d pzgemr2do
19 #define fortran_mr2dnew pzgemr2d
21 #define zlacpy_ zlacpy
23 #define Clacpy Czgelacpy
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 zgescanD0
86 #define dispmat zgedispmat
87 #define setmemory zgesetmemory
88 #define freememory zgefreememory
89 #define scan_intervals zgescan_intervals
120 assert(blocksize >= 0);
121 if (blocksize == 0) {
134 if (ptrtobefreed == NULL)
136 free((
char *) ptrtobefreed);
144 scan_intervals(type, ja, jb, n, ma, mb, q0, q1, col0, col1,
147 int ja, jb, n, q0, q1, col0, col1;
151 int offset, j0, j1, templatewidth0, templatewidth1, nbcol0, nbcol1;
153 assert(type ==
'c' || type ==
'r');
154 nbcol0 = (type ==
'c' ? ma->
nbcol : ma->
nbrow);
155 nbcol1 = (type ==
'c' ? mb->
nbcol : mb->
nbrow);
156 templatewidth0 = q0 * nbcol0;
157 templatewidth1 = q1 * nbcol1;
159 int sp0 = (type ==
'c' ? ma->
spcol : ma->
sprow);
160 int sp1 = (type ==
'c' ? mb->
spcol : mb->
sprow);
161 j0 =
SHIFT(col0, sp0, q0) * nbcol0 - ja;
162 j1 =
SHIFT(col1, sp1, q1) * nbcol1 - jb;
169 assert(j0 + nbcol0 > 0);
170 assert(j1 + nbcol1 > 0);
171 while ((j0 < n) && (j1 < n)) {
177 j0 += templatewidth0;
182 j1 += templatewidth1;
187 start =
max(start, 0);
189 result[offset].
lstart = l + start - j0;
190 end =
min(end0, end1);
192 j0 += templatewidth0;
196 j1 += templatewidth1;
206 result[offset].
len = end - start;