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

◆ pzladom()

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

Definition at line 913 of file pzblastim.f.

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