LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
zpot02.f
Go to the documentation of this file.
00001 *> \brief \b ZPOT02
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 ZPOT02( UPLO, N, NRHS, A, LDA, X, LDX, B, LDB, RWORK,
00012 *                          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 *> ZPOT02 computes the residual for the solution of a Hermitian system
00031 *> of linear equations  A*x = b:
00032 *>
00033 *>    RESID = norm(B - A*X) / ( norm(A) * norm(X) * EPS ),
00034 *>
00035 *> where EPS is the machine epsilon.
00036 *> \endverbatim
00037 *
00038 *  Arguments:
00039 *  ==========
00040 *
00041 *> \param[in] UPLO
00042 *> \verbatim
00043 *>          UPLO is CHARACTER*1
00044 *>          Specifies whether the upper or lower triangular part of the
00045 *>          Hermitian matrix A is stored:
00046 *>          = 'U':  Upper triangular
00047 *>          = 'L':  Lower triangular
00048 *> \endverbatim
00049 *>
00050 *> \param[in] N
00051 *> \verbatim
00052 *>          N is INTEGER
00053 *>          The number of rows and columns of the matrix A.  N >= 0.
00054 *> \endverbatim
00055 *>
00056 *> \param[in] NRHS
00057 *> \verbatim
00058 *>          NRHS is INTEGER
00059 *>          The number of columns of B, the matrix of right hand sides.
00060 *>          NRHS >= 0.
00061 *> \endverbatim
00062 *>
00063 *> \param[in] A
00064 *> \verbatim
00065 *>          A is COMPLEX*16 array, dimension (LDA,N)
00066 *>          The original Hermitian matrix A.
00067 *> \endverbatim
00068 *>
00069 *> \param[in] LDA
00070 *> \verbatim
00071 *>          LDA is INTEGER
00072 *>          The leading dimension of the array A.  LDA >= max(1,N)
00073 *> \endverbatim
00074 *>
00075 *> \param[in] X
00076 *> \verbatim
00077 *>          X is COMPLEX*16 array, dimension (LDX,NRHS)
00078 *>          The computed solution vectors for the system of linear
00079 *>          equations.
00080 *> \endverbatim
00081 *>
00082 *> \param[in] LDX
00083 *> \verbatim
00084 *>          LDX is INTEGER
00085 *>          The leading dimension of the array X.   LDX >= max(1,N).
00086 *> \endverbatim
00087 *>
00088 *> \param[in,out] B
00089 *> \verbatim
00090 *>          B is COMPLEX*16 array, dimension (LDB,NRHS)
00091 *>          On entry, the right hand side vectors for the system of
00092 *>          linear equations.
00093 *>          On exit, B is overwritten with the difference B - A*X.
00094 *> \endverbatim
00095 *>
00096 *> \param[in] LDB
00097 *> \verbatim
00098 *>          LDB is INTEGER
00099 *>          The leading dimension of the array B.  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 ZPOT02( UPLO, N, NRHS, A, LDA, X, LDX, B, LDB, RWORK,
00128      $                   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
00151       PARAMETER          ( CONE = ( 1.0D+0, 0.0D+0 ) )
00152 *     ..
00153 *     .. Local Scalars ..
00154       INTEGER            J
00155       DOUBLE PRECISION   ANORM, BNORM, EPS, XNORM
00156 *     ..
00157 *     .. External Functions ..
00158       DOUBLE PRECISION   DLAMCH, DZASUM, ZLANHE
00159       EXTERNAL           DLAMCH, DZASUM, ZLANHE
00160 *     ..
00161 *     .. External Subroutines ..
00162       EXTERNAL           ZHEMM
00163 *     ..
00164 *     .. Intrinsic Functions ..
00165       INTRINSIC          MAX
00166 *     ..
00167 *     .. Executable Statements ..
00168 *
00169 *     Quick exit if N = 0 or NRHS = 0.
00170 *
00171       IF( N.LE.0 .OR. NRHS.LE.0 ) THEN
00172          RESID = ZERO
00173          RETURN
00174       END IF
00175 *
00176 *     Exit with RESID = 1/EPS if ANORM = 0.
00177 *
00178       EPS = DLAMCH( 'Epsilon' )
00179       ANORM = ZLANHE( '1', UPLO, N, A, LDA, RWORK )
00180       IF( ANORM.LE.ZERO ) THEN
00181          RESID = ONE / EPS
00182          RETURN
00183       END IF
00184 *
00185 *     Compute  B - A*X
00186 *
00187       CALL ZHEMM( 'Left', UPLO, N, NRHS, -CONE, A, LDA, X, LDX, CONE, B,
00188      $            LDB )
00189 *
00190 *     Compute the maximum over the number of right hand sides of
00191 *        norm( B - A*X ) / ( norm(A) * norm(X) * EPS ) .
00192 *
00193       RESID = ZERO
00194       DO 10 J = 1, NRHS
00195          BNORM = DZASUM( N, B( 1, J ), 1 )
00196          XNORM = DZASUM( N, X( 1, J ), 1 )
00197          IF( XNORM.LE.ZERO ) THEN
00198             RESID = ONE / EPS
00199          ELSE
00200             RESID = MAX( RESID, ( ( BNORM / ANORM ) / XNORM ) / EPS )
00201          END IF
00202    10 CONTINUE
00203 *
00204       RETURN
00205 *
00206 *     End of ZPOT02
00207 *
00208       END
 All Files Functions