LAPACK 3.12.0 LAPACK: Linear Algebra PACKage
Searching...
No Matches

## ◆ cgtt02()

 subroutine cgtt02 ( character trans, integer n, integer nrhs, complex, dimension( * ) dl, complex, dimension( * ) d, complex, dimension( * ) du, complex, dimension( ldx, * ) x, integer ldx, complex, dimension( ldb, * ) b, integer ldb, real resid )

CGTT02

Purpose:
CGTT02 computes the residual for the solution to a tridiagonal
system of equations:
RESID = norm(B - op(A)*X) / (norm(op(A)) * norm(X) * EPS),
where EPS is the machine epsilon.
Parameters
 [in] TRANS TRANS is CHARACTER Specifies the form of the residual. = 'N': B - A * X (No transpose) = 'T': B - A**T * X (Transpose) = 'C': B - A**H * X (Conjugate transpose) [in] N N is INTEGER The order of the matrix A. N >= 0. [in] NRHS NRHS is INTEGER The number of right hand sides, i.e., the number of columns of the matrices B and X. NRHS >= 0. [in] DL DL is COMPLEX array, dimension (N-1) The (n-1) sub-diagonal elements of A. [in] D D is COMPLEX array, dimension (N) The diagonal elements of A. [in] DU DU is COMPLEX array, dimension (N-1) The (n-1) super-diagonal elements of A. [in] X X is COMPLEX array, dimension (LDX,NRHS) The computed solution vectors X. [in] LDX LDX is INTEGER The leading dimension of the array X. LDX >= max(1,N). [in,out] B B is COMPLEX array, dimension (LDB,NRHS) On entry, the right hand side vectors for the system of linear equations. On exit, B is overwritten with the difference B - op(A)*X. [in] LDB LDB is INTEGER The leading dimension of the array B. LDB >= max(1,N). [out] RESID RESID is REAL norm(B - op(A)*X) / (norm(op(A)) * norm(X) * EPS)

Definition at line 122 of file cgtt02.f.

124*
125* -- LAPACK test routine --
126* -- LAPACK is a software package provided by Univ. of Tennessee, --
127* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
128*
129* .. Scalar Arguments ..
130 CHARACTER TRANS
131 INTEGER LDB, LDX, N, NRHS
132 REAL RESID
133* ..
134* .. Array Arguments ..
135 COMPLEX B( LDB, * ), D( * ), DL( * ), DU( * ),
136 \$ X( LDX, * )
137* ..
138*
139* =====================================================================
140*
141* .. Parameters ..
142 REAL ONE, ZERO
143 parameter( one = 1.0e+0, zero = 0.0e+0 )
144* ..
145* .. Local Scalars ..
146 INTEGER J
147 REAL ANORM, BNORM, EPS, XNORM
148* ..
149* .. External Functions ..
150 LOGICAL LSAME
151 REAL CLANGT, SCASUM, SLAMCH
152 EXTERNAL lsame, clangt, scasum, slamch
153* ..
154* .. External Subroutines ..
155 EXTERNAL clagtm
156* ..
157* .. Intrinsic Functions ..
158 INTRINSIC max
159* ..
160* .. Executable Statements ..
161*
162* Quick exit if N = 0 or NRHS = 0
163*
164 resid = zero
165 IF( n.LE.0 .OR. nrhs.EQ.0 )
166 \$ RETURN
167*
168* Compute the maximum over the number of right hand sides of
169* norm(B - op(A)*X) / ( norm(op(A)) * norm(X) * EPS ).
170*
171 IF( lsame( trans, 'N' ) ) THEN
172 anorm = clangt( '1', n, dl, d, du )
173 ELSE
174 anorm = clangt( 'I', n, dl, d, du )
175 END IF
176*
177* Exit with RESID = 1/EPS if ANORM = 0.
178*
179 eps = slamch( 'Epsilon' )
180 IF( anorm.LE.zero ) THEN
181 resid = one / eps
182 RETURN
183 END IF
184*
185* Compute B - op(A)*X and store in B.
186*
187 CALL clagtm( trans, n, nrhs, -one, dl, d, du, x, ldx, one, b,
188 \$ ldb )
189*
190 DO 10 j = 1, nrhs
191 bnorm = scasum( n, b( 1, j ), 1 )
192 xnorm = scasum( n, x( 1, j ), 1 )
193 IF( xnorm.LE.zero ) THEN
194 resid = one / eps
195 ELSE
196 resid = max( resid, ( ( bnorm / anorm ) / xnorm ) / eps )
197 END IF
198 10 CONTINUE
199*
200 RETURN
201*
202* End of CGTT02
203*
real function scasum(n, cx, incx)
SCASUM
Definition scasum.f:72
subroutine clagtm(trans, n, nrhs, alpha, dl, d, du, x, ldx, beta, b, ldb)
CLAGTM performs a matrix-matrix product of the form C = αAB+βC, where A is a tridiagonal matrix,...
Definition clagtm.f:145
real function slamch(cmach)
SLAMCH
Definition slamch.f:68
real function clangt(norm, n, dl, d, du)
CLANGT returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition clangt.f:106
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
Here is the call graph for this function:
Here is the caller graph for this function: