1 SUBROUTINE chk1mat( MA, MAPOS0, NA, NAPOS0, IA, JA, DESCA,
10 INTEGER DESCAPOS0, IA, INFO, JA, MA, MAPOS0, NA, NAPOS0
63 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
64 $ lld_, mb_, m_, nb_, n_, rsrc_
65 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
66 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
67 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
68 INTEGER DESCMULT, BIGNUM
69 parameter( descmult = 100, bignum = descmult*descmult )
72 INTEGER DESCAPOS, IAPOS, JAPOS, MAPOS, NAPOS, MYCOL,
76 EXTERNAL blacs_gridinfo
93 ELSE IF( info.LT.-descmult )
THEN
96 info = -info * descmult
102 mapos = mapos0 * descmult
103 napos = napos0 * descmult
104 iapos = (descapos0-2) * descmult
105 japos = (descapos0-1) * descmult
106 descapos = descapos0 * descmult
110 CALL blacs_gridinfo( desca( ctxt_ ), nprow, npcol, myrow, mycol )
114 IF( desca( dtype_ ) .NE. block_cyclic_2d )
THEN
115 info =
min( info, descapos+dtype_ )
116 ELSE IF( ma.LT.0 )
THEN
117 info =
min( info, mapos )
118 ELSE IF( na.LT.0 )
THEN
119 info =
min( info, napos )
120 ELSE IF( ia.LT.1 )
THEN
121 info =
min( info, iapos )
122 ELSE IF( ja.LT.1 )
THEN
123 info =
min( info, japos )
124 ELSE IF( desca( mb_ ).LT.1 )
THEN
125 info =
min( info, descapos+mb_ )
126 ELSE IF( desca( nb_ ).LT.1 )
THEN
127 info =
min( info, descapos+nb_ )
128 ELSE IF( desca( rsrc_ ).LT.0 .OR. desca( rsrc_ ).GE.nprow )
THEN
129 info =
min( info, descapos+rsrc_ )
130 ELSE IF( desca( csrc_ ).LT.0 .OR. desca( csrc_ ).GE.npcol )
THEN
131 info =
min( info, descapos+csrc_ )
132 ELSE IF( desca( lld_ ).LT.1 )
THEN
133 info =
min( info, descapos+lld_ )
134 ELSE IF( desca( lld_ ) .LT.
135 $ numroc( desca( m_ ), desca( mb_ ), myrow, desca(rsrc_),
137 IF( numroc( desca( n_ ), desca( nb_ ), mycol, desca( csrc_ ),
139 $ info =
min( info, descapos+lld_ )
142 IF( ma.EQ.0 .OR. na.EQ.0 )
THEN
147 $ info =
min( info, descapos+m_ )
149 $ info =
min( info, descapos+n_ )
155 IF( desca( m_ ).LT.1 )
THEN
156 info =
min( info, descapos+m_ )
157 ELSE IF( desca( n_ ).LT.1 )
THEN
158 info =
min( info, descapos+n_ )
160 IF( ia.GT.desca( m_ ) )
THEN
161 info =
min( info, iapos )
162 ELSE IF( ja.GT.desca( n_ ) )
THEN
163 info =
min( info, japos )
165 IF( ia+ma-1.GT.desca( m_ ) )
166 $ info =
min( info, mapos )
167 IF( ja+na-1.GT.desca( n_ ) )
168 $ info =
min( info, napos )
177 IF( info.EQ.bignum )
THEN
179 ELSE IF( mod( info, descmult ).EQ.0 )
THEN
180 info = -info / descmult