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

◆ pcmmch3()

subroutine pcmmch3 ( character*1  uplo,
character*1  trans,
integer  m,
integer  n,
complex  alpha,
complex, dimension( * )  a,
integer  ia,
integer  ja,
integer, dimension( * )  desca,
complex  beta,
complex, dimension( * )  c,
complex, dimension( * )  pc,
integer  ic,
integer  jc,
integer, dimension( * )  descc,
real  err,
integer  info 
)

Definition at line 6582 of file pcblastst.f.

6584*
6585* -- PBLAS test routine (version 2.0) --
6586* University of Tennessee, Knoxville, Oak Ridge National Laboratory,
6587* and University of California, Berkeley.
6588* April 1, 1998
6589*
6590* .. Scalar Arguments ..
6591 CHARACTER*1 TRANS, UPLO
6592 INTEGER IA, IC, INFO, JA, JC, M, N
6593 REAL ERR
6594 COMPLEX ALPHA, BETA
6595* ..
6596* .. Array Arguments ..
6597 INTEGER DESCA( * ), DESCC( * )
6598 COMPLEX A( * ), C( * ), PC( * )
6599* ..
6600*
6601* Purpose
6602* =======
6603*
6604* PCMMCH3 checks the results of the computational tests.
6605*
6606* Notes
6607* =====
6608*
6609* A description vector is associated with each 2D block-cyclicly dis-
6610* tributed matrix. This vector stores the information required to
6611* establish the mapping between a matrix entry and its corresponding
6612* process and memory location.
6613*
6614* In the following comments, the character _ should be read as
6615* "of the distributed matrix". Let A be a generic term for any 2D
6616* block cyclicly distributed matrix. Its description vector is DESCA:
6617*
6618* NOTATION STORED IN EXPLANATION
6619* ---------------- --------------- ------------------------------------
6620* DTYPE_A (global) DESCA( DTYPE_ ) The descriptor type.
6621* CTXT_A (global) DESCA( CTXT_ ) The BLACS context handle, indicating
6622* the NPROW x NPCOL BLACS process grid
6623* A is distributed over. The context
6624* itself is global, but the handle
6625* (the integer value) may vary.
6626* M_A (global) DESCA( M_ ) The number of rows in the distribu-
6627* ted matrix A, M_A >= 0.
6628* N_A (global) DESCA( N_ ) The number of columns in the distri-
6629* buted matrix A, N_A >= 0.
6630* IMB_A (global) DESCA( IMB_ ) The number of rows of the upper left
6631* block of the matrix A, IMB_A > 0.
6632* INB_A (global) DESCA( INB_ ) The number of columns of the upper
6633* left block of the matrix A,
6634* INB_A > 0.
6635* MB_A (global) DESCA( MB_ ) The blocking factor used to distri-
6636* bute the last M_A-IMB_A rows of A,
6637* MB_A > 0.
6638* NB_A (global) DESCA( NB_ ) The blocking factor used to distri-
6639* bute the last N_A-INB_A columns of
6640* A, NB_A > 0.
6641* RSRC_A (global) DESCA( RSRC_ ) The process row over which the first
6642* row of the matrix A is distributed,
6643* NPROW > RSRC_A >= 0.
6644* CSRC_A (global) DESCA( CSRC_ ) The process column over which the
6645* first column of A is distributed.
6646* NPCOL > CSRC_A >= 0.
6647* LLD_A (local) DESCA( LLD_ ) The leading dimension of the local
6648* array storing the local blocks of
6649* the distributed matrix A,
6650* IF( Lc( 1, N_A ) > 0 )
6651* LLD_A >= MAX( 1, Lr( 1, M_A ) )
6652* ELSE
6653* LLD_A >= 1.
6654*
6655* Let K be the number of rows of a matrix A starting at the global in-
6656* dex IA,i.e, A( IA:IA+K-1, : ). Lr( IA, K ) denotes the number of rows
6657* that the process of row coordinate MYROW ( 0 <= MYROW < NPROW ) would
6658* receive if these K rows were distributed over NPROW processes. If K
6659* is the number of columns of a matrix A starting at the global index
6660* JA, i.e, A( :, JA:JA+K-1, : ), Lc( JA, K ) denotes the number of co-
6661* lumns that the process MYCOL ( 0 <= MYCOL < NPCOL ) would receive if
6662* these K columns were distributed over NPCOL processes.
6663*
6664* The values of Lr() and Lc() may be determined via a call to the func-
6665* tion PB_NUMROC:
6666* Lr( IA, K ) = PB_NUMROC( K, IA, IMB_A, MB_A, MYROW, RSRC_A, NPROW )
6667* Lc( JA, K ) = PB_NUMROC( K, JA, INB_A, NB_A, MYCOL, CSRC_A, NPCOL )
6668*
6669* Arguments
6670* =========
6671*
6672* UPLO (global input) CHARACTER*1
6673* On entry, UPLO specifies which part of C should contain the
6674* result.
6675*
6676* TRANS (global input) CHARACTER*1
6677* On entry, TRANS specifies whether the matrix A has to be
6678* transposed or not before computing the matrix-matrix addi-
6679* tion.
6680*
6681* M (global input) INTEGER
6682* On entry, M specifies the number of rows of C.
6683*
6684* N (global input) INTEGER
6685* On entry, N specifies the number of columns of C.
6686*
6687* ALPHA (global input) COMPLEX
6688* On entry, ALPHA specifies the scalar alpha.
6689*
6690* A (local input) COMPLEX array
6691* On entry, A is an array of dimension (DESCA( M_ ),*). This
6692* array contains a local copy of the initial entire matrix PA.
6693*
6694* IA (global input) INTEGER
6695* On entry, IA specifies A's global row index, which points to
6696* the beginning of the submatrix sub( A ).
6697*
6698* JA (global input) INTEGER
6699* On entry, JA specifies A's global column index, which points
6700* to the beginning of the submatrix sub( A ).
6701*
6702* DESCA (global and local input) INTEGER array
6703* On entry, DESCA is an integer array of dimension DLEN_. This
6704* is the array descriptor for the matrix A.
6705*
6706* BETA (global input) COMPLEX
6707* On entry, BETA specifies the scalar beta.
6708*
6709* C (local input/local output) COMPLEX array
6710* On entry, C is an array of dimension (DESCC( M_ ),*). This
6711* array contains a local copy of the initial entire matrix PC.
6712*
6713* PC (local input) COMPLEX array
6714* On entry, PC is an array of dimension (DESCC( LLD_ ),*). This
6715* array contains the local pieces of the matrix PC.
6716*
6717* IC (global input) INTEGER
6718* On entry, IC specifies C's global row index, which points to
6719* the beginning of the submatrix sub( C ).
6720*
6721* JC (global input) INTEGER
6722* On entry, JC specifies C's global column index, which points
6723* to the beginning of the submatrix sub( C ).
6724*
6725* DESCC (global and local input) INTEGER array
6726* On entry, DESCC is an integer array of dimension DLEN_. This
6727* is the array descriptor for the matrix C.
6728*
6729* ERR (global output) REAL
6730* On exit, ERR specifies the largest error in absolute value.
6731*
6732* INFO (global output) INTEGER
6733* On exit, if INFO <> 0, the result is less than half accurate.
6734*
6735* -- Written on April 1, 1998 by
6736* Antoine Petitet, University of Tennessee, Knoxville 37996, USA.
6737*
6738* =====================================================================
6739*
6740* .. Parameters ..
6741 INTEGER BLOCK_CYCLIC_2D_INB, CSRC_, CTXT_, DLEN_,
6742 $ DTYPE_, IMB_, INB_, LLD_, MB_, M_, NB_, N_,
6743 $ RSRC_
6744 parameter( block_cyclic_2d_inb = 2, dlen_ = 11,
6745 $ dtype_ = 1, ctxt_ = 2, m_ = 3, n_ = 4,
6746 $ imb_ = 5, inb_ = 6, mb_ = 7, nb_ = 8,
6747 $ rsrc_ = 9, csrc_ = 10, lld_ = 11 )
6748 REAL ZERO
6749 parameter( zero = 0.0e+0 )
6750* ..
6751* .. Local Scalars ..
6752 LOGICAL COLREP, CTRAN, LOWER, NOTRAN, ROWREP, UPPER
6753 INTEGER I, ICCOL, ICROW, ICTXT, IIC, IOFFA, IOFFC, J,
6754 $ JJC, LDA, LDC, LDPC, MYCOL, MYROW, NPCOL,
6755 $ NPROW
6756 REAL ERR0, ERRI, PREC
6757* ..
6758* .. External Subroutines ..
6759 EXTERNAL blacs_gridinfo, igsum2d, pb_infog2l,
6760 $ pcerraxpby, sgamx2d
6761* ..
6762* .. External Functions ..
6763 LOGICAL LSAME
6764 REAL PSLAMCH
6765 EXTERNAL lsame, pslamch
6766* ..
6767* .. Intrinsic Functions ..
6768 INTRINSIC abs, conjg, max
6769* ..
6770* .. Executable Statements ..
6771*
6772 ictxt = descc( ctxt_ )
6773 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
6774*
6775 prec = pslamch( ictxt, 'eps' )
6776*
6777 upper = lsame( uplo, 'U' )
6778 lower = lsame( uplo, 'L' )
6779 notran = lsame( trans, 'N' )
6780 ctran = lsame( trans, 'C' )
6781*
6782* Compute expected result in C using data in A and C. This part of
6783* the computation is performed by every process in the grid.
6784*
6785 info = 0
6786 err = zero
6787*
6788 lda = max( 1, desca( m_ ) )
6789 ldc = max( 1, descc( m_ ) )
6790 ldpc = max( 1, descc( lld_ ) )
6791 rowrep = ( descc( rsrc_ ).EQ.-1 )
6792 colrep = ( descc( csrc_ ).EQ.-1 )
6793*
6794 IF( notran ) THEN
6795*
6796 DO 20 j = jc, jc + n - 1
6797*
6798 ioffc = ic + ( j - 1 ) * ldc
6799 ioffa = ia + ( ja - 1 + j - jc ) * lda
6800*
6801 DO 10 i = ic, ic + m - 1
6802*
6803 IF( upper ) THEN
6804 IF( ( j - jc ).GE.( i - ic ) ) THEN
6805 CALL pcerraxpby( erri, alpha, a( ioffa ), beta,
6806 $ c( ioffc ), prec )
6807 ELSE
6808 erri = zero
6809 END IF
6810 ELSE IF( lower ) THEN
6811 IF( ( j - jc ).LE.( i - ic ) ) THEN
6812 CALL pcerraxpby( erri, alpha, a( ioffa ), beta,
6813 $ c( ioffc ), prec )
6814 ELSE
6815 erri = zero
6816 END IF
6817 ELSE
6818 CALL pcerraxpby( erri, alpha, a( ioffa ), beta,
6819 $ c( ioffc ), prec )
6820 END IF
6821*
6822 CALL pb_infog2l( i, j, descc, nprow, npcol, myrow, mycol,
6823 $ iic, jjc, icrow, iccol )
6824 IF( ( myrow.EQ.icrow .OR. rowrep ) .AND.
6825 $ ( mycol.EQ.iccol .OR. colrep ) ) THEN
6826 err0 = abs( pc( iic+(jjc-1)*ldpc )-c( ioffc ) )
6827 IF( err0.GT.erri )
6828 $ info = 1
6829 err = max( err, err0 )
6830 END IF
6831*
6832 ioffa = ioffa + 1
6833 ioffc = ioffc + 1
6834*
6835 10 CONTINUE
6836*
6837 20 CONTINUE
6838*
6839 ELSE IF( ctran ) THEN
6840*
6841 DO 40 j = jc, jc + n - 1
6842*
6843 ioffc = ic + ( j - 1 ) * ldc
6844 ioffa = ia + ( j - jc ) + ( ja - 1 ) * lda
6845*
6846 DO 30 i = ic, ic + m - 1
6847*
6848 IF( upper ) THEN
6849 IF( ( j - jc ).GE.( i - ic ) ) THEN
6850 CALL pcerraxpby( erri, alpha, conjg( a( ioffa ) ),
6851 $ beta, c( ioffc ), prec )
6852 ELSE
6853 erri = zero
6854 END IF
6855 ELSE IF( lower ) THEN
6856 IF( ( j - jc ).LE.( i - ic ) ) THEN
6857 CALL pcerraxpby( erri, alpha, conjg( a( ioffa ) ),
6858 $ beta, c( ioffc ), prec )
6859 ELSE
6860 erri = zero
6861 END IF
6862 ELSE
6863 CALL pcerraxpby( erri, alpha, conjg( a( ioffa ) ),
6864 $ beta, c( ioffc ), prec )
6865 END IF
6866*
6867 CALL pb_infog2l( i, j, descc, nprow, npcol, myrow, mycol,
6868 $ iic, jjc, icrow, iccol )
6869 IF( ( myrow.EQ.icrow .OR. rowrep ) .AND.
6870 $ ( mycol.EQ.iccol .OR. colrep ) ) THEN
6871 err0 = abs( pc( iic+(jjc-1)*ldpc )-c( ioffc ) )
6872 IF( err0.GT.erri )
6873 $ info = 1
6874 err = max( err, err0 )
6875 END IF
6876*
6877 ioffc = ioffc + 1
6878 ioffa = ioffa + lda
6879*
6880 30 CONTINUE
6881*
6882 40 CONTINUE
6883*
6884 ELSE
6885*
6886 DO 60 j = jc, jc + n - 1
6887*
6888 ioffc = ic + ( j - 1 ) * ldc
6889 ioffa = ia + ( j - jc ) + ( ja - 1 ) * lda
6890*
6891 DO 50 i = ic, ic + m - 1
6892*
6893 IF( upper ) THEN
6894 IF( ( j - jc ).GE.( i - ic ) ) THEN
6895 CALL pcerraxpby( erri, alpha, a( ioffa ), beta,
6896 $ c( ioffc ), prec )
6897 ELSE
6898 erri = zero
6899 END IF
6900 ELSE IF( lower ) THEN
6901 IF( ( j - jc ).LE.( i - ic ) ) THEN
6902 CALL pcerraxpby( erri, alpha, a( ioffa ), beta,
6903 $ c( ioffc ), prec )
6904 ELSE
6905 erri = zero
6906 END IF
6907 ELSE
6908 CALL pcerraxpby( erri, alpha, a( ioffa ), beta,
6909 $ c( ioffc ), prec )
6910 END IF
6911*
6912 CALL pb_infog2l( i, j, descc, nprow, npcol, myrow, mycol,
6913 $ iic, jjc, icrow, iccol )
6914 IF( ( myrow.EQ.icrow .OR. rowrep ) .AND.
6915 $ ( mycol.EQ.iccol .OR. colrep ) ) THEN
6916 err0 = abs( pc( iic+(jjc-1)*ldpc )-c( ioffc ) )
6917 IF( err0.GT.erri )
6918 $ info = 1
6919 err = max( err, err0 )
6920 END IF
6921*
6922 ioffc = ioffc + 1
6923 ioffa = ioffa + lda
6924*
6925 50 CONTINUE
6926*
6927 60 CONTINUE
6928*
6929 END IF
6930*
6931* If INFO = 0, all results are at least half accurate.
6932*
6933 CALL igsum2d( ictxt, 'All', ' ', 1, 1, info, 1, -1, mycol )
6934 CALL sgamx2d( ictxt, 'All', ' ', 1, 1, err, 1, i, j, -1, -1,
6935 $ mycol )
6936*
6937 RETURN
6938*
6939* End of PCMMCH3
6940*
subroutine pb_infog2l(i, j, desc, nprow, npcol, myrow, mycol, ii, jj, prow, pcol)
Definition pblastst.f:1673
subroutine pcerraxpby(errbnd, alpha, x, beta, y, prec)
Definition pcblastst.f:6943
real function pslamch(ictxt, cmach)
Definition pcblastst.f:7455
#define max(A, B)
Definition pcgemr.c:180
logical function lsame(ca, cb)
Definition tools.f:1724
Here is the call graph for this function:
Here is the caller graph for this function: