1 SUBROUTINE pstrtrs( UPLO, TRANS, DIAG, N, NRHS, A, IA, JA, DESCA,
2 $ B, IB, JB, DESCB, INFO )
10 CHARACTER DIAG, TRANS, UPLO
11 INTEGER IA, IB, INFO, JA, JB, N, NRHS
14 INTEGER DESCA( * ), DESCB( * )
163 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
164 $ lld_, mb_, m_, nb_, n_, rsrc_
165 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
166 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
167 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
169 parameter( zero = 0.0e+0, one = 1.0e+0 )
172 LOGICAL NOTRAN, NOUNIT, UPPER
173 INTEGER I, IAROW, IBROW, ICOFFA, ICTXT, ICURCOL,
174 $ icurrow, iroffa, iroffb, idum, ii, ioffa, j,
175 $ jblk, jj, jn, lda, ll, mycol, myrow, npcol,
179 INTEGER IDUM1( 3 ), IDUM2( 3 )
187 INTEGER ICEIL, INDXG2P
188 EXTERNAL iceil, indxg2p, lsame
191 INTRINSIC ichar,
min, mod
197 ictxt = desca( ctxt_ )
198 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
203 IF( nprow.EQ.-1 )
THEN
206 upper = lsame( uplo,
'U' )
207 nounit = lsame( diag,
'N' )
208 notran = lsame( trans,
'N' )
210 CALL chk1mat( n, 4, n, 4, ia, ja, desca, 9, info )
211 CALL chk1mat( n, 4, nrhs, 5, ib, jb, descb, 13, info )
213 iroffa = mod( ia-1, desca( mb_ ) )
214 icoffa = mod( ja-1, desca( nb_ ) )
215 iroffb = mod( ib-1, descb( mb_ ) )
216 iarow = indxg2p( ia, desca( mb_ ), myrow, desca( rsrc_ ),
218 ibrow = indxg2p( ib, descb( mb_ ), myrow, descb( rsrc_ ),
220 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
222 ELSE IF( .NOT.notran .AND. .NOT.lsame( trans,
'T' ) .AND.
223 $ .NOT.lsame( trans,
'C' ) )
THEN
225 ELSE IF( .NOT.nounit .AND. .NOT.lsame( diag,
'U' ) )
THEN
227 ELSE IF( iroffa.NE.icoffa .OR. iroffa.NE.0 )
THEN
229 ELSE IF( iroffa.NE.iroffb .OR. iarow.NE.ibrow )
THEN
231 ELSE IF( desca( mb_ ).NE.desca( nb_ ) )
THEN
233 ELSE IF( descb( mb_ ).NE.desca( nb_ ) )
THEN
239 idum1( 1 ) = ichar(
'U' )
241 idum1( 1 ) = ichar(
'L' )
245 idum1( 2 ) = ichar(
'N' )
246 ELSE IF( lsame( trans,
'T' ) )
THEN
247 idum1( 2 ) = ichar(
'T' )
248 ELSE IF( lsame( trans,
'C' ) )
THEN
249 idum1( 2 ) = ichar(
'C' )
253 idum1( 3 ) = ichar(
'N' )
255 idum1( 3 ) = ichar(
'D' )
258 CALL pchk2mat( n, 4, n, 4, ia, ja, desca, 9, n, 4, nrhs, 5,
259 $ ib, jb, descb, 13, 3, idum1, idum2, info )
263 CALL pxerbla( ictxt,
'PSTRTRS', -info )
269 IF( n.EQ.0 .OR. nrhs.EQ.0 )
275 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol,
276 $ ii, jj, icurrow, icurcol )
277 jn =
min( iceil( ja, desca( nb_ ) ) * desca( nb_ ), ja+n-1 )
279 ioffa = ii + ( jj - 1 ) * lda
284 IF( myrow.EQ.icurrow .AND. mycol.EQ.icurcol )
THEN
287 IF( a( ll ).EQ.zero .AND. info.EQ.0 )
292 IF( myrow.EQ.icurrow )
293 $ ioffa = ioffa + jblk
294 IF( mycol.EQ.icurcol )
295 $ ioffa = ioffa + jblk*lda
296 icurrow = mod( icurrow+1, nprow )
297 icurcol = mod( icurcol+1, npcol )
301 DO 30 j = jn+1, ja+n-1, desca( nb_ )
302 jblk =
min( ja+n-j, desca( nb_ ) )
303 IF( myrow.EQ.icurrow .AND. mycol.EQ.icurcol )
THEN
306 IF( a( ll ).EQ.zero .AND. info.EQ.0 )
307 $ info = j + i - ja + 1
311 IF( myrow.EQ.icurrow )
312 $ ioffa = ioffa + jblk
313 IF( mycol.EQ.icurcol )
314 $ ioffa = ioffa + jblk*lda
315 icurrow = mod( icurrow+1, nprow )
316 icurcol = mod( icurcol+1, npcol )
318 CALL igamx2d( ictxt,
'All',
' ', 1, 1, info, 1, idum, idum,
326 CALL pstrsm(
'Left', uplo, trans, diag, n, nrhs, one, a, ia, ja,
327 $ desca, b, ib, jb, descb )