1 SUBROUTINE pdgetrf( M, N, A, IA, JA, DESCA, IPIV, INFO )
9 INTEGER IA, INFO, JA, M, N
12 INTEGER DESCA( * ), IPIV( * )
13 DOUBLE PRECISION A( * )
136 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
137 $ LLD_, MB_, M_, NB_, N_, RSRC_
138 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
139 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
140 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
142 parameter( one = 1.0d+0 )
145 CHARACTER COLBTOP, COLCTOP, ROWBTOP
146 INTEGER I, ICOFF, ICTXT, IINFO, IN, IROFF, J, JB, JN,
147 $ MN, MYCOL, MYROW, NPCOL, NPROW
150 INTEGER IDUM1( 1 ), IDUM2( 1 )
154 $ pb_topget, pb_topset, pdgemm,
pdgetf2,
168 ictxt = desca( ctxt_ )
169 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
174 IF( nprow.EQ.-1 )
THEN
177 CALL chk1mat( m, 1, n, 2, ia, ja, desca, 6, info )
179 iroff = mod( ia-1, desca( mb_ ) )
180 icoff = mod( ja-1, desca( nb_ ) )
181 IF( iroff.NE.0 )
THEN
183 ELSE IF( icoff.NE.0 )
THEN
185 ELSE IF( desca( mb_ ).NE.desca( nb_ ) )
THEN
189 CALL pchk1mat( m, 1, n, 2, ia, ja, desca, 6, 0, idum1,
194 CALL pxerbla( ictxt,
'PDGETRF', -info )
200 IF( desca( m_ ).EQ.1 )
THEN
203 ELSE IF( m.EQ.0 .OR. n.EQ.0 )
THEN
209 CALL pb_topget( ictxt,
'Broadcast',
'Rowwise', rowbtop )
210 CALL pb_topget( ictxt,
'Broadcast',
'Columnwise', colbtop )
211 CALL pb_topget( ictxt,
'Combine',
'Columnwise', colctop )
212 CALL pb_topset( ictxt,
'Broadcast',
'Rowwise',
'S-ring' )
213 CALL pb_topset( ictxt,
'Broadcast',
'Columnwise',
' ' )
214 CALL pb_topset( ictxt,
'Combine',
'Columnwise',
' ' )
219 in =
min( iceil( ia, desca( mb_ ) )*desca( mb_ ), ia+m-1 )
220 jn =
min( iceil( ja, desca( nb_ ) )*desca( nb_ ), ja+mn-1 )
226 CALL pdgetf2( m, jb, a, ia, ja, desca, ipiv, info )
232 CALL pdlaswp(
'Forward',
'Rows', n-jb, a, ia, jn+1, desca,
237 CALL pdtrsm(
'Left',
'Lower',
'No transpose',
'Unit', jb,
238 $ n-jb, one, a, ia, ja, desca, a, ia, jn+1, desca )
244 CALL pdgemm(
'No transpose',
'No transpose', m-jb, n-jb, jb,
245 $ -one, a, in+1, ja, desca, a, ia, jn+1, desca,
246 $ one, a, in+1, jn+1, desca )
253 DO 10 j = jn+1, ja+mn-1, desca( nb_ )
254 jb =
min( mn-j+ja, desca( nb_ ) )
260 CALL pdgetf2( m-j+ja, jb, a, i, j, desca, ipiv, iinfo )
262 IF( info.EQ.0 .AND. iinfo.GT.0 )
263 $ info = iinfo + j - ja
267 CALL pdlaswp(
'Forward',
'Rowwise', j-ja, a, ia, ja, desca,
270 IF( j-ja+jb+1.LE.n )
THEN
274 CALL pdlaswp(
'Forward',
'Rowwise', n-j-jb+ja, a, ia, j+jb,
275 $ desca, i, i+jb-1, ipiv )
279 CALL pdtrsm(
'Left',
'Lower',
'No transpose',
'Unit', jb,
280 $ n-j-jb+ja, one, a, i, j, desca, a, i, j+jb,
283 IF( j-ja+jb+1.LE.m )
THEN
287 CALL pdgemm(
'No transpose',
'No transpose', m-j-jb+ja,
288 $ n-j-jb+ja, jb, -one, a, i+jb, j, desca, a,
289 $ i, j+jb, desca, one, a, i+jb, j+jb, desca )
298 CALL igamn2d( ictxt,
'Rowwise',
' ', 1, 1, info, 1, idum1, idum2,
303 CALL pb_topset( ictxt,
'Broadcast',
'Rowwise', rowbtop )
304 CALL pb_topset( ictxt,
'Broadcast',
'Columnwise', colbtop )
305 CALL pb_topset( ictxt,
'Combine',
'Columnwise', colctop )