LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
zget02.f
Go to the documentation of this file.
1*> \brief \b ZGET02
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 ZGET02( TRANS, M, N, NRHS, A, LDA, X, LDX, B, LDB,
12* RWORK, RESID )
13*
14* .. Scalar Arguments ..
15* CHARACTER TRANS
16* INTEGER LDA, LDB, LDX, M, 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*> ZGET02 computes the residual for a solution of a system of linear
31*> equations op(A)*X = B:
32*> RESID = norm(B - op(A)*X) / ( norm(op(A)) * norm(X) * EPS ),
33*> where op(A) = A, A**T, or A**H, depending on TRANS, and EPS is the
34*> machine epsilon.
35*> \endverbatim
36*
37* Arguments:
38* ==========
39*
40*> \param[in] TRANS
41*> \verbatim
42*> TRANS is CHARACTER*1
43*> Specifies the form of the system of equations:
44*> = 'N': A * X = B (No transpose)
45*> = 'T': A**T * X = B (Transpose)
46*> = 'C': A**H * X = B (Conjugate transpose)
47*> \endverbatim
48*>
49*> \param[in] M
50*> \verbatim
51*> M is INTEGER
52*> The number of rows of the matrix A. M >= 0.
53*> \endverbatim
54*>
55*> \param[in] N
56*> \verbatim
57*> N is INTEGER
58*> The number of columns of the matrix A. N >= 0.
59*> \endverbatim
60*>
61*> \param[in] NRHS
62*> \verbatim
63*> NRHS is INTEGER
64*> The number of columns of B, the matrix of right hand sides.
65*> NRHS >= 0.
66*> \endverbatim
67*>
68*> \param[in] A
69*> \verbatim
70*> A is COMPLEX*16 array, dimension (LDA,N)
71*> The original M x N matrix A.
72*> \endverbatim
73*>
74*> \param[in] LDA
75*> \verbatim
76*> LDA is INTEGER
77*> The leading dimension of the array A. LDA >= max(1,M).
78*> \endverbatim
79*>
80*> \param[in] X
81*> \verbatim
82*> X is COMPLEX*16 array, dimension (LDX,NRHS)
83*> The computed solution vectors for the system of linear
84*> equations.
85*> \endverbatim
86*>
87*> \param[in] LDX
88*> \verbatim
89*> LDX is INTEGER
90*> The leading dimension of the array X. If TRANS = 'N',
91*> LDX >= max(1,N); if TRANS = 'T' or 'C', LDX >= max(1,M).
92*> \endverbatim
93*>
94*> \param[in,out] B
95*> \verbatim
96*> B is COMPLEX*16 array, dimension (LDB,NRHS)
97*> On entry, the right hand side vectors for the system of
98*> linear equations.
99*> On exit, B is overwritten with the difference B - A*X.
100*> \endverbatim
101*>
102*> \param[in] LDB
103*> \verbatim
104*> LDB is INTEGER
105*> The leading dimension of the array B. IF TRANS = 'N',
106*> LDB >= max(1,M); if TRANS = 'T' or 'C', LDB >= max(1,N).
107*> \endverbatim
108*>
109*> \param[out] RWORK
110*> \verbatim
111*> RWORK is DOUBLE PRECISION array, dimension (M)
112*> \endverbatim
113*>
114*> \param[out] RESID
115*> \verbatim
116*> RESID is DOUBLE PRECISION
117*> The maximum over the number of right hand sides of
118*> norm(B - op(A)*X) / ( norm(op(A)) * norm(X) * EPS ).
119*> \endverbatim
120*
121* Authors:
122* ========
123*
124*> \author Univ. of Tennessee
125*> \author Univ. of California Berkeley
126*> \author Univ. of Colorado Denver
127*> \author NAG Ltd.
128*
129*> \ingroup complex16_eig
130*
131* =====================================================================
132 SUBROUTINE zget02( TRANS, M, N, NRHS, A, LDA, X, LDX, B, LDB,
133 $ RWORK, RESID )
134*
135* -- LAPACK test routine --
136* -- LAPACK is a software package provided by Univ. of Tennessee, --
137* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
138*
139* .. Scalar Arguments ..
140 CHARACTER TRANS
141 INTEGER LDA, LDB, LDX, M, N, NRHS
142 DOUBLE PRECISION RESID
143* ..
144* .. Array Arguments ..
145 DOUBLE PRECISION RWORK( * )
146 COMPLEX*16 A( LDA, * ), B( LDB, * ), X( LDX, * )
147* ..
148*
149* =====================================================================
150*
151* .. Parameters ..
152 DOUBLE PRECISION ZERO, ONE
153 parameter( zero = 0.0d+0, one = 1.0d+0 )
154 COMPLEX*16 CONE
155 parameter( cone = ( 1.0d+0, 0.0d+0 ) )
156* ..
157* .. Local Scalars ..
158 INTEGER J, N1, N2
159 DOUBLE PRECISION ANORM, BNORM, EPS, XNORM
160* ..
161* .. External Functions ..
162 LOGICAL LSAME
163 DOUBLE PRECISION DLAMCH, DZASUM, ZLANGE
164 EXTERNAL lsame, dlamch, dzasum, zlange
165* ..
166* .. External Subroutines ..
167 EXTERNAL zgemm
168* ..
169* .. Intrinsic Functions ..
170 INTRINSIC max
171* ..
172* .. Executable Statements ..
173*
174* Quick exit if M = 0 or N = 0 or NRHS = 0
175*
176 IF( m.LE.0 .OR. n.LE.0 .OR. nrhs.EQ.0 ) THEN
177 resid = zero
178 RETURN
179 END IF
180*
181 IF( lsame( trans, 'T' ) .OR. lsame( trans, 'C' ) ) THEN
182 n1 = n
183 n2 = m
184 ELSE
185 n1 = m
186 n2 = n
187 END IF
188*
189* Exit with RESID = 1/EPS if ANORM = 0.
190*
191 eps = dlamch( 'Epsilon' )
192 IF( lsame( trans, 'N' ) ) THEN
193 anorm = zlange( '1', m, n, a, lda, rwork )
194 ELSE
195 anorm = zlange( 'I', m, n, a, lda, rwork )
196 END IF
197 IF( anorm.LE.zero ) THEN
198 resid = one / eps
199 RETURN
200 END IF
201*
202* Compute B - op(A)*X and store in B.
203*
204 CALL zgemm( trans, 'No transpose', n1, nrhs, n2, -cone, a, lda, x,
205 $ ldx, cone, b, ldb )
206*
207* Compute the maximum over the number of right hand sides of
208* norm(B - op(A)*X) / ( norm(op(A)) * norm(X) * EPS ) .
209*
210 resid = zero
211 DO 10 j = 1, nrhs
212 bnorm = dzasum( n1, b( 1, j ), 1 )
213 xnorm = dzasum( n2, x( 1, j ), 1 )
214 IF( xnorm.LE.zero ) THEN
215 resid = one / eps
216 ELSE
217 resid = max( resid, ( ( bnorm / anorm ) / xnorm ) / eps )
218 END IF
219 10 CONTINUE
220*
221 RETURN
222*
223* End of ZGET02
224*
225 END
subroutine zget02(trans, m, n, nrhs, a, lda, x, ldx, b, ldb, rwork, resid)
ZGET02
Definition zget02.f:134
subroutine zgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
ZGEMM
Definition zgemm.f:188