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 SUBROUTINE pchkpbe( ICTXT, NOUT, SNAME, INFOT )
1091 INTEGER ICTXT, INFOT, NOUT
1196 INTEGER GERR, MYCOL, MYROW, NPCOL, NPROW
1199 EXTERNAL BLACS_GRIDINFO, IGSUM2D
1203 COMMON /INFOC/INFO, NBLOG
1207 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
1210 IF( info.NE.-infot )
1213 CALL igsum2d( ictxt,
'All',
' ', 1, 1, gerr, 1, -1, 0 )
1215 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
THEN
1216 IF( gerr.EQ.( nprow * npcol ) )
THEN
1217 WRITE( nout, fmt = 9999 ) sname, info, -infot
1221 9999
FORMAT( 1x, a7,
': *** ERROR *** ERROR CODE RETURNED = ', i6,
1222 $
' SHOULD HAVE BEEN ', i6 )
1229 REAL FUNCTION PSDIFF( X, Y )
1268 DOUBLE PRECISION FUNCTION pddiff( X, Y )
1276 DOUBLE PRECISION x, y
1306 SUBROUTINE pxerbla( ICTXT, SRNAME, INFO )
1317 CHARACTER*(*) SRNAME
1350 INTEGER MYCOL, MYROW, NPCOL, NPROW
1353 EXTERNAL BLACS_GRIDINFO
1357 CALL BLACS_GRIDINFO( ICTXT, NPROW, NPCOL, MYROW, MYCOL )
1359 WRITE( *, fmt = 9999 ) myrow, mycol, srname, info
1361 9999
FORMAT(
'{', i5,
',', i5,
'}: On entry to ', a,
1362 $
' parameter number ', i4,
' had an illegal value' )
1369 LOGICAL FUNCTION lsame( CA, CB )
1399 INTEGER inta, intb, zcode
1411 zcode = ichar(
'Z' )
1421 IF( zcode.EQ.90 .OR. zcode.EQ.122 )
THEN
1426 IF( inta.GE.97 .AND. inta.LE.122 ) inta = inta - 32
1427 IF( intb.GE.97 .AND. intb.LE.122 ) intb = intb - 32
1429 ELSE IF( zcode.EQ.233 .OR. zcode.EQ.169 )
THEN
1434 IF( inta.GE.129 .AND. inta.LE.137 .OR.
1435 $ inta.GE.145 .AND. inta.LE.153 .OR.
1436 $ inta.GE.162 .AND. inta.LE.169 ) inta = inta + 64
1437 IF( intb.GE.129 .AND. intb.LE.137 .OR.
1438 $ intb.GE.145 .AND. intb.LE.153 .OR.
1439 $ intb.GE.162 .AND. intb.LE.169 ) intb = intb + 64
1441 ELSE IF( zcode.EQ.218 .OR. zcode.EQ.250 )
THEN
1446 IF( inta.GE.225 .AND. inta.LE.250 ) inta = inta - 32
1447 IF( intb.GE.225 .AND. intb.LE.250 ) intb = intb - 32
1449 lsame = inta.EQ.intb
1456 LOGICAL FUNCTION lsamen( N, CA, CB )
1464 CHARACTER*( * ) ca, cb
1503 IF( len( ca ).LT.n .OR. len( cb ).LT.n )
1512 IF( .NOT.
lsame( ca( i: i ), cb( i: i ) ) )
1524 SUBROUTINE icopy( N, SX, INCX, SY, INCY )
1532 INTEGER INCX, INCY, N
1535 INTEGER SX( * ), SY( * )
1565 INTEGER I, IX, IY, M, MP1
1574 IF( incx.EQ.1 .AND. incy.EQ.1 )
1582 $ ix = ( -n+1 )*incx + 1
1584 $ iy = ( -n+1 )*incy + 1
1609 sy( i+1 ) = sx( i+1 )
1610 sy( i+2 ) = sx( i+2 )
1611 sy( i+3 ) = sx( i+3 )
1612 sy( i+4 ) = sx( i+4 )
1613 sy( i+5 ) = sx( i+5 )
1614 sy( i+6 ) = sx( i+6 )
1652 INTEGER info, nblog, nout
1654 common /infoc/info, nblog
1655 common /pberrorc/nout, abrtflg
1671 SUBROUTINE pb_infog2l( I, J, DESC, NPROW, NPCOL, MYROW, MYCOL, II,
1680 INTEGER I, II, J, JJ, MYCOL, MYROW, NPCOL, NPROW, PCOL,
1819 INTEGER BLOCK_CYCLIC_2D_INB, CSRC_, CTXT_, DLEN_,
1820 $ DTYPE_, IMB_, INB_, LLD_, MB_, M_, NB_, N_,
1822 PARAMETER ( BLOCK_CYCLIC_2D_INB = 2, dlen_ = 11,
1823 $ dtype_ = 1, ctxt_ = 2, m_ = 3, n_ = 4,
1824 $ imb_ = 5, inb_ = 6, mb_ = 7, nb_ = 8,
1825 $ rsrc_ = 9, csrc_ = 10, lld_ = 11 )
1828 INTEGER CSRC, I1, ILOCBLK, IMB, INB, J1, MB, MYDIST,
1832 INTEGER DESC2( DLEN_ )
1835 EXTERNAL PB_DESCTRANS
1841 CALL pb_desctrans( desc, desc2 )
1844 prow = desc2( rsrc_ )
1848 IF( ( prow.EQ.-1 ).OR.( nprow.EQ.1 ) )
THEN
1852 ELSE IF( i.LE.imb )
THEN
1856 IF( myrow.EQ.prow )
THEN
1869 IF( myrow.EQ.rsrc )
THEN
1871 nblocks = ( i - imb - 1 ) / mb + 1
1872 prow = prow + nblocks
1873 prow = prow - ( prow / nprow ) * nprow
1875 ilocblk = nblocks / nprow
1877 IF( ilocblk.GT.0 )
THEN
1878 IF( ( ilocblk*nprow ).GE.nblocks )
THEN
1879 IF( myrow.EQ.prow )
THEN
1880 ii = i + ( ilocblk - nblocks ) * mb
1882 ii = imb + ( ilocblk - 1 ) * mb + 1
1885 ii = imb + ilocblk * mb + 1
1894 nblocks = ( i1 - 1 ) / mb + 1
1895 prow = prow + nblocks
1896 prow = prow - ( prow / nprow ) * nprow
1898 mydist = myrow - rsrc
1900 $ mydist = mydist + nprow
1902 ilocblk = nblocks / nprow
1904 IF( ilocblk.GT.0 )
THEN
1905 mydist = mydist - nblocks + ilocblk * nprow
1906 IF( mydist.LT.0 )
THEN
1907 ii = mb + ilocblk * mb + 1
1909 IF( myrow.EQ.prow )
THEN
1910 ii = i1 + ( ilocblk - nblocks + 1 ) * mb
1912 ii = ilocblk * mb + 1
1916 mydist = mydist - nblocks
1917 IF( mydist.LT.0 )
THEN
1919 ELSE IF( myrow.EQ.prow )
THEN
1920 ii = i1 + ( 1 - nblocks ) * mb
1930 pcol = desc2( csrc_ )
1934 IF( ( pcol.EQ.-1 ).OR.( npcol.EQ.1 ) )
THEN
1938 ELSE IF( j.LE.inb )
THEN
1942 IF( mycol.EQ.pcol )
THEN
1955 IF( mycol.EQ.csrc )
THEN
1957 nblocks = ( j - inb - 1 ) / nb + 1
1958 pcol = pcol + nblocks
1959 pcol = pcol - ( pcol / npcol ) * npcol
1961 ilocblk = nblocks / npcol
1963 IF( ilocblk.GT.0 )
THEN
1964 IF( ( ilocblk*npcol ).GE.nblocks )
THEN
1965 IF( mycol.EQ.pcol )
THEN
1966 jj = j + ( ilocblk - nblocks ) * nb
1968 jj = inb + ( ilocblk - 1 ) * nb + 1
1971 jj = inb + ilocblk * nb + 1
1980 nblocks = ( j1 - 1 ) / nb + 1
1981 pcol = pcol + nblocks
1982 pcol = pcol - ( pcol / npcol ) * npcol
1984 mydist = mycol - csrc
1986 $ mydist = mydist + npcol
1988 ilocblk = nblocks / npcol
1990 IF( ilocblk.GT.0 )
THEN
1991 mydist = mydist - nblocks + ilocblk * npcol
1992 IF( mydist.LT.0 )
THEN
1993 jj = nb + ilocblk * nb + 1
1995 IF( mycol.EQ.pcol )
THEN
1996 jj = j1 + ( ilocblk - nblocks + 1 ) * nb
1998 jj = ilocblk * nb + 1
2002 mydist = mydist - nblocks
2003 IF( mydist.LT.0 )
THEN
2005 ELSE IF( mycol.EQ.pcol )
THEN
2006 jj = j1 + ( 1 - nblocks ) * nb
2020 SUBROUTINE pb_ainfog2l( M, N, I, J, DESC, NPROW, NPCOL, MYROW,
2021 $ MYCOL, IMB1, INB1, MP, NQ, II, JJ, PROW,
2022 $ PCOL, RPROW, RPCOL )
2030 INTEGER I, II, IMB1, INB1, J, JJ, M, MP, MYCOL, MYROW,
2031 $ n, npcol, nprow, nq, pcol, prow, rpcol, rprow
2215 INTEGER BLOCK_CYCLIC_2D_INB, CSRC_, CTXT_, DLEN_,
2216 $ DTYPE_, IMB_, INB_, LLD_, MB_, M_, NB_, N_,
2218 PARAMETER ( BLOCK_CYCLIC_2D_INB = 2, dlen_ = 11,
2219 $ dtype_ = 1, ctxt_ = 2, m_ = 3, n_ = 4,
2220 $ imb_ = 5, inb_ = 6, mb_ = 7, nb_ = 8,
2221 $ rsrc_ = 9, csrc_ = 10, lld_ = 11 )
2224 INTEGER CSRC, I1, ILOCBLK, J1, M1, MB, MYDIST, N1, NB,
2228 INTEGER DESC2( DLEN_ )
2243 imb1 = desc2( imb_ )
2244 rsrc = desc2( rsrc_ )
2246 IF( ( rsrc.EQ.-1 ).OR.( nprow.EQ.1 ) )
THEN
2251 $ imb1 = ( ( -imb1 ) / mb + 1 ) * mb + imb1
2252 imb1 =
min( imb1, m )
2261 IF( i.LE.imb1 )
THEN
2265 IF( myrow.EQ.prow )
THEN
2276 nblocks = i1 / mb + 1
2277 prow = rsrc + nblocks
2278 prow = prow - ( prow / nprow ) * nprow
2280 IF( myrow.EQ.rsrc )
THEN
2282 ilocblk = nblocks / nprow
2284 IF( ilocblk.GT.0 )
THEN
2285 IF( ( ilocblk*nprow ).GE.nblocks )
THEN
2286 IF( myrow.EQ.prow )
THEN
2287 ii = i + ( ilocblk - nblocks ) * mb
2289 ii = imb1 + ( ilocblk - 1 ) * mb + 1
2292 ii = imb1 + ilocblk * mb + 1
2300 mydist = myrow - rsrc
2302 $ mydist = mydist + nprow
2304 ilocblk = nblocks / nprow
2306 IF( ilocblk.GT.0 )
THEN
2307 mydist = mydist - nblocks + ilocblk * nprow
2308 IF( mydist.LT.0 )
THEN
2309 ii = ( ilocblk + 1 ) * mb + 1
2310 ELSE IF( myrow.EQ.prow )
THEN
2311 ii = i1 + ( ilocblk - nblocks + 1 ) * mb + 1
2313 ii = ilocblk * mb + 1
2316 mydist = mydist - nblocks
2317 IF( mydist.LT.0 )
THEN
2319 ELSE IF( myrow.EQ.prow )
THEN
2320 ii = i1 + ( 1 - nblocks ) * mb + 1
2327 imb1 = nblocks * mb - i1
2333 IF( m.LE.imb1 )
THEN
2335 IF( myrow.EQ.prow )
THEN
2344 nblocks = m1 / mb + 1
2346 IF( myrow.EQ.prow )
THEN
2347 ilocblk = nblocks / nprow
2348 IF( ilocblk.GT.0 )
THEN
2349 IF( ( nblocks - ilocblk * nprow ).GT.0 )
THEN
2350 mp = imb1 + ilocblk * mb
2352 mp = m + mb * ( ilocblk - nblocks )
2358 mydist = myrow - prow
2360 $ mydist = mydist + nprow
2361 ilocblk = nblocks / nprow
2362 IF( ilocblk.GT.0 )
THEN
2363 mydist = mydist - nblocks + ilocblk * nprow
2364 IF( mydist.LT.0 )
THEN
2365 mp = ( ilocblk + 1 ) * mb
2366 ELSE IF( mydist.GT.0 )
THEN
2369 mp = m1 + mb * ( ilocblk - nblocks + 1 )
2372 mydist = mydist - nblocks
2373 IF( mydist.LT.0 )
THEN
2375 ELSE IF( mydist.GT.0 )
THEN
2378 mp = m1 + mb * ( 1 - nblocks )
2385 imb1 =
min( imb1, m )
2386 rprow = myrow - prow
2388 $ rprow = rprow + nprow
2393 inb1 = desc2( inb_ )
2394 csrc = desc2( csrc_ )
2396 IF( ( csrc.EQ.-1 ).OR.( npcol.EQ.1 ) )
THEN
2401 $ inb1 = ( ( -inb1 ) / nb + 1 ) * nb + inb1
2402 inb1 =
min( inb1, n )
2411 IF( j.LE.inb1 )
THEN
2415 IF( mycol.EQ.pcol )
THEN
2426 nblocks = j1 / nb + 1
2427 pcol = csrc + nblocks
2428 pcol = pcol - ( pcol / npcol ) * npcol
2430 IF( mycol.EQ.csrc )
THEN
2432 ilocblk = nblocks / npcol
2434 IF( ilocblk.GT.0 )
THEN
2435 IF( ( ilocblk*npcol ).GE.nblocks )
THEN
2436 IF( mycol.EQ.pcol )
THEN
2437 jj = j + ( ilocblk - nblocks ) * nb
2439 jj = inb1 + ( ilocblk - 1 ) * nb + 1
2442 jj = inb1 + ilocblk * nb + 1
2450 mydist = mycol - csrc
2452 $ mydist = mydist + npcol
2454 ilocblk = nblocks / npcol
2456 IF( ilocblk.GT.0 )
THEN
2457 mydist = mydist - nblocks + ilocblk * npcol
2458 IF( mydist.LT.0 )
THEN
2459 jj = ( ilocblk + 1 ) * nb + 1
2460 ELSE IF( mycol.EQ.pcol )
THEN
2461 jj = j1 + ( ilocblk - nblocks + 1 ) * nb + 1
2463 jj = ilocblk * nb + 1
2466 mydist = mydist - nblocks
2467 IF( mydist.LT.0 )
THEN
2469 ELSE IF( mycol.EQ.pcol )
THEN
2470 jj = j1 + ( 1 - nblocks ) * nb + 1
2477 inb1 = nblocks * nb - j1
2483 IF( n.LE.inb1 )
THEN
2485 IF( mycol.EQ.pcol )
THEN
2494 nblocks = n1 / nb + 1
2496 IF( mycol.EQ.pcol )
THEN
2497 ilocblk = nblocks / npcol
2498 IF( ilocblk.GT.0 )
THEN
2499 IF( ( nblocks - ilocblk * npcol ).GT.0 )
THEN
2500 nq = inb1 + ilocblk * nb
2502 nq = n + nb * ( ilocblk - nblocks )
2508 mydist = mycol - pcol
2510 $ mydist = mydist + npcol
2511 ilocblk = nblocks / npcol
2512 IF( ilocblk.GT.0 )
THEN
2513 mydist = mydist - nblocks + ilocblk * npcol
2514 IF( mydist.LT.0 )
THEN
2515 nq = ( ilocblk + 1 ) * nb
2516 ELSE IF( mydist.GT.0 )
THEN
2519 nq = n1 + nb * ( ilocblk - nblocks + 1 )
2522 mydist = mydist - nblocks
2523 IF( mydist.LT.0 )
THEN
2525 ELSE IF( mydist.GT.0 )
THEN
2528 nq = n1 + nb * ( 1 - nblocks )
2535 inb1 =
min( inb1, n )
2536 rpcol = mycol - pcol
2538 $ rpcol = rpcol + npcol
2547 INTEGER FUNCTION pb_numroc( N, I, INB, NB, PROC, SRCPROC, NPROCS )
2555 INTEGER i, inb, n, nb, nprocs, proc, srcproc
2607 INTEGER i1, ilocblk, inb1, mydist, n1, nblocks,
2612 if( ( srcproc.EQ.-1 ).OR.( nprocs.EQ.1 ) ) then
2631 nblocks = i1 / nb + 1
2632 srcproc1 = srcproc + nblocks
2633 srcproc1 = srcproc1 - ( srcproc1 / nprocs ) * nprocs
2634 inb1 = nblocks*nb - i1
2641 IF( n.LE.inb1 )
THEN
2642 IF( proc.EQ.srcproc1 )
THEN
2651 nblocks = n1 / nb + 1
2653 IF( proc.EQ.srcproc1 )
THEN
2654 ilocblk = nblocks / nprocs
2655 IF( ilocblk.GT.0 )
THEN
2656 IF( ( nblocks - ilocblk * nprocs ).GT.0 )
THEN
2659 pb_numroc = n + nb * ( ilocblk - nblocks )
2665 mydist = proc - srcproc1
2667 $ mydist = mydist + nprocs
2668 ilocblk = nblocks / nprocs
2669 IF( ilocblk.GT.0 )
THEN
2670 mydist = mydist - nblocks + ilocblk * nprocs
2671 IF( mydist.LT.0 )
THEN
2673 ELSE IF( mydist.GT.0 )
THEN
2676 pb_numroc = n1 + nb * ( ilocblk - nblocks + 1 )
2679 mydist = mydist - nblocks
2680 IF( mydist.LT.0 )
THEN
2682 ELSE IF( mydist.GT.0 )
THEN
2695 INTEGER FUNCTION pb_fceil( NUM, DENOM )
2733 pb_fceil = nint( ( ( num + denom - 1.0e+0 ) / denom ) - 0.5e+0 )
2740 SUBROUTINE pb_chkmat( ICTXT, M, MPOS0, N, NPOS0, IA, JA, DESCA,
2749 INTEGER DPOS0, IA, ICTXT, INFO, JA, M, MPOS0, N, NPOS0
2818 INTEGER BLOCK_CYCLIC_2D_INB, CSRC_, CTXT_, DLEN_,
2819 $ DTYPE_, IMB_, INB_, LLD_, MB_, M_, NB_, N_,
2821 PARAMETER ( BLOCK_CYCLIC_2D_INB = 2, dlen_ = 11,
2822 $ dtype_ = 1, ctxt_ = 2, m_ = 3, n_ = 4,
2823 $ imb_ = 5, inb_ = 6, mb_ = 7, nb_ = 8,
2824 $ rsrc_ = 9, csrc_ = 10, lld_ = 11 )
2825 INTEGER DESCMULT, BIGNUM
2826 PARAMETER ( DESCMULT = 100, bignum = descmult*descmult )
2829 INTEGER DPOS, IAPOS, JAPOS, MP, MPOS, MYCOL, MYROW,
2830 $ npcol, npos, nprow, nq
2833 INTEGER DESCA2( DLEN_ )
2836 EXTERNAL BLACS_GRIDINFO, PB_DESCTRANS
2849 CALL pb_desctrans( desca, desca2 )
2855 IF( info.GE.0 )
THEN
2857 ELSE IF( info.LT.-descmult )
THEN
2860 info = -info * descmult
2866 mpos = mpos0 * descmult
2867 npos = npos0 * descmult
2868 iapos = ( dpos0 - 2 ) * descmult
2869 japos = ( dpos0 - 1 ) * descmult
2870 dpos = dpos0 * descmult
2874 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
2879 $ info =
min( info, mpos )
2881 $ info =
min( info, npos )
2883 $ info =
min( info, iapos )
2885 $ info =
min( info, japos )
2886 IF( desca2( dtype_ ).NE.block_cyclic_2d_inb )
2887 $ info =
min( info, dpos + dtype_ )
2888 IF( desca2( imb_ ).LT.1 )
2889 $ info =
min( info, dpos + imb_ )
2890 IF( desca2( inb_ ).LT.1 )
2891 $ info =
min( info, dpos + inb_ )
2892 IF( desca2( mb_ ).LT.1 )
2893 $ info =
min( info, dpos + mb_ )
2894 IF( desca2( nb_ ).LT.1 )
2895 $ info =
min( info, dpos + nb_ )
2896 IF( desca2( rsrc_ ).LT.-1 .OR. desca2( rsrc_ ).GE.nprow )
2897 $ info =
min( info, dpos + rsrc_ )
2898 IF( desca2( csrc_ ).LT.-1 .OR. desca2( csrc_ ).GE.npcol )
2899 $ info =
min( info, dpos + csrc_ )
2900 IF( desca2( ctxt_ ).NE.ictxt )
2901 $ info =
min( info, dpos + ctxt_ )
2903 IF( m.EQ.0 .OR. n.EQ.0 )
THEN
2907 IF( desca2( m_ ).LT.0 )
2908 $ info =
min( info, dpos + m_ )
2909 IF( desca2( n_ ).LT.0 )
2910 $ info =
min( info, dpos + n_ )
2911 IF( desca2( lld_ ).LT.1 )
2912 $ info =
min( info, dpos + lld_ )
2918 mp = pb_numroc( desca2( m_ ), 1, desca2( imb_ ), desca2( mb_ ),
2919 $ myrow, desca2( rsrc_ ), nprow )
2921 IF( desca2( m_ ).LT.1 )
2922 $ info =
min( info, dpos + m_ )
2923 IF( desca2( n_ ).LT.1 )
2924 $ info =
min( info, dpos + n_ )
2925 IF( ia.GT.desca2( m_ ) )
2926 $ info =
min( info, iapos )
2927 IF( ja.GT.desca2( n_ ) )
2928 $ info =
min( info, japos )
2929 IF( ia+m-1.GT.desca2( m_ ) )
2930 $ info =
min( info, mpos )
2931 IF( ja+n-1.GT.desca2( n_ ) )
2932 $ info =
min( info, npos )
2934 IF( desca2( lld_ ).LT.
max( 1, mp ) )
THEN
2935 nq = pb_numroc( desca2( n_ ), 1, desca2( inb_ ),
2936 $ desca2( nb_ ), mycol, desca2( csrc_ ),
2938 IF( desca2( lld_ ).LT.1 )
THEN
2939 info =
min( info, dpos + lld_ )
2940 ELSE IF( nq.GT.0 )
THEN
2941 info =
min( info, dpos + lld_ )
2950 IF( info.EQ.bignum )
THEN
2952 ELSE IF( mod( info, descmult ).EQ.0 )
THEN
2953 info = -( info / descmult )
2971 INTEGER DESCIN( * ), DESCOUT( * )
3117 INTEGER BLOCK_CYCLIC_2D, CSRC1_, CTXT1_, DLEN1_,
3118 $ DTYPE1_, LLD1_, M1_, MB1_, N1_, NB1_, RSRC1_
3119 PARAMETER ( BLOCK_CYCLIC_2D = 1, dlen1_ = 9, dtype1_ = 1,
3120 $ ctxt1_ = 2, m1_ = 3, n1_ = 4, mb1_ = 5,
3121 $ nb1_ = 6, rsrc1_ = 7, csrc1_ = 8, lld1_ = 9 )
3122 INTEGER BLOCK_CYCLIC_2D_INB, CSRC_, CTXT_, DLEN_,
3123 $ DTYPE_, IMB_, INB_, LLD_, MB_, M_, NB_, N_,
3125 PARAMETER ( BLOCK_CYCLIC_2D_INB = 2, dlen_ = 11,
3126 $ dtype_ = 1, ctxt_ = 2, m_ = 3, n_ = 4,
3127 $ imb_ = 5, inb_ = 6, mb_ = 7, nb_ = 8,
3128 $ rsrc_ = 9, csrc_ = 10, lld_ = 11 )
3135 IF( descin( dtype_ ).EQ.block_cyclic_2d )
THEN
3136 descout( dtype_ ) = block_cyclic_2d_inb
3137 descout( ctxt_ ) = descin( ctxt1_ )
3138 descout( m_ ) = descin( m1_ )
3139 descout( n_ ) = descin( n1_ )
3140 descout( imb_ ) = descin( mb1_ )
3141 descout( inb_ ) = descin( nb1_ )
3142 descout( mb_ ) = descin( mb1_ )
3143 descout( nb_ ) = descin( nb1_ )
3144 descout( rsrc_ ) = descin( rsrc1_ )
3145 descout( csrc_ ) = descin( csrc1_ )
3146 descout( lld_ ) = descin( lld1_ )
3147 ELSE IF( descin( dtype_ ).EQ.block_cyclic_2d_inb )
THEN
3149 descout( i ) = descin( i )
3152 descout( dtype_ ) = descin( 1 )
3153 descout( ctxt_ ) = descin( 2 )
3160 descout( rsrc_ ) = 0
3161 descout( csrc_ ) = 0
3170 SUBROUTINE pb_descset2( DESC, M, N, IMB, INB, MB, NB, RSRC, CSRC,
3179 INTEGER CSRC, CTXT, IMB, INB, LLD, M, MB, N, NB, RSRC
3308 INTEGER BLOCK_CYCLIC_2D_INB, CSRC_, CTXT_, DLEN_,
3309 $ DTYPE_, IMB_, INB_, LLD_, MB_, M_, NB_, N_,
3311 PARAMETER ( BLOCK_CYCLIC_2D_INB = 2, dlen_ = 11,
3312 $ dtype_ = 1, ctxt_ = 2, m_ = 3, n_ = 4,
3313 $ imb_ = 5, inb_ = 6, mb_ = 7, nb_ = 8,
3314 $ rsrc_ = 9, csrc_ = 10, lld_ = 11 )
3318 desc( dtype_ ) = block_cyclic_2d_inb
3319 desc( ctxt_ ) = ctxt
3326 desc( rsrc_ ) = rsrc
3327 desc( csrc_ ) = csrc
3335 SUBROUTINE pb_descinit2( DESC, M, N, IMB, INB, MB, NB, RSRC, CSRC,
3344 INTEGER CSRC, CTXT, IMB, INB, INFO, LLD, M, MB, N, NB,
3493 INTEGER BLOCK_CYCLIC_2D_INB, CSRC_, CTXT_, DLEN_,
3494 $ DTYPE_, IMB_, INB_, LLD_, MB_, M_, NB_, N_,
3496 PARAMETER ( BLOCK_CYCLIC_2D_INB = 2, dlen_ = 11,
3497 $ dtype_ = 1, ctxt_ = 2, m_ = 3, n_ = 4,
3498 $ imb_ = 5, inb_ = 6, mb_ = 7, nb_ = 8,
3499 $ rsrc_ = 9, csrc_ = 10, lld_ = 11 )
3502 INTEGER LLDMIN, MP, MYCOL, MYROW, NPCOL, NPROW
3505 EXTERNAL BLACS_GRIDINFO, PXERBLA
3518 CALL blacs_gridinfo( ctxt, nprow, npcol, myrow, mycol )
3523 ELSE IF( n.LT.0 )
THEN
3525 ELSE IF( imb.LT.1 )
THEN
3527 ELSE IF( inb.LT.1 )
THEN
3529 ELSE IF( mb.LT.1 )
THEN
3531 ELSE IF( nb.LT.1 )
THEN
3533 ELSE IF( rsrc.LT.-1 .OR. rsrc.GE.nprow )
THEN
3535 ELSE IF( csrc.LT.-1 .OR. csrc.GE.npcol )
THEN
3537 ELSE IF( nprow.EQ.-1 )
THEN
3543 IF( info.EQ.0 )
THEN
3544 mp = pb_numroc( m, 1, imb, mb, myrow, rsrc, nprow )
3545 IF( pb_numroc( n, 1, inb, nb, mycol, csrc, npcol ).GT.0 )
THEN
3546 lldmin =
max( 1, mp )
3555 $
CALL pxerbla( ctxt,
'PB_DESCINIT2', -info )
3557 desc( dtype_ ) = block_cyclic_2d_inb
3558 desc( ctxt_ ) = ctxt
3559 desc( m_ ) =
max( 0, m )
3560 desc( n_ ) =
max( 0, n )
3561 desc( imb_ ) =
max( 1, imb )
3562 desc( inb_ ) =
max( 1, inb )
3563 desc( mb_ ) =
max( 1, mb )
3564 desc( nb_ ) =
max( 1, nb )
3565 desc( rsrc_ ) =
max( -1,
min( rsrc, nprow-1 ) )
3566 desc( csrc_ ) =
max( -1,
min( csrc, npcol-1 ) )
3567 desc( lld_ ) =
max( lld, lldmin )
3574 SUBROUTINE pb_binfo( OFFD, M, N, IMB1, INB1, MB, NB, MRROW, MRCOL,
3575 $ LCMT00, MBLKS, NBLKS, IMBLOC, INBLOC, LMBLOC,
3576 $ LNBLOC, ILOW, LOW, IUPP, UPP )
3584 INTEGER ILOW, IMB1, IMBLOC, INB1, INBLOC, IUPP, LCMT00,
3585 $ lmbloc, lnbloc, low, m, mb, mblks, mrcol,
3586 $ mrrow, n, nb, nblks, offd, upp
3726 IF( m.LE.0 .OR. n.LE.0 )
THEN
3728 IF( mrrow.GT.0 )
THEN
3731 iupp = max( 0, imb1 - 1 )
3737 IF( mrcol.GT.0 )
THEN
3740 ilow = min( 0, 1 - inb1 )
3746 lcmt00 = lcmt00 + ( low - ilow + mrcol * nb ) -
3747 $ ( iupp - upp + mrrow * mb )
3753 IF( mrrow.GT.0 )
THEN
3755 imbloc = min( m, mb )
3757 lcmt00 = lcmt00 - ( imb1 - mb + mrrow * mb )
3758 mblks = ( m - 1 ) / mb + 1
3759 lmbloc = m - ( m / mb ) * mb
3763 IF( mrcol.GT.0 )
THEN
3765 inbloc = min( n, nb )
3767 lcmt00 = lcmt00 + inb1 - nb + mrcol * nb
3768 nblks = ( n - 1 ) / nb + 1
3769 lnbloc = n - ( n / nb ) * nb
3778 IF( tmp1.GT.0 )
THEN
3782 nblks = ( tmp1 - 1 ) / nb + 2
3783 lnbloc = tmp1 - ( tmp1 / nb ) * nb
3801 IF( tmp1.GT.0 )
THEN
3805 mblks = ( tmp1 - 1 ) / mb + 2
3806 lmbloc = tmp1 - ( tmp1 / mb ) * mb
3817 IF( mrcol.GT.0 )
THEN
3819 inbloc = min( n, nb )
3821 lcmt00 = lcmt00 + inb1 - nb + mrcol * nb
3822 nblks = ( n - 1 ) / nb + 1
3823 lnbloc = n - ( n / nb ) * nb
3832 IF( tmp1.GT.0 )
THEN
3836 nblks = ( tmp1 - 1 ) / nb + 2
3837 lnbloc = tmp1 - ( tmp1 / nb ) * nb
3857 INTEGER FUNCTION pilaenv( ICTXT, PREC )
3897 common /infoc/info, nblog
3908 SUBROUTINE pb_locinfo( I, INB, NB, MYROC, SRCPROC, NPROCS,
3909 $ ILOCBLK, ILOCOFF, MYDIST )
3917 INTEGER I, ILOCBLK, ILOCOFF, INB, MYDIST, MYROC, NB,
3982 INTEGER ITMP, NBLOCKS, PROC
3988 if( srcproc.LT.0 )
THEN
4000 nblocks = ( itmp - 1 ) / nb + 1
4002 ilocoff = itmp - 1 - ( nblocks - 1 ) * nb
4009 mydist = myroc - proc
4011 $ mydist = mydist + nprocs
4022 nblocks = ( itmp - 1 ) / nb + 1
4023 proc = proc + nblocks
4024 proc = proc - ( proc / nprocs ) * nprocs
4025 ilocblk = nblocks / nprocs
4027 IF( ( ilocblk*nprocs ).LT.( mydist-nblocks ) )
4028 $ ilocblk = ilocblk + 1
4031 $ ilocoff = itmp - 1 - ( nblocks - 1 ) * nb
4042 SUBROUTINE pb_initjmp( COLMAJ, NVIR, IMBVIR, INBVIR, IMBLOC,
4043 $ INBLOC, MB, NB, RSRC, CSRC, NPROW, NPCOL,
4053 INTEGER CSRC, IMBLOC, IMBVIR, INBLOC, INBVIR, MB, NB,
4054 $ npcol, nprow, nvir, rsrc, stride
4145 INTEGER JMP_1, JMP_COL, JMP_IMBV, JMP_INBV, JMP_LEN,
4146 $ JMP_MB, JMP_NB, JMP_NPIMBLOC, JMP_NPMB,
4147 $ JMP_NQINBLOC, JMP_NQNB, JMP_ROW
4148 PARAMETER ( JMP_1 = 1, jmp_row = 2, jmp_col = 3,
4149 $ jmp_mb = 4, jmp_imbv = 5, jmp_npmb = 6,
4150 $ jmp_npimbloc = 7, jmp_nb = 8, jmp_inbv = 9,
4151 $ jmp_nqnb = 10, jmp_nqinbloc = 11,
4159 IF( RSRC.LT.0 ) THEN
4164 IF( csrc.LT.0 )
THEN
4173 jmp( jmp_imbv ) = imbvir
4174 jmp( jmp_npmb ) = npmb
4175 jmp( jmp_npimbloc ) = imbloc + npmb - mb
4178 jmp( jmp_inbv ) = inbvir
4179 jmp( jmp_nqnb ) = nqnb
4180 jmp( jmp_nqinbloc ) = inbloc + nqnb - nb
4183 jmp( jmp_row ) = stride
4184 jmp( jmp_col ) = stride * nvir
4186 jmp( jmp_row ) = stride * nvir
4187 jmp( jmp_col ) = stride
4203 INTEGER IMULADD( 4, * ), JMP( * ), MULADD0( * )
4242 INTEGER JMP_1, JMP_COL, JMP_IMBV, JMP_INBV, JMP_LEN,
4243 $ JMP_MB, JMP_NB, JMP_NPIMBLOC, JMP_NPMB,
4244 $ JMP_NQINBLOC, JMP_NQNB, JMP_ROW
4245 PARAMETER ( JMP_1 = 1, jmp_row = 2, jmp_col = 3,
4246 $ jmp_mb = 4, jmp_imbv = 5, jmp_npmb = 6,
4247 $ jmp_npimbloc = 7, jmp_nb = 8, jmp_inbv = 9,
4248 $ jmp_nqnb = 10, jmp_nqinbloc = 11,
4253 INTEGER ITMP1( 2 ), ITMP2( 2 )
4265 CALL pb_jump( jmp( jmp_1 ), muladd0, itmp2, itmp1,
4266 $ imuladd( 1, jmp_1 ) )
4268 CALL pb_jump( jmp( jmp_row ), muladd0, itmp1, itmp2,
4269 $ imuladd( 1, jmp_row ) )
4270 CALL pb_jump( jmp( jmp_col ), muladd0, itmp1, itmp2,
4271 $ imuladd( 1, jmp_col ) )
4276 CALL pb_jump( jmp( jmp_imbv ), imuladd( 1, jmp_row ), itmp1,
4277 $ itmp2, imuladd( 1, jmp_imbv ) )
4278 CALL pb_jump( jmp( jmp_mb ), imuladd( 1, jmp_row ), itmp1,
4279 $ itmp2, imuladd( 1, jmp_mb ) )
4280 CALL pb_jump( jmp( jmp_npmb ), imuladd( 1, jmp_row ), itmp1,
4281 $ itmp2, imuladd( 1, jmp_npmb ) )
4282 CALL pb_jump( jmp( jmp_npimbloc ), imuladd( 1, jmp_row ), itmp1,
4283 $ itmp2, imuladd( 1, jmp_npimbloc ) )
4285 CALL pb_jump( jmp( jmp_inbv ), imuladd( 1, jmp_col ), itmp1,
4286 $ itmp2, imuladd( 1, jmp_inbv ) )
4287 CALL pb_jump( jmp( jmp_nb ), imuladd( 1, jmp_col ), itmp1,
4288 $ itmp2, imuladd( 1, jmp_nb ) )
4289 CALL pb_jump( jmp( jmp_nqnb ), imuladd( 1, jmp_col ), itmp1,
4290 $ itmp2, imuladd( 1, jmp_nqnb ) )
4291 CALL pb_jump( jmp( jmp_nqinbloc ), imuladd( 1, jmp_col ), itmp1,
4292 $ itmp2, imuladd( 1, jmp_nqinbloc ) )
4299 SUBROUTINE pb_setlocran( SEED, ILOCBLK, JLOCBLK, ILOCOFF, JLOCOFF,
4300 $ MYRDIST, MYCDIST, NPROW, NPCOL, JMP,
4309 INTEGER ILOCBLK, ILOCOFF, JLOCBLK, JLOCOFF, MYCDIST,
4310 $ myrdist, npcol, nprow, seed
4313 INTEGER IMULADD( 4, * ), IRAN( * ), JMP( * )
4397 INTEGER JMP_1, JMP_COL, JMP_IMBV, JMP_INBV, JMP_LEN,
4398 $ JMP_MB, JMP_NB, JMP_NPIMBLOC, JMP_NPMB,
4399 $ JMP_NQINBLOC, JMP_NQNB, JMP_ROW
4400 PARAMETER ( JMP_1 = 1, jmp_row = 2, jmp_col = 3,
4401 $ jmp_mb = 4, jmp_imbv = 5, jmp_npmb = 6,
4402 $ jmp_npimbloc = 7, jmp_nb = 8, jmp_inbv = 9,
4403 $ jmp_nqnb = 10, jmp_nqinbloc = 11,
4407 INTEGER IMULADDTMP( 4 ), ITMP( 2 )
4410 EXTERNAL PB_JUMP, PB_SETRAN
4419 CALL pb_jump( jmp( jmp_1 ), imuladd( 1, jmp_1 ), itmp, iran,
4424 CALL pb_jump( ilocoff, imuladd( 1, jmp_row ), iran, itmp,
4426 IF( myrdist.GT.0 )
THEN
4427 CALL pb_jump( jmp( jmp_imbv ), imuladd( 1, jmp_row ), itmp,
4428 $ iran, imuladdtmp )
4429 CALL pb_jump( myrdist - 1, imuladd( 1, jmp_mb ), iran,
4430 $ itmp, imuladdtmp )
4431 CALL pb_jump( ilocblk, imuladd( 1, jmp_npmb ), itmp,
4432 $ iran, imuladdtmp )
4434 IF( ilocblk.GT.0 )
THEN
4435 CALL pb_jump( jmp( jmp_imbv ), imuladd( 1, jmp_row ), itmp,
4436 $ iran, imuladdtmp )
4437 CALL pb_jump( nprow - 1, imuladd( 1, jmp_mb ), iran,
4438 $ itmp, imuladdtmp )
4439 CALL pb_jump( ilocblk - 1, imuladd( 1, jmp_npmb ), itmp,
4440 $ iran, imuladdtmp )
4442 CALL pb_jump( 0, imuladd( 1, jmp_1 ), itmp,
4443 $ iran, imuladdtmp )
4449 CALL pb_jump( jlocoff, imuladd( 1, jmp_col ), iran, itmp,
4451 IF( mycdist.GT.0 )
THEN
4452 CALL pb_jump( jmp( jmp_inbv ), imuladd( 1, jmp_col ), itmp,
4453 $ iran, imuladdtmp )
4454 CALL pb_jump( mycdist - 1, imuladd( 1, jmp_nb ), iran,
4455 $ itmp, imuladdtmp )
4456 CALL pb_jump( jlocblk, imuladd( 1, jmp_nqnb ), itmp,
4457 $ iran, imuladdtmp )
4459 IF( jlocblk.GT.0 )
THEN
4460 CALL pb_jump( jmp( jmp_inbv ), imuladd( 1, jmp_col ), itmp,
4461 $ iran, imuladdtmp )
4462 CALL pb_jump( npcol - 1, imuladd( 1, jmp_nb ), iran,
4463 $ itmp, imuladdtmp )
4464 CALL pb_jump( jlocblk - 1, imuladd( 1, jmp_nqnb ), itmp,
4465 $ iran, imuladdtmp )
4467 CALL pb_jump( 0, imuladd( 1, jmp_1 ), itmp,
4468 $ iran, imuladdtmp )
4472 CALL pb_setran( iran, imuladd( 1, jmp_1 ) )
4487 INTEGER I( 2 ), J( 2 ), K( 2 )
4532 INTEGER IPOW15, IPOW16
4533 PARAMETER ( IPOW15 = 2**15, ipow16 = 2**16 )
4536 INTEGER ITMP1, ITMP2
4542 ITMP1 = k( 1 ) + j( 1 )
4543 itmp2 = itmp1 / ipow16
4544 i( 1 ) = itmp1 - itmp2 * ipow16
4549 itmp1 = itmp2 + k( 2 ) + j( 2 )
4550 itmp2 = itmp1 / ipow15
4551 i( 2 ) = itmp1 - itmp2 * ipow15
4566 INTEGER I( 2 ), J( 2 ), K( 2 )
4612 INTEGER IPOW15, IPOW16, IPOW30
4613 PARAMETER ( IPOW15 = 2**15, ipow16 = 2**16,
4617 INTEGER ITMP1, ITMP2
4621 ITMP1 = k( 1 ) * j( 1 )
4623 $ itmp1 = ( itmp1 + ipow30 ) + ipow30
4627 itmp2 = itmp1 / ipow16
4628 i( 1 ) = itmp1 - itmp2 * ipow16
4630 itmp1 = k( 1 ) * j( 2 ) + k( 2 ) * j( 1 )
4632 $ itmp1 = ( itmp1 + ipow30 ) + ipow30
4634 itmp1 = itmp2 + itmp1
4636 $ itmp1 = ( itmp1 + ipow30 ) + ipow30
4640 i( 2 ) = itmp1 - ( itmp1 / ipow15 ) * ipow15
4647 SUBROUTINE pb_jump( K, MULADD, IRANN, IRANM, IMA )
4658 INTEGER IMA( 4 ), IRANM( 2 ), IRANN( 2 ), MULADD( 4 )
4720 EXTERNAL PB_LADD, PB_LMUL
4726 IMA( 1 ) = muladd( 1 )
4727 ima( 2 ) = muladd( 2 )
4728 ima( 3 ) = muladd( 3 )
4729 ima( 4 ) = muladd( 4 )
4733 CALL pb_lmul( ima, muladd, j )
4738 CALL pb_lmul( ima( 3 ), muladd, j )
4739 CALL pb_ladd( muladd( 3 ), j, ima( 3 ) )
4743 CALL pb_lmul( irann, ima, j )
4744 CALL pb_ladd( j, ima( 3 ), iranm )
4748 iranm( 1 ) = irann( 1 )
4749 iranm( 2 ) = irann( 2 )
4766 INTEGER IAC( 4 ), IRAN( 2 )
4801 INTEGER IACS( 4 ), IRAND( 2 )
4802 COMMON /RANCOM/ IRAND, IACS
4809 IRAND( 1 ) = iran( 1 )
4810 irand( 2 ) = iran( 2 )
4811 iacs( 1 ) = iac( 1 )
4812 iacs( 2 ) = iac( 2 )
4813 iacs( 3 ) = iac( 3 )
4814 iacs( 4 ) = iac( 4 )
4821 SUBROUTINE pb_jumpit( MULADD, IRANN, IRANM )
4829 INTEGER IRANM( 2 ), IRANN( 2 ), MULADD( 4 )
4872 EXTERNAL PB_LADD, PB_LMUL
4875 INTEGER IACS( 4 ), IRAND( 2 )
4876 COMMON /RANCOM/ IRAND, IACS
4883 CALL PB_LMUL( IRANN, MULADD, J )
4884 CALL PB_LADD( J, MULADD( 3 ), IRANM )
4886 IRAND( 1 ) = iranm( 1 )
4887 irand( 2 ) = iranm( 2 )