LAPACK  3.4.0
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, NEGONE
00149       PARAMETER          ( ZERO = 0.0D+0, ONE = 1.0D+0 )
00150       PARAMETER          ( NEGONE = -1.0D+0 )
00151       COMPLEX*16         CONE, NEGCONE
00152       PARAMETER          ( CONE = ( 1.0D+0, 0.0D+0 ) )
00153       PARAMETER          ( NEGCONE = ( -1.0D+0, 0.0D+0 ) )
00154 *     ..
00155 *     .. Local Scalars ..
00156       INTEGER            IFAIL, J
00157       DOUBLE PRECISION   ANORM, BNORM, EPS, XNORM
00158       COMPLEX*16         ZDUM
00159 *     ..
00160 *     .. External Functions ..
00161       LOGICAL            LSAME
00162       INTEGER            IZAMAX
00163       DOUBLE PRECISION   DLAMCH, ZLANSY
00164       EXTERNAL           LSAME, IZAMAX, DLAMCH, ZLANSY
00165 *     ..
00166 *     .. External Subroutines ..
00167       EXTERNAL           ZHEMM
00168 *     ..
00169 *     .. Intrinsic Functions ..
00170       INTRINSIC          ABS, DBLE, DIMAG, MAX
00171 *     ..
00172 *     .. Statement Functions ..
00173       DOUBLE PRECISION   CABS1
00174 *     ..
00175 *     .. Statement Function definitions ..
00176       CABS1( ZDUM ) = ABS( DBLE( ZDUM ) ) + ABS( DIMAG( ZDUM ) )
00177 *     ..
00178 *     ..
00179 *     .. Executable Statements ..
00180 *
00181 *     Quick exit if N = 0 or NRHS = 0
00182 *
00183       IF( N.LE.0 .OR. NRHS.EQ.0 ) THEN
00184          RESID = ZERO
00185          RETURN
00186       END IF
00187 *
00188 *     Exit with RESID = 1/EPS if ANORM = 0.
00189 *
00190       EPS = DLAMCH( 'Epsilon' )
00191       ANORM = ZLANSY( 'I', UPLO, N, A, LDA, RWORK )
00192       IF( ANORM.LE.ZERO ) THEN
00193          RESID = ONE / EPS
00194          RETURN
00195       END IF
00196 *
00197 *     Compute  B - A*X  and store in B.
00198       IFAIL=0
00199 *
00200       CALL ZHEMM( 'Left', UPLO, N, NRHS, NEGCONE, A, LDA, X,
00201      $            LDX, CONE, B, LDB )
00202 *
00203 *     Compute the maximum over the number of right hand sides of
00204 *        norm(B - A*X) / ( norm(A) * norm(X) * EPS ) .
00205 *
00206       RESID = ZERO
00207       DO 10 J = 1, NRHS
00208          BNORM = CABS1(B(IZAMAX( N, B( 1, J ), 1 ),J))
00209          XNORM = CABS1(X(IZAMAX( N, X( 1, J ), 1 ),J))
00210          IF( XNORM.LE.ZERO ) THEN
00211             RESID = ONE / EPS
00212          ELSE
00213             RESID = MAX( RESID, ( ( BNORM / ANORM ) / XNORM ) / EPS )
00214          END IF
00215    10 CONTINUE
00216 *
00217       RETURN
00218 *
00219 *     End of ZPOT06
00220 *
00221       END
 All Files Functions