1 SUBROUTINE pzgecon( NORM, N, A, IA, JA, DESCA, ANORM, RCOND, WORK,
2 $ LWORK, RWORK, LRWORK, INFO )
11 INTEGER IA, INFO, JA, LRWORK, LWORK, N
12 DOUBLE PRECISION ANORM, RCOND
16 DOUBLE PRECISION RWORK( * )
17 COMPLEX*16 A( * ), WORK( * )
176 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
177 $ lld_, mb_, m_, nb_, n_, rsrc_
178 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
179 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
180 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
181 DOUBLE PRECISION ONE, ZERO
182 parameter( one = 1.0d+0, zero = 0.0d+0 )
185 LOGICAL LQUERY, ONENRM
186 CHARACTER CBTOP, COLCTOP, NORMIN, ROWCTOP
187 INTEGER IACOL, IAROW, ICOFF, ICTXT, IIA, IPNL, IPNU,
188 $ ipv, ipw, ipx, iroff, iv, ix, ixx, jja, jv, jx,
189 $ kase, kase1, lrwmin, lwmin, mycol, myrow, np,
190 $ npcol, npmod, nprow, nq, nqmod
191 DOUBLE PRECISION AINVNM, SCALE, SL, SMLNUM, SU
192 COMPLEX*16 WMAX, ZDUM
195 INTEGER DESCV( DLEN_ ), DESCX( DLEN_ ), IDUM1( 3 ),
206 INTEGER ICEIL, INDXG2P, NUMROC
207 DOUBLE PRECISION PDLAMCH
208 EXTERNAL iceil, indxg2p, lsame, numroc, pdlamch
211 INTRINSIC abs, dble, dimag, ichar,
max, mod
214 DOUBLE PRECISION CABS1
217 cabs1( zdum ) = abs( dble( zdum ) ) + abs( dimag( zdum ) )
223 ictxt = desca( ctxt_ )
224 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
229 IF( nprow.EQ.-1 )
THEN
230 info = -( 600 + ctxt_ )
232 CALL chk1mat( n, 2, n, 2, ia, ja, desca, 6, info )
234 onenrm = norm.EQ.
'1' .OR. lsame( norm,
'O' )
235 iarow = indxg2p( ia, desca( mb_ ), myrow, desca( rsrc_ ),
237 iacol = indxg2p( ja, desca( nb_ ), mycol, desca( csrc_ ),
239 npmod = numroc( n + mod( ia-1, desca( mb_ ) ), desca( mb_ ),
240 $ myrow, iarow, nprow )
241 nqmod = numroc( n + mod( ja-1, desca( nb_ ) ), desca( nb_ ),
242 $ mycol, iacol, npcol )
244 $
max( 2,
max( desca( nb_ )*
245 $
max( 1, iceil( nprow-1, npcol ) ), nqmod +
247 $
max( 1, iceil( npcol-1, nprow ) ) ) )
248 work( 1 ) = dble( lwmin )
249 lrwmin =
max( 1, 2*nqmod )
250 rwork( 1 ) = dble( lrwmin )
251 lquery = ( lwork.EQ.-1 .OR. lrwork.EQ.-1 )
253 IF( .NOT.onenrm .AND. .NOT.lsame( norm,
'I' ) )
THEN
255 ELSE IF( anorm.LT.zero )
THEN
257 ELSE IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
259 ELSE IF( lrwork.LT.lrwmin .AND. .NOT.lquery )
THEN
265 idum1( 1 ) = ichar(
'1' )
267 idum1( 1 ) = ichar(
'I' )
270 IF( lwork.EQ.-1 )
THEN
276 IF( lrwork.EQ.-1 )
THEN
282 CALL pchk1mat( n, 2, n, 2, ia, ja, desca, 6, 3, idum1, idum2,
287 CALL pxerbla( ictxt,
'PZGECON', -info )
289 ELSE IF( lquery )
THEN
299 ELSE IF( anorm.EQ.zero )
THEN
301 ELSE IF( n.EQ.1 )
THEN
306 CALL pb_topget( ictxt,
'Combine',
'Columnwise', colctop )
307 CALL pb_topget( ictxt,
'Combine',
'Rowwise', rowctop )
308 CALL pb_topset( ictxt,
'Combine',
'Columnwise',
'1-tree' )
309 CALL pb_topset( ictxt,
'Combine',
'Rowwise',
'1-tree' )
311 smlnum = pdlamch( ictxt,
'Safe minimum' )
312 iroff = mod( ia-1, desca( mb_ ) )
313 icoff = mod( ja-1, desca( nb_ ) )
314 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, iia, jja,
316 np = numroc( n+iroff, desca( mb_ ), myrow, iarow, nprow )
317 nq = numroc( n+icoff, desca( nb_ ), mycol, iacol, npcol )
329 CALL descset( descv, n+iroff, 1, desca( mb_ ), 1, iarow, mycol,
330 $ ictxt,
max( 1, np ) )
331 CALL descset( descx, n+iroff, 1, desca( mb_ ), 1, iarow, mycol,
332 $ ictxt,
max( 1, np ) )
346 CALL pzlacon( n, work( ipv ), iv, jv, descv, work( ipx ), ix, jx,
347 $ descx, ainvnm, kase )
349 IF( kase.EQ.kase1 )
THEN
353 descx( csrc_ ) = iacol
354 CALL pzlatrs(
'Lower',
'No transpose',
'Unit', normin,
355 $ n, a, ia, ja, desca, work( ipx ), ix, jx,
356 $ descx, sl, rwork( ipnl ), work( ipw ) )
357 descx( csrc_ ) = mycol
361 descx( csrc_ ) = iacol
362 CALL pzlatrs(
'Upper',
'No transpose',
'Non-unit', normin,
363 $ n, a, ia, ja, desca, work( ipx ), ix, jx,
364 $ descx, su, rwork( ipnu ), work( ipw ) )
365 descx( csrc_ ) = mycol
370 descx( csrc_ ) = iacol
371 CALL pzlatrs(
'Upper',
'Conjugate transpose',
'Non-unit',
372 $ normin, n, a, ia, ja, desca, work( ipx ), ix,
373 $ jx, descx, su, rwork( ipnu ), work( ipw ) )
374 descx( csrc_ ) = mycol
378 descx( csrc_ ) = iacol
379 CALL pzlatrs(
'Lower',
'Conjugate transpose',
'Unit',
380 $ normin, n, a, ia, ja, desca, work( ipx ),
381 $ ix, jx, descx, sl, rwork( ipnl ),
383 descx( csrc_ ) = mycol
390 IF( scale.NE.one )
THEN
391 CALL pzamax( n, wmax, ixx, work( ipx ), ix, jx, descx, 1 )
392 IF( descx( m_ ).EQ.1 .AND. n.EQ.1 )
THEN
393 CALL pb_topget( ictxt,
'Broadcast',
'Columnwise', cbtop )
394 IF( myrow.EQ.iarow )
THEN
395 CALL zgebs2d( ictxt,
'Column', cbtop, 1, 1, wmax, 1 )
397 CALL zgebr2d( ictxt,
'Column', cbtop, 1, 1, wmax, 1,
401 IF( scale.LT.cabs1( wmax )*smlnum .OR. scale.EQ.zero )
403 CALL pzdrscl( n, scale, work( ipx ), ix, jx, descx, 1 )
411 $ rcond = ( one / ainvnm ) / anorm
415 CALL pb_topset( ictxt,
'Combine',
'Columnwise', colctop )
416 CALL pb_topset( ictxt,
'Combine',
'Rowwise', rowctop )