3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
11 * SUBROUTINE ZPOT06( UPLO, N, NRHS, A, LDA, X, LDX, B, LDB,
14 * .. Scalar Arguments ..
16 * INTEGER LDA, LDB, LDX, N, NRHS
17 * DOUBLE PRECISION RESID
19 * .. Array Arguments ..
20 * DOUBLE PRECISION RWORK( * )
21 * COMPLEX*16 A( LDA, * ), B( LDB, * ), X( LDX, * )
30 *> ZPOT06 computes the residual for a solution of a system of linear
31 *> equations A*x = b :
32 *> RESID = norm(B - A*X,inf) / ( norm(A,inf) * norm(X,inf) * EPS ),
33 *> where EPS is the machine epsilon.
41 *> UPLO is CHARACTER*1
42 *> Specifies whether the upper or lower triangular part of the
43 *> symmetric matrix A is stored:
44 *> = 'U': Upper triangular
45 *> = 'L': Lower triangular
51 *> The number of rows and columns of the matrix A. N >= 0.
57 *> The number of columns of B, the matrix of right hand sides.
63 *> A is COMPLEX*16 array, dimension (LDA,N)
64 *> The original M x N matrix A.
70 *> The leading dimension of the array A. LDA >= max(1,N).
75 *> X is COMPLEX*16 array, dimension (LDX,NRHS)
76 *> The computed solution vectors for the system of linear
83 *> The leading dimension of the array X. If TRANS = 'N',
84 *> LDX >= max(1,N); if TRANS = 'T' or 'C', LDX >= max(1,N).
89 *> B is COMPLEX*16 array, dimension (LDB,NRHS)
90 *> On entry, the right hand side vectors for the system of
92 *> On exit, B is overwritten with the difference B - A*X.
98 *> The leading dimension of the array B. IF TRANS = 'N',
99 *> LDB >= max(1,M); if TRANS = 'T' or 'C', LDB >= max(1,N).
104 *> RWORK is DOUBLE PRECISION array, dimension (N)
109 *> RESID is DOUBLE PRECISION
110 *> The maximum over the number of right hand sides of
111 *> norm(B - A*X) / ( norm(A) * norm(X) * EPS ).
117 *> \author Univ. of Tennessee
118 *> \author Univ. of California Berkeley
119 *> \author Univ. of Colorado Denver
122 *> \date November 2011
124 *> \ingroup complex16_lin
126 * =====================================================================
127 SUBROUTINE ZPOT06( UPLO, N, NRHS, A, LDA, X, LDX, B, LDB,
130 * -- LAPACK test routine (version 3.4.0) --
131 * -- LAPACK is a software package provided by Univ. of Tennessee, --
132 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
135 * .. Scalar Arguments ..
137 INTEGER LDA, LDB, LDX, N, NRHS
138 DOUBLE PRECISION RESID
140 * .. Array Arguments ..
141 DOUBLE PRECISION RWORK( * )
142 COMPLEX*16 A( LDA, * ), B( LDB, * ), X( LDX, * )
145 * =====================================================================
148 DOUBLE PRECISION ZERO, ONE
149 PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 )
150 COMPLEX*16 CONE, NEGCONE
151 PARAMETER ( CONE = ( 1.0D+0, 0.0D+0 ) )
152 PARAMETER ( NEGCONE = ( -1.0D+0, 0.0D+0 ) )
154 * .. Local Scalars ..
156 DOUBLE PRECISION ANORM, BNORM, EPS, XNORM
159 * .. External Functions ..
162 DOUBLE PRECISION DLAMCH, ZLANSY
163 EXTERNAL LSAME, IZAMAX, DLAMCH, ZLANSY
165 * .. External Subroutines ..
168 * .. Intrinsic Functions ..
169 INTRINSIC ABS, DBLE, DIMAG, MAX
171 * .. Statement Functions ..
172 DOUBLE PRECISION CABS1
174 * .. Statement Function definitions ..
175 CABS1( ZDUM ) = ABS( DBLE( ZDUM ) ) + ABS( DIMAG( ZDUM ) )
178 * .. Executable Statements ..
180 * Quick exit if N = 0 or NRHS = 0
182 IF( N.LE.0 .OR. NRHS.EQ.0 ) THEN
187 * Exit with RESID = 1/EPS if ANORM = 0.
189 EPS = DLAMCH( 'Epsilon' )
190 ANORM = ZLANSY( 'I', UPLO, N, A, LDA, RWORK )
191 IF( ANORM.LE.ZERO ) THEN
196 * Compute B - A*X and store in B.
199 CALL ZHEMM( 'Left', UPLO, N, NRHS, NEGCONE, A, LDA, X,
200 $ LDX, CONE, B, LDB )
202 * Compute the maximum over the number of right hand sides of
203 * norm(B - A*X) / ( norm(A) * norm(X) * EPS ) .
207 BNORM = CABS1(B(IZAMAX( N, B( 1, J ), 1 ),J))
208 XNORM = CABS1(X(IZAMAX( N, X( 1, J ), 1 ),J))
209 IF( XNORM.LE.ZERO ) THEN
212 RESID = MAX( RESID, ( ( BNORM / ANORM ) / XNORM ) / EPS )