39{
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242 char DiagA, DirB, OpC, OpR, SideOp, TopC, TopR, TranOp, UploA,
243 Var, ctop, ctopsave, rtop, rtopsave;
244 Int Ai, Aj, Bi, Bj, ChooseAB, ForceTop, ctxt, info, lside, mycol,
245 myrow, nb, notran, nounit, npcol, nprow, upper;
246 double ABestL, ABestR, Best, tmp1, tmp2, tmp3, tmp4;
248
249
250
252
253
254
255
262#ifndef NO_ARGCHK
263
264
265
267 if( !( info = ( ( nprow == -1 ) ? -( 1101 +
CTXT_ ) : 0 ) ) )
268 {
269 if( ( !lside ) && ( SideOp !=
CRIGHT ) )
270 {
271 PB_Cwarn( ctxt, __LINE__,
"PSTRMM",
"Illegal SIDE = %c\n", SideOp );
272 info = -1;
273 }
274 else if( ( !upper ) && ( UploA !=
CLOWER ) )
275 {
276 PB_Cwarn( ctxt, __LINE__,
"PSTRMM",
"Illegal UPLO = %c\n", UploA );
277 info = -2;
278 }
279 else if( ( !notran ) && ( TranOp !=
CTRAN ) && ( TranOp !=
CCOTRAN ) )
280 {
281 PB_Cwarn( ctxt, __LINE__,
"PSTRMM",
"Illegal TRANS = %c\n", TranOp );
282 info = -3;
283 }
284 if( ( !nounit ) && ( DiagA !=
CUNIT ) )
285 {
287 "Illegal DIAG = %c\n", DiagA );
288 info = -4;
289 }
290 if( lside )
291 PB_Cchkmat( ctxt,
"PSTRMM",
"A", *M, 5, *M, 5, Ai, Aj, Ad, 11,
292 &info );
293 else
294 PB_Cchkmat( ctxt,
"PSTRMM",
"A", *N, 6, *N, 6, Ai, Aj, Ad, 11,
295 &info );
296 PB_Cchkmat( ctxt,
"PSTRMM",
"B", *M, 5, *N, 6, Bi, Bj, Bd, 15,
297 &info );
298 }
299 if( info ) {
PB_Cabort( ctxt,
"PSTRMM", info );
return; }
300#endif
301
302
303
304 if( *M == 0 || *N == 0 ) return;
305
306
307
309
310
311
313 {
315 ((char *) B), Bi, Bj, Bd );
316 return;
317 }
318
319
320
321#ifdef NO_ARGCHK
323#endif
324
325
326
327
328
329
330
331
332
333 if( lside )
334 {
335 if( notran )
336 {
338 ABestR = (double)(*M) *
339 ( ( ( ( Ad[
CSRC_] == -1 ) || ( npcol == 1 ) ) ?
ZERO : tmp1 /
TWO ) +
340 ( ( ( Bd[
RSRC_] == -1 ) || ( nprow == 1 ) ) ?
ZERO : tmp4 ) );
343 Best = (double)(*N) *
345 ( nprow == 1 ?
ZERO : tmp2 ) +
MAX( tmp2, tmp4 ) );
346 ChooseAB = ( ( 1.1 * ABestR ) <= Best );
347 }
348 else
349 {
352 ABestL = (double)(*M) *
353 ( ( ( ( Ad[
CSRC_] == -1 ) || ( npcol == 1 ) ) ?
ZERO : tmp1 /
TWO ) +
355 ( ( ( Bd[
RSRC_] == -1 ) || ( nprow == 1 ) ) ?
ZERO : tmp4 ) );
356 ABestR = (double)(*M) *
357 ( ( ( ( Ad[
CSRC_] == -1 ) || ( npcol == 1 ) ) ?
ZERO : tmp1 /
TWO ) +
358 ( ( ( Bd[
RSRC_] == -1 ) || ( nprow == 1 ) ) ?
ZERO : tmp4 ) +
359 MAX( tmp2, tmp1 ) /
TWO );
362 Best = (double)(*N) *
363 ( ( ( ( Bd[
CSRC_] == -1 ) || ( npcol == 1 ) ) ?
ZERO : tmp1 ) +
365 ChooseAB = ( ( ( 1.1 * ABestL ) <= Best ) ||
366 ( ( 1.1 * ABestR ) <= Best ) );
367 }
368 }
369 else
370 {
371 if( notran )
372 {
374 ABestR = (double)(*N) *
375 ( ( ( ( Ad[
RSRC_] == -1 ) || ( nprow == 1 ) ) ?
ZERO : tmp2 /
TWO ) +
376 ( ( ( Bd[
CSRC_] == -1 ) || ( npcol == 1 ) ) ?
ZERO : tmp3 ) );
379 Best = (double)(*M) *
381 ( npcol == 1 ?
ZERO : tmp1 ) +
MAX( tmp1, tmp3 ) );
382 ChooseAB = ( ( 1.1 * ABestR ) <= Best );
383 }
384 else
385 {
388 ABestL = (double)(*N) *
389 ( ( ( ( Ad[
RSRC_] == -1 ) || ( nprow == 1 ) ) ?
ZERO : tmp2 /
TWO ) +
391 ( ( ( Bd[
CSRC_] == -1 ) || ( npcol == 1 ) ) ?
ZERO : tmp3 ) );
392 ABestR = (double)(*N) *
393 ( ( ( ( Ad[
RSRC_] == -1 ) || ( nprow == 1 ) ) ?
ZERO : tmp2 /
TWO ) +
394 ( ( ( Bd[
CSRC_] == -1 ) || ( npcol == 1 ) ) ?
ZERO : tmp3 ) +
395 MAX( tmp2, tmp1 ) /
TWO );
398 Best = (double)(*M) *
399 ( ( ( ( Bd[
RSRC_] == -1 ) || ( nprow == 1 ) ) ?
ZERO : tmp2 ) +
401 ChooseAB = ( ( ( 1.1 * ABestL ) <= Best ) ||
402 ( ( 1.1 * ABestR ) <= Best ) );
403 }
404 }
405
406
407
408
409
411 ForceTop = ( ( *M > nb ) && ( *N > nb ) );
412
413 if( ChooseAB )
414 {
415 if( lside )
416 {
417 if( notran )
418 {
422 }
423 else
424 {
425 if( ABestL <= ABestR )
426 {
430 }
431 else
432 {
436 }
437 }
438 }
439 else
440 {
441 if( notran )
442 {
446 }
447 else
448 {
449 if( ABestL <= ABestR )
450 {
454 }
455 else
456 {
460 }
461 }
462 }
463
466
467 if( ForceTop )
468 {
469 if( ( rtopsave = rtop ) != TopR )
471 if( ( ctopsave = ctop ) != TopC )
473
474
475
476
481 }
482
484 &DiagA, *M, *N, ((char *)ALPHA), ((char *)A), Ai, Aj, Ad,
485 ((char *)B), Bi, Bj, Bd );
486 }
487 else
488 {
489 if( ( lside && notran ) || ( !( lside ) && !( notran ) ) )
490 {
494
495 if( ForceTop )
496 {
497 rtopsave = rtop;
498 ctopsave = ctop;
499
500
501
502
507
508
509
510
512 }
513 }
514 else
515 {
519
520 if( ForceTop )
521 {
522 rtopsave = rtop;
523 ctopsave = ctop;
524
525
526
527
532
533
534
535
537 }
538 }
539
540 if( lside )
542 else
544
546 &DiagA, *M, *N, ((char *)ALPHA), ((char *)A), Ai, Aj, Ad,
547 ((char *)B), Bi, Bj, Bd );
548 }
549
550
551
552 if( ForceTop )
553 {
554 rtopsave = *
PB_Ctop( &ctxt, &OpR,
ROW, &rtopsave );
556 }
557
558
559
560}