SCALAPACK 2.2.2
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ pb_chkmat()

subroutine pb_chkmat ( integer  ictxt,
integer  m,
integer  mpos0,
integer  n,
integer  npos0,
integer  ia,
integer  ja,
integer, dimension( * )  desca,
integer  dpos0,
integer  info 
)

Definition at line 3335 of file pblastim.f.

3337*
3338* -- PBLAS test routine (version 2.0) --
3339* University of Tennessee, Knoxville, Oak Ridge National Laboratory,
3340* and University of California, Berkeley.
3341* April 1, 1998
3342*
3343* .. Scalar Arguments ..
3344 INTEGER DPOS0, IA, ICTXT, INFO, JA, M, MPOS0, N, NPOS0
3345* ..
3346* .. Array Arguments ..
3347 INTEGER DESCA( * )
3348* ..
3349*
3350* Purpose
3351* =======
3352*
3353* PB_CHKMAT checks the validity of a descriptor vector DESCA, the re-
3354* lated global indexes IA, JA from a local view point. If an inconsis-
3355* tency is found among its parameters IA, JA and DESCA, the routine re-
3356* turns an error code in INFO.
3357*
3358* Arguments
3359* =========
3360*
3361* ICTXT (local input) INTEGER
3362* On entry, ICTXT specifies the BLACS context handle, indica-
3363* ting the global context of the operation. The context itself
3364* is global, but the value of ICTXT is local.
3365*
3366* M (global input) INTEGER
3367* On entry, M specifies the number of rows the submatrix
3368* sub( A ).
3369*
3370* MPOS0 (global input) INTEGER
3371* On entry, MPOS0 specifies the position in the calling rou-
3372* tine's parameter list where the formal parameter M appears.
3373*
3374* N (global input) INTEGER
3375* On entry, N specifies the number of columns the submatrix
3376* sub( A ).
3377*
3378* NPOS0 (global input) INTEGER
3379* On entry, NPOS0 specifies the position in the calling rou-
3380* tine's parameter list where the formal parameter N appears.
3381*
3382* IA (global input) INTEGER
3383* On entry, IA specifies A's global row index, which points to
3384* the beginning of the submatrix sub( A ).
3385*
3386* JA (global input) INTEGER
3387* On entry, JA specifies A's global column index, which points
3388* to the beginning of the submatrix sub( A ).
3389*
3390* DESCA (global and local input) INTEGER array
3391* On entry, DESCA is an integer array of dimension DLEN_. This
3392* is the array descriptor for the matrix A.
3393*
3394* DPOS0 (global input) INTEGER
3395* On entry, DPOS0 specifies the position in the calling rou-
3396* tine's parameter list where the formal parameter DESCA ap-
3397* pears. Note that it is assumed that IA and JA are respecti-
3398* vely 2 and 1 entries behind DESCA.
3399*
3400* INFO (local input/local output) INTEGER
3401* = 0: successful exit
3402* < 0: If the i-th argument is an array and the j-entry had an
3403* illegal value, then INFO = -(i*100+j), if the i-th
3404* argument is a scalar and had an illegal value, then
3405* INFO = -i.
3406*
3407* -- Written on April 1, 1998 by
3408* R. Clint Whaley, University of Tennessee, Knoxville 37996, USA.
3409*
3410* =====================================================================
3411*
3412* .. Parameters ..
3413 INTEGER BLOCK_CYCLIC_2D_INB, CSRC_, CTXT_, DLEN_,
3414 $ DTYPE_, IMB_, INB_, LLD_, MB_, M_, NB_, N_,
3415 $ RSRC_
3416 parameter( block_cyclic_2d_inb = 2, dlen_ = 11,
3417 $ dtype_ = 1, ctxt_ = 2, m_ = 3, n_ = 4,
3418 $ imb_ = 5, inb_ = 6, mb_ = 7, nb_ = 8,
3419 $ rsrc_ = 9, csrc_ = 10, lld_ = 11 )
3420 INTEGER DESCMULT, BIGNUM
3421 parameter( descmult = 100, bignum = descmult*descmult )
3422* ..
3423* .. Local Scalars ..
3424 INTEGER DPOS, IAPOS, JAPOS, MP, MPOS, MYCOL, MYROW,
3425 $ NPCOL, NPOS, NPROW, NQ
3426* ..
3427* .. Local Arrays ..
3428 INTEGER DESCA2( DLEN_ )
3429* ..
3430* .. External Subroutines ..
3431 EXTERNAL blacs_gridinfo, pb_desctrans
3432* ..
3433* .. External Functions ..
3434 INTEGER PB_NUMROC
3435 EXTERNAL pb_numroc
3436* ..
3437* .. Intrinsic Functions ..
3438 INTRINSIC min, max
3439* ..
3440* .. Executable Statements ..
3441*
3442* Convert descriptor
3443*
3444 CALL pb_desctrans( desca, desca2 )
3445*
3446* Want to find errors with MIN( ), so if no error, set it to a big
3447* number. If there already is an error, multiply by the the des-
3448* criptor multiplier
3449*
3450 IF( info.GE.0 ) THEN
3451 info = bignum
3452 ELSE IF( info.LT.-descmult ) THEN
3453 info = -info
3454 ELSE
3455 info = -info * descmult
3456 END IF
3457*
3458* Figure where in parameter list each parameter was, factoring in
3459* descriptor multiplier
3460*
3461 mpos = mpos0 * descmult
3462 npos = npos0 * descmult
3463 iapos = ( dpos0 - 2 ) * descmult
3464 japos = ( dpos0 - 1 ) * descmult
3465 dpos = dpos0 * descmult
3466*
3467* Get grid parameters
3468*
3469 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
3470*
3471* Check that matrix values make sense from local viewpoint
3472*
3473 IF( m.LT.0 )
3474 $ info = min( info, mpos )
3475 IF( n.LT.0 )
3476 $ info = min( info, npos )
3477 IF( ia.LT.1 )
3478 $ info = min( info, iapos )
3479 IF( ja.LT.1 )
3480 $ info = min( info, japos )
3481 IF( desca2( dtype_ ).NE.block_cyclic_2d_inb )
3482 $ info = min( info, dpos + dtype_ )
3483 IF( desca2( imb_ ).LT.1 )
3484 $ info = min( info, dpos + imb_ )
3485 IF( desca2( inb_ ).LT.1 )
3486 $ info = min( info, dpos + inb_ )
3487 IF( desca2( mb_ ).LT.1 )
3488 $ info = min( info, dpos + mb_ )
3489 IF( desca2( nb_ ).LT.1 )
3490 $ info = min( info, dpos + nb_ )
3491 IF( desca2( rsrc_ ).LT.-1 .OR. desca2( rsrc_ ).GE.nprow )
3492 $ info = min( info, dpos + rsrc_ )
3493 IF( desca2( csrc_ ).LT.-1 .OR. desca2( csrc_ ).GE.npcol )
3494 $ info = min( info, dpos + csrc_ )
3495 IF( desca2( ctxt_ ).NE.ictxt )
3496 $ info = min( info, dpos + ctxt_ )
3497*
3498 IF( m.EQ.0 .OR. n.EQ.0 ) THEN
3499*
3500* NULL matrix, relax some checks
3501*
3502 IF( desca2( m_ ).LT.0 )
3503 $ info = min( info, dpos + m_ )
3504 IF( desca2( n_ ).LT.0 )
3505 $ info = min( info, dpos + n_ )
3506 IF( desca2( lld_ ).LT.1 )
3507 $ info = min( info, dpos + lld_ )
3508*
3509 ELSE
3510*
3511* more rigorous checks for non-degenerate matrices
3512*
3513 mp = pb_numroc( desca2( m_ ), 1, desca2( imb_ ), desca2( mb_ ),
3514 $ myrow, desca2( rsrc_ ), nprow )
3515*
3516 IF( desca2( m_ ).LT.1 )
3517 $ info = min( info, dpos + m_ )
3518 IF( desca2( n_ ).LT.1 )
3519 $ info = min( info, dpos + n_ )
3520 IF( ia.GT.desca2( m_ ) )
3521 $ info = min( info, iapos )
3522 IF( ja.GT.desca2( n_ ) )
3523 $ info = min( info, japos )
3524 IF( ia+m-1.GT.desca2( m_ ) )
3525 $ info = min( info, mpos )
3526 IF( ja+n-1.GT.desca2( n_ ) )
3527 $ info = min( info, npos )
3528*
3529 IF( desca2( lld_ ).LT.max( 1, mp ) ) THEN
3530 nq = pb_numroc( desca2( n_ ), 1, desca2( inb_ ),
3531 $ desca2( nb_ ), mycol, desca2( csrc_ ),
3532 $ npcol )
3533 IF( desca2( lld_ ).LT.1 ) THEN
3534 info = min( info, dpos + lld_ )
3535 ELSE IF( nq.GT.0 ) THEN
3536 info = min( info, dpos + lld_ )
3537 END IF
3538 END IF
3539*
3540 END IF
3541*
3542* Prepare output: set info = 0 if no error, and divide by
3543* DESCMULT if error is not in a descriptor entry
3544*
3545 IF( info.EQ.bignum ) THEN
3546 info = 0
3547 ELSE IF( mod( info, descmult ).EQ.0 ) THEN
3548 info = -( info / descmult )
3549 ELSE
3550 info = -info
3551 END IF
3552*
3553 RETURN
3554*
3555* End of PB_CHKMAT
3556*
subroutine pb_desctrans(descin, descout)
Definition pblastst.f:2964
integer function pb_numroc(n, i, inb, nb, proc, srcproc, nprocs)
Definition pblastst.f:2548
#define max(A, B)
Definition pcgemr.c:180
#define min(A, B)
Definition pcgemr.c:181
Here is the call graph for this function: