1 SUBROUTINE pzpoequ( N, A, IA, JA, DESCA, SR, SC, SCOND, AMAX,
10 INTEGER IA, INFO, JA, N
11 DOUBLE PRECISION AMAX, SCOND
15 DOUBLE PRECISION SC( * ), SR( * )
150 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
151 $ lld_, mb_, m_, nb_, n_, rsrc_
152 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
153 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
154 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
155 DOUBLE PRECISION ZERO, ONE
156 parameter( zero = 0.0d+0, one = 1.0d+0 )
159 CHARACTER ALLCTOP, COLCTOP, ROWCTOP
160 INTEGER IACOL, IAROW, ICOFF, ICTXT, ICURCOL, ICURROW,
161 $ idumm, ii, iia, ioffa, ioffd, iroff, j, jb, jj,
162 $ jja, jn, lda, ll, mycol, myrow, np, npcol,
164 DOUBLE PRECISION AII, SMIN
167 INTEGER DESCSC( DLEN_ ), DESCSR( DLEN_ )
171 $ dgamx2d, dgsum2d, igamn2d,
infog2l,
175 INTEGER ICEIL, NUMROC
176 DOUBLE PRECISION PDLAMCH
177 EXTERNAL iceil, numroc, pdlamch
180 INTRINSIC dble,
max,
min, mod, sqrt
186 ictxt = desca( ctxt_ )
187 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
192 IF( nprow.EQ.-1 )
THEN
195 CALL chk1mat( n, 1, n, 1, ia, ja, desca, 5, info )
196 CALL pchk1mat( n, 1, n, 1, ia, ja, desca, 5, 0, idumm, idumm,
201 CALL pxerbla( ictxt,
'PZPOEQU', -info )
213 CALL pb_topget( ictxt,
'Combine',
'All', allctop )
214 CALL pb_topget( ictxt,
'Combine',
'Rowwise', rowctop )
215 CALL pb_topget( ictxt,
'Combine',
'Columnwise', colctop )
219 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, iia, jja,
221 iroff = mod( ia-1, desca( mb_ ) )
222 icoff = mod( ja-1, desca( nb_ ) )
223 np = numroc( n+iroff, desca( mb_ ), myrow, iarow, nprow )
224 nq = numroc( n+icoff, desca( nb_ ), mycol, iacol, npcol )
229 jn =
min( iceil( ja, desca( nb_ ) ) * desca( nb_ ), ja+n-1 )
234 CALL descset( descsr, n, 1, desca( mb_ ), 1, 0, 0, ictxt,
236 CALL descset( descsc, 1, n, 1, desca( nb_ ), 0, 0, ictxt, 1 )
240 DO 10 ii = iia, iia+np-1
244 DO 20 jj = jja, jja+nq-1
254 smin = one / pdlamch( ictxt,
'S' )
257 ioffa = ii+(jj-1)*lda
258 IF( myrow.EQ.iarow .AND. mycol.EQ.iacol )
THEN
261 aii = dble( a( ioffd ) )
264 smin =
min( smin, aii )
265 amax =
max( amax, aii )
266 IF( aii.LE.zero .AND. info.EQ.0 )
268 ioffd = ioffd + lda + 1
272 IF( myrow.EQ.iarow )
THEN
276 IF( mycol.EQ.iacol )
THEN
278 ioffa = ioffa + jb*lda
280 icurrow = mod( iarow+1, nprow )
281 icurcol = mod( iacol+1, npcol )
285 DO 50 j = jn+1, ja+n-1, desca( nb_ )
286 jb =
min( n-j+ja, desca( nb_ ) )
288 IF( myrow.EQ.icurrow .AND. mycol.EQ.icurcol )
THEN
291 aii = dble( a( ioffd ) )
294 smin =
min( smin, aii )
295 amax =
max( amax, aii )
296 IF( aii.LE.zero .AND. info.EQ.0 )
297 $ info = j + ll - ja + 1
298 ioffd = ioffd + lda + 1
302 IF( myrow.EQ.icurrow )
THEN
306 IF( mycol.EQ.icurcol )
THEN
308 ioffa = ioffa + jb*lda
310 icurrow = mod( icurrow+1, nprow )
311 icurcol = mod( icurcol+1, npcol )
317 CALL dgsum2d( ictxt,
'Columnwise', colctop, 1, nq, sc( jja ),
319 CALL dgsum2d( ictxt,
'Rowwise', rowctop, np, 1, sr( iia ),
320 $
max( 1, np ), -1, mycol )
322 CALL dgamx2d( ictxt,
'All', allctop, 1, 1, amax, 1, idumm, idumm,
324 CALL dgamn2d( ictxt,
'All', allctop, 1, 1, smin, 1, idumm, idumm,
327 IF( smin.LE.zero )
THEN
331 CALL igamn2d( ictxt,
'All', allctop, 1, 1, info, 1, ii, jj, -1,
340 DO 60 ii = iia, iia+np-1
341 sr( ii ) = one / sqrt( sr( ii ) )
344 DO 70 jj = jja, jja+nq-1
345 sc( jj ) = one / sqrt( sc( jj ) )
350 scond = sqrt( smin ) / sqrt( amax )