1 SUBROUTINE pdpoequ( N, A, IA, JA, DESCA, SR, SC, SCOND, AMAX,
10 INTEGER IA, INFO, JA, N
11 DOUBLE PRECISION AMAX, SCOND
15 DOUBLE PRECISION A( * ), SC( * ), SR( * )
149 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
150 $ lld_, mb_, m_, nb_, n_, rsrc_
151 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
152 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
153 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
154 DOUBLE PRECISION ZERO, ONE
155 parameter( zero = 0.0d+0, one = 1.0d+0 )
158 CHARACTER ALLCTOP, COLCTOP, ROWCTOP
159 INTEGER IACOL, IAROW, ICOFF, ICTXT, ICURCOL, ICURROW,
160 $ idumm, ii, iia, ioffa, ioffd, iroff, j, jb, jj,
161 $ jja, jn, lda, ll, mycol, myrow, np, npcol,
163 DOUBLE PRECISION AII, SMIN
166 INTEGER DESCSC( DLEN_ ), DESCSR( DLEN_ )
170 $ dgamx2d, dgsum2d, igamn2d,
infog2l,
174 INTEGER ICEIL, NUMROC
175 DOUBLE PRECISION PDLAMCH
176 EXTERNAL iceil, numroc, pdlamch
179 INTRINSIC max,
min, mod, sqrt
185 ictxt = desca( ctxt_ )
186 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
191 IF( nprow.EQ.-1 )
THEN
194 CALL chk1mat( n, 1, n, 1, ia, ja, desca, 5, info )
195 CALL pchk1mat( n, 1, n, 1, ia, ja, desca, 5, 0, idumm, idumm,
200 CALL pxerbla( ictxt,
'PDPOEQU', -info )
212 CALL pb_topget( ictxt,
'Combine',
'All', allctop )
213 CALL pb_topget( ictxt,
'Combine',
'Rowwise', rowctop )
214 CALL pb_topget( ictxt,
'Combine',
'Columnwise', colctop )
218 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, iia, jja,
220 iroff = mod( ia-1, desca( mb_ ) )
221 icoff = mod( ja-1, desca( nb_ ) )
222 np = numroc( n+iroff, desca( mb_ ), myrow, iarow, nprow )
223 nq = numroc( n+icoff, desca( nb_ ), mycol, iacol, npcol )
228 jn =
min( iceil( ja, desca( nb_ ) ) * desca( nb_ ), ja+n-1 )
233 CALL descset( descsr, n, 1, desca( mb_ ), 1, 0, 0, ictxt,
235 CALL descset( descsc, 1, n, 1, desca( nb_ ), 0, 0, ictxt, 1 )
239 DO 10 ii = iia, iia+np-1
243 DO 20 jj = jja, jja+nq-1
253 smin = one / pdlamch( ictxt,
'S' )
256 ioffa = ii+(jj-1)*lda
257 IF( myrow.EQ.iarow .AND. mycol.EQ.iacol )
THEN
263 smin =
min( smin, aii )
264 amax =
max( amax, aii )
265 IF( aii.LE.zero .AND. info.EQ.0 )
267 ioffd = ioffd + lda + 1
271 IF( myrow.EQ.iarow )
THEN
275 IF( mycol.EQ.iacol )
THEN
277 ioffa = ioffa + jb*lda
279 icurrow = mod( iarow+1, nprow )
280 icurcol = mod( iacol+1, npcol )
284 DO 50 j = jn+1, ja+n-1, desca( nb_ )
285 jb =
min( n-j+ja, desca( nb_ ) )
287 IF( myrow.EQ.icurrow .AND. mycol.EQ.icurcol )
THEN
293 smin =
min( smin, aii )
294 amax =
max( amax, aii )
295 IF( aii.LE.zero .AND. info.EQ.0 )
296 $ info = j + ll - ja + 1
297 ioffd = ioffd + lda + 1
301 IF( myrow.EQ.icurrow )
THEN
305 IF( mycol.EQ.icurcol )
THEN
307 ioffa = ioffa + jb*lda
309 icurrow = mod( icurrow+1, nprow )
310 icurcol = mod( icurcol+1, npcol )
316 CALL dgsum2d( ictxt,
'Columnwise', colctop, 1, nq, sc( jja ),
318 CALL dgsum2d( ictxt,
'Rowwise', rowctop, np, 1, sr( iia ),
319 $
max( 1, np ), -1, mycol )
321 CALL dgamx2d( ictxt,
'All', allctop, 1, 1, amax, 1, idumm, idumm,
323 CALL dgamn2d( ictxt,
'All', allctop, 1, 1, smin, 1, idumm, idumm,
326 IF( smin.LE.zero )
THEN
330 CALL igamn2d( ictxt,
'All', allctop, 1, 1, info, 1, ii, jj, -1,
339 DO 60 ii = iia, iia+np-1
340 sr( ii ) = one / sqrt( sr( ii ) )
343 DO 70 jj = jja, jja+nq-1
344 sc( jj ) = one / sqrt( sc( jj ) )
349 scond = sqrt( smin ) / sqrt( amax )