1 SUBROUTINE pztrtrs( 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( * )
15 COMPLEX*16 A( * ), B( * )
165 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
166 $ lld_, mb_, m_, nb_, n_, rsrc_
167 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
168 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
169 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
171 parameter( zero = 0.0d+0, one = 1.0d+0 )
174 LOGICAL NOTRAN, NOUNIT, UPPER
175 INTEGER I, IAROW, IBROW, ICOFFA, ICTXT, ICURCOL,
176 $ icurrow, iroffa, iroffb, idum, ii, ioffa, j,
177 $ jblk, jj, jn, lda, ll, mycol, myrow, npcol,
181 INTEGER IDUM1( 3 ), IDUM2( 3 )
189 INTEGER ICEIL, INDXG2P
190 EXTERNAL iceil, indxg2p, lsame
193 INTRINSIC ichar,
min, mod
199 ictxt = desca( ctxt_ )
200 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
205 IF( nprow.EQ.-1 )
THEN
208 upper = lsame( uplo,
'U' )
209 nounit = lsame( diag,
'N' )
210 notran = lsame( trans,
'N' )
212 CALL chk1mat( n, 4, n, 4, ia, ja, desca, 9, info )
213 CALL chk1mat( n, 4, nrhs, 5, ib, jb, descb, 13, info )
215 iroffa = mod( ia-1, desca( mb_ ) )
216 icoffa = mod( ja-1, desca( nb_ ) )
217 iroffb = mod( ib-1, descb( mb_ ) )
218 iarow = indxg2p( ia, desca( mb_ ), myrow, desca( rsrc_ ),
220 ibrow = indxg2p( ib, descb( mb_ ), myrow, descb( rsrc_ ),
222 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
224 ELSE IF( .NOT.notran .AND. .NOT.lsame( trans,
'T' ) .AND.
225 $ .NOT.lsame( trans,
'C' ) )
THEN
227 ELSE IF( .NOT.nounit .AND. .NOT.lsame( diag,
'U' ) )
THEN
229 ELSE IF( iroffa.NE.icoffa .OR. iroffa.NE.0 )
THEN
231 ELSE IF( iroffa.NE.iroffb .OR. iarow.NE.ibrow )
THEN
233 ELSE IF( desca( mb_ ).NE.desca( nb_ ) )
THEN
235 ELSE IF( descb( mb_ ).NE.desca( nb_ ) )
THEN
241 idum1( 1 ) = ichar(
'U' )
243 idum1( 1 ) = ichar(
'L' )
247 idum1( 2 ) = ichar(
'N' )
248 ELSE IF( lsame( trans,
'T' ) )
THEN
249 idum1( 2 ) = ichar(
'T' )
250 ELSE IF( lsame( trans,
'C' ) )
THEN
251 idum1( 2 ) = ichar(
'C' )
255 idum1( 3 ) = ichar(
'N' )
257 idum1( 3 ) = ichar(
'D' )
260 CALL pchk2mat( n, 4, n, 4, ia, ja, desca, 9, n, 4, nrhs, 5,
261 $ ib, jb, descb, 13, 3, idum1, idum2, info )
265 CALL pxerbla( ictxt,
'PZTRTRS', -info )
271 IF( n.EQ.0 .OR. nrhs.EQ.0 )
277 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol,
278 $ ii, jj, icurrow, icurcol )
279 jn =
min( iceil( ja, desca( nb_ ) ) * desca( nb_ ), ja+n-1 )
281 ioffa = ii + ( jj - 1 ) * lda
286 IF( myrow.EQ.icurrow .AND. mycol.EQ.icurcol )
THEN
289 IF( a( ll ).EQ.zero .AND. info.EQ.0 )
294 IF( myrow.EQ.icurrow )
295 $ ioffa = ioffa + jblk
296 IF( mycol.EQ.icurcol )
297 $ ioffa = ioffa + jblk*lda
298 icurrow = mod( icurrow+1, nprow )
299 icurcol = mod( icurcol+1, npcol )
303 DO 30 j = jn+1, ja+n-1, desca( nb_ )
304 jblk =
min( ja+n-j, desca( nb_ ) )
305 IF( myrow.EQ.icurrow .AND. mycol.EQ.icurcol )
THEN
308 IF( a( ll ).EQ.zero .AND. info.EQ.0 )
309 $ info = j + i - ja + 1
313 IF( myrow.EQ.icurrow )
314 $ ioffa = ioffa + jblk
315 IF( mycol.EQ.icurcol )
316 $ ioffa = ioffa + jblk*lda
317 icurrow = mod( icurrow+1, nprow )
318 icurcol = mod( icurcol+1, npcol )
320 CALL igamx2d( ictxt,
'All',
' ', 1, 1, info, 1, idum, idum,
328 CALL pztrsm(
'Left', uplo, trans, diag, n, nrhs, one, a, ia, ja,
329 $ desca, b, ib, jb, descb )