3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
11 * SUBROUTINE CQRT16( TRANS, M, N, NRHS, A, LDA, X, LDX, B, LDB,
14 * .. Scalar Arguments ..
16 * INTEGER LDA, LDB, LDX, M, N, NRHS
19 * .. Array Arguments ..
21 * COMPLEX A( LDA, * ), B( LDB, * ), X( LDX, * )
30 *> CQRT16 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) / ( max(m,n) * 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 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 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 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 REAL array, dimension (M)
116 *> The maximum over the number of right hand sides of
117 *> norm(B - A*X) / ( max(m,n) * 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 2011
130 *> \ingroup complex_lin
132 * =====================================================================
133 SUBROUTINE CQRT16( TRANS, M, N, NRHS, A, LDA, X, LDX, B, LDB,
136 * -- LAPACK test routine (version 3.4.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
146 * .. Array Arguments ..
148 COMPLEX A( LDA, * ), B( LDB, * ), X( LDX, * )
151 * =====================================================================
155 PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 )
157 PARAMETER ( CONE = ( 1.0E+0, 0.0E+0 ) )
159 * .. Local Scalars ..
161 REAL ANORM, BNORM, EPS, XNORM
163 * .. External Functions ..
165 REAL CLANGE, SCASUM, SLAMCH
166 EXTERNAL LSAME, CLANGE, SCASUM, SLAMCH
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
184 ANORM = CLANGE( 'I', M, N, A, LDA, RWORK )
188 ANORM = CLANGE( '1', M, N, A, LDA, RWORK )
193 EPS = SLAMCH( 'Epsilon' )
195 * Compute B - A*X (or B - A'*X ) and store in B.
197 CALL CGEMM( TRANS, 'No transpose', N1, NRHS, N2, -CONE, A, LDA, X,
198 $ LDX, CONE, B, LDB )
200 * Compute the maximum over the number of right hand sides of
201 * norm(B - A*X) / ( max(m,n) * norm(A) * norm(X) * EPS ) .
205 BNORM = SCASUM( N1, B( 1, J ), 1 )
206 XNORM = SCASUM( N2, X( 1, J ), 1 )
207 IF( ANORM.EQ.ZERO .AND. BNORM.EQ.ZERO ) THEN
209 ELSE IF( ANORM.LE.ZERO .OR. XNORM.LE.ZERO ) THEN
212 RESID = MAX( RESID, ( ( BNORM / ANORM ) / XNORM ) /
213 $ ( MAX( M, N )*EPS ) )