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

◆ pzmmch3()

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

Definition at line 6583 of file pzblastst.f.

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