1 SUBROUTINE pzgetrs( TRANS, N, NRHS, A, IA, JA, DESCA, IPIV, B,
2 $ IB, JB, DESCB, INFO )
11 INTEGER IA, IB, INFO, JA, JB, N, NRHS
14 INTEGER DESCA( * ), DESCB( * ), IPIV( * )
15 COMPLEX*16 A( * ), B( * )
152 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
153 $ lld_, mb_, m_, nb_, n_, rsrc_
154 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
155 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
156 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
158 parameter( one = 1.0d+0 )
162 INTEGER IAROW, IBROW, ICOFFA, ICTXT, IROFFA, IROFFB,
163 $ mycol, myrow, npcol, nprow
166 INTEGER DESCIP( DLEN_ ), IDUM1( 1 ), IDUM2( 1 )
174 INTEGER INDXG2P, NUMROC
175 EXTERNAL indxg2p, lsame, numroc
184 ictxt = desca( ctxt_ )
185 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
190 IF( nprow.EQ.-1 )
THEN
193 notran = lsame( trans,
'N' )
194 CALL chk1mat( n, 2, n, 2, ia, ja, desca, 7, info )
195 CALL chk1mat( n, 2, nrhs, 3, ib, jb, descb, 12, info )
197 iarow = indxg2p( ia, desca( mb_ ), myrow, desca( rsrc_ ),
199 ibrow = indxg2p( ib, descb( mb_ ), myrow, descb( rsrc_ ),
201 iroffa = mod( ia-1, desca( mb_ ) )
202 icoffa = mod( ja-1, desca( nb_ ) )
203 iroffb = mod( ib-1, descb( mb_ ) )
204 IF( .NOT.notran .AND. .NOT.lsame( trans,
'T' ) .AND. .NOT.
205 $ lsame( trans,
'C' ) )
THEN
207 ELSE IF( iroffa.NE.0 )
THEN
209 ELSE IF( icoffa.NE.0 )
THEN
211 ELSE IF( desca( mb_ ).NE.desca( nb_ ) )
THEN
213 ELSE IF( iroffb.NE.0 .OR. ibrow.NE.iarow )
THEN
215 ELSE IF( descb( mb_ ).NE.desca( nb_ ) )
THEN
217 ELSE IF( ictxt.NE.descb( ctxt_ ) )
THEN
222 idum1( 1 ) = ichar(
'N' )
223 ELSE IF( lsame( trans,
'T' ) )
THEN
224 idum1( 1 ) = ichar(
'T' )
226 idum1( 1 ) = ichar(
'C' )
229 CALL pchk2mat( n, 2, n, 2, ia, ja, desca, 7, n, 2, nrhs, 3,
230 $ ib, jb, descb, 12, 1, idum1, idum2, info )
234 CALL pxerbla( ictxt,
'PZGETRS', -info )
240 IF( n.EQ.0 .OR. nrhs.EQ.0 )
243 CALL descset( descip, desca( m_ ) + desca( mb_ )*nprow, 1,
244 $ desca( mb_ ), 1, desca( rsrc_ ), mycol, ictxt,
245 $ desca( mb_ ) + numroc( desca( m_ ), desca( mb_ ),
246 $ myrow, desca( rsrc_ ), nprow ) )
254 CALL pzlapiv(
'Forward',
'Row',
'Col', n, nrhs, b, ib, jb,
255 $ descb, ipiv, ia, 1, descip, idum1 )
259 CALL pztrsm(
'Left',
'Lower',
'No transpose',
'Unit', n, nrhs,
260 $ one, a, ia, ja, desca, b, ib, jb, descb )
264 CALL pztrsm(
'Left',
'Upper',
'No transpose',
'Non-unit', n,
265 $ nrhs, one, a, ia, ja, desca, b, ib, jb, descb )
272 CALL pztrsm(
'Left',
'Upper', trans,
'Non-unit', n, nrhs,
273 $ one, a, ia, ja, desca, b, ib, jb, descb )
277 CALL pztrsm(
'Left',
'Lower', trans,
'Unit', n, nrhs, one,
278 $ a, ia, ja, desca, b, ib, jb, descb )
282 CALL pzlapiv(
'Backward',
'Row',
'Col', n, nrhs, b, ib, jb,
283 $ descb, ipiv, ia, 1, descip, idum1 )