1 SUBROUTINE pvdimchk( ICTXT, NOUT, N, MATRIX, IX, JX, DESCX, INCX,
11 INTEGER ICTXT, INCX, INFO, IX, JX, N, NOUT
132 INTEGER BLOCK_CYCLIC_2D_INB, CSRC_, CTXT_, DLEN_,
133 $ dtype_, imb_, inb_, lld_, mb_, m_, nb_, n_,
135 parameter( block_cyclic_2d_inb = 2, dlen_ = 11,
136 $ dtype_ = 1, ctxt_ = 2, m_ = 3, n_ = 4,
137 $ imb_ = 5, inb_ = 6, mb_ = 7, nb_ = 8,
138 $ rsrc_ = 9, csrc_ = 10, lld_ = 11 )
141 INTEGER MYCOL, MYROW, NPCOL, NPROW
144 EXTERNAL blacs_gridinfo, igsum2d
149 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
153 ELSE IF( n.EQ.0 )
THEN
154 IF( descx( m_ ).LT.0 )
156 IF( descx( n_ ).LT.0 )
159 IF( incx.EQ.descx( m_ ) .AND.
160 $ descx( n_ ).LT.( jx+n-1 ) )
THEN
162 ELSE IF( incx.EQ.1 .AND. incx.NE.descx( m_ ) .AND.
163 $ descx( m_ ).LT.( ix+n-1 ) )
THEN
166 IF( ix.GT.descx( m_ ) )
THEN
168 ELSE IF( jx.GT.descx( n_ ) )
THEN
176 CALL igsum2d( ictxt,
'All',
' ', 1, 1, info, 1, -1, 0 )
179 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
THEN
180 WRITE( nout, fmt = 9999 ) matrix
181 WRITE( nout, fmt = 9998 ) n, matrix, ix, matrix, jx, matrix,
183 WRITE( nout, fmt = 9997 ) matrix, descx( m_ ), matrix,
185 WRITE( nout, fmt = * )
189 9999
FORMAT(
'Incompatible arguments for matrix ', a1,
':' )
190 9998
FORMAT(
'N = ', i6,
', I', a1,
' = ', i6,
', J', a1,
' = ',
191 $ i6,
',INC', a1,
' = ', i6 )
192 9997
FORMAT(
'DESC', a1,
'( M_ ) = ', i6,
', DESC', a1,
'( N_ ) = ',
200 SUBROUTINE pmdimchk( ICTXT, NOUT, M, N, MATRIX, IA, JA, DESCA,
210 INTEGER ICTXT, INFO, IA, JA, M, N, NOUT
326 INTEGER BLOCK_CYCLIC_2D_INB, CSRC_, CTXT_, DLEN_,
327 $ DTYPE_, IMB_, INB_, LLD_, MB_, M_, NB_, N_,
329 parameter( block_cyclic_2d_inb = 2, dlen_ = 11,
330 $ dtype_ = 1, ctxt_ = 2, m_ = 3, n_ = 4,
331 $ imb_ = 5, inb_ = 6, mb_ = 7, nb_ = 8,
332 $ rsrc_ = 9, csrc_ = 10, lld_ = 11 )
335 INTEGER MYCOL, MYROW, NPCOL, NPROW
338 EXTERNAL blacs_gridinfo, igsum2d
343 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
345 IF( ( m.LT.0 ).OR.( n.LT.0 ) )
THEN
347 ELSE IF( ( m.EQ.0 ).OR.( n.EQ.0 ) )
THEN
348 IF( desca( m_ ).LT.0 )
350 IF( desca( n_ ).LT.0 )
353 IF( desca( m_ ).LT.( ia+m-1 ) )
355 IF( desca( n_ ).LT.( ja+n-1 ) )
361 CALL igsum2d( ictxt,
'All',
' ', 1, 1, info, 1, -1, 0 )
364 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
THEN
365 WRITE( nout, fmt = 9999 ) matrix
366 WRITE( nout, fmt = 9998 ) m, n, matrix, ia, matrix, ja
367 WRITE( nout, fmt = 9997 ) matrix, desca( m_ ), matrix,
369 WRITE( nout, fmt = * )
373 9999
FORMAT(
'Incompatible arguments for matrix ', a1,
':' )
374 9998
FORMAT(
'M = ', i6,
', N = ', i6,
', I', a1,
' = ', i6,
375 $
', J', a1,
' = ', i6 )
376 9997
FORMAT(
'DESC', a1,
'( M_ ) = ', i6,
', DESC', a1,
'( N_ ) = ',
384 SUBROUTINE pvdescchk( ICTXT, NOUT, MATRIX, DESCX, DTX, MX, NX,
385 $ IMBX, INBX, MBX, NBX, RSRCX, CSRCX, INCX,
386 $ MPX, NQX, IPREX, IMIDX, IPOSTX, IGAP,
396 INTEGER CSRCX, DTX, GAPMUL, ICTXT, IGAP, IMBX, IMIDX,
397 $ INBX, INCX, INFO, IPOSTX, IPREX, MBX, MPX, MX,
398 $ NBX, NOUT, NQX, NX, RSRCX
578 INTEGER BLOCK_CYCLIC_2D_INB, CSRC_, CTXT_, DLEN_,
579 $ DTYPE_, IMB_, INB_, LLD_, MB_, M_, NB_, N_,
581 PARAMETER ( BLOCK_CYCLIC_2D_INB = 2, dlen_ = 11,
582 $ dtype_ = 1, ctxt_ = 2, m_ = 3, n_ = 4,
583 $ imb_ = 5, inb_ = 6, mb_ = 7, nb_ = 8,
584 $ rsrc_ = 9, csrc_ = 10, lld_ = 11 )
587 INTEGER LLDX, MYCOL, MYROW, NPCOL, NPROW
590 EXTERNAL BLACS_GRIDINFO, IGSUM2D, PB_DESCINIT2
602 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
606 IF( dtx.NE.block_cyclic_2d_inb )
THEN
607 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
608 $
WRITE( nout, fmt = 9999 ) matrix,
'DTYPE', matrix, dtx,
609 $ block_cyclic_2d_inb
616 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
617 $
WRITE( nout, fmt = 9998 ) matrix,
'M', matrix, mx
619 ELSE IF( nx.LT.0 )
THEN
620 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
621 $
WRITE( nout, fmt = 9997 ) matrix,
'N', matrix, nx
628 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
629 $
WRITE( nout, fmt = 9996 ) matrix,
'IMB', matrix, imbx
631 ELSE IF( inbx.LT.1 )
THEN
632 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
633 $
WRITE( nout, fmt = 9995 ) matrix,
'INB', matrix, inbx
640 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
641 $
WRITE( nout, fmt = 9994 ) matrix,
'MB', matrix, mbx
643 ELSE IF( nbx.LT.1 )
THEN
644 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
645 $
WRITE( nout, fmt = 9993 ) matrix,
'NB', matrix, nbx
651 IF( rsrcx.LT.-1 .OR. rsrcx.GE.nprow )
THEN
652 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
THEN
653 WRITE( nout, fmt = 9992 ) matrix
654 WRITE( nout, fmt = 9990 )
'RSRC', matrix, rsrcx, nprow
657 ELSE IF( csrcx.LT.-1 .OR. csrcx.GE.npcol )
THEN
658 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
THEN
659 WRITE( nout, fmt = 9991 ) matrix
660 WRITE( nout, fmt = 9990 )
'CSRC', matrix, csrcx, npcol
667 IF( incx.NE.1 .AND. incx.NE.mx )
THEN
668 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
THEN
669 WRITE( nout, fmt = 9989 ) matrix
670 WRITE( nout, fmt = 9988 )
'INC', matrix, incx, matrix, mx
677 CALL igsum2d( ictxt,
'All',
' ', 1, 1, info, 1, -1, 0 )
681 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
THEN
682 WRITE( nout, fmt = 9987 ) matrix
683 WRITE( nout, fmt = * )
690 mpx = pb_numroc( mx, 1, imbx, mbx, myrow, rsrcx, nprow )
691 nqx = pb_numroc( nx, 1, inbx, nbx, mycol, csrcx, npcol )
692 iprex =
max( gapmul*nbx, mpx )
694 ipostx =
max( gapmul*nbx, nqx )
695 lldx =
max( 1, mpx ) + imidx
697 CALL pb_descinit2( descx, mx, nx, imbx, inbx, mbx, nbx, rsrcx,
698 $ csrcx, ictxt, lldx, info )
702 CALL igsum2d( ictxt,
'All',
' ', 1, 1, info, 1, -1, 0 )
705 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
THEN
706 WRITE( nout, fmt = 9987 ) matrix
707 WRITE( nout, fmt = * )
713 9999
FORMAT( 2x,
'>> Invalid matrix ', a1,
' descriptor type ', a5, a1,
714 $
': ', i6,
' should be ', i3,
'.' )
715 9998
FORMAT( 2x,
'>> Invalid matrix ', a1,
' row dimension ', a1, a1,
716 $
': ', i6,
' should be at least 1.' )
717 9997
FORMAT( 2x,
'>> Invalid matrix ', a1,
' column dimension ', a1,
718 $ a1,
': ', i6,
' should be at least 1.' )
719 9996
FORMAT( 2x,
'>> Invalid matrix ', a1,
' first row block size ',
720 $ a3, a1,
': ', i6,
' should be at least 1.' )
721 9995
FORMAT( 2x,
'>> Invalid matrix ', a1,
' first column block size ',
722 $ a3, a1,
': ', i6,
' should be at least 1.' )
723 9994
FORMAT( 2x,
'>> Invalid matrix ', a1,
' row block size ', a2, a1,
724 $
': ', i6,
' should be at least 1.' )
725 9993
FORMAT( 2x,
'>> Invalid matrix ', a1,
' column block size ', a2,
726 $ a1,
': ', i6,
' should be at least 1.' )
727 9992
FORMAT( 2x,
'>> Invalid matrix ', a1,
' row process source:' )
728 9991
FORMAT( 2x,
'>> Invalid matrix ', a1,
' column process source:' )
729 9990
FORMAT( 2x,
'>> ', a4, a1,
'= ', i6,
' should be >= -1 and < ',
731 9989
FORMAT( 2x,
'>> Invalid vector ', a1,
' increment:' )
732 9988
FORMAT( 2x,
'>> ', a3, a1,
'= ', i6,
' should be 1 or M', a1,
734 9987
FORMAT( 2x,
'>> Invalid matrix ', a1,
' descriptor: going on to ',
735 $
'next test case.' )
742 SUBROUTINE pmdescchk( ICTXT, NOUT, MATRIX, DESCA, DTA, MA, NA,
743 $ IMBA, INBA, MBA, NBA, RSRCA, CSRCA, MPA,
744 $ NQA, IPREA, IMIDA, IPOSTA, IGAP, GAPMUL,
754 INTEGER CSRCA, DTA, GAPMUL, ICTXT, IGAP, IMBA, IMIDA,
755 $ INBA, INFO, IPOSTA, IPREA, MA, MBA, MPA, NA,
756 $ NBA, NOUT, NQA, RSRCA
932 INTEGER BLOCK_CYCLIC_2D_INB, CSRC_, CTXT_, DLEN_,
933 $ DTYPE_, IMB_, INB_, LLD_, MB_, M_, NB_, N_,
935 PARAMETER ( BLOCK_CYCLIC_2D_INB = 2, dlen_ = 11,
936 $ dtype_ = 1, ctxt_ = 2, m_ = 3, n_ = 4,
937 $ imb_ = 5, inb_ = 6, mb_ = 7, nb_ = 8,
938 $ rsrc_ = 9, csrc_ = 10, lld_ = 11 )
941 INTEGER LLDA, MYCOL, MYROW, NPCOL, NPROW
956 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
960 IF( dta.NE.block_cyclic_2d_inb )
THEN
961 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
962 $
WRITE( nout, fmt = 9999 ) matrix,
'DTYPE', matrix, dta,
963 $ block_cyclic_2d_inb
970 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
971 $
WRITE( nout, fmt = 9998 ) matrix,
'M', matrix, ma
973 ELSE IF( na.LT.0 )
THEN
974 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
975 $
WRITE( nout, fmt = 9997 ) matrix,
'N', matrix, na
982 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
983 $
WRITE( nout, fmt = 9996 ) matrix,
'IMB', matrix, imba
985 ELSE IF( inba.LT.1 )
THEN
986 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
987 $
WRITE( nout, fmt = 9995 ) matrix,
'INB', matrix, inba
994 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
995 $
WRITE( nout, fmt = 9994 ) matrix,
'MB', matrix, mba
997 ELSE IF( nba.LT.1 )
THEN
998 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
999 $
WRITE( nout, fmt = 9993 ) matrix,
'NB', matrix, nba
1005 IF( rsrca.LT.-1 .OR. rsrca.GE.nprow )
THEN
1006 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
THEN
1007 WRITE( nout, fmt = 9992 ) matrix
1008 WRITE( nout, fmt = 9990 )
'RSRC', matrix, rsrca, nprow
1011 ELSE IF( csrca.LT.-1 .OR. csrca.GE.npcol )
THEN
1012 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
THEN
1013 WRITE( nout, fmt = 9991 ) matrix
1014 WRITE( nout, fmt = 9990 )
'CSRC', matrix, csrca, npcol
1021 CALL igsum2d( ictxt,
'All',
' ', 1, 1, info, 1, -1, 0 )
1023 IF( info.NE.0 )
THEN
1025 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
THEN
1026 WRITE( nout, fmt = 9989 ) matrix
1027 WRITE( nout, fmt = * )
1034 mpa = pb_numroc( ma, 1, imba, mba, myrow, rsrca, nprow )
1035 nqa = pb_numroc( na, 1, inba, nba, mycol, csrca, npcol )
1036 iprea =
max( gapmul*nba, mpa )
1038 iposta =
max( gapmul*nba, nqa )
1039 llda =
max( 1, mpa ) + imida
1041 CALL pb_descinit2( desca, ma, na, imba, inba, mba, nba, rsrca,
1042 $ csrca, ictxt, llda, info )
1046 CALL igsum2d( ictxt,
'All',
' ', 1, 1, info, 1, -1, 0 )
1048 IF( info.NE.0 )
THEN
1049 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
THEN
1050 WRITE( nout, fmt = 9989 ) matrix
1051 WRITE( nout, fmt = * )
1057 9999
FORMAT( 2x,
'>> Invalid matrix ', a1,
' descriptor type ', a5, a1,
1058 $
': ', i6,
' should be ', i3,
'.' )
1059 9998
FORMAT( 2x,
'>> Invalid matrix ', a1,
' row dimension ', a1, a1,
1060 $
': ', i6,
' should be at least 1.' )
1061 9997
FORMAT( 2x,
'>> Invalid matrix ', a1,
' column dimension ', a1,
1062 $ a1,
': ', i6,
' should be at least 1.' )
1063 9996
FORMAT( 2x,
'>> Invalid matrix ', a1,
' first row block size ',
1064 $ a3, a1,
': ', i6,
' should be at least 1.' )
1065 9995
FORMAT( 2x,
'>> Invalid matrix ', a1,
' first column block size ',
1066 $ a3, a1,
': ', i6,
' should be at least 1.' )
1067 9994
FORMAT( 2x,
'>> Invalid matrix ', a1,
' row block size ', a2, a1,
1068 $
': ', i6,
' should be at least 1.' )
1069 9993
FORMAT( 2x,
'>> Invalid matrix ', a1,
' column block size ', a2,
1070 $ a1,
': ', i6,
' should be at least 1.' )
1071 9992
FORMAT( 2x,
'>> Invalid matrix ', a1,
' row process source:' )
1072 9991
FORMAT( 2x,
'>> Invalid matrix ', a1,
' column process source:' )
1073 9990
FORMAT( 2x,
'>> ', a4, a1,
'= ', i6,
' should be >= -1 and < ',
1075 9989
FORMAT( 2x,
'>> Invalid matrix ', a1,
' descriptor: going on to ',
1076 $
'next test case.' )
1083 DOUBLE PRECISION FUNCTION pdopbl2( SUBNAM, M, N, KKL, KKU )
1092 INTEGER kkl, kku, m, n
1134 DOUBLE PRECISION one, six, two, zero
1135 PARAMETER ( one = 1.0d+0, six = 6.0d+0, two = 2.0d+0,
1142 DOUBLE PRECISION adds, ek, em, en, kl, ku, mults
1155 IF( m.LE.0 .OR. .NOT.(
lsamen( 2, subnam,
'PS' ) .OR.
1156 $
lsamen( 2, subnam,
'PD' ) .OR.
1157 $
lsamen( 2, subnam,
'PC' ) .OR.
lsamen( 2, subnam,
'PZ' ) ) )
1168 kl =
max( 0,
min( m-1, kkl ) )
1169 ku =
max( 0,
min( n-1, kku ) )
1178 IF(
lsamen( 3, c3,
'MV ' ) )
THEN
1180 IF(
lsamen( 2, c2,
'GE' ) )
THEN
1182 mults = em * ( en + one )
1189 ELSE IF(
lsamen( 2, c2,
'GB' ) )
THEN
1191 mults = em * ( en + one ) -
1192 $ ( em - one - kl ) * ( em - kl ) / two -
1193 $ ( en - one - ku ) * ( en - ku ) / two
1194 adds = em * ( en + one ) -
1195 $ ( em - one - kl ) * ( em - kl ) / two -
1196 $ ( en - one - ku ) * ( en - ku ) / two
1198 ELSE IF(
lsamen( 2, c2,
'SY' ) .OR.
lsamen( 2, c2,
'SP' ) .OR.
1202 mults = em * ( em + one )
1205 ELSE IF(
lsamen( 2, c2,
'SB' ) .OR.
1206 $
lsamen( 2, c2,
'HB' ) )
THEN
1208 mults = em * ( em + one ) - ( em - one - ek ) * ( em - ek )
1209 adds = em * em - ( em - one - ek ) * ( em - ek )
1211 ELSE IF(
lsamen( 2, c2,
'TR' ) .OR.
lsamen( 2, c2,
'TP' ) )
1214 mults = em * ( em + one ) / two
1215 adds = ( em - one ) * em / two
1217 ELSE IF(
lsamen( 2, c2,
'TB' ) )
THEN
1219 mults = em * ( em + one ) / two -
1220 $ ( em - ek - one ) * ( em - ek ) / two
1221 adds = ( em - one ) * em / two -
1222 $ ( em - ek - one ) * ( em - ek ) / two
1230 ELSE IF(
lsamen( 3, c3,
'SV ' ) )
THEN
1232 IF(
lsamen( 2, c2,
'TR' ) .OR.
lsamen( 2, c2,
'TP' ) )
THEN
1234 mults = em * ( em + one ) / two
1235 adds = ( em - one ) * em / two
1237 ELSE IF(
lsamen( 2, c2,
'TB' ) )
THEN
1239 mults = em * ( em + one ) / two -
1240 $ ( em - ek - one ) * ( em - ek ) / two
1241 adds = ( em - one ) * em / two -
1242 $ ( em - ek - one ) * ( em - ek ) / two
1250 ELSE IF(
lsamen( 3, c3,
'R ' ) )
THEN
1252 IF(
lsamen( 2, c2,
'GE' ) )
THEN
1254 mults = em * en +
min( em, en )
1257 ELSE IF(
lsamen( 2, c2,
'SY' ) .OR.
lsamen( 2, c2,
'SP' ) .OR.
1261 mults = em * ( em + one ) / two + em
1262 adds = em * ( em + one ) / two
1266 ELSE IF(
lsamen( 3, c3,
'RC ' ) .OR.
lsamen( 3, c3,
'RU ' ) )
THEN
1268 IF(
lsamen( 2, c2,
'GE' ) )
THEN
1270 mults = em * en +
min( em, en )
1279 ELSE IF(
lsamen( 3, c3,
'R2 ' ) )
THEN
1280 IF(
lsamen( 2, c2,
'SY' ) .OR.
lsamen( 2, c2,
'SP' ) .OR.
1281 $
lsamen( 2, c2,
'HE' ) .OR.
lsamen( 2, c2,
'HP' ) )
THEN
1283 mults = em * ( em + one ) + two * em
1284 adds = em * ( em + one )
1297 IF(
lsame( c1,
'S' ) .OR.
lsame( c1,
'D' ) )
THEN
1303 pdopbl2 = six * mults + two * adds
1312 DOUBLE PRECISION FUNCTION pdopbl3( SUBNAM, M, N, K )
1360 DOUBLE PRECISION one, six, two, zero
1361 PARAMETER ( one = 1.0d+0, six = 6.0d+0, two = 2.0d+0,
1368 DOUBLE PRECISION adds, ek, em, en, mults
1381 IF( m.LE.0 .OR. .NOT.(
lsamen( 2, subnam,
'PS' ) .OR.
1382 $
lsamen( 2, subnam,
'PD' ) .OR.
lsamen( 2, subnam,
'PC' )
1383 $ .OR.
lsamen( 2, subnam,
'PZ' ) ) )
1403 IF(
lsamen( 3, c3,
'MM ' ) )
THEN
1405 IF(
lsamen( 2, c2,
'GE' ) )
THEN
1407 mults = em * ek * en
1410 ELSE IF(
lsamen( 2, c2,
'SY' ) .OR.
1411 $
lsamen( 2, c2,
'HE' ) )
THEN
1416 mults = em * em * en
1419 mults = em * en * en
1423 ELSE IF(
lsamen( 2, c2,
'TR' ) )
THEN
1428 mults = en * em * ( em + one ) / two
1429 adds = en * em * ( em - one ) / two
1431 mults = em * en * ( en + one ) / two
1432 adds = em * en * ( en - one ) / two
1441 ELSE IF(
lsamen( 3, c3,
'RK ' ) )
THEN
1443 IF(
lsamen( 2, c2,
'SY' ) .OR.
1444 $
lsamen( 2, c2,
'HE' ) )
THEN
1446 mults = ek * em *( em + one ) / two
1447 adds = ek * em *( em + one ) / two
1454 ELSE IF(
lsamen( 3, c3,
'R2K' ) )
THEN
1456 IF(
lsamen( 2, c2,
'SY' ) .OR.
1457 $
lsamen( 3, c2,
'HE' ) )
THEN
1459 mults = ek * em * em
1460 adds = ek * em * em + em
1467 ELSE IF(
lsamen( 4, subnam( 3:6 ),
'TRSM' ) )
THEN
1470 mults = en * em * ( em + one ) / two
1471 adds = en * em * ( em - one ) / two
1473 mults = em * en * ( en + one ) / two
1474 adds = em * en * ( en - one ) / two
1481 ELSE IF(
lsamen( 3, c3,
'ADD' ) )
THEN
1483 IF(
lsamen( 2, c2,
'GE' ) )
THEN
1488 ELSE IF(
lsamen( 2, c2,
'TR' ) )
THEN
1494 mults = em * ( two * en - em + one )
1495 adds = em * ( em + one ) / two + em * ( en - em )
1497 mults = en * ( en + one )
1498 adds = en * ( en + one ) / two
1502 mults = en * ( two * em - en + one )
1503 adds = en * ( en + one ) / two + en * ( em - en )
1505 mults = em * ( em + one )
1506 adds = em * ( em + one ) / two
1522 IF(
lsame( c1,
'S' ) .OR.
lsame( c1,
'D' ) )
THEN
1528 pdopbl3 = six * mults + two * adds
1537 SUBROUTINE pxerbla( ICTXT, SRNAME, INFO )
1548 CHARACTER*(*) SRNAME
1581 INTEGER MYCOL, MYROW, NPCOL, NPROW
1584 EXTERNAL BLACS_GRIDINFO
1588 CALL BLACS_GRIDINFO( ICTXT, NPROW, NPCOL, MYROW, MYCOL )
1590 WRITE( *, fmt = 9999 ) myrow, mycol, srname, info
1592 9999
FORMAT(
'{', i5,
',', i5,
'}: On entry to ', a,
1593 $
' parameter number ', i4,
' had an illegal value' )
1600 LOGICAL FUNCTION lsame( CA, CB )
1630 INTEGER inta, intb, zcode
1642 zcode = ichar(
'Z' )
1652 IF( zcode.EQ.90 .OR. zcode.EQ.122 )
THEN
1657 IF( inta.GE.97 .AND. inta.LE.122 ) inta = inta - 32
1658 IF( intb.GE.97 .AND. intb.LE.122 ) intb = intb - 32
1660 ELSE IF( zcode.EQ.233 .OR. zcode.EQ.169 )
THEN
1665 IF( inta.GE.129 .AND. inta.LE.137 .OR.
1666 $ inta.GE.145 .AND. inta.LE.153 .OR.
1667 $ inta.GE.162 .AND. inta.LE.169 ) inta = inta + 64
1668 IF( intb.GE.129 .AND. intb.LE.137 .OR.
1669 $ intb.GE.145 .AND. intb.LE.153 .OR.
1670 $ intb.GE.162 .AND. intb.LE.169 ) intb = intb + 64
1672 ELSE IF( zcode.EQ.218 .OR. zcode.EQ.250 )
THEN
1677 IF( inta.GE.225 .AND. inta.LE.250 ) inta = inta - 32
1678 IF( intb.GE.225 .AND. intb.LE.250 ) intb = intb - 32
1680 lsame = inta.EQ.intb
1687 LOGICAL FUNCTION lsamen( N, CA, CB )
1695 CHARACTER*( * ) ca, cb
1734 IF( len( ca ).LT.n .OR. len( cb ).LT.n )
1743 IF( .NOT.
lsame( ca( i: i ), cb( i: i ) ) )
1755 SUBROUTINE icopy( N, SX, INCX, SY, INCY )
1763 INTEGER INCX, INCY, N
1766 INTEGER SX( * ), SY( * )
1796 INTEGER I, IX, IY, M, MP1
1805 IF( incx.EQ.1 .AND. incy.EQ.1 )
1813 $ ix = ( -n+1 )*incx + 1
1815 $ iy = ( -n+1 )*incy + 1
1840 sy( i+1 ) = sx( i+1 )
1841 sy( i+2 ) = sx( i+2 )
1842 sy( i+3 ) = sx( i+3 )
1843 sy( i+4 ) = sx( i+4 )
1844 sy( i+5 ) = sx( i+5 )
1845 sy( i+6 ) = sx( i+6 )
1883 INTEGER info, nblog, nout
1885 common /infoc/info, nblog
1886 common /pberrorc/nout, abrtflg
1902 SUBROUTINE pb_infog2l( I, J, DESC, NPROW, NPCOL, MYROW, MYCOL, II,
1911 INTEGER I, II, J, JJ, MYCOL, MYROW, NPCOL, NPROW, PCOL,
2050 INTEGER BLOCK_CYCLIC_2D_INB, CSRC_, CTXT_, DLEN_,
2051 $ DTYPE_, IMB_, INB_, LLD_, MB_, M_, NB_, N_,
2053 PARAMETER ( BLOCK_CYCLIC_2D_INB = 2, dlen_ = 11,
2054 $ dtype_ = 1, ctxt_ = 2, m_ = 3, n_ = 4,
2055 $ imb_ = 5, inb_ = 6, mb_ = 7, nb_ = 8,
2056 $ rsrc_ = 9, csrc_ = 10, lld_ = 11 )
2059 INTEGER CSRC, I1, ILOCBLK, IMB, INB, J1, MB, MYDIST,
2063 INTEGER DESC2( DLEN_ )
2066 EXTERNAL PB_DESCTRANS
2072 CALL pb_desctrans( desc, desc2 )
2075 prow = desc2( rsrc_ )
2079 IF( ( prow.EQ.-1 ).OR.( nprow.EQ.1 ) )
THEN
2083 ELSE IF( i.LE.imb )
THEN
2087 IF( myrow.EQ.prow )
THEN
2100 IF( myrow.EQ.rsrc )
THEN
2102 nblocks = ( i - imb - 1 ) / mb + 1
2103 prow = prow + nblocks
2104 prow = prow - ( prow / nprow ) * nprow
2106 ilocblk = nblocks / nprow
2108 IF( ilocblk.GT.0 )
THEN
2109 IF( ( ilocblk*nprow ).GE.nblocks )
THEN
2110 IF( myrow.EQ.prow )
THEN
2111 ii = i + ( ilocblk - nblocks ) * mb
2113 ii = imb + ( ilocblk - 1 ) * mb + 1
2116 ii = imb + ilocblk * mb + 1
2125 nblocks = ( i1 - 1 ) / mb + 1
2126 prow = prow + nblocks
2127 prow = prow - ( prow / nprow ) * nprow
2129 mydist = myrow - rsrc
2131 $ mydist = mydist + nprow
2133 ilocblk = nblocks / nprow
2135 IF( ilocblk.GT.0 )
THEN
2136 mydist = mydist - nblocks + ilocblk * nprow
2137 IF( mydist.LT.0 )
THEN
2138 ii = mb + ilocblk * mb + 1
2140 IF( myrow.EQ.prow )
THEN
2141 ii = i1 + ( ilocblk - nblocks + 1 ) * mb
2143 ii = ilocblk * mb + 1
2147 mydist = mydist - nblocks
2148 IF( mydist.LT.0 )
THEN
2150 ELSE IF( myrow.EQ.prow )
THEN
2151 ii = i1 + ( 1 - nblocks ) * mb
2161 pcol = desc2( csrc_ )
2165 IF( ( pcol.EQ.-1 ).OR.( npcol.EQ.1 ) )
THEN
2169 ELSE IF( j.LE.inb )
THEN
2173 IF( mycol.EQ.pcol )
THEN
2186 IF( mycol.EQ.csrc )
THEN
2188 nblocks = ( j - inb - 1 ) / nb + 1
2189 pcol = pcol + nblocks
2190 pcol = pcol - ( pcol / npcol ) * npcol
2192 ilocblk = nblocks / npcol
2194 IF( ilocblk.GT.0 )
THEN
2195 IF( ( ilocblk*npcol ).GE.nblocks )
THEN
2196 IF( mycol.EQ.pcol )
THEN
2197 jj = j + ( ilocblk - nblocks ) * nb
2199 jj = inb + ( ilocblk - 1 ) * nb + 1
2202 jj = inb + ilocblk * nb + 1
2211 nblocks = ( j1 - 1 ) / nb + 1
2212 pcol = pcol + nblocks
2213 pcol = pcol - ( pcol / npcol ) * npcol
2215 mydist = mycol - csrc
2217 $ mydist = mydist + npcol
2219 ilocblk = nblocks / npcol
2221 IF( ilocblk.GT.0 )
THEN
2222 mydist = mydist - nblocks + ilocblk * npcol
2223 IF( mydist.LT.0 )
THEN
2224 jj = nb + ilocblk * nb + 1
2226 IF( mycol.EQ.pcol )
THEN
2227 jj = j1 + ( ilocblk - nblocks + 1 ) * nb
2229 jj = ilocblk * nb + 1
2233 mydist = mydist - nblocks
2234 IF( mydist.LT.0 )
THEN
2236 ELSE IF( mycol.EQ.pcol )
THEN
2237 jj = j1 + ( 1 - nblocks ) * nb
2251 SUBROUTINE pb_ainfog2l( M, N, I, J, DESC, NPROW, NPCOL, MYROW,
2252 $ MYCOL, IMB1, INB1, MP, NQ, II, JJ, PROW,
2253 $ PCOL, RPROW, RPCOL )
2261 INTEGER I, II, IMB1, INB1, J, JJ, M, MP, MYCOL, MYROW,
2262 $ n, npcol, nprow, nq, pcol, prow, rpcol, rprow
2446 INTEGER BLOCK_CYCLIC_2D_INB, CSRC_, CTXT_, DLEN_,
2447 $ DTYPE_, IMB_, INB_, LLD_, MB_, M_, NB_, N_,
2449 PARAMETER ( BLOCK_CYCLIC_2D_INB = 2, dlen_ = 11,
2450 $ dtype_ = 1, ctxt_ = 2, m_ = 3, n_ = 4,
2451 $ imb_ = 5, inb_ = 6, mb_ = 7, nb_ = 8,
2452 $ rsrc_ = 9, csrc_ = 10, lld_ = 11 )
2455 INTEGER CSRC, I1, ILOCBLK, J1, M1, MB, MYDIST, N1, NB,
2459 INTEGER DESC2( DLEN_ )
2474 imb1 = desc2( imb_ )
2475 rsrc = desc2( rsrc_ )
2477 IF( ( rsrc.EQ.-1 ).OR.( nprow.EQ.1 ) )
THEN
2482 $ imb1 = ( ( -imb1 ) / mb + 1 ) * mb + imb1
2483 imb1 =
min( imb1, m )
2492 IF( i.LE.imb1 )
THEN
2496 IF( myrow.EQ.prow )
THEN
2507 nblocks = i1 / mb + 1
2508 prow = rsrc + nblocks
2509 prow = prow - ( prow / nprow ) * nprow
2511 IF( myrow.EQ.rsrc )
THEN
2513 ilocblk = nblocks / nprow
2515 IF( ilocblk.GT.0 )
THEN
2516 IF( ( ilocblk*nprow ).GE.nblocks )
THEN
2517 IF( myrow.EQ.prow )
THEN
2518 ii = i + ( ilocblk - nblocks ) * mb
2520 ii = imb1 + ( ilocblk - 1 ) * mb + 1
2523 ii = imb1 + ilocblk * mb + 1
2531 mydist = myrow - rsrc
2533 $ mydist = mydist + nprow
2535 ilocblk = nblocks / nprow
2537 IF( ilocblk.GT.0 )
THEN
2538 mydist = mydist - nblocks + ilocblk * nprow
2539 IF( mydist.LT.0 )
THEN
2540 ii = ( ilocblk + 1 ) * mb + 1
2541 ELSE IF( myrow.EQ.prow )
THEN
2542 ii = i1 + ( ilocblk - nblocks + 1 ) * mb + 1
2544 ii = ilocblk * mb + 1
2547 mydist = mydist - nblocks
2548 IF( mydist.LT.0 )
THEN
2550 ELSE IF( myrow.EQ.prow )
THEN
2551 ii = i1 + ( 1 - nblocks ) * mb + 1
2558 imb1 = nblocks * mb - i1
2564 IF( m.LE.imb1 )
THEN
2566 IF( myrow.EQ.prow )
THEN
2575 nblocks = m1 / mb + 1
2577 IF( myrow.EQ.prow )
THEN
2578 ilocblk = nblocks / nprow
2579 IF( ilocblk.GT.0 )
THEN
2580 IF( ( nblocks - ilocblk * nprow ).GT.0 )
THEN
2581 mp = imb1 + ilocblk * mb
2583 mp = m + mb * ( ilocblk - nblocks )
2589 mydist = myrow - prow
2591 $ mydist = mydist + nprow
2592 ilocblk = nblocks / nprow
2593 IF( ilocblk.GT.0 )
THEN
2594 mydist = mydist - nblocks + ilocblk * nprow
2595 IF( mydist.LT.0 )
THEN
2596 mp = ( ilocblk + 1 ) * mb
2597 ELSE IF( mydist.GT.0 )
THEN
2600 mp = m1 + mb * ( ilocblk - nblocks + 1 )
2603 mydist = mydist - nblocks
2604 IF( mydist.LT.0 )
THEN
2606 ELSE IF( mydist.GT.0 )
THEN
2609 mp = m1 + mb * ( 1 - nblocks )
2616 imb1 =
min( imb1, m )
2617 rprow = myrow - prow
2619 $ rprow = rprow + nprow
2624 inb1 = desc2( inb_ )
2625 csrc = desc2( csrc_ )
2627 IF( ( csrc.EQ.-1 ).OR.( npcol.EQ.1 ) )
THEN
2632 $ inb1 = ( ( -inb1 ) / nb + 1 ) * nb + inb1
2633 inb1 =
min( inb1, n )
2642 IF( j.LE.inb1 )
THEN
2646 IF( mycol.EQ.pcol )
THEN
2657 nblocks = j1 / nb + 1
2658 pcol = csrc + nblocks
2659 pcol = pcol - ( pcol / npcol ) * npcol
2661 IF( mycol.EQ.csrc )
THEN
2663 ilocblk = nblocks / npcol
2665 IF( ilocblk.GT.0 )
THEN
2666 IF( ( ilocblk*npcol ).GE.nblocks )
THEN
2667 IF( mycol.EQ.pcol )
THEN
2668 jj = j + ( ilocblk - nblocks ) * nb
2670 jj = inb1 + ( ilocblk - 1 ) * nb + 1
2673 jj = inb1 + ilocblk * nb + 1
2681 mydist = mycol - csrc
2683 $ mydist = mydist + npcol
2685 ilocblk = nblocks / npcol
2687 IF( ilocblk.GT.0 )
THEN
2688 mydist = mydist - nblocks + ilocblk * npcol
2689 IF( mydist.LT.0 )
THEN
2690 jj = ( ilocblk + 1 ) * nb + 1
2691 ELSE IF( mycol.EQ.pcol )
THEN
2692 jj = j1 + ( ilocblk - nblocks + 1 ) * nb + 1
2694 jj = ilocblk * nb + 1
2697 mydist = mydist - nblocks
2698 IF( mydist.LT.0 )
THEN
2700 ELSE IF( mycol.EQ.pcol )
THEN
2701 jj = j1 + ( 1 - nblocks ) * nb + 1
2708 inb1 = nblocks * nb - j1
2714 IF( n.LE.inb1 )
THEN
2716 IF( mycol.EQ.pcol )
THEN
2725 nblocks = n1 / nb + 1
2727 IF( mycol.EQ.pcol )
THEN
2728 ilocblk = nblocks / npcol
2729 IF( ilocblk.GT.0 )
THEN
2730 IF( ( nblocks - ilocblk * npcol ).GT.0 )
THEN
2731 nq = inb1 + ilocblk * nb
2733 nq = n + nb * ( ilocblk - nblocks )
2739 mydist = mycol - pcol
2741 $ mydist = mydist + npcol
2742 ilocblk = nblocks / npcol
2743 IF( ilocblk.GT.0 )
THEN
2744 mydist = mydist - nblocks + ilocblk * npcol
2745 IF( mydist.LT.0 )
THEN
2746 nq = ( ilocblk + 1 ) * nb
2747 ELSE IF( mydist.GT.0 )
THEN
2750 nq = n1 + nb * ( ilocblk - nblocks + 1 )
2753 mydist = mydist - nblocks
2754 IF( mydist.LT.0 )
THEN
2756 ELSE IF( mydist.GT.0 )
THEN
2759 nq = n1 + nb * ( 1 - nblocks )
2766 inb1 =
min( inb1, n )
2767 rpcol = mycol - pcol
2769 $ rpcol = rpcol + npcol
2778 INTEGER FUNCTION pb_numroc( N, I, INB, NB, PROC, SRCPROC, NPROCS )
2786 INTEGER i, inb, n, nb, nprocs, proc, srcproc
2838 INTEGER i1, ilocblk, inb1, mydist, n1, nblocks,
2843 if( ( srcproc.EQ.-1 ).OR.( nprocs.EQ.1 ) ) then
2862 nblocks = i1 / nb + 1
2863 srcproc1 = srcproc + nblocks
2864 srcproc1 = srcproc1 - ( srcproc1 / nprocs ) * nprocs
2865 inb1 = nblocks*nb - i1
2872 IF( n.LE.inb1 )
THEN
2873 IF( proc.EQ.srcproc1 )
THEN
2882 nblocks = n1 / nb + 1
2884 IF( proc.EQ.srcproc1 )
THEN
2885 ilocblk = nblocks / nprocs
2886 IF( ilocblk.GT.0 )
THEN
2887 IF( ( nblocks - ilocblk * nprocs ).GT.0 )
THEN
2890 pb_numroc = n + nb * ( ilocblk - nblocks )
2896 mydist = proc - srcproc1
2898 $ mydist = mydist + nprocs
2899 ilocblk = nblocks / nprocs
2900 IF( ilocblk.GT.0 )
THEN
2901 mydist = mydist - nblocks + ilocblk * nprocs
2902 IF( mydist.LT.0 )
THEN
2904 ELSE IF( mydist.GT.0 )
THEN
2907 pb_numroc = n1 + nb * ( ilocblk - nblocks + 1 )
2910 mydist = mydist - nblocks
2911 IF( mydist.LT.0 )
THEN
2913 ELSE IF( mydist.GT.0 )
THEN
2946 PARAMETER ( NTIMER = 64 )
2947 double precision startflag, zero
2948 parameter( startflag = -5.0d+0, zero = 0.0d+0 )
2955 DOUBLE PRECISION CPUSEC( NTIMER ), CPUSTART( NTIMER ),
2956 $ wallsec( ntimer ), wallstart( ntimer )
2957 COMMON /sltimer00/ cpusec, wallsec, cpustart, wallstart, disabled
2965 cpustart( i ) = startflag
2966 wallstart( i ) = startflag
3009 PARAMETER ( NTIMER = 64 )
3010 double precision startflag
3011 parameter( startflag = -5.0d+0 )
3014 DOUBLE PRECISION DCPUTIME00, DWALLTIME00
3015 EXTERNAL DCPUTIME00, DWALLTIME00
3019 DOUBLE PRECISION CPUSEC( NTIMER ), CPUSTART( NTIMER ),
3020 $ wallsec( ntimer ), wallstart( ntimer )
3021 COMMON /sltimer00/ cpusec, wallsec, cpustart, wallstart, disabled
3030 IF( wallstart( i ).EQ.startflag )
THEN
3034 wallstart( i ) = dwalltime00()
3035 cpustart( i ) = dcputime00()
3041 cpusec( i ) = cpusec( i ) + dcputime00() - cpustart( i )
3042 wallsec( i ) = wallsec( i ) + dwalltime00() - wallstart( i )
3043 wallstart( i ) = startflag
3073 PARAMETER ( NTIMER = 64 )
3077 DOUBLE PRECISION CPUSEC( NTIMER ), CPUSTART( NTIMER ),
3078 $ WALLSEC( NTIMER ), WALLSTART( NTIMER )
3079 COMMON /SLTIMER00/ CPUSEC, WALLSEC, CPUSTART, WALLSTART, DISABLED
3110 PARAMETER ( NTIMER = 64 )
3114 DOUBLE PRECISION CPUSEC( NTIMER ), CPUSTART( NTIMER ),
3115 $ WALLSEC( NTIMER ), WALLSTART( NTIMER )
3116 COMMON /SLTIMER00/ CPUSEC, WALLSEC, CPUSTART, WALLSTART, DISABLED
3128 DOUBLE PRECISION FUNCTION pb_inquire( TMTYPE, I )
3164 PARAMETER ( ntimer = 64 )
3165 double precision errflag
3166 parameter( errflag = -1.0d+0 )
3169 DOUBLE PRECISION time
3173 DOUBLE PRECISION dcputime00, dwalltime00
3174 EXTERNAL dcputime00, dwalltime00,
lsame
3178 DOUBLE PRECISION cpusec( ntimer ), cpustart( ntimer ),
3179 $ wallsec( ntimer ), wallstart( ntimer )
3180 COMMON /sltimer00/ cpusec, wallsec, cpustart, wallstart, disabled
3184 IF(
lsame( tmtype,
'W' ) )
THEN
3188 IF( dwalltime00().EQ.errflag )
THEN
3194 IF( dcputime00().EQ.errflag )
THEN
3209 SUBROUTINE pb_combine( ICTXT, SCOPE, OP, TMTYPE, N, IBEG,
3218 CHARACTER*1 OP, SCOPE, TMTYPE
3219 INTEGER IBEG, ICTXT, N
3222 DOUBLE PRECISION TIMES( N )
3249 PARAMETER ( NTIMER = 64 )
3250 double precision errflag
3251 parameter( errflag = -1.0d+0 )
3259 EXTERNAL DGAMX2D, DGAMN2D, DGSUM2D, PB_TOPGET
3263 DOUBLE PRECISION DCPUTIME00, DWALLTIME00
3264 EXTERNAL DCPUTIME00, DWALLTIME00, LSAME
3268 DOUBLE PRECISION CPUSEC( NTIMER ), CPUSTART( NTIMER ),
3269 $ WALLSEC( NTIMER ), WALLSTART( NTIMER )
3270 COMMON /SLTIMER00/ CPUSEC, WALLSEC, CPUSTART, WALLSTART, DISABLED
3281 IF( lsame( tmtype,
'W' ) )
THEN
3286 IF( dwalltime00().EQ.errflag )
THEN
3288 times( i ) = errflag
3293 times( i ) = wallsec( ibeg + i - 1 )
3297 IF( dcputime00().EQ.errflag )
THEN
3299 times( i ) = errflag
3304 times( i ) = cpusec( ibeg + i - 1 )
3311 IF( op.EQ.
'>' )
THEN
3312 CALL pb_topget( ictxt,
'Combine', scope, top )
3313 CALL dgamx2d( ictxt, scope, top, n, 1, times, n, -1, -1,
3315 ELSE IF( op.EQ.
'<' )
THEN
3316 CALL pb_topget( ictxt,
'Combine', scope, top )
3317 CALL dgamn2d( ictxt, scope, top, n, 1, times, n, -1, -1,
3319 ELSE IF( op.EQ.
'+' )
THEN
3320 CALL pb_topget( ictxt,
'Combine', scope, top )
3321 CALL dgsum2d( ictxt, scope, top, n, 1, times, n, -1, 0 )
3323 CALL pb_topget( ictxt,
'Combine', scope, top )
3324 CALL dgamx2d( ictxt, scope, top, n, 1, times, n, -1, -1,
3335 SUBROUTINE pb_chkmat( ICTXT, M, MPOS0, N, NPOS0, IA, JA, DESCA,
3344 INTEGER DPOS0, IA, ICTXT, INFO, JA, M, MPOS0, N, NPOS0
3413 INTEGER BLOCK_CYCLIC_2D_INB, CSRC_, CTXT_, DLEN_,
3414 $ DTYPE_, IMB_, INB_, LLD_, MB_, M_, NB_, N_,
3416 PARAMETER ( BLOCK_CYCLIC_2D_INB = 2, dlen_ = 11,
3417 $ dtype_ = 1, ctxt_ = 2, m_ = 3, n_ = 4,
3418 $ imb_ = 5, inb_ = 6, mb_ = 7, nb_ = 8,
3419 $ rsrc_ = 9, csrc_ = 10, lld_ = 11 )
3420 INTEGER DESCMULT, BIGNUM
3421 PARAMETER ( DESCMULT = 100, bignum = descmult*descmult )
3424 INTEGER DPOS, IAPOS, JAPOS, MP, MPOS, MYCOL, MYROW,
3425 $ NPCOL, NPOS, NPROW, NQ
3428 INTEGER DESCA2( DLEN_ )
3450 IF( info.GE.0 )
THEN
3452 ELSE IF( info.LT.-descmult )
THEN
3455 info = -info * descmult
3461 mpos = mpos0 * descmult
3462 npos = npos0 * descmult
3463 iapos = ( dpos0 - 2 ) * descmult
3464 japos = ( dpos0 - 1 ) * descmult
3465 dpos = dpos0 * descmult
3469 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
3474 $ info =
min( info, mpos )
3476 $ info =
min( info, npos )
3478 $ info =
min( info, iapos )
3480 $ info =
min( info, japos )
3481 IF( desca2( dtype_ ).NE.block_cyclic_2d_inb )
3482 $ info =
min( info, dpos + dtype_ )
3483 IF( desca2( imb_ ).LT.1 )
3484 $ info =
min( info, dpos + imb_ )
3485 IF( desca2( inb_ ).LT.1 )
3486 $ info =
min( info, dpos + inb_ )
3487 IF( desca2( mb_ ).LT.1 )
3488 $ info =
min( info, dpos + mb_ )
3489 IF( desca2( nb_ ).LT.1 )
3490 $ info =
min( info, dpos + nb_ )
3491 IF( desca2( rsrc_ ).LT.-1 .OR. desca2( rsrc_ ).GE.nprow )
3492 $ info =
min( info, dpos + rsrc_ )
3493 IF( desca2( csrc_ ).LT.-1 .OR. desca2( csrc_ ).GE.npcol )
3494 $ info =
min( info, dpos + csrc_ )
3495 IF( desca2( ctxt_ ).NE.ictxt )
3496 $ info =
min( info, dpos + ctxt_ )
3498 IF( m.EQ.0 .OR. n.EQ.0 )
THEN
3502 IF( desca2( m_ ).LT.0 )
3503 $ info =
min( info, dpos + m_ )
3504 IF( desca2( n_ ).LT.0 )
3505 $ info =
min( info, dpos + n_ )
3506 IF( desca2( lld_ ).LT.1 )
3507 $ info =
min( info, dpos + lld_ )
3513 mp = pb_numroc( desca2( m_ ), 1, desca2( imb_ ), desca2( mb_ ),
3514 $ myrow, desca2( rsrc_ ), nprow )
3516 IF( desca2( m_ ).LT.1 )
3517 $ info =
min( info, dpos + m_ )
3518 IF( desca2( n_ ).LT.1 )
3519 $ info =
min( info, dpos + n_ )
3520 IF( ia.GT.desca2( m_ ) )
3521 $ info =
min( info, iapos )
3522 IF( ja.GT.desca2( n_ ) )
3523 $ info =
min( info, japos )
3524 IF( ia+m-1.GT.desca2( m_ ) )
3525 $ info =
min( info, mpos )
3526 IF( ja+n-1.GT.desca2( n_ ) )
3527 $ info =
min( info, npos )
3529 IF( desca2( lld_ ).LT.
max( 1, mp ) )
THEN
3530 nq = pb_numroc( desca2( n_ ), 1, desca2( inb_ ),
3531 $ desca2( nb_ ), mycol, desca2( csrc_ ),
3533 IF( desca2( lld_ ).LT.1 )
THEN
3534 info =
min( info, dpos + lld_ )
3535 ELSE IF( nq.GT.0 )
THEN
3536 info =
min( info, dpos + lld_ )
3545 IF( info.EQ.bignum )
THEN
3547 ELSE IF( mod( info, descmult ).EQ.0 )
THEN
3548 info = -( info / descmult )
3566 INTEGER DESCIN( * ), DESCOUT( * )
3712 INTEGER BLOCK_CYCLIC_2D, CSRC1_, CTXT1_, DLEN1_,
3713 $ DTYPE1_, LLD1_, M1_, MB1_, N1_, NB1_, RSRC1_
3714 PARAMETER ( BLOCK_CYCLIC_2D = 1, dlen1_ = 9, dtype1_ = 1,
3715 $ ctxt1_ = 2, m1_ = 3, n1_ = 4, mb1_ = 5,
3716 $ nb1_ = 6, rsrc1_ = 7, csrc1_ = 8, lld1_ = 9 )
3717 INTEGER BLOCK_CYCLIC_2D_INB, CSRC_, CTXT_, DLEN_,
3718 $ DTYPE_, IMB_, INB_, LLD_, MB_, M_, NB_, N_,
3720 PARAMETER ( BLOCK_CYCLIC_2D_INB = 2, dlen_ = 11,
3721 $ dtype_ = 1, ctxt_ = 2, m_ = 3, n_ = 4,
3722 $ imb_ = 5, inb_ = 6, mb_ = 7, nb_ = 8,
3723 $ rsrc_ = 9, csrc_ = 10, lld_ = 11 )
3730 IF( descin( dtype_ ).EQ.block_cyclic_2d )
THEN
3731 descout( dtype_ ) = block_cyclic_2d_inb
3732 descout( ctxt_ ) = descin( ctxt1_ )
3733 descout( m_ ) = descin( m1_ )
3734 descout( n_ ) = descin( n1_ )
3735 descout( imb_ ) = descin( mb1_ )
3736 descout( inb_ ) = descin( nb1_ )
3737 descout( mb_ ) = descin( mb1_ )
3738 descout( nb_ ) = descin( nb1_ )
3739 descout( rsrc_ ) = descin( rsrc1_ )
3740 descout( csrc_ ) = descin( csrc1_ )
3741 descout( lld_ ) = descin( lld1_ )
3742 ELSE IF( descin( dtype_ ).EQ.block_cyclic_2d_inb )
THEN
3744 descout( i ) = descin( i )
3747 descout( dtype_ ) = descin( 1 )
3748 descout( ctxt_ ) = descin( 2 )
3755 descout( rsrc_ ) = 0
3756 descout( csrc_ ) = 0
3765 SUBROUTINE pb_descset2( DESC, M, N, IMB, INB, MB, NB, RSRC, CSRC,
3774 INTEGER CSRC, CTXT, IMB, INB, LLD, M, MB, N, NB, RSRC
3903 INTEGER BLOCK_CYCLIC_2D_INB, CSRC_, CTXT_, DLEN_,
3904 $ DTYPE_, IMB_, INB_, LLD_, MB_, M_, NB_, N_,
3906 PARAMETER ( BLOCK_CYCLIC_2D_INB = 2, dlen_ = 11,
3907 $ dtype_ = 1, ctxt_ = 2, m_ = 3, n_ = 4,
3908 $ imb_ = 5, inb_ = 6, mb_ = 7, nb_ = 8,
3909 $ rsrc_ = 9, csrc_ = 10, lld_ = 11 )
3913 desc( dtype_ ) = block_cyclic_2d_inb
3914 desc( ctxt_ ) = ctxt
3921 desc( rsrc_ ) = rsrc
3922 desc( csrc_ ) = csrc
3930 SUBROUTINE pb_descinit2( DESC, M, N, IMB, INB, MB, NB, RSRC, CSRC,
3939 INTEGER CSRC, CTXT, IMB, INB, INFO, LLD, M, MB, N, NB,
4088 INTEGER BLOCK_CYCLIC_2D_INB, CSRC_, CTXT_, DLEN_,
4089 $ DTYPE_, IMB_, INB_, LLD_, MB_, M_, NB_, N_,
4091 PARAMETER ( BLOCK_CYCLIC_2D_INB = 2, dlen_ = 11,
4092 $ dtype_ = 1, ctxt_ = 2, m_ = 3, n_ = 4,
4093 $ imb_ = 5, inb_ = 6, mb_ = 7, nb_ = 8,
4094 $ rsrc_ = 9, csrc_ = 10, lld_ = 11 )
4097 INTEGER LLDMIN, MP, MYCOL, MYROW, NPCOL, NPROW
4100 EXTERNAL BLACS_GRIDINFO, PXERBLA
4113 CALL blacs_gridinfo( ctxt, nprow, npcol, myrow, mycol )
4118 ELSE IF( n.LT.0 )
THEN
4120 ELSE IF( imb.LT.1 )
THEN
4122 ELSE IF( inb.LT.1 )
THEN
4124 ELSE IF( mb.LT.1 )
THEN
4126 ELSE IF( nb.LT.1 )
THEN
4128 ELSE IF( rsrc.LT.-1 .OR. rsrc.GE.nprow )
THEN
4130 ELSE IF( csrc.LT.-1 .OR. csrc.GE.npcol )
THEN
4132 ELSE IF( nprow.EQ.-1 )
THEN
4138 IF( info.EQ.0 )
THEN
4139 mp = pb_numroc( m, 1, imb, mb, myrow, rsrc, nprow )
4140 IF( pb_numroc( n, 1, inb, nb, mycol, csrc, npcol ).GT.0 )
THEN
4141 lldmin =
max( 1, mp )
4150 $
CALL pxerbla( ctxt,
'PB_DESCINIT2', -info )
4152 desc( dtype_ ) = block_cyclic_2d_inb
4153 desc( ctxt_ ) = ctxt
4154 desc( m_ ) =
max( 0, m )
4155 desc( n_ ) =
max( 0, n )
4156 desc( imb_ ) =
max( 1, imb )
4157 desc( inb_ ) =
max( 1, inb )
4158 desc( mb_ ) =
max( 1, mb )
4159 desc( nb_ ) =
max( 1, nb )
4160 desc( rsrc_ ) =
max( -1,
min( rsrc, nprow-1 ) )
4161 desc( csrc_ ) =
max( -1,
min( csrc, npcol-1 ) )
4162 desc( lld_ ) =
max( lld, lldmin )
4169 SUBROUTINE pb_binfo( OFFD, M, N, IMB1, INB1, MB, NB, MRROW, MRCOL,
4170 $ LCMT00, MBLKS, NBLKS, IMBLOC, INBLOC, LMBLOC,
4171 $ LNBLOC, ILOW, LOW, IUPP, UPP )
4179 INTEGER ILOW, IMB1, IMBLOC, INB1, INBLOC, IUPP, LCMT00,
4180 $ LMBLOC, LNBLOC, LOW, M, MB, MBLKS, MRCOL,
4181 $ mrrow, n, nb, nblks, offd, upp
4321 IF( m.LE.0 .OR. n.LE.0 )
THEN
4323 IF( mrrow.GT.0 )
THEN
4326 iupp = max( 0, imb1 - 1 )
4332 IF( mrcol.GT.0 )
THEN
4335 ilow = min( 0, 1 - inb1 )
4341 lcmt00 = lcmt00 + ( low - ilow + mrcol * nb ) -
4342 $ ( iupp - upp + mrrow * mb )
4348 IF( mrrow.GT.0 )
THEN
4350 imbloc = min( m, mb )
4352 lcmt00 = lcmt00 - ( imb1 - mb + mrrow * mb )
4353 mblks = ( m - 1 ) / mb + 1
4354 lmbloc = m - ( m / mb ) * mb
4358 IF( mrcol.GT.0 )
THEN
4360 inbloc = min( n, nb )
4362 lcmt00 = lcmt00 + inb1 - nb + mrcol * nb
4363 nblks = ( n - 1 ) / nb + 1
4364 lnbloc = n - ( n / nb ) * nb
4373 IF( tmp1.GT.0 )
THEN
4377 nblks = ( tmp1 - 1 ) / nb + 2
4378 lnbloc = tmp1 - ( tmp1 / nb ) * nb
4396 IF( tmp1.GT.0 )
THEN
4400 mblks = ( tmp1 - 1 ) / mb + 2
4401 lmbloc = tmp1 - ( tmp1 / mb ) * mb
4412 IF( mrcol.GT.0 )
THEN
4414 inbloc = min( n, nb )
4416 lcmt00 = lcmt00 + inb1 - nb + mrcol * nb
4417 nblks = ( n - 1 ) / nb + 1
4418 lnbloc = n - ( n / nb ) * nb
4427 IF( tmp1.GT.0 )
THEN
4431 nblks = ( tmp1 - 1 ) / nb + 2
4432 lnbloc = tmp1 - ( tmp1 / nb ) * nb
4452 INTEGER FUNCTION pilaenv( ICTXT, PREC )
4492 common /infoc/info, nblog
4503 SUBROUTINE pb_locinfo( I, INB, NB, MYROC, SRCPROC, NPROCS,
4504 $ ILOCBLK, ILOCOFF, MYDIST )
4512 INTEGER I, ILOCBLK, ILOCOFF, INB, MYDIST, MYROC, NB,
4577 INTEGER ITMP, NBLOCKS, PROC
4583 if( srcproc.LT.0 )
THEN
4595 nblocks = ( itmp - 1 ) / nb + 1
4597 ilocoff = itmp - 1 - ( nblocks - 1 ) * nb
4604 mydist = myroc - proc
4606 $ mydist = mydist + nprocs
4617 nblocks = ( itmp - 1 ) / nb + 1
4618 proc = proc + nblocks
4619 proc = proc - ( proc / nprocs ) * nprocs
4620 ilocblk = nblocks / nprocs
4622 IF( ( ilocblk*nprocs ).LT.( mydist-nblocks ) )
4623 $ ilocblk = ilocblk + 1
4626 $ ilocoff = itmp - 1 - ( nblocks - 1 ) * nb
4637 SUBROUTINE pb_initjmp( COLMAJ, NVIR, IMBVIR, INBVIR, IMBLOC,
4638 $ INBLOC, MB, NB, RSRC, CSRC, NPROW, NPCOL,
4648 INTEGER CSRC, IMBLOC, IMBVIR, INBLOC, INBVIR, MB, NB,
4649 $ NPCOL, NPROW, NVIR, RSRC, STRIDE
4740 INTEGER JMP_1, JMP_COL, JMP_IMBV, JMP_INBV, JMP_LEN,
4741 $ JMP_MB, JMP_NB, JMP_NPIMBLOC, JMP_NPMB,
4742 $ JMP_NQINBLOC, JMP_NQNB, JMP_ROW
4743 PARAMETER ( JMP_1 = 1, jmp_row = 2, jmp_col = 3,
4744 $ jmp_mb = 4, jmp_imbv = 5, jmp_npmb = 6,
4745 $ jmp_npimbloc = 7, jmp_nb = 8, jmp_inbv = 9,
4746 $ jmp_nqnb = 10, jmp_nqinbloc = 11,
4754 IF( RSRC.LT.0 ) THEN
4759 IF( csrc.LT.0 )
THEN
4768 jmp( jmp_imbv ) = imbvir
4769 jmp( jmp_npmb ) = npmb
4770 jmp( jmp_npimbloc ) = imbloc + npmb - mb
4773 jmp( jmp_inbv ) = inbvir
4774 jmp( jmp_nqnb ) = nqnb
4775 jmp( jmp_nqinbloc ) = inbloc + nqnb - nb
4778 jmp( jmp_row ) = stride
4779 jmp( jmp_col ) = stride * nvir
4781 jmp( jmp_row ) = stride * nvir
4782 jmp( jmp_col ) = stride
4798 INTEGER IMULADD( 4, * ), JMP( * ), MULADD0( * )
4837 INTEGER JMP_1, JMP_COL, JMP_IMBV, JMP_INBV, JMP_LEN,
4838 $ JMP_MB, JMP_NB, JMP_NPIMBLOC, JMP_NPMB,
4839 $ JMP_NQINBLOC, JMP_NQNB, JMP_ROW
4840 PARAMETER ( JMP_1 = 1, jmp_row = 2, jmp_col = 3,
4841 $ jmp_mb = 4, jmp_imbv = 5, jmp_npmb = 6,
4842 $ jmp_npimbloc = 7, jmp_nb = 8, jmp_inbv = 9,
4843 $ jmp_nqnb = 10, jmp_nqinbloc = 11,
4848 INTEGER ITMP1( 2 ), ITMP2( 2 )
4860 CALL pb_jump( jmp( jmp_1 ), muladd0, itmp2, itmp1,
4861 $ imuladd( 1, jmp_1 ) )
4863 CALL pb_jump( jmp( jmp_row ), muladd0, itmp1, itmp2,
4864 $ imuladd( 1, jmp_row ) )
4865 CALL pb_jump( jmp( jmp_col ), muladd0, itmp1, itmp2,
4866 $ imuladd( 1, jmp_col ) )
4871 CALL pb_jump( jmp( jmp_imbv ), imuladd( 1, jmp_row ), itmp1,
4872 $ itmp2, imuladd( 1, jmp_imbv ) )
4873 CALL pb_jump( jmp( jmp_mb ), imuladd( 1, jmp_row ), itmp1,
4874 $ itmp2, imuladd( 1, jmp_mb ) )
4875 CALL pb_jump( jmp( jmp_npmb ), imuladd( 1, jmp_row ), itmp1,
4876 $ itmp2, imuladd( 1, jmp_npmb ) )
4877 CALL pb_jump( jmp( jmp_npimbloc ), imuladd( 1, jmp_row ), itmp1,
4878 $ itmp2, imuladd( 1, jmp_npimbloc ) )
4880 CALL pb_jump( jmp( jmp_inbv ), imuladd( 1, jmp_col ), itmp1,
4881 $ itmp2, imuladd( 1, jmp_inbv ) )
4882 CALL pb_jump( jmp( jmp_nb ), imuladd( 1, jmp_col ), itmp1,
4883 $ itmp2, imuladd( 1, jmp_nb ) )
4884 CALL pb_jump( jmp( jmp_nqnb ), imuladd( 1, jmp_col ), itmp1,
4885 $ itmp2, imuladd( 1, jmp_nqnb ) )
4886 CALL pb_jump( jmp( jmp_nqinbloc ), imuladd( 1, jmp_col ), itmp1,
4887 $ itmp2, imuladd( 1, jmp_nqinbloc ) )
4894 SUBROUTINE pb_setlocran( SEED, ILOCBLK, JLOCBLK, ILOCOFF, JLOCOFF,
4895 $ MYRDIST, MYCDIST, NPROW, NPCOL, JMP,
4904 INTEGER ILOCBLK, ILOCOFF, JLOCBLK, JLOCOFF, MYCDIST,
4905 $ MYRDIST, NPCOL, NPROW, SEED
4908 INTEGER IMULADD( 4, * ), IRAN( * ), JMP( * )
4992 INTEGER JMP_1, JMP_COL, JMP_IMBV, JMP_INBV, JMP_LEN,
4993 $ JMP_MB, JMP_NB, JMP_NPIMBLOC, JMP_NPMB,
4994 $ JMP_NQINBLOC, JMP_NQNB, JMP_ROW
4995 PARAMETER ( JMP_1 = 1, jmp_row = 2, jmp_col = 3,
4996 $ jmp_mb = 4, jmp_imbv = 5, jmp_npmb = 6,
4997 $ jmp_npimbloc = 7, jmp_nb = 8, jmp_inbv = 9,
4998 $ jmp_nqnb = 10, jmp_nqinbloc = 11,
5002 INTEGER IMULADDTMP( 4 ), ITMP( 2 )
5005 EXTERNAL PB_JUMP, PB_SETRAN
5014 CALL pb_jump( jmp( jmp_1 ), imuladd( 1, jmp_1 ), itmp, iran,
5019 CALL pb_jump( ilocoff, imuladd( 1, jmp_row ), iran, itmp,
5021 IF( myrdist.GT.0 )
THEN
5022 CALL pb_jump( jmp( jmp_imbv ), imuladd( 1, jmp_row ), itmp,
5023 $ iran, imuladdtmp )
5024 CALL pb_jump( myrdist - 1, imuladd( 1, jmp_mb ), iran,
5025 $ itmp, imuladdtmp )
5026 CALL pb_jump( ilocblk, imuladd( 1, jmp_npmb ), itmp,
5027 $ iran, imuladdtmp )
5029 IF( ilocblk.GT.0 )
THEN
5030 CALL pb_jump( jmp( jmp_imbv ), imuladd( 1, jmp_row ), itmp,
5031 $ iran, imuladdtmp )
5032 CALL pb_jump( nprow - 1, imuladd( 1, jmp_mb ), iran,
5033 $ itmp, imuladdtmp )
5034 CALL pb_jump( ilocblk - 1, imuladd( 1, jmp_npmb ), itmp,
5035 $ iran, imuladdtmp )
5037 CALL pb_jump( 0, imuladd( 1, jmp_1 ), itmp,
5038 $ iran, imuladdtmp )
5044 CALL pb_jump( jlocoff, imuladd( 1, jmp_col ), iran, itmp,
5046 IF( mycdist.GT.0 )
THEN
5047 CALL pb_jump( jmp( jmp_inbv ), imuladd( 1, jmp_col ), itmp,
5048 $ iran, imuladdtmp )
5049 CALL pb_jump( mycdist - 1, imuladd( 1, jmp_nb ), iran,
5050 $ itmp, imuladdtmp )
5051 CALL pb_jump( jlocblk, imuladd( 1, jmp_nqnb ), itmp,
5052 $ iran, imuladdtmp )
5054 IF( jlocblk.GT.0 )
THEN
5055 CALL pb_jump( jmp( jmp_inbv ), imuladd( 1, jmp_col ), itmp,
5056 $ iran, imuladdtmp )
5057 CALL pb_jump( npcol - 1, imuladd( 1, jmp_nb ), iran,
5058 $ itmp, imuladdtmp )
5059 CALL pb_jump( jlocblk - 1, imuladd( 1, jmp_nqnb ), itmp,
5060 $ iran, imuladdtmp )
5062 CALL pb_jump( 0, imuladd( 1, jmp_1 ), itmp,
5063 $ iran, imuladdtmp )
5067 CALL pb_setran( iran, imuladd( 1, jmp_1 ) )
5082 INTEGER I( 2 ), J( 2 ), K( 2 )
5127 INTEGER IPOW15, IPOW16
5128 PARAMETER ( IPOW15 = 2**15, ipow16 = 2**16 )
5131 INTEGER ITMP1, ITMP2
5137 ITMP1 = k( 1 ) + j( 1 )
5138 itmp2 = itmp1 / ipow16
5139 i( 1 ) = itmp1 - itmp2 * ipow16
5144 itmp1 = itmp2 + k( 2 ) + j( 2 )
5145 itmp2 = itmp1 / ipow15
5146 i( 2 ) = itmp1 - itmp2 * ipow15
5161 INTEGER I( 2 ), J( 2 ), K( 2 )
5207 INTEGER IPOW15, IPOW16, IPOW30
5208 PARAMETER ( IPOW15 = 2**15, ipow16 = 2**16,
5212 INTEGER ITMP1, ITMP2
5216 ITMP1 = k( 1 ) * j( 1 )
5218 $ itmp1 = ( itmp1 + ipow30 ) + ipow30
5222 itmp2 = itmp1 / ipow16
5223 i( 1 ) = itmp1 - itmp2 * ipow16
5225 itmp1 = k( 1 ) * j( 2 ) + k( 2 ) * j( 1 )
5227 $ itmp1 = ( itmp1 + ipow30 ) + ipow30
5229 itmp1 = itmp2 + itmp1
5231 $ itmp1 = ( itmp1 + ipow30 ) + ipow30
5235 i( 2 ) = itmp1 - ( itmp1 / ipow15 ) * ipow15
5242 SUBROUTINE pb_jump( K, MULADD, IRANN, IRANM, IMA )
5253 INTEGER IMA( 4 ), IRANM( 2 ), IRANN( 2 ), MULADD( 4 )
5315 EXTERNAL PB_LADD, PB_LMUL
5321 IMA( 1 ) = muladd( 1 )
5322 ima( 2 ) = muladd( 2 )
5323 ima( 3 ) = muladd( 3 )
5324 ima( 4 ) = muladd( 4 )
5328 CALL pb_lmul( ima, muladd, j )
5333 CALL pb_lmul( ima( 3 ), muladd, j )
5334 CALL pb_ladd( muladd( 3 ), j, ima( 3 ) )
5338 CALL pb_lmul( irann, ima, j )
5339 CALL pb_ladd( j, ima( 3 ), iranm )
5343 iranm( 1 ) = irann( 1 )
5344 iranm( 2 ) = irann( 2 )
5361 INTEGER IAC( 4 ), IRAN( 2 )
5396 INTEGER IACS( 4 ), IRAND( 2 )
5397 COMMON /RANCOM/ IRAND, IACS
5404 IRAND( 1 ) = iran( 1 )
5405 irand( 2 ) = iran( 2 )
5406 iacs( 1 ) = iac( 1 )
5407 iacs( 2 ) = iac( 2 )
5408 iacs( 3 ) = iac( 3 )
5409 iacs( 4 ) = iac( 4 )
5416 SUBROUTINE pb_jumpit( MULADD, IRANN, IRANM )
5424 INTEGER IRANM( 2 ), IRANN( 2 ), MULADD( 4 )
5467 EXTERNAL PB_LADD, PB_LMUL
5470 INTEGER IACS( 4 ), IRAND( 2 )
5471 COMMON /RANCOM/ IRAND, IACS
5478 CALL PB_LMUL( IRANN, MULADD, J )
5479 CALL PB_LADD( J, MULADD( 3 ), IRANM )
5481 IRAND( 1 ) = iranm( 1 )
5482 irand( 2 ) = iranm( 2 )