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

◆ pcladom()

subroutine pcladom ( logical  inplace,
integer  n,
complex  alpha,
complex, dimension( * )  a,
integer  ia,
integer  ja,
integer, dimension( * )  desca 
)

Definition at line 912 of file pcblastim.f.

913*
914* -- PBLAS test routine (version 2.0) --
915* University of Tennessee, Knoxville, Oak Ridge National Laboratory,
916* and University of California, Berkeley.
917* April 1, 1998
918*
919* .. Scalar Arguments ..
920 LOGICAL INPLACE
921 INTEGER IA, JA, N
922 COMPLEX ALPHA
923* ..
924* .. Array Arguments ..
925 INTEGER DESCA( * )
926 COMPLEX A( * )
927* ..
928*
929* Purpose
930* =======
931*
932* PCLADOM adds alpha to the diagonal entries of an n by n submatrix
933* sub( A ) denoting A( IA:IA+N-1, JA:JA+N-1 ).
934*
935* Notes
936* =====
937*
938* A description vector is associated with each 2D block-cyclicly dis-
939* tributed matrix. This vector stores the information required to
940* establish the mapping between a matrix entry and its corresponding
941* process and memory location.
942*
943* In the following comments, the character _ should be read as
944* "of the distributed matrix". Let A be a generic term for any 2D
945* block cyclicly distributed matrix. Its description vector is DESCA:
946*
947* NOTATION STORED IN EXPLANATION
948* ---------------- --------------- ------------------------------------
949* DTYPE_A (global) DESCA( DTYPE_ ) The descriptor type.
950* CTXT_A (global) DESCA( CTXT_ ) The BLACS context handle, indicating
951* the NPROW x NPCOL BLACS process grid
952* A is distributed over. The context
953* itself is global, but the handle
954* (the integer value) may vary.
955* M_A (global) DESCA( M_ ) The number of rows in the distribu-
956* ted matrix A, M_A >= 0.
957* N_A (global) DESCA( N_ ) The number of columns in the distri-
958* buted matrix A, N_A >= 0.
959* IMB_A (global) DESCA( IMB_ ) The number of rows of the upper left
960* block of the matrix A, IMB_A > 0.
961* INB_A (global) DESCA( INB_ ) The number of columns of the upper
962* left block of the matrix A,
963* INB_A > 0.
964* MB_A (global) DESCA( MB_ ) The blocking factor used to distri-
965* bute the last M_A-IMB_A rows of A,
966* MB_A > 0.
967* NB_A (global) DESCA( NB_ ) The blocking factor used to distri-
968* bute the last N_A-INB_A columns of
969* A, NB_A > 0.
970* RSRC_A (global) DESCA( RSRC_ ) The process row over which the first
971* row of the matrix A is distributed,
972* NPROW > RSRC_A >= 0.
973* CSRC_A (global) DESCA( CSRC_ ) The process column over which the
974* first column of A is distributed.
975* NPCOL > CSRC_A >= 0.
976* LLD_A (local) DESCA( LLD_ ) The leading dimension of the local
977* array storing the local blocks of
978* the distributed matrix A,
979* IF( Lc( 1, N_A ) > 0 )
980* LLD_A >= MAX( 1, Lr( 1, M_A ) )
981* ELSE
982* LLD_A >= 1.
983*
984* Let K be the number of rows of a matrix A starting at the global in-
985* dex IA,i.e, A( IA:IA+K-1, : ). Lr( IA, K ) denotes the number of rows
986* that the process of row coordinate MYROW ( 0 <= MYROW < NPROW ) would
987* receive if these K rows were distributed over NPROW processes. If K
988* is the number of columns of a matrix A starting at the global index
989* JA, i.e, A( :, JA:JA+K-1, : ), Lc( JA, K ) denotes the number of co-
990* lumns that the process MYCOL ( 0 <= MYCOL < NPCOL ) would receive if
991* these K columns were distributed over NPCOL processes.
992*
993* The values of Lr() and Lc() may be determined via a call to the func-
994* tion PB_NUMROC:
995* Lr( IA, K ) = PB_NUMROC( K, IA, IMB_A, MB_A, MYROW, RSRC_A, NPROW )
996* Lc( JA, K ) = PB_NUMROC( K, JA, INB_A, NB_A, MYCOL, CSRC_A, NPCOL )
997*
998* Arguments
999* =========
1000*
1001* INPLACE (global input) LOGICAL
1002* On entry, INPLACE specifies if the matrix should be generated
1003* in place or not. If INPLACE is .TRUE., the local random array
1004* to be generated will start in memory at the local memory lo-
1005* cation A( 1, 1 ), otherwise it will start at the local posi-
1006* tion induced by IA and JA.
1007*
1008* N (global input) INTEGER
1009* On entry, N specifies the global order of the submatrix
1010* sub( A ) to be modified. N must be at least zero.
1011*
1012* ALPHA (global input) COMPLEX
1013* On entry, ALPHA specifies the scalar alpha.
1014*
1015* A (local input/local output) COMPLEX array
1016* On entry, A is an array of dimension (LLD_A, Ka), where Ka is
1017* at least Lc( 1, JA+N-1 ). Before entry, this array contains
1018* the local entries of the matrix A. On exit, the local entries
1019* of this array corresponding to the main diagonal of sub( A )
1020* have been updated.
1021*
1022* IA (global input) INTEGER
1023* On entry, IA specifies A's global row index, which points to
1024* the beginning of the submatrix sub( A ).
1025*
1026* JA (global input) INTEGER
1027* On entry, JA specifies A's global column index, which points
1028* to the beginning of the submatrix sub( A ).
1029*
1030* DESCA (global and local input) INTEGER array
1031* On entry, DESCA is an integer array of dimension DLEN_. This
1032* is the array descriptor for the matrix A.
1033*
1034* -- Written on April 1, 1998 by
1035* Antoine Petitet, University of Tennessee, Knoxville 37996, USA.
1036*
1037* =====================================================================
1038*
1039* .. Parameters ..
1040 INTEGER BLOCK_CYCLIC_2D_INB, CSRC_, CTXT_, DLEN_,
1041 $ DTYPE_, IMB_, INB_, LLD_, MB_, M_, NB_, N_,
1042 $ RSRC_
1043 parameter( block_cyclic_2d_inb = 2, dlen_ = 11,
1044 $ dtype_ = 1, ctxt_ = 2, m_ = 3, n_ = 4,
1045 $ imb_ = 5, inb_ = 6, mb_ = 7, nb_ = 8,
1046 $ rsrc_ = 9, csrc_ = 10, lld_ = 11 )
1047* ..
1048* .. Local Scalars ..
1049 LOGICAL GODOWN, GOLEFT
1050 INTEGER I, IACOL, IAROW, ICTXT, IIA, IJOFFA, ILOW,
1051 $ IMB1, IMBLOC, INB1, INBLOC, IOFFA, IOFFD, IUPP,
1052 $ JJA, JOFFA, JOFFD, LCMT, LCMT00, LDA, LDAP1,
1053 $ LMBLOC, LNBLOC, LOW, MB, MBLKD, MBLKS, MBLOC,
1054 $ MRCOL, MRROW, MYCOL, MYROW, NB, NBLKD, NBLKS,
1055 $ NBLOC, NP, NPCOL, NPROW, NQ, PMB, QNB, UPP
1056 COMPLEX ATMP
1057* ..
1058* .. Local Scalars ..
1059 INTEGER DESCA2( DLEN_ )
1060* ..
1061* .. External Subroutines ..
1062 EXTERNAL blacs_gridinfo, pb_ainfog2l, pb_binfo,
1063 $ pb_desctrans
1064* ..
1065* .. Intrinsic Functions ..
1066 INTRINSIC abs, aimag, cmplx, max, min, real
1067* ..
1068* .. Executable Statements ..
1069*
1070* Convert descriptor
1071*
1072 CALL pb_desctrans( desca, desca2 )
1073*
1074* Get grid parameters
1075*
1076 ictxt = desca2( ctxt_ )
1077 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
1078*
1079 IF( n.EQ.0 )
1080 $ RETURN
1081*
1082 CALL pb_ainfog2l( n, n, ia, ja, desca2, nprow, npcol, myrow,
1083 $ mycol, imb1, inb1, np, nq, iia, jja, iarow,
1084 $ iacol, mrrow, mrcol )
1085*
1086* Decide where the entries shall be stored in memory
1087*
1088 IF( inplace ) THEN
1089 iia = 1
1090 jja = 1
1091 END IF
1092*
1093* Initialize LCMT00, MBLKS, NBLKS, IMBLOC, INBLOC, LMBLOC, LNBLOC,
1094* ILOW, LOW, IUPP, and UPP.
1095*
1096 mb = desca2( mb_ )
1097 nb = desca2( nb_ )
1098*
1099 CALL pb_binfo( 0, np, nq, imb1, inb1, mb, nb, mrrow, mrcol,
1100 $ lcmt00, mblks, nblks, imbloc, inbloc, lmbloc,
1101 $ lnbloc, ilow, low, iupp, upp )
1102*
1103 ioffa = iia - 1
1104 joffa = jja - 1
1105 lda = desca2( lld_ )
1106 ldap1 = lda + 1
1107*
1108 IF( desca2( rsrc_ ).LT.0 ) THEN
1109 pmb = mb
1110 ELSE
1111 pmb = nprow * mb
1112 END IF
1113 IF( desca2( csrc_ ).LT.0 ) THEN
1114 qnb = nb
1115 ELSE
1116 qnb = npcol * nb
1117 END IF
1118*
1119* Handle the first block of rows or columns separately, and update
1120* LCMT00, MBLKS and NBLKS.
1121*
1122 godown = ( lcmt00.GT.iupp )
1123 goleft = ( lcmt00.LT.ilow )
1124*
1125 IF( .NOT.godown .AND. .NOT.goleft ) THEN
1126*
1127* LCMT00 >= ILOW && LCMT00 <= IUPP
1128*
1129 IF( lcmt00.GE.0 ) THEN
1130 ijoffa = ioffa+lcmt00 + ( joffa - 1 ) * lda
1131 DO 10 i = 1, min( inbloc, max( 0, imbloc - lcmt00 ) )
1132 atmp = a( ijoffa + i*ldap1 )
1133 a( ijoffa + i*ldap1 ) = alpha +
1134 $ cmplx( abs( real( atmp ) ),
1135 $ abs( aimag( atmp ) ) )
1136 10 CONTINUE
1137 ELSE
1138 ijoffa = ioffa + ( joffa - lcmt00 - 1 ) * lda
1139 DO 20 i = 1, min( imbloc, max( 0, inbloc + lcmt00 ) )
1140 atmp = a( ijoffa + i*ldap1 )
1141 a( ijoffa + i*ldap1 ) = alpha +
1142 $ cmplx( abs( real( atmp ) ),
1143 $ abs( aimag( atmp ) ) )
1144 20 CONTINUE
1145 END IF
1146 goleft = ( ( lcmt00 - ( iupp - upp + pmb ) ).LT.ilow )
1147 godown = .NOT.goleft
1148*
1149 END IF
1150*
1151 IF( godown ) THEN
1152*
1153 lcmt00 = lcmt00 - ( iupp - upp + pmb )
1154 mblks = mblks - 1
1155 ioffa = ioffa + imbloc
1156*
1157 30 CONTINUE
1158 IF( mblks.GT.0 .AND. lcmt00.GT.upp ) THEN
1159 lcmt00 = lcmt00 - pmb
1160 mblks = mblks - 1
1161 ioffa = ioffa + mb
1162 GO TO 30
1163 END IF
1164*
1165 lcmt = lcmt00
1166 mblkd = mblks
1167 ioffd = ioffa
1168*
1169 mbloc = mb
1170 40 CONTINUE
1171 IF( mblkd.GT.0 .AND. lcmt.GE.ilow ) THEN
1172 IF( mblkd.EQ.1 )
1173 $ mbloc = lmbloc
1174 IF( lcmt.GE.0 ) THEN
1175 ijoffa = ioffd + lcmt + ( joffa - 1 ) * lda
1176 DO 50 i = 1, min( inbloc, max( 0, mbloc - lcmt ) )
1177 atmp = a( ijoffa + i*ldap1 )
1178 a( ijoffa + i*ldap1 ) = alpha +
1179 $ cmplx( abs( real( atmp ) ),
1180 $ abs( aimag( atmp ) ) )
1181 50 CONTINUE
1182 ELSE
1183 ijoffa = ioffd + ( joffa - lcmt - 1 ) * lda
1184 DO 60 i = 1, min( mbloc, max( 0, inbloc + lcmt ) )
1185 atmp = a( ijoffa + i*ldap1 )
1186 a( ijoffa + i*ldap1 ) = alpha +
1187 $ cmplx( abs( real( atmp ) ),
1188 $ abs( aimag( atmp ) ) )
1189 60 CONTINUE
1190 END IF
1191 lcmt00 = lcmt
1192 lcmt = lcmt - pmb
1193 mblks = mblkd
1194 mblkd = mblkd - 1
1195 ioffa = ioffd
1196 ioffd = ioffd + mbloc
1197 GO TO 40
1198 END IF
1199*
1200 lcmt00 = lcmt00 + low - ilow + qnb
1201 nblks = nblks - 1
1202 joffa = joffa + inbloc
1203*
1204 ELSE IF( goleft ) THEN
1205*
1206 lcmt00 = lcmt00 + low - ilow + qnb
1207 nblks = nblks - 1
1208 joffa = joffa + inbloc
1209*
1210 70 CONTINUE
1211 IF( nblks.GT.0 .AND. lcmt00.LT.low ) THEN
1212 lcmt00 = lcmt00 + qnb
1213 nblks = nblks - 1
1214 joffa = joffa + nb
1215 GO TO 70
1216 END IF
1217*
1218 lcmt = lcmt00
1219 nblkd = nblks
1220 joffd = joffa
1221*
1222 nbloc = nb
1223 80 CONTINUE
1224 IF( nblkd.GT.0 .AND. lcmt.LE.iupp ) THEN
1225 IF( nblkd.EQ.1 )
1226 $ nbloc = lnbloc
1227 IF( lcmt.GE.0 ) THEN
1228 ijoffa = ioffa + lcmt + ( joffd - 1 ) * lda
1229 DO 90 i = 1, min( nbloc, max( 0, imbloc - lcmt ) )
1230 atmp = a( ijoffa + i*ldap1 )
1231 a( ijoffa + i*ldap1 ) = alpha +
1232 $ cmplx( abs( real( atmp ) ),
1233 $ abs( aimag( atmp ) ) )
1234 90 CONTINUE
1235 ELSE
1236 ijoffa = ioffa + ( joffd - lcmt - 1 ) * lda
1237 DO 100 i = 1, min( imbloc, max( 0, nbloc + lcmt ) )
1238 atmp = a( ijoffa + i*ldap1 )
1239 a( ijoffa + i*ldap1 ) = alpha +
1240 $ cmplx( abs( real( atmp ) ),
1241 $ abs( aimag( atmp ) ) )
1242 100 CONTINUE
1243 END IF
1244 lcmt00 = lcmt
1245 lcmt = lcmt + qnb
1246 nblks = nblkd
1247 nblkd = nblkd - 1
1248 joffa = joffd
1249 joffd = joffd + nbloc
1250 GO TO 80
1251 END IF
1252*
1253 lcmt00 = lcmt00 - ( iupp - upp + pmb )
1254 mblks = mblks - 1
1255 ioffa = ioffa + imbloc
1256*
1257 END IF
1258*
1259 nbloc = nb
1260 110 CONTINUE
1261 IF( nblks.GT.0 ) THEN
1262 IF( nblks.EQ.1 )
1263 $ nbloc = lnbloc
1264 120 CONTINUE
1265 IF( mblks.GT.0 .AND. lcmt00.GT.upp ) THEN
1266 lcmt00 = lcmt00 - pmb
1267 mblks = mblks - 1
1268 ioffa = ioffa + mb
1269 GO TO 120
1270 END IF
1271*
1272 lcmt = lcmt00
1273 mblkd = mblks
1274 ioffd = ioffa
1275*
1276 mbloc = mb
1277 130 CONTINUE
1278 IF( mblkd.GT.0 .AND. lcmt.GE.low ) THEN
1279 IF( mblkd.EQ.1 )
1280 $ mbloc = lmbloc
1281 IF( lcmt.GE.0 ) THEN
1282 ijoffa = ioffd + lcmt + ( joffa - 1 ) * lda
1283 DO 140 i = 1, min( nbloc, max( 0, mbloc - lcmt ) )
1284 atmp = a( ijoffa + i*ldap1 )
1285 a( ijoffa + i*ldap1 ) = alpha +
1286 $ cmplx( abs( real( atmp ) ),
1287 $ abs( aimag( atmp ) ) )
1288 140 CONTINUE
1289 ELSE
1290 ijoffa = ioffd + ( joffa - lcmt - 1 ) * lda
1291 DO 150 i = 1, min( mbloc, max( 0, nbloc + lcmt ) )
1292 atmp = a( ijoffa + i*ldap1 )
1293 a( ijoffa + i*ldap1 ) = alpha +
1294 $ cmplx( abs( real( atmp ) ),
1295 $ abs( aimag( atmp ) ) )
1296 150 CONTINUE
1297 END IF
1298 lcmt00 = lcmt
1299 lcmt = lcmt - pmb
1300 mblks = mblkd
1301 mblkd = mblkd - 1
1302 ioffa = ioffd
1303 ioffd = ioffd + mbloc
1304 GO TO 130
1305 END IF
1306*
1307 lcmt00 = lcmt00 + qnb
1308 nblks = nblks - 1
1309 joffa = joffa + nbloc
1310 GO TO 110
1311*
1312 END IF
1313*
1314 RETURN
1315*
1316* End of PCLADOM
1317*
float cmplx[2]
Definition pblas.h:136
subroutine pb_ainfog2l(m, n, i, j, desc, nprow, npcol, myrow, mycol, imb1, inb1, mp, nq, ii, jj, prow, pcol, rprow, rpcol)
Definition pblastst.f:2023
subroutine pb_binfo(offd, m, n, imb1, inb1, mb, nb, mrrow, mrcol, lcmt00, mblks, nblks, imbloc, inbloc, lmbloc, lnbloc, ilow, low, iupp, upp)
Definition pblastst.f:3577
subroutine pb_desctrans(descin, descout)
Definition pblastst.f:2964
#define max(A, B)
Definition pcgemr.c:180
#define min(A, B)
Definition pcgemr.c:181
Here is the call graph for this function: