1 SUBROUTINE pstrtri( UPLO, DIAG, N, A, IA, JA, DESCA, INFO )
10 INTEGER IA, INFO, JA, N
133 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
134 $ LLD_, MB_, M_, NB_, N_, RSRC_
135 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
136 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
137 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
139 parameter( zero = 0.0e+0, one = 1.0e+0 )
142 LOGICAL NOUNIT, UPPER
143 INTEGER I, ICOFF, ICTXT, IROFF, ICURCOL, ICURROW,
144 $ IDUMMY, II, IOFFA, J, JB, JJ, JN, LDA, MYCOL,
145 $ MYROW, NN, NPCOL, NPROW
148 INTEGER IDUM1( 2 ), IDUM2( 2 )
158 EXTERNAL iceil, lsame
161 INTRINSIC ichar,
min, mod
167 ictxt = desca( ctxt_ )
168 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
173 IF( nprow.EQ.-1 )
THEN
176 upper = lsame( uplo,
'U' )
177 nounit = lsame( diag,
'N' )
179 CALL chk1mat( n, 3, n, 3, ia, ja, desca, 7, info )
181 iroff = mod( ia-1, desca( mb_ ) )
182 icoff = mod( ja-1, desca( nb_ ) )
183 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
185 ELSE IF( .NOT.nounit .AND. .NOT.lsame( diag,
'U' ) )
THEN
187 ELSE IF( iroff.NE.icoff .OR. iroff.NE.0 )
THEN
189 ELSE IF( desca( mb_ ).NE.desca( nb_ ) )
THEN
195 idum1( 1 ) = ichar(
'U' )
197 idum1( 1 ) = ichar(
'L' )
201 idum1( 2 ) = ichar(
'N' )
203 idum1( 2 ) = ichar(
'U' )
207 CALL pchk1mat( n, 3, n, 3, ia, ja, desca, 7, 2, idum1, idum2,
212 CALL pxerbla( ictxt,
'PSTRTRI', -info )
223 jn =
min( iceil( ja, desca( nb_ ) ) * desca( nb_ ), ja+n-1 )
225 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol,
226 $ ii, jj, icurrow, icurcol )
232 IF( myrow.EQ.icurrow .AND. mycol.EQ.icurcol )
THEN
233 ioffa = ii+(jj-1)*lda
235 IF( a( ioffa ).EQ.zero .AND. info.EQ.0 )
237 ioffa = ioffa + lda + 1
240 IF( myrow.EQ.icurrow )
242 IF( mycol.EQ.icurcol )
244 icurrow = mod( icurrow+1, nprow )
245 icurcol = mod( icurcol+1, npcol )
249 DO 30 j = jn+1, ja+n-1, desca( nb_ )
250 jb =
min( ja+n-j, desca( nb_ ) )
251 IF( myrow.EQ.icurrow .AND. mycol.EQ.icurcol )
THEN
252 ioffa = ii+(jj-1)*lda
254 IF( a( ioffa ).EQ.zero .AND. info.EQ.0 )
255 $ info = j + i - ja + 1
256 ioffa = ioffa + lda + 1
259 IF( myrow.EQ.icurrow )
261 IF( mycol.EQ.icurcol )
263 icurrow = mod( icurrow+1, nprow )
264 icurcol = mod( icurcol+1, npcol )
266 CALL igamx2d( ictxt,
'All',
' ', 1, 1, info, 1, idummy,
267 $ idummy, -1, -1, mycol )
282 CALL pstrti2( uplo, diag, jb, a, ia, ja, desca, info )
286 DO 40 j = jn+1, ja+n-1, desca( nb_ )
287 jb =
min( desca( nb_ ), ja+n-j )
292 CALL pstrmm(
'Left', uplo,
'No transpose', diag, j-ja, jb,
293 $ one, a, ia, ja, desca, a, ia, j, desca )
294 CALL pstrsm(
'Right', uplo,
'No transpose', diag, j-ja,
295 $ jb, -one, a, i, j, desca, a, ia, j, desca )
299 CALL pstrti2( uplo, diag, jb, a, i, j, desca, info )
307 nn = ( ( ja+n-2 ) / desca( nb_ ) )*desca( nb_ ) + 1
308 DO 50 j = nn, jn+1, -desca( nb_ )
309 jb =
min( desca( nb_ ), ja+n-j )
311 IF( j+jb.LE.ja+n-1 )
THEN
315 CALL pstrmm(
'Left', uplo,
'No transpose', diag,
316 $ ja+n-j-jb, jb, one, a, i+jb, j+jb, desca,
317 $ a, i+jb, j, desca )
318 CALL pstrsm(
'Right', uplo,
'No transpose', diag,
319 $ ja+n-j-jb, jb, -one, a, i, j, desca,
320 $ a, i+jb, j, desca )
325 CALL pstrti2( uplo, diag, jb, a, i, j, desca, info )
332 IF( ja+jb.LE.ja+n-1 )
THEN
336 CALL pstrmm(
'Left', uplo,
'No transpose', diag, n-jb, jb,
337 $ one, a, ia+jb, ja+jb, desca, a, ia+jb, ja,
339 CALL pstrsm(
'Right', uplo,
'No transpose', diag, n-jb, jb,
340 $ -one, a, ia, ja, desca, a, ia+jb, ja, desca )
345 CALL pstrti2( uplo, diag, jb, a, ia, ja, desca, info )