3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
11 * SUBROUTINE ZGET02( TRANS, M, N, NRHS, A, LDA, X, LDX, B, LDB,
14 * .. Scalar Arguments ..
16 * INTEGER LDA, LDB, LDX, M, N, NRHS
17 * DOUBLE PRECISION RESID
19 * .. Array Arguments ..
20 * DOUBLE PRECISION RWORK( * )
21 * COMPLEX*16 A( LDA, * ), B( LDB, * ), X( LDX, * )
30 *> ZGET02 computes the residual for a solution of a system of linear
31 *> equations A*x = b or A'*x = b:
32 *> RESID = norm(B - A*X) / ( norm(A) * norm(X) * EPS ),
33 *> where EPS is the machine epsilon.
41 *> TRANS is CHARACTER*1
42 *> Specifies the form of the system of equations:
44 *> = 'T': A^T*x = b, where A^T is the transpose of A
45 *> = 'C': A^H*x = b, where A^H is the conjugate transpose of A
51 *> The number of rows of the matrix A. M >= 0.
57 *> The number of columns of the matrix A. N >= 0.
63 *> The number of columns of B, the matrix of right hand sides.
69 *> A is COMPLEX*16 array, dimension (LDA,N)
70 *> The original M x N matrix A.
76 *> The leading dimension of the array A. LDA >= max(1,M).
81 *> X is COMPLEX*16 array, dimension (LDX,NRHS)
82 *> The computed solution vectors for the system of linear
89 *> The leading dimension of the array X. If TRANS = 'N',
90 *> LDX >= max(1,N); if TRANS = 'T' or 'C', LDX >= max(1,M).
95 *> B is COMPLEX*16 array, dimension (LDB,NRHS)
96 *> On entry, the right hand side vectors for the system of
98 *> On exit, B is overwritten with the difference B - A*X.
104 *> The leading dimension of the array B. IF TRANS = 'N',
105 *> LDB >= max(1,M); if TRANS = 'T' or 'C', LDB >= max(1,N).
110 *> RWORK is DOUBLE PRECISION array, dimension (M)
115 *> RESID is DOUBLE PRECISION
116 *> The maximum over the number of right hand sides of
117 *> norm(B - A*X) / ( norm(A) * norm(X) * EPS ).
123 *> \author Univ. of Tennessee
124 *> \author Univ. of California Berkeley
125 *> \author Univ. of Colorado Denver
128 *> \date November 2015
130 *> \ingroup complex16_lin
132 * =====================================================================
133 SUBROUTINE ZGET02( TRANS, M, N, NRHS, A, LDA, X, LDX, B, LDB,
136 * -- LAPACK test routine (version 3.6.0) --
137 * -- LAPACK is a software package provided by Univ. of Tennessee, --
138 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
141 * .. Scalar Arguments ..
143 INTEGER LDA, LDB, LDX, M, N, NRHS
144 DOUBLE PRECISION RESID
146 * .. Array Arguments ..
147 DOUBLE PRECISION RWORK( * )
148 COMPLEX*16 A( LDA, * ), B( LDB, * ), X( LDX, * )
151 * =====================================================================
154 DOUBLE PRECISION ZERO, ONE
155 PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 )
157 PARAMETER ( CONE = ( 1.0D+0, 0.0D+0 ) )
159 * .. Local Scalars ..
161 DOUBLE PRECISION ANORM, BNORM, EPS, XNORM
163 * .. External Functions ..
165 DOUBLE PRECISION DLAMCH, DZASUM, ZLANGE
166 EXTERNAL LSAME, DLAMCH, DZASUM, ZLANGE
168 * .. External Subroutines ..
171 * .. Intrinsic Functions ..
174 * .. Executable Statements ..
176 * Quick exit if M = 0 or N = 0 or NRHS = 0
178 IF( M.LE.0 .OR. N.LE.0 .OR. NRHS.EQ.0 ) THEN
183 IF( LSAME( TRANS, 'T' ) .OR. LSAME( TRANS, 'C' ) ) THEN
191 * Exit with RESID = 1/EPS if ANORM = 0.
193 EPS = DLAMCH( 'Epsilon' )
194 ANORM = ZLANGE( '1', M, N, A, LDA, RWORK )
195 IF( ANORM.LE.ZERO ) THEN
200 * Compute B - A*X (or B - A'*X ) and store in B.
202 CALL ZGEMM( TRANS, 'No transpose', N1, NRHS, N2, -CONE, A, LDA, X,
203 $ LDX, CONE, B, LDB )
205 * Compute the maximum over the number of right hand sides of
206 * norm(B - A*X) / ( norm(A) * norm(X) * EPS ) .
210 BNORM = DZASUM( N1, B( 1, J ), 1 )
211 XNORM = DZASUM( N2, X( 1, J ), 1 )
212 IF( XNORM.LE.ZERO ) THEN
215 RESID = MAX( RESID, ( ( BNORM / ANORM ) / XNORM ) / EPS )