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 2740 of file pblastst.f.

2742*
2743* -- PBLAS test routine (version 2.0) --
2744* University of Tennessee, Knoxville, Oak Ridge National Laboratory,
2745* and University of California, Berkeley.
2746* April 1, 1998
2747*
2748* .. Scalar Arguments ..
2749 INTEGER DPOS0, IA, ICTXT, INFO, JA, M, MPOS0, N, NPOS0
2750* ..
2751* .. Array Arguments ..
2752 INTEGER DESCA( * )
2753* ..
2754*
2755* Purpose
2756* =======
2757*
2758* PB_CHKMAT checks the validity of a descriptor vector DESCA, the re-
2759* lated global indexes IA, JA from a local view point. If an inconsis-
2760* tency is found among its parameters IA, JA and DESCA, the routine re-
2761* turns an error code in INFO.
2762*
2763* Arguments
2764* =========
2765*
2766* ICTXT (local input) INTEGER
2767* On entry, ICTXT specifies the BLACS context handle, indica-
2768* ting the global context of the operation. The context itself
2769* is global, but the value of ICTXT is local.
2770*
2771* M (global input) INTEGER
2772* On entry, M specifies the number of rows the submatrix
2773* sub( A ).
2774*
2775* MPOS0 (global input) INTEGER
2776* On entry, MPOS0 specifies the position in the calling rou-
2777* tine's parameter list where the formal parameter M appears.
2778*
2779* N (global input) INTEGER
2780* On entry, N specifies the number of columns the submatrix
2781* sub( A ).
2782*
2783* NPOS0 (global input) INTEGER
2784* On entry, NPOS0 specifies the position in the calling rou-
2785* tine's parameter list where the formal parameter N appears.
2786*
2787* IA (global input) INTEGER
2788* On entry, IA specifies A's global row index, which points to
2789* the beginning of the submatrix sub( A ).
2790*
2791* JA (global input) INTEGER
2792* On entry, JA specifies A's global column index, which points
2793* to the beginning of the submatrix sub( A ).
2794*
2795* DESCA (global and local input) INTEGER array
2796* On entry, DESCA is an integer array of dimension DLEN_. This
2797* is the array descriptor for the matrix A.
2798*
2799* DPOS0 (global input) INTEGER
2800* On entry, DPOS0 specifies the position in the calling rou-
2801* tine's parameter list where the formal parameter DESCA ap-
2802* pears. Note that it is assumed that IA and JA are respecti-
2803* vely 2 and 1 entries behind DESCA.
2804*
2805* INFO (local input/local output) INTEGER
2806* = 0: successful exit
2807* < 0: If the i-th argument is an array and the j-entry had an
2808* illegal value, then INFO = -(i*100+j), if the i-th
2809* argument is a scalar and had an illegal value, then
2810* INFO = -i.
2811*
2812* -- Written on April 1, 1998 by
2813* R. Clint Whaley, University of Tennessee, Knoxville 37996, USA.
2814*
2815* =====================================================================
2816*
2817* .. Parameters ..
2818 INTEGER BLOCK_CYCLIC_2D_INB, CSRC_, CTXT_, DLEN_,
2819 $ DTYPE_, IMB_, INB_, LLD_, MB_, M_, NB_, N_,
2820 $ RSRC_
2821 parameter( block_cyclic_2d_inb = 2, dlen_ = 11,
2822 $ dtype_ = 1, ctxt_ = 2, m_ = 3, n_ = 4,
2823 $ imb_ = 5, inb_ = 6, mb_ = 7, nb_ = 8,
2824 $ rsrc_ = 9, csrc_ = 10, lld_ = 11 )
2825 INTEGER DESCMULT, BIGNUM
2826 parameter( descmult = 100, bignum = descmult*descmult )
2827* ..
2828* .. Local Scalars ..
2829 INTEGER DPOS, IAPOS, JAPOS, MP, MPOS, MYCOL, MYROW,
2830 $ NPCOL, NPOS, NPROW, NQ
2831* ..
2832* .. Local Arrays ..
2833 INTEGER DESCA2( DLEN_ )
2834* ..
2835* .. External Subroutines ..
2836 EXTERNAL blacs_gridinfo, pb_desctrans
2837* ..
2838* .. External Functions ..
2839 INTEGER PB_NUMROC
2840 EXTERNAL pb_numroc
2841* ..
2842* .. Intrinsic Functions ..
2843 INTRINSIC min, max
2844* ..
2845* .. Executable Statements ..
2846*
2847* Convert descriptor
2848*
2849 CALL pb_desctrans( desca, desca2 )
2850*
2851* Want to find errors with MIN( ), so if no error, set it to a big
2852* number. If there already is an error, multiply by the the des-
2853* criptor multiplier
2854*
2855 IF( info.GE.0 ) THEN
2856 info = bignum
2857 ELSE IF( info.LT.-descmult ) THEN
2858 info = -info
2859 ELSE
2860 info = -info * descmult
2861 END IF
2862*
2863* Figure where in parameter list each parameter was, factoring in
2864* descriptor multiplier
2865*
2866 mpos = mpos0 * descmult
2867 npos = npos0 * descmult
2868 iapos = ( dpos0 - 2 ) * descmult
2869 japos = ( dpos0 - 1 ) * descmult
2870 dpos = dpos0 * descmult
2871*
2872* Get grid parameters
2873*
2874 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
2875*
2876* Check that matrix values make sense from local viewpoint
2877*
2878 IF( m.LT.0 )
2879 $ info = min( info, mpos )
2880 IF( n.LT.0 )
2881 $ info = min( info, npos )
2882 IF( ia.LT.1 )
2883 $ info = min( info, iapos )
2884 IF( ja.LT.1 )
2885 $ info = min( info, japos )
2886 IF( desca2( dtype_ ).NE.block_cyclic_2d_inb )
2887 $ info = min( info, dpos + dtype_ )
2888 IF( desca2( imb_ ).LT.1 )
2889 $ info = min( info, dpos + imb_ )
2890 IF( desca2( inb_ ).LT.1 )
2891 $ info = min( info, dpos + inb_ )
2892 IF( desca2( mb_ ).LT.1 )
2893 $ info = min( info, dpos + mb_ )
2894 IF( desca2( nb_ ).LT.1 )
2895 $ info = min( info, dpos + nb_ )
2896 IF( desca2( rsrc_ ).LT.-1 .OR. desca2( rsrc_ ).GE.nprow )
2897 $ info = min( info, dpos + rsrc_ )
2898 IF( desca2( csrc_ ).LT.-1 .OR. desca2( csrc_ ).GE.npcol )
2899 $ info = min( info, dpos + csrc_ )
2900 IF( desca2( ctxt_ ).NE.ictxt )
2901 $ info = min( info, dpos + ctxt_ )
2902*
2903 IF( m.EQ.0 .OR. n.EQ.0 ) THEN
2904*
2905* NULL matrix, relax some checks
2906*
2907 IF( desca2( m_ ).LT.0 )
2908 $ info = min( info, dpos + m_ )
2909 IF( desca2( n_ ).LT.0 )
2910 $ info = min( info, dpos + n_ )
2911 IF( desca2( lld_ ).LT.1 )
2912 $ info = min( info, dpos + lld_ )
2913*
2914 ELSE
2915*
2916* more rigorous checks for non-degenerate matrices
2917*
2918 mp = pb_numroc( desca2( m_ ), 1, desca2( imb_ ), desca2( mb_ ),
2919 $ myrow, desca2( rsrc_ ), nprow )
2920*
2921 IF( desca2( m_ ).LT.1 )
2922 $ info = min( info, dpos + m_ )
2923 IF( desca2( n_ ).LT.1 )
2924 $ info = min( info, dpos + n_ )
2925 IF( ia.GT.desca2( m_ ) )
2926 $ info = min( info, iapos )
2927 IF( ja.GT.desca2( n_ ) )
2928 $ info = min( info, japos )
2929 IF( ia+m-1.GT.desca2( m_ ) )
2930 $ info = min( info, mpos )
2931 IF( ja+n-1.GT.desca2( n_ ) )
2932 $ info = min( info, npos )
2933*
2934 IF( desca2( lld_ ).LT.max( 1, mp ) ) THEN
2935 nq = pb_numroc( desca2( n_ ), 1, desca2( inb_ ),
2936 $ desca2( nb_ ), mycol, desca2( csrc_ ),
2937 $ npcol )
2938 IF( desca2( lld_ ).LT.1 ) THEN
2939 info = min( info, dpos + lld_ )
2940 ELSE IF( nq.GT.0 ) THEN
2941 info = min( info, dpos + lld_ )
2942 END IF
2943 END IF
2944*
2945 END IF
2946*
2947* Prepare output: set info = 0 if no error, and divide by
2948* DESCMULT if error is not in a descriptor entry
2949*
2950 IF( info.EQ.bignum ) THEN
2951 info = 0
2952 ELSE IF( mod( info, descmult ).EQ.0 ) THEN
2953 info = -( info / descmult )
2954 ELSE
2955 info = -info
2956 END IF
2957*
2958 RETURN
2959*
2960* End of PB_CHKMAT
2961*
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 caller graph for this function: