1*> \brief \b ZPBT02 2* 3* =========== DOCUMENTATION =========== 4* 5* Online html documentation available at 6* http://www.netlib.org/lapack/explore-html/ 7* 8* Definition: 9* =========== 10* 11* SUBROUTINE ZPBT02( UPLO, N, KD, NRHS, A, LDA, X, LDX, B, LDB, 12* RWORK, RESID ) 13* 14* .. Scalar Arguments .. 15* CHARACTER UPLO 16* INTEGER KD, LDA, LDB, LDX, N, NRHS 17* DOUBLE PRECISION RESID 18* .. 19* .. Array Arguments .. 20* DOUBLE PRECISION RWORK( * ) 21* COMPLEX*16 A( LDA, * ), B( LDB, * ), X( LDX, * ) 22* .. 23* 24* 25*> \par Purpose: 26* ============= 27*> 28*> \verbatim 29*> 30*> ZPBT02 computes the residual for a solution of a Hermitian banded 31*> system of equations A*x = b: 32*> RESID = norm( B - A*X ) / ( norm(A) * norm(X) * EPS) 33*> where EPS is the machine precision. 34*> \endverbatim 35* 36* Arguments: 37* ========== 38* 39*> \param[in] UPLO 40*> \verbatim 41*> UPLO is CHARACTER*1 42*> Specifies whether the upper or lower triangular part of the 43*> Hermitian matrix A is stored: 44*> = 'U': Upper triangular 45*> = 'L': Lower triangular 46*> \endverbatim 47*> 48*> \param[in] N 49*> \verbatim 50*> N is INTEGER 51*> The number of rows and columns of the matrix A. N >= 0. 52*> \endverbatim 53*> 54*> \param[in] KD 55*> \verbatim 56*> KD is INTEGER 57*> The number of super-diagonals of the matrix A if UPLO = 'U', 58*> or the number of sub-diagonals if UPLO = 'L'. KD >= 0. 59*> \endverbatim 60*> 61*> \param[in] NRHS 62*> \verbatim 63*> NRHS is INTEGER 64*> The number of right hand sides. NRHS >= 0. 65*> \endverbatim 66*> 67*> \param[in] A 68*> \verbatim 69*> A is COMPLEX*16 array, dimension (LDA,N) 70*> The original Hermitian band matrix A. If UPLO = 'U', the 71*> upper triangular part of A is stored as a band matrix; if 72*> UPLO = 'L', the lower triangular part of A is stored. The 73*> columns of the appropriate triangle are stored in the columns 74*> of A and the diagonals of the triangle are stored in the rows 75*> of A. See ZPBTRF for further details. 76*> \endverbatim 77*> 78*> \param[in] LDA 79*> \verbatim 80*> LDA is INTEGER. 81*> The leading dimension of the array A. LDA >= max(1,KD+1). 82*> \endverbatim 83*> 84*> \param[in] X 85*> \verbatim 86*> X is COMPLEX*16 array, dimension (LDX,NRHS) 87*> The computed solution vectors for the system of linear 88*> equations. 89*> \endverbatim 90*> 91*> \param[in] LDX 92*> \verbatim 93*> LDX is INTEGER 94*> The leading dimension of the array X. LDX >= max(1,N). 95*> \endverbatim 96*> 97*> \param[in,out] B 98*> \verbatim 99*> B is COMPLEX*16 array, dimension (LDB,NRHS) 100*> On entry, the right hand side vectors for the system of 101*> linear equations. 102*> On exit, B is overwritten with the difference B - A*X. 103*> \endverbatim 104*> 105*> \param[in] LDB 106*> \verbatim 107*> LDB is INTEGER 108*> The leading dimension of the array B. LDB >= max(1,N). 109*> \endverbatim 110*> 111*> \param[out] RWORK 112*> \verbatim 113*> RWORK is DOUBLE PRECISION array, dimension (N) 114*> \endverbatim 115*> 116*> \param[out] RESID 117*> \verbatim 118*> RESID is DOUBLE PRECISION 119*> The maximum over the number of right hand sides of 120*> norm(B - A*X) / ( norm(A) * norm(X) * EPS ). 121*> \endverbatim 122* 123* Authors: 124* ======== 125* 126*> \author Univ. of Tennessee 127*> \author Univ. of California Berkeley 128*> \author Univ. of Colorado Denver 129*> \author NAG Ltd. 130* 131*> \date December 2016 132* 133*> \ingroup complex16_lin 134* 135* ===================================================================== 136 SUBROUTINE ZPBT02( UPLO, N, KD, NRHS, A, LDA, X, LDX, B, LDB, 137 $ RWORK, RESID ) 138* 139* -- LAPACK test routine (version 3.7.0) -- 140* -- LAPACK is a software package provided by Univ. of Tennessee, -- 141* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 142* December 2016 143* 144* .. Scalar Arguments .. 145 CHARACTER UPLO 146 INTEGER KD, LDA, LDB, LDX, N, NRHS 147 DOUBLE PRECISION RESID 148* .. 149* .. Array Arguments .. 150 DOUBLE PRECISION RWORK( * ) 151 COMPLEX*16 A( LDA, * ), B( LDB, * ), X( LDX, * ) 152* .. 153* 154* ===================================================================== 155* 156* .. Parameters .. 157 DOUBLE PRECISION ZERO, ONE 158 PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 ) 159 COMPLEX*16 CONE 160 PARAMETER ( CONE = ( 1.0D+0, 0.0D+0 ) ) 161* .. 162* .. Local Scalars .. 163 INTEGER J 164 DOUBLE PRECISION ANORM, BNORM, EPS, XNORM 165* .. 166* .. External Functions .. 167 DOUBLE PRECISION DLAMCH, DZASUM, ZLANHB 168 EXTERNAL DLAMCH, DZASUM, ZLANHB 169* .. 170* .. External Subroutines .. 171 EXTERNAL ZHBMV 172* .. 173* .. Intrinsic Functions .. 174 INTRINSIC MAX 175* .. 176* .. Executable Statements .. 177* 178* Quick exit if N = 0 or NRHS = 0. 179* 180 IF( N.LE.0 .OR. NRHS.LE.0 ) THEN 181 RESID = ZERO 182 RETURN 183 END IF 184* 185* Exit with RESID = 1/EPS if ANORM = 0. 186* 187 EPS = DLAMCH( 'Epsilon' ) 188 ANORM = ZLANHB( '1', UPLO, N, KD, A, LDA, RWORK ) 189 IF( ANORM.LE.ZERO ) THEN 190 RESID = ONE / EPS 191 RETURN 192 END IF 193* 194* Compute B - A*X 195* 196 DO 10 J = 1, NRHS 197 CALL ZHBMV( UPLO, N, KD, -CONE, A, LDA, X( 1, J ), 1, CONE, 198 $ B( 1, J ), 1 ) 199 10 CONTINUE 200* 201* Compute the maximum over the number of right hand sides of 202* norm( B - A*X ) / ( norm(A) * norm(X) * EPS ) 203* 204 RESID = ZERO 205 DO 20 J = 1, NRHS 206 BNORM = DZASUM( N, B( 1, J ), 1 ) 207 XNORM = DZASUM( N, X( 1, J ), 1 ) 208 IF( XNORM.LE.ZERO ) THEN 209 RESID = ONE / EPS 210 ELSE 211 RESID = MAX( RESID, ( ( BNORM / ANORM ) / XNORM ) / EPS ) 212 END IF 213 20 CONTINUE 214* 215 RETURN 216* 217* End of ZPBT02 218* 219 END 220