LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
zpot06.f
Go to the documentation of this file.
00001 *> \brief \b ZPOT06
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *  Definition:
00009 *  ===========
00010 *
00011 *       SUBROUTINE ZPOT06( UPLO, N, NRHS, A, LDA, X, LDX, B, LDB,
00012 *                          RWORK, RESID )
00013 * 
00014 *       .. Scalar Arguments ..
00015 *       CHARACTER          UPLO
00016 *       INTEGER            LDA, LDB, LDX, N, NRHS
00017 *       DOUBLE PRECISION   RESID
00018 *       ..
00019 *       .. Array Arguments ..
00020 *       DOUBLE PRECISION   RWORK( * )
00021 *       COMPLEX*16         A( LDA, * ), B( LDB, * ), X( LDX, * )
00022 *       ..
00023 *  
00024 *
00025 *> \par Purpose:
00026 *  =============
00027 *>
00028 *> \verbatim
00029 *>
00030 *> ZPOT06 computes the residual for a solution of a system of linear
00031 *> equations  A*x = b :
00032 *>    RESID = norm(B - A*X,inf) / ( norm(A,inf) * norm(X,inf) * EPS ),
00033 *> where EPS is the machine epsilon.
00034 *> \endverbatim
00035 *
00036 *  Arguments:
00037 *  ==========
00038 *
00039 *> \param[in] UPLO
00040 *> \verbatim
00041 *>          UPLO is CHARACTER*1
00042 *>          Specifies whether the upper or lower triangular part of the
00043 *>          symmetric matrix A is stored:
00044 *>          = 'U':  Upper triangular
00045 *>          = 'L':  Lower triangular
00046 *> \endverbatim
00047 *>
00048 *> \param[in] N
00049 *> \verbatim
00050 *>          N is INTEGER
00051 *>          The number of rows and columns of the matrix A.  N >= 0.
00052 *> \endverbatim
00053 *>
00054 *> \param[in] NRHS
00055 *> \verbatim
00056 *>          NRHS is INTEGER
00057 *>          The number of columns of B, the matrix of right hand sides.
00058 *>          NRHS >= 0.
00059 *> \endverbatim
00060 *>
00061 *> \param[in] A
00062 *> \verbatim
00063 *>          A is COMPLEX*16 array, dimension (LDA,N)
00064 *>          The original M x N matrix A.
00065 *> \endverbatim
00066 *>
00067 *> \param[in] LDA
00068 *> \verbatim
00069 *>          LDA is INTEGER
00070 *>          The leading dimension of the array A.  LDA >= max(1,N).
00071 *> \endverbatim
00072 *>
00073 *> \param[in] X
00074 *> \verbatim
00075 *>          X is COMPLEX*16 array, dimension (LDX,NRHS)
00076 *>          The computed solution vectors for the system of linear
00077 *>          equations.
00078 *> \endverbatim
00079 *>
00080 *> \param[in] LDX
00081 *> \verbatim
00082 *>          LDX is INTEGER
00083 *>          The leading dimension of the array X.  If TRANS = 'N',
00084 *>          LDX >= max(1,N); if TRANS = 'T' or 'C', LDX >= max(1,N).
00085 *> \endverbatim
00086 *>
00087 *> \param[in,out] B
00088 *> \verbatim
00089 *>          B is COMPLEX*16 array, dimension (LDB,NRHS)
00090 *>          On entry, the right hand side vectors for the system of
00091 *>          linear equations.
00092 *>          On exit, B is overwritten with the difference B - A*X.
00093 *> \endverbatim
00094 *>
00095 *> \param[in] LDB
00096 *> \verbatim
00097 *>          LDB is INTEGER
00098 *>          The leading dimension of the array B.  IF TRANS = 'N',
00099 *>          LDB >= max(1,M); if TRANS = 'T' or 'C', LDB >= max(1,N).
00100 *> \endverbatim
00101 *>
00102 *> \param[out] RWORK
00103 *> \verbatim
00104 *>          RWORK is DOUBLE PRECISION array, dimension (N)
00105 *> \endverbatim
00106 *>
00107 *> \param[out] RESID
00108 *> \verbatim
00109 *>          RESID is DOUBLE PRECISION
00110 *>          The maximum over the number of right hand sides of
00111 *>          norm(B - A*X) / ( norm(A) * norm(X) * EPS ).
00112 *> \endverbatim
00113 *
00114 *  Authors:
00115 *  ========
00116 *
00117 *> \author Univ. of Tennessee 
00118 *> \author Univ. of California Berkeley 
00119 *> \author Univ. of Colorado Denver 
00120 *> \author NAG Ltd. 
00121 *
00122 *> \date November 2011
00123 *
00124 *> \ingroup complex16_lin
00125 *
00126 *  =====================================================================
00127       SUBROUTINE ZPOT06( UPLO, N, NRHS, A, LDA, X, LDX, B, LDB,
00128      $                   RWORK, RESID )
00129 *
00130 *  -- LAPACK test routine (version 3.4.0) --
00131 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00132 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00133 *     November 2011
00134 *
00135 *     .. Scalar Arguments ..
00136       CHARACTER          UPLO
00137       INTEGER            LDA, LDB, LDX, N, NRHS
00138       DOUBLE PRECISION   RESID
00139 *     ..
00140 *     .. Array Arguments ..
00141       DOUBLE PRECISION   RWORK( * )
00142       COMPLEX*16         A( LDA, * ), B( LDB, * ), X( LDX, * )
00143 *     ..
00144 *
00145 *  =====================================================================
00146 *
00147 *     .. Parameters ..
00148       DOUBLE PRECISION   ZERO, ONE
00149       PARAMETER          ( ZERO = 0.0D+0, ONE = 1.0D+0 )
00150       COMPLEX*16         CONE, NEGCONE
00151       PARAMETER          ( CONE = ( 1.0D+0, 0.0D+0 ) )
00152       PARAMETER          ( NEGCONE = ( -1.0D+0, 0.0D+0 ) )
00153 *     ..
00154 *     .. Local Scalars ..
00155       INTEGER            IFAIL, J
00156       DOUBLE PRECISION   ANORM, BNORM, EPS, XNORM
00157       COMPLEX*16         ZDUM
00158 *     ..
00159 *     .. External Functions ..
00160       LOGICAL            LSAME
00161       INTEGER            IZAMAX
00162       DOUBLE PRECISION   DLAMCH, ZLANSY
00163       EXTERNAL           LSAME, IZAMAX, DLAMCH, ZLANSY
00164 *     ..
00165 *     .. External Subroutines ..
00166       EXTERNAL           ZHEMM
00167 *     ..
00168 *     .. Intrinsic Functions ..
00169       INTRINSIC          ABS, DBLE, DIMAG, MAX
00170 *     ..
00171 *     .. Statement Functions ..
00172       DOUBLE PRECISION   CABS1
00173 *     ..
00174 *     .. Statement Function definitions ..
00175       CABS1( ZDUM ) = ABS( DBLE( ZDUM ) ) + ABS( DIMAG( ZDUM ) )
00176 *     ..
00177 *     ..
00178 *     .. Executable Statements ..
00179 *
00180 *     Quick exit if N = 0 or NRHS = 0
00181 *
00182       IF( N.LE.0 .OR. NRHS.EQ.0 ) THEN
00183          RESID = ZERO
00184          RETURN
00185       END IF
00186 *
00187 *     Exit with RESID = 1/EPS if ANORM = 0.
00188 *
00189       EPS = DLAMCH( 'Epsilon' )
00190       ANORM = ZLANSY( 'I', UPLO, N, A, LDA, RWORK )
00191       IF( ANORM.LE.ZERO ) THEN
00192          RESID = ONE / EPS
00193          RETURN
00194       END IF
00195 *
00196 *     Compute  B - A*X  and store in B.
00197       IFAIL=0
00198 *
00199       CALL ZHEMM( 'Left', UPLO, N, NRHS, NEGCONE, A, LDA, X,
00200      $            LDX, CONE, B, LDB )
00201 *
00202 *     Compute the maximum over the number of right hand sides of
00203 *        norm(B - A*X) / ( norm(A) * norm(X) * EPS ) .
00204 *
00205       RESID = ZERO
00206       DO 10 J = 1, NRHS
00207          BNORM = CABS1(B(IZAMAX( N, B( 1, J ), 1 ),J))
00208          XNORM = CABS1(X(IZAMAX( N, X( 1, J ), 1 ),J))
00209          IF( XNORM.LE.ZERO ) THEN
00210             RESID = ONE / EPS
00211          ELSE
00212             RESID = MAX( RESID, ( ( BNORM / ANORM ) / XNORM ) / EPS )
00213          END IF
00214    10 CONTINUE
00215 *
00216       RETURN
00217 *
00218 *     End of ZPOT06
00219 *
00220       END
 All Files Functions