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

◆ psladom()

subroutine psladom ( logical  inplace,
integer  n,
real  alpha,
real, dimension( * )  a,
integer  ia,
integer  ja,
integer, dimension( * )  desca 
)

Definition at line 907 of file psblastim.f.

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