![]() |
LAPACK
3.4.1
LAPACK: Linear Algebra PACKage
|
00001 *> \brief \b ZPBT02 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 ZPBT02( UPLO, N, KD, NRHS, A, LDA, X, LDX, B, LDB, 00012 * RWORK, RESID ) 00013 * 00014 * .. Scalar Arguments .. 00015 * CHARACTER UPLO 00016 * INTEGER KD, 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 *> ZPBT02 computes the residual for a solution of a Hermitian banded 00031 *> system of equations A*x = b: 00032 *> RESID = norm( B - A*X ) / ( norm(A) * norm(X) * EPS) 00033 *> where EPS is the machine precision. 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 *> Hermitian 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] KD 00055 *> \verbatim 00056 *> KD is INTEGER 00057 *> The number of super-diagonals of the matrix A if UPLO = 'U', 00058 *> or the number of sub-diagonals if UPLO = 'L'. KD >= 0. 00059 *> \endverbatim 00060 *> 00061 *> \param[in] NRHS 00062 *> \verbatim 00063 *> NRHS is INTEGER 00064 *> The number of right hand sides. NRHS >= 0. 00065 *> \endverbatim 00066 *> 00067 *> \param[in] A 00068 *> \verbatim 00069 *> A is COMPLEX*16 array, dimension (LDA,N) 00070 *> The original Hermitian band matrix A. If UPLO = 'U', the 00071 *> upper triangular part of A is stored as a band matrix; if 00072 *> UPLO = 'L', the lower triangular part of A is stored. The 00073 *> columns of the appropriate triangle are stored in the columns 00074 *> of A and the diagonals of the triangle are stored in the rows 00075 *> of A. See ZPBTRF for further details. 00076 *> \endverbatim 00077 *> 00078 *> \param[in] LDA 00079 *> \verbatim 00080 *> LDA is INTEGER. 00081 *> The leading dimension of the array A. LDA >= max(1,KD+1). 00082 *> \endverbatim 00083 *> 00084 *> \param[in] X 00085 *> \verbatim 00086 *> X is COMPLEX*16 array, dimension (LDX,NRHS) 00087 *> The computed solution vectors for the system of linear 00088 *> equations. 00089 *> \endverbatim 00090 *> 00091 *> \param[in] LDX 00092 *> \verbatim 00093 *> LDX is INTEGER 00094 *> The leading dimension of the array X. LDX >= max(1,N). 00095 *> \endverbatim 00096 *> 00097 *> \param[in,out] B 00098 *> \verbatim 00099 *> B is COMPLEX*16 array, dimension (LDB,NRHS) 00100 *> On entry, the right hand side vectors for the system of 00101 *> linear equations. 00102 *> On exit, B is overwritten with the difference B - A*X. 00103 *> \endverbatim 00104 *> 00105 *> \param[in] LDB 00106 *> \verbatim 00107 *> LDB is INTEGER 00108 *> The leading dimension of the array B. LDB >= max(1,N). 00109 *> \endverbatim 00110 *> 00111 *> \param[out] RWORK 00112 *> \verbatim 00113 *> RWORK is DOUBLE PRECISION array, dimension (N) 00114 *> \endverbatim 00115 *> 00116 *> \param[out] RESID 00117 *> \verbatim 00118 *> RESID is DOUBLE PRECISION 00119 *> The maximum over the number of right hand sides of 00120 *> norm(B - A*X) / ( norm(A) * norm(X) * EPS ). 00121 *> \endverbatim 00122 * 00123 * Authors: 00124 * ======== 00125 * 00126 *> \author Univ. of Tennessee 00127 *> \author Univ. of California Berkeley 00128 *> \author Univ. of Colorado Denver 00129 *> \author NAG Ltd. 00130 * 00131 *> \date November 2011 00132 * 00133 *> \ingroup complex16_lin 00134 * 00135 * ===================================================================== 00136 SUBROUTINE ZPBT02( UPLO, N, KD, NRHS, A, LDA, X, LDX, B, LDB, 00137 $ RWORK, RESID ) 00138 * 00139 * -- LAPACK test routine (version 3.4.0) -- 00140 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00141 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00142 * November 2011 00143 * 00144 * .. Scalar Arguments .. 00145 CHARACTER UPLO 00146 INTEGER KD, LDA, LDB, LDX, N, NRHS 00147 DOUBLE PRECISION RESID 00148 * .. 00149 * .. Array Arguments .. 00150 DOUBLE PRECISION RWORK( * ) 00151 COMPLEX*16 A( LDA, * ), B( LDB, * ), X( LDX, * ) 00152 * .. 00153 * 00154 * ===================================================================== 00155 * 00156 * .. Parameters .. 00157 DOUBLE PRECISION ZERO, ONE 00158 PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 ) 00159 COMPLEX*16 CONE 00160 PARAMETER ( CONE = ( 1.0D+0, 0.0D+0 ) ) 00161 * .. 00162 * .. Local Scalars .. 00163 INTEGER J 00164 DOUBLE PRECISION ANORM, BNORM, EPS, XNORM 00165 * .. 00166 * .. External Functions .. 00167 DOUBLE PRECISION DLAMCH, DZASUM, ZLANHB 00168 EXTERNAL DLAMCH, DZASUM, ZLANHB 00169 * .. 00170 * .. External Subroutines .. 00171 EXTERNAL ZHBMV 00172 * .. 00173 * .. Intrinsic Functions .. 00174 INTRINSIC MAX 00175 * .. 00176 * .. Executable Statements .. 00177 * 00178 * Quick exit if N = 0 or NRHS = 0. 00179 * 00180 IF( N.LE.0 .OR. NRHS.LE.0 ) THEN 00181 RESID = ZERO 00182 RETURN 00183 END IF 00184 * 00185 * Exit with RESID = 1/EPS if ANORM = 0. 00186 * 00187 EPS = DLAMCH( 'Epsilon' ) 00188 ANORM = ZLANHB( '1', UPLO, N, KD, A, LDA, RWORK ) 00189 IF( ANORM.LE.ZERO ) THEN 00190 RESID = ONE / EPS 00191 RETURN 00192 END IF 00193 * 00194 * Compute B - A*X 00195 * 00196 DO 10 J = 1, NRHS 00197 CALL ZHBMV( UPLO, N, KD, -CONE, A, LDA, X( 1, J ), 1, CONE, 00198 $ B( 1, J ), 1 ) 00199 10 CONTINUE 00200 * 00201 * Compute the maximum over the number of right hand sides of 00202 * norm( B - A*X ) / ( norm(A) * norm(X) * EPS ) 00203 * 00204 RESID = ZERO 00205 DO 20 J = 1, NRHS 00206 BNORM = DZASUM( N, B( 1, J ), 1 ) 00207 XNORM = DZASUM( N, X( 1, J ), 1 ) 00208 IF( XNORM.LE.ZERO ) THEN 00209 RESID = ONE / EPS 00210 ELSE 00211 RESID = MAX( RESID, ( ( BNORM / ANORM ) / XNORM ) / EPS ) 00212 END IF 00213 20 CONTINUE 00214 * 00215 RETURN 00216 * 00217 * End of ZPBT02 00218 * 00219 END