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

◆ pdladom()

subroutine pdladom ( logical  inplace,
integer  n,
double precision  alpha,
double precision, dimension( * )  a,
integer  ia,
integer  ja,
integer, dimension( * )  desca 
)

Definition at line 906 of file pdblastim.f.

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