18317
18318
18319 CHARACTER*1 SCOPE
18320 INTEGER ICTXT, M, N, LDA, LDI, TESTNUM, MAXERR, NERR
18321
18322
18323 INTEGER RA(*), CA(*), ERRIBUF(6, MAXERR), ISEED(*)
18324 DOUBLE COMPLEX A(LDA,*), ERRDBUF(2, MAXERR), VALS(*)
18325
18326
18327 INTEGER IBTMYPROC, IBTNPROCS, IBTSPNUM
18328 DOUBLE PRECISION DBTEPS, ZBTABS
18329 DOUBLE COMPLEX ZBTRAN
18331
18332
18334
18335
18336 LOGICAL ERROR
18337 INTEGER NPROCS, NNODES, NPROW, NPCOL, MYROW, MYCOL, RAMX, CAMX
18338 INTEGER IAMX, I, J, K, H, DEST, NODE
18339 DOUBLE PRECISION EPS
18340
18341
18342
18345 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
18346 dest = myrow*nprocs + mycol
18347
18348
18349
18350 IF( scope .EQ. 'R' ) THEN
18351 nnodes = npcol
18352 DO 10 i = 0, nnodes-1
18353 node = myrow * nprocs + i
18354 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
18355 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
18356 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
18357 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
18358 10 CONTINUE
18359 ELSE IF( scope .EQ. 'C' ) THEN
18360 nnodes = nprow
18361 DO 20 i = 0, nnodes-1
18362 node = i * nprocs + mycol
18363 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
18364 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
18365 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
18366 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
18367 20 CONTINUE
18368 ELSE
18369 nnodes = nprow * npcol
18370 DO 30 i = 0, nnodes-1
18371 node = (i / npcol) * nprocs + mod(i, npcol)
18372 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
18373 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
18374 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
18375 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
18376 30 CONTINUE
18377 END IF
18378
18379 DO 100 j = 1, n
18380 DO 90 i = 1, m
18381 h = (j-1)*ldi + i
18382 vals(1) =
zbtran( iseed )
18383 iamx = 1
18384 IF( nnodes .GT. 1 ) THEN
18385 DO 40 k = 1, nnodes-1
18386 vals(k+1) =
zbtran( iseed(k*4+1) )
18388 $ iamx = k + 1
18389 40 CONTINUE
18390 END IF
18391
18392
18393
18394 IF( a(i,j) .NE. vals(iamx) ) THEN
18395
18396
18397
18398 IF( ldi .NE. -1 ) THEN
18399
18400
18401
18402 k =
ibtspnum( scope, ra(h), ca(h), npcol ) + 1
18403 IF( k.GT.0 .AND. k.LE.nnodes ) THEN
18405 $ .GT. 3*eps
18406 IF( .NOT.error ) iamx = k
18407 ELSE
18408 error = .true.
18409 END IF
18410 ELSE
18411
18412
18413
18414
18416 $ .GT. 3*eps
18417 IF( .NOT.error ) THEN
18418 DO 50 k = 1, nnodes
18419 IF( vals(k) .EQ. a(i,j) ) GOTO 60
18420 50 CONTINUE
18421 error = .true.
18422 60 CONTINUE
18423 ENDIF
18424 END IF
18425
18426
18427
18428 IF( error ) THEN
18429 nerr = nerr + 1
18430 erribuf(1, nerr) = testnum
18431 erribuf(2, nerr) = nnodes
18432 erribuf(3, nerr) = dest
18433 erribuf(4, nerr) = i
18434 erribuf(5, nerr) = j
18435 erribuf(6, nerr) = 5
18436 errdbuf(1, nerr) = a(i,j)
18437 errdbuf(2, nerr) = vals(iamx)
18438 END IF
18439 END IF
18440
18441
18442
18443 IF( ldi .NE. -1 ) THEN
18444 k =
ibtspnum( scope, ra(h), ca(h), npcol ) + 1
18445 IF( k.NE.iamx ) THEN
18446
18447
18448
18449
18450
18451 IF( k.GT.nnodes .OR. k.LT.1 ) THEN
18452 error = .true.
18453 ELSE
18454 error = ( vals(k) .NE. vals(iamx) )
18455 END IF
18456 IF( error ) THEN
18457 CALL ibtspcoord( scope, iamx-1, myrow, mycol,
18458 $ npcol, ramx, camx )
18459 IF( ramx .NE. ra(h) ) THEN
18460 nerr = nerr + 1
18461 erribuf(1, nerr) = testnum
18462 erribuf(2, nerr) = nnodes
18463 erribuf(3, nerr) = dest
18464 erribuf(4, nerr) = i
18465 erribuf(5, nerr) = j
18466 erribuf(6, nerr) = -5
18467 errdbuf(1, nerr) = ra(h)
18468 errdbuf(2, nerr) = ramx
18469 END IF
18470 IF( camx .NE. ca(h) ) THEN
18471 nerr = nerr + 1
18472 erribuf(1, nerr) = testnum
18473 erribuf(2, nerr) = nnodes
18474 erribuf(3, nerr) = dest
18475 erribuf(4, nerr) = i
18476 erribuf(5, nerr) = j
18477 erribuf(6, nerr) = -15
18478 errdbuf(1, nerr) = ca(h)
18479 errdbuf(2, nerr) = camx
18480 END IF
18481 END IF
18482 END IF
18483 END IF
18484 90 CONTINUE
18485 100 CONTINUE
18486
18487 RETURN
18488
18489
18490
double complex function zbtran(iseed)
subroutine ibtspcoord(scope, pnum, myrow, mycol, npcol, prow, pcol)
integer function ibtspnum(scope, prow, pcol, npcol)
double precision function zbtabs(val)
double precision function dbteps()
integer function ibtnprocs()
integer function ibtmyproc()