9 #if defined(Add_) || defined(f77IsF2C)
10 #define fortran_mr2d psgemr2do_
11 #define fortran_mr2dnew psgemr2d_
13 #define fortran_mr2dnew PSGEMR2D
14 #define fortran_mr2d PSGEMR2DO
16 #define slacpy_ SLACPY
18 #define fortran_mr2d psgemr2do
19 #define fortran_mr2dnew psgemr2d
21 #define slacpy_ slacpy
23 #define Clacpy Csgelacpy
36 #define BLOCK_CYCLIC_2D 1
41 #define SHIFT(row,sprow,nbrow) ((row)-(sprow)+ ((row) >= (sprow) ? 0 : (nbrow)))
42 #define max(A,B) ((A)>(B)?(A):(B))
43 #define min(A,B) ((A)>(B)?(B):(A))
44 #define DIVUP(a,b) ( ((a)-1) /(b)+1)
45 #define ROUNDUP(a,b) (DIVUP(a,b)*(b))
47 #define malloc mymalloc
49 #define realloc myrealloc
82 #define scanD0 sgescanD0
83 #define dispmat sgedispmat
84 #define setmemory sgesetmemory
85 #define freememory sgefreememory
86 #define scan_intervals sgescan_intervals
117 assert(blocksize >= 0);
118 if (blocksize == 0) {
123 blocksize *
sizeof(
float));
131 if (ptrtobefreed == NULL)
133 free((
char *) ptrtobefreed);
141 scan_intervals(type, ja, jb, n, ma, mb, q0, q1, col0, col1,
144 int ja, jb, n, q0, q1, col0, col1;
148 int offset, j0, j1, templatewidth0, templatewidth1, nbcol0, nbcol1;
150 assert(type ==
'c' || type ==
'r');
151 nbcol0 = (type ==
'c' ? ma->
nbcol : ma->
nbrow);
152 nbcol1 = (type ==
'c' ? mb->
nbcol : mb->
nbrow);
153 templatewidth0 = q0 * nbcol0;
154 templatewidth1 = q1 * nbcol1;
156 int sp0 = (type ==
'c' ? ma->
spcol : ma->
sprow);
157 int sp1 = (type ==
'c' ? mb->
spcol : mb->
sprow);
158 j0 =
SHIFT(col0, sp0, q0) * nbcol0 - ja;
159 j1 =
SHIFT(col1, sp1, q1) * nbcol1 - jb;
166 assert(j0 + nbcol0 > 0);
167 assert(j1 + nbcol1 > 0);
168 while ((j0 < n) && (j1 < n)) {
174 j0 += templatewidth0;
179 j1 += templatewidth1;
184 start =
max(start, 0);
186 result[offset].
lstart = l + start - j0;
187 end =
min(end0, end1);
189 j0 += templatewidth0;
193 j1 += templatewidth1;
203 result[offset].
len = end - start;