LAPACK  3.10.0
LAPACK: Linear Algebra PACKage
dtbt02.f
Go to the documentation of this file.
1 *> \brief \b DTBT02
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 DTBT02( UPLO, TRANS, DIAG, N, KD, NRHS, AB, LDAB, X,
12 * LDX, B, LDB, WORK, RESID )
13 *
14 * .. Scalar Arguments ..
15 * CHARACTER DIAG, TRANS, UPLO
16 * INTEGER KD, LDAB, LDB, LDX, N, NRHS
17 * DOUBLE PRECISION RESID
18 * ..
19 * .. Array Arguments ..
20 * DOUBLE PRECISION AB( LDAB, * ), B( LDB, * ), WORK( * ),
21 * $ X( LDX, * )
22 * ..
23 *
24 *
25 *> \par Purpose:
26 * =============
27 *>
28 *> \verbatim
29 *>
30 *> DTBT02 computes the residual for the computed solution to a
31 *> triangular system of linear equations A*x = b or A' *x = b when
32 *> A is a triangular band matrix. Here A' is the transpose of A and
33 *> x and b are N by NRHS matrices. The test ratio is the maximum over
34 *> the number of right hand sides of
35 *> norm(b - op(A)*x) / ( norm(op(A)) * norm(x) * EPS ),
36 *> where op(A) denotes A or A' and EPS is the machine epsilon.
37 *> The norm used is the 1-norm.
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**T * X = B (Transpose)
57 *> = 'C': A**H * 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] X
105 *> \verbatim
106 *> X is DOUBLE PRECISION array, dimension (LDX,NRHS)
107 *> The computed solution vectors for the system of linear
108 *> equations.
109 *> \endverbatim
110 *>
111 *> \param[in] LDX
112 *> \verbatim
113 *> LDX is INTEGER
114 *> The leading dimension of the array X. LDX >= max(1,N).
115 *> \endverbatim
116 *>
117 *> \param[in] B
118 *> \verbatim
119 *> B is DOUBLE PRECISION array, dimension (LDB,NRHS)
120 *> The right hand side vectors for the system of linear
121 *> equations.
122 *> \endverbatim
123 *>
124 *> \param[in] LDB
125 *> \verbatim
126 *> LDB is INTEGER
127 *> The leading dimension of the array B. LDB >= max(1,N).
128 *> \endverbatim
129 *>
130 *> \param[out] WORK
131 *> \verbatim
132 *> WORK is DOUBLE PRECISION array, dimension (N)
133 *> \endverbatim
134 *>
135 *> \param[out] RESID
136 *> \verbatim
137 *> RESID is DOUBLE PRECISION
138 *> The maximum over the number of right hand sides of
139 *> norm(B - op(A)*X) / ( norm(op(A)) * norm(X) * EPS ).
140 *> \endverbatim
141 *
142 * Authors:
143 * ========
144 *
145 *> \author Univ. of Tennessee
146 *> \author Univ. of California Berkeley
147 *> \author Univ. of Colorado Denver
148 *> \author NAG Ltd.
149 *
150 *> \ingroup double_lin
151 *
152 * =====================================================================
153  SUBROUTINE dtbt02( UPLO, TRANS, DIAG, N, KD, NRHS, AB, LDAB, X,
154  $ LDX, B, LDB, WORK, RESID )
155 *
156 * -- LAPACK test routine --
157 * -- LAPACK is a software package provided by Univ. of Tennessee, --
158 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
159 *
160 * .. Scalar Arguments ..
161  CHARACTER DIAG, TRANS, UPLO
162  INTEGER KD, LDAB, LDB, LDX, N, NRHS
163  DOUBLE PRECISION RESID
164 * ..
165 * .. Array Arguments ..
166  DOUBLE PRECISION AB( LDAB, * ), B( LDB, * ), WORK( * ),
167  $ x( ldx, * )
168 * ..
169 *
170 * =====================================================================
171 *
172 * .. Parameters ..
173  DOUBLE PRECISION ZERO, ONE
174  parameter( zero = 0.0d+0, one = 1.0d+0 )
175 * ..
176 * .. Local Scalars ..
177  INTEGER J
178  DOUBLE PRECISION ANORM, BNORM, EPS, XNORM
179 * ..
180 * .. External Functions ..
181  LOGICAL LSAME
182  DOUBLE PRECISION DASUM, DLAMCH, DLANTB
183  EXTERNAL lsame, dasum, dlamch, dlantb
184 * ..
185 * .. External Subroutines ..
186  EXTERNAL daxpy, dcopy, dtbmv
187 * ..
188 * .. Intrinsic Functions ..
189  INTRINSIC max
190 * ..
191 * .. Executable Statements ..
192 *
193 * Quick exit if N = 0 or NRHS = 0
194 *
195  IF( n.LE.0 .OR. nrhs.LE.0 ) THEN
196  resid = zero
197  RETURN
198  END IF
199 *
200 * Compute the 1-norm of op(A).
201 *
202  IF( lsame( trans, 'N' ) ) THEN
203  anorm = dlantb( '1', uplo, diag, n, kd, ab, ldab, work )
204  ELSE
205  anorm = dlantb( 'I', uplo, diag, n, kd, ab, ldab, work )
206  END IF
207 *
208 * Exit with RESID = 1/EPS if ANORM = 0.
209 *
210  eps = dlamch( 'Epsilon' )
211  IF( anorm.LE.zero ) THEN
212  resid = one / eps
213  RETURN
214  END IF
215 *
216 * Compute the maximum over the number of right hand sides of
217 * norm(B - op(A)*X) / ( norm(op(A)) * norm(X) * EPS ).
218 *
219  resid = zero
220  DO 10 j = 1, nrhs
221  CALL dcopy( n, x( 1, j ), 1, work, 1 )
222  CALL dtbmv( uplo, trans, diag, n, kd, ab, ldab, work, 1 )
223  CALL daxpy( n, -one, b( 1, j ), 1, work, 1 )
224  bnorm = dasum( n, work, 1 )
225  xnorm = dasum( n, x( 1, j ), 1 )
226  IF( xnorm.LE.zero ) THEN
227  resid = one / eps
228  ELSE
229  resid = max( resid, ( ( bnorm / anorm ) / xnorm ) / eps )
230  END IF
231  10 CONTINUE
232 *
233  RETURN
234 *
235 * End of DTBT02
236 *
237  END
subroutine dcopy(N, DX, INCX, DY, INCY)
DCOPY
Definition: dcopy.f:82
subroutine daxpy(N, DA, DX, INCX, DY, INCY)
DAXPY
Definition: daxpy.f:89
subroutine dtbmv(UPLO, TRANS, DIAG, N, K, A, LDA, X, INCX)
DTBMV
Definition: dtbmv.f:186
subroutine dtbt02(UPLO, TRANS, DIAG, N, KD, NRHS, AB, LDAB, X, LDX, B, LDB, WORK, RESID)
DTBT02
Definition: dtbt02.f:155