LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
dtbt03.f
Go to the documentation of this file.
1*> \brief \b DTBT03
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 DTBT03( UPLO, TRANS, DIAG, N, KD, NRHS, AB, LDAB,
12* SCALE, CNORM, TSCAL, X, LDX, B, LDB, WORK,
13* RESID )
14*
15* .. Scalar Arguments ..
16* CHARACTER DIAG, TRANS, UPLO
17* INTEGER KD, LDAB, LDB, LDX, N, NRHS
18* DOUBLE PRECISION RESID, SCALE, TSCAL
19* ..
20* .. Array Arguments ..
21* DOUBLE PRECISION AB( LDAB, * ), B( LDB, * ), CNORM( * ),
22* $ WORK( * ), X( LDX, * )
23* ..
24*
25*
26*> \par Purpose:
27* =============
28*>
29*> \verbatim
30*>
31*> DTBT03 computes the residual for the solution to a scaled triangular
32*> system of equations A*x = s*b or A'*x = s*b when A is a
33*> triangular band matrix. Here A' is the transpose of A, s is a scalar,
34*> and x and b are N by NRHS matrices. The test ratio is the maximum
35*> over the number of right hand sides of
36*> norm(s*b - op(A)*x) / ( norm(op(A)) * norm(x) * EPS ),
37*> where op(A) denotes A or A' and EPS is the machine epsilon.
38*> \endverbatim
39*
40* Arguments:
41* ==========
42*
43*> \param[in] UPLO
44*> \verbatim
45*> UPLO is CHARACTER*1
46*> Specifies whether the matrix A is upper or lower triangular.
47*> = 'U': Upper triangular
48*> = 'L': Lower triangular
49*> \endverbatim
50*>
51*> \param[in] TRANS
52*> \verbatim
53*> TRANS is CHARACTER*1
54*> Specifies the operation applied to A.
55*> = 'N': A *x = b (No transpose)
56*> = 'T': A'*x = b (Transpose)
57*> = 'C': A'*x = b (Conjugate transpose = Transpose)
58*> \endverbatim
59*>
60*> \param[in] DIAG
61*> \verbatim
62*> DIAG is CHARACTER*1
63*> Specifies whether or not the matrix A is unit triangular.
64*> = 'N': Non-unit triangular
65*> = 'U': Unit triangular
66*> \endverbatim
67*>
68*> \param[in] N
69*> \verbatim
70*> N is INTEGER
71*> The order of the matrix A. N >= 0.
72*> \endverbatim
73*>
74*> \param[in] KD
75*> \verbatim
76*> KD is INTEGER
77*> The number of superdiagonals or subdiagonals of the
78*> triangular band matrix A. KD >= 0.
79*> \endverbatim
80*>
81*> \param[in] NRHS
82*> \verbatim
83*> NRHS is INTEGER
84*> The number of right hand sides, i.e., the number of columns
85*> of the matrices X and B. NRHS >= 0.
86*> \endverbatim
87*>
88*> \param[in] AB
89*> \verbatim
90*> AB is DOUBLE PRECISION array, dimension (LDAB,N)
91*> The upper or lower triangular band matrix A, stored in the
92*> first kd+1 rows of the array. The j-th column of A is stored
93*> in the j-th column of the array AB as follows:
94*> if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
95*> if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+kd).
96*> \endverbatim
97*>
98*> \param[in] LDAB
99*> \verbatim
100*> LDAB is INTEGER
101*> The leading dimension of the array AB. LDAB >= KD+1.
102*> \endverbatim
103*>
104*> \param[in] SCALE
105*> \verbatim
106*> SCALE is DOUBLE PRECISION
107*> The scaling factor s used in solving the triangular system.
108*> \endverbatim
109*>
110*> \param[in] CNORM
111*> \verbatim
112*> CNORM is DOUBLE PRECISION array, dimension (N)
113*> The 1-norms of the columns of A, not counting the diagonal.
114*> \endverbatim
115*>
116*> \param[in] TSCAL
117*> \verbatim
118*> TSCAL is DOUBLE PRECISION
119*> The scaling factor used in computing the 1-norms in CNORM.
120*> CNORM actually contains the column norms of TSCAL*A.
121*> \endverbatim
122*>
123*> \param[in] X
124*> \verbatim
125*> X is DOUBLE PRECISION array, dimension (LDX,NRHS)
126*> The computed solution vectors for the system of linear
127*> equations.
128*> \endverbatim
129*>
130*> \param[in] LDX
131*> \verbatim
132*> LDX is INTEGER
133*> The leading dimension of the array X. LDX >= max(1,N).
134*> \endverbatim
135*>
136*> \param[in] B
137*> \verbatim
138*> B is DOUBLE PRECISION array, dimension (LDB,NRHS)
139*> The right hand side vectors for the system of linear
140*> equations.
141*> \endverbatim
142*>
143*> \param[in] LDB
144*> \verbatim
145*> LDB is INTEGER
146*> The leading dimension of the array B. LDB >= max(1,N).
147*> \endverbatim
148*>
149*> \param[out] WORK
150*> \verbatim
151*> WORK is DOUBLE PRECISION array, dimension (N)
152*> \endverbatim
153*>
154*> \param[out] RESID
155*> \verbatim
156*> RESID is DOUBLE PRECISION
157*> The maximum over the number of right hand sides of
158*> norm(op(A)*x - s*b) / ( norm(op(A)) * norm(x) * EPS ).
159*> \endverbatim
160*
161* Authors:
162* ========
163*
164*> \author Univ. of Tennessee
165*> \author Univ. of California Berkeley
166*> \author Univ. of Colorado Denver
167*> \author NAG Ltd.
168*
169*> \ingroup double_lin
170*
171* =====================================================================
172 SUBROUTINE dtbt03( UPLO, TRANS, DIAG, N, KD, NRHS, AB, LDAB,
173 $ SCALE, CNORM, TSCAL, X, LDX, B, LDB, WORK,
174 $ RESID )
175*
176* -- LAPACK test routine --
177* -- LAPACK is a software package provided by Univ. of Tennessee, --
178* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
179*
180* .. Scalar Arguments ..
181 CHARACTER DIAG, TRANS, UPLO
182 INTEGER KD, LDAB, LDB, LDX, N, NRHS
183 DOUBLE PRECISION RESID, SCALE, TSCAL
184* ..
185* .. Array Arguments ..
186 DOUBLE PRECISION AB( LDAB, * ), B( LDB, * ), CNORM( * ),
187 $ WORK( * ), X( LDX, * )
188* ..
189*
190* =====================================================================
191*
192* .. Parameters ..
193 DOUBLE PRECISION ONE, ZERO
194 PARAMETER ( ONE = 1.0d+0, zero = 0.0d+0 )
195* ..
196* .. Local Scalars ..
197 INTEGER IX, J
198 DOUBLE PRECISION BIGNUM, EPS, ERR, SMLNUM, TNORM, XNORM, XSCAL
199* ..
200* .. External Functions ..
201 LOGICAL LSAME
202 INTEGER IDAMAX
203 DOUBLE PRECISION DLAMCH
204 EXTERNAL lsame, idamax, dlamch
205* ..
206* .. External Subroutines ..
207 EXTERNAL daxpy, dcopy, dscal, dtbmv
208* ..
209* .. Intrinsic Functions ..
210 INTRINSIC abs, dble, max
211* ..
212* .. Executable Statements ..
213*
214* Quick exit if N = 0
215*
216 IF( n.LE.0 .OR. nrhs.LE.0 ) THEN
217 resid = zero
218 RETURN
219 END IF
220 eps = dlamch( 'Epsilon' )
221 smlnum = dlamch( 'Safe minimum' )
222 bignum = one / smlnum
223*
224* Compute the norm of the triangular matrix A using the column
225* norms already computed by DLATBS.
226*
227 tnorm = zero
228 IF( lsame( diag, 'N' ) ) THEN
229 IF( lsame( uplo, 'U' ) ) THEN
230 DO 10 j = 1, n
231 tnorm = max( tnorm, tscal*abs( ab( kd+1, j ) )+
232 $ cnorm( j ) )
233 10 CONTINUE
234 ELSE
235 DO 20 j = 1, n
236 tnorm = max( tnorm, tscal*abs( ab( 1, j ) )+cnorm( j ) )
237 20 CONTINUE
238 END IF
239 ELSE
240 DO 30 j = 1, n
241 tnorm = max( tnorm, tscal+cnorm( j ) )
242 30 CONTINUE
243 END IF
244*
245* Compute the maximum over the number of right hand sides of
246* norm(op(A)*x - s*b) / ( norm(op(A)) * norm(x) * EPS ).
247*
248 resid = zero
249 DO 40 j = 1, nrhs
250 CALL dcopy( n, x( 1, j ), 1, work, 1 )
251 ix = idamax( n, work, 1 )
252 xnorm = max( one, abs( x( ix, j ) ) )
253 xscal = ( one / xnorm ) / dble( kd+1 )
254 CALL dscal( n, xscal, work, 1 )
255 CALL dtbmv( uplo, trans, diag, n, kd, ab, ldab, work, 1 )
256 CALL daxpy( n, -scale*xscal, b( 1, j ), 1, work, 1 )
257 ix = idamax( n, work, 1 )
258 err = tscal*abs( work( ix ) )
259 ix = idamax( n, x( 1, j ), 1 )
260 xnorm = abs( x( ix, j ) )
261 IF( err*smlnum.LE.xnorm ) THEN
262 IF( xnorm.GT.zero )
263 $ err = err / xnorm
264 ELSE
265 IF( err.GT.zero )
266 $ err = one / eps
267 END IF
268 IF( err*smlnum.LE.tnorm ) THEN
269 IF( tnorm.GT.zero )
270 $ err = err / tnorm
271 ELSE
272 IF( err.GT.zero )
273 $ err = one / eps
274 END IF
275 resid = max( resid, err )
276 40 CONTINUE
277*
278 RETURN
279*
280* End of DTBT03
281*
282 END
subroutine dtbt03(uplo, trans, diag, n, kd, nrhs, ab, ldab, scale, cnorm, tscal, x, ldx, b, ldb, work, resid)
DTBT03
Definition dtbt03.f:175
subroutine daxpy(n, da, dx, incx, dy, incy)
DAXPY
Definition daxpy.f:89
subroutine dcopy(n, dx, incx, dy, incy)
DCOPY
Definition dcopy.f:82
subroutine dscal(n, da, dx, incx)
DSCAL
Definition dscal.f:79
subroutine dtbmv(uplo, trans, diag, n, k, a, lda, x, incx)
DTBMV
Definition dtbmv.f:186