LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
zptt02.f
Go to the documentation of this file.
1*> \brief \b ZPTT02
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 ZPTT02( UPLO, N, NRHS, D, E, X, LDX, B, LDB, RESID )
12*
13* .. Scalar Arguments ..
14* CHARACTER UPLO
15* INTEGER LDB, LDX, N, NRHS
16* DOUBLE PRECISION RESID
17* ..
18* .. Array Arguments ..
19* DOUBLE PRECISION D( * )
20* COMPLEX*16 B( LDB, * ), E( * ), X( LDX, * )
21* ..
22*
23*
24*> \par Purpose:
25* =============
26*>
27*> \verbatim
28*>
29*> ZPTT02 computes the residual for the solution to a symmetric
30*> tridiagonal system of equations:
31*> RESID = norm(B - A*X) / (norm(A) * norm(X) * EPS),
32*> where EPS is the machine epsilon.
33*> \endverbatim
34*
35* Arguments:
36* ==========
37*
38*> \param[in] UPLO
39*> \verbatim
40*> UPLO is CHARACTER*1
41*> Specifies whether the superdiagonal or the subdiagonal of the
42*> tridiagonal matrix A is stored.
43*> = 'U': E is the superdiagonal of A
44*> = 'L': E is the subdiagonal of A
45*> \endverbatim
46*>
47*> \param[in] N
48*> \verbatim
49*> N is INTEGER
50*> The order of the matrix A.
51*> \endverbatim
52*>
53*> \param[in] NRHS
54*> \verbatim
55*> NRHS is INTEGER
56*> The number of right hand sides, i.e., the number of columns
57*> of the matrices B and X. NRHS >= 0.
58*> \endverbatim
59*>
60*> \param[in] D
61*> \verbatim
62*> D is DOUBLE PRECISION array, dimension (N)
63*> The n diagonal elements of the tridiagonal matrix A.
64*> \endverbatim
65*>
66*> \param[in] E
67*> \verbatim
68*> E is COMPLEX*16 array, dimension (N-1)
69*> The (n-1) subdiagonal elements of the tridiagonal matrix A.
70*> \endverbatim
71*>
72*> \param[in] X
73*> \verbatim
74*> X is COMPLEX*16 array, dimension (LDX,NRHS)
75*> The n by nrhs matrix of solution vectors X.
76*> \endverbatim
77*>
78*> \param[in] LDX
79*> \verbatim
80*> LDX is INTEGER
81*> The leading dimension of the array X. LDX >= max(1,N).
82*> \endverbatim
83*>
84*> \param[in,out] B
85*> \verbatim
86*> B is COMPLEX*16 array, dimension (LDB,NRHS)
87*> On entry, the n by nrhs matrix of right hand side vectors B.
88*> On exit, B is overwritten with the difference B - A*X.
89*> \endverbatim
90*>
91*> \param[in] LDB
92*> \verbatim
93*> LDB is INTEGER
94*> The leading dimension of the array B. LDB >= max(1,N).
95*> \endverbatim
96*>
97*> \param[out] RESID
98*> \verbatim
99*> RESID is DOUBLE PRECISION
100*> norm(B - A*X) / (norm(A) * norm(X) * EPS)
101*> \endverbatim
102*
103* Authors:
104* ========
105*
106*> \author Univ. of Tennessee
107*> \author Univ. of California Berkeley
108*> \author Univ. of Colorado Denver
109*> \author NAG Ltd.
110*
111*> \ingroup complex16_lin
112*
113* =====================================================================
114 SUBROUTINE zptt02( UPLO, N, NRHS, D, E, X, LDX, B, LDB, RESID )
115*
116* -- LAPACK test routine --
117* -- LAPACK is a software package provided by Univ. of Tennessee, --
118* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
119*
120* .. Scalar Arguments ..
121 CHARACTER UPLO
122 INTEGER LDB, LDX, N, NRHS
123 DOUBLE PRECISION RESID
124* ..
125* .. Array Arguments ..
126 DOUBLE PRECISION D( * )
127 COMPLEX*16 B( LDB, * ), E( * ), X( LDX, * )
128* ..
129*
130* =====================================================================
131*
132* .. Parameters ..
133 DOUBLE PRECISION ONE, ZERO
134 parameter( one = 1.0d+0, zero = 0.0d+0 )
135* ..
136* .. Local Scalars ..
137 INTEGER J
138 DOUBLE PRECISION ANORM, BNORM, EPS, XNORM
139* ..
140* .. External Functions ..
141 DOUBLE PRECISION DLAMCH, DZASUM, ZLANHT
142 EXTERNAL dlamch, dzasum, zlanht
143* ..
144* .. Intrinsic Functions ..
145 INTRINSIC max
146* ..
147* .. External Subroutines ..
148 EXTERNAL zlaptm
149* ..
150* .. Executable Statements ..
151*
152* Quick return if possible
153*
154 IF( n.LE.0 ) THEN
155 resid = zero
156 RETURN
157 END IF
158*
159* Compute the 1-norm of the tridiagonal matrix A.
160*
161 anorm = zlanht( '1', n, d, e )
162*
163* Exit with RESID = 1/EPS if ANORM = 0.
164*
165 eps = dlamch( 'Epsilon' )
166 IF( anorm.LE.zero ) THEN
167 resid = one / eps
168 RETURN
169 END IF
170*
171* Compute B - A*X.
172*
173 CALL zlaptm( uplo, n, nrhs, -one, d, e, x, ldx, one, b, ldb )
174*
175* Compute the maximum over the number of right hand sides of
176* norm(B - A*X) / ( norm(A) * norm(X) * EPS ).
177*
178 resid = zero
179 DO 10 j = 1, nrhs
180 bnorm = dzasum( n, b( 1, j ), 1 )
181 xnorm = dzasum( n, x( 1, j ), 1 )
182 IF( xnorm.LE.zero ) THEN
183 resid = one / eps
184 ELSE
185 resid = max( resid, ( ( bnorm / anorm ) / xnorm ) / eps )
186 END IF
187 10 CONTINUE
188*
189 RETURN
190*
191* End of ZPTT02
192*
193 END
subroutine zlaptm(uplo, n, nrhs, alpha, d, e, x, ldx, beta, b, ldb)
ZLAPTM
Definition zlaptm.f:129
subroutine zptt02(uplo, n, nrhs, d, e, x, ldx, b, ldb, resid)
ZPTT02
Definition zptt02.f:115