LAPACK  3.10.1
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 op(A)*X = B, when A is a
32 *> triangular band matrix. The test ratio is the maximum over
33 *> norm(b - op(A)*x) / ( ||op(A)||_1 * norm(x) * EPS ),
34 *> where op(A) = A or A**T, b is the column of B, x is the solution
35 *> vector, and EPS is the machine epsilon.
36 *> The norm used is the 1-norm.
37 *> \endverbatim
38 *
39 * Arguments:
40 * ==========
41 *
42 *> \param[in] UPLO
43 *> \verbatim
44 *> UPLO is CHARACTER*1
45 *> Specifies whether the matrix A is upper or lower triangular.
46 *> = 'U': Upper triangular
47 *> = 'L': Lower triangular
48 *> \endverbatim
49 *>
50 *> \param[in] TRANS
51 *> \verbatim
52 *> TRANS is CHARACTER*1
53 *> Specifies the operation applied to A.
54 *> = 'N': A * X = B (No transpose)
55 *> = 'T': A**T * X = B (Transpose)
56 *> = 'C': A**H * X = B (Conjugate transpose = Transpose)
57 *> \endverbatim
58 *>
59 *> \param[in] DIAG
60 *> \verbatim
61 *> DIAG is CHARACTER*1
62 *> Specifies whether or not the matrix A is unit triangular.
63 *> = 'N': Non-unit triangular
64 *> = 'U': Unit triangular
65 *> \endverbatim
66 *>
67 *> \param[in] N
68 *> \verbatim
69 *> N is INTEGER
70 *> The order of the matrix A. N >= 0.
71 *> \endverbatim
72 *>
73 *> \param[in] KD
74 *> \verbatim
75 *> KD is INTEGER
76 *> The number of superdiagonals or subdiagonals of the
77 *> triangular band matrix A. KD >= 0.
78 *> \endverbatim
79 *>
80 *> \param[in] NRHS
81 *> \verbatim
82 *> NRHS is INTEGER
83 *> The number of right hand sides, i.e., the number of columns
84 *> of the matrices X and B. NRHS >= 0.
85 *> \endverbatim
86 *>
87 *> \param[in] AB
88 *> \verbatim
89 *> AB is DOUBLE PRECISION array, dimension (LDAB,N)
90 *> The upper or lower triangular band matrix A, stored in the
91 *> first kd+1 rows of the array. The j-th column of A is stored
92 *> in the j-th column of the array AB as follows:
93 *> if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
94 *> if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+kd).
95 *> \endverbatim
96 *>
97 *> \param[in] LDAB
98 *> \verbatim
99 *> LDAB is INTEGER
100 *> The leading dimension of the array AB. LDAB >= KD+1.
101 *> \endverbatim
102 *>
103 *> \param[in] X
104 *> \verbatim
105 *> X is DOUBLE PRECISION array, dimension (LDX,NRHS)
106 *> The computed solution vectors for the system of linear
107 *> equations.
108 *> \endverbatim
109 *>
110 *> \param[in] LDX
111 *> \verbatim
112 *> LDX is INTEGER
113 *> The leading dimension of the array X. LDX >= max(1,N).
114 *> \endverbatim
115 *>
116 *> \param[in] B
117 *> \verbatim
118 *> B is DOUBLE PRECISION array, dimension (LDB,NRHS)
119 *> The right hand side vectors for the system of linear
120 *> equations.
121 *> \endverbatim
122 *>
123 *> \param[in] LDB
124 *> \verbatim
125 *> LDB is INTEGER
126 *> The leading dimension of the array B. LDB >= max(1,N).
127 *> \endverbatim
128 *>
129 *> \param[out] WORK
130 *> \verbatim
131 *> WORK is DOUBLE PRECISION array, dimension (N)
132 *> \endverbatim
133 *>
134 *> \param[out] RESID
135 *> \verbatim
136 *> RESID is DOUBLE PRECISION
137 *> The maximum over the number of right hand sides of
138 *> norm(op(A)*x - b) / ( norm(op(A)) * norm(x) * EPS ).
139 *> \endverbatim
140 *
141 * Authors:
142 * ========
143 *
144 *> \author Univ. of Tennessee
145 *> \author Univ. of California Berkeley
146 *> \author Univ. of Colorado Denver
147 *> \author NAG Ltd.
148 *
149 *> \ingroup double_lin
150 *
151 * =====================================================================
152  SUBROUTINE dtbt02( UPLO, TRANS, DIAG, N, KD, NRHS, AB, LDAB, X,
153  $ LDX, B, LDB, WORK, RESID )
154 *
155 * -- LAPACK test routine --
156 * -- LAPACK is a software package provided by Univ. of Tennessee, --
157 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
158 *
159 * .. Scalar Arguments ..
160  CHARACTER DIAG, TRANS, UPLO
161  INTEGER KD, LDAB, LDB, LDX, N, NRHS
162  DOUBLE PRECISION RESID
163 * ..
164 * .. Array Arguments ..
165  DOUBLE PRECISION AB( LDAB, * ), B( LDB, * ), WORK( * ),
166  $ x( ldx, * )
167 * ..
168 *
169 * =====================================================================
170 *
171 * .. Parameters ..
172  DOUBLE PRECISION ZERO, ONE
173  parameter( zero = 0.0d+0, one = 1.0d+0 )
174 * ..
175 * .. Local Scalars ..
176  INTEGER J
177  DOUBLE PRECISION ANORM, BNORM, EPS, XNORM
178 * ..
179 * .. External Functions ..
180  LOGICAL LSAME
181  DOUBLE PRECISION DASUM, DLAMCH, DLANTB
182  EXTERNAL lsame, dasum, dlamch, dlantb
183 * ..
184 * .. External Subroutines ..
185  EXTERNAL daxpy, dcopy, dtbmv
186 * ..
187 * .. Intrinsic Functions ..
188  INTRINSIC max
189 * ..
190 * .. Executable Statements ..
191 *
192 * Quick exit if N = 0 or NRHS = 0
193 *
194  IF( n.LE.0 .OR. nrhs.LE.0 ) THEN
195  resid = zero
196  RETURN
197  END IF
198 *
199 * Compute the 1-norm of op(A).
200 *
201  IF( lsame( trans, 'N' ) ) THEN
202  anorm = dlantb( '1', uplo, diag, n, kd, ab, ldab, work )
203  ELSE
204  anorm = dlantb( 'I', uplo, diag, n, kd, ab, ldab, work )
205  END IF
206 *
207 * Exit with RESID = 1/EPS if ANORM = 0.
208 *
209  eps = dlamch( 'Epsilon' )
210  IF( anorm.LE.zero ) THEN
211  resid = one / eps
212  RETURN
213  END IF
214 *
215 * Compute the maximum over the number of right hand sides of
216 * norm(op(A)*x - b) / ( norm(op(A)) * norm(x) * EPS ).
217 *
218  resid = zero
219  DO 10 j = 1, nrhs
220  CALL dcopy( n, x( 1, j ), 1, work, 1 )
221  CALL dtbmv( uplo, trans, diag, n, kd, ab, ldab, work, 1 )
222  CALL daxpy( n, -one, b( 1, j ), 1, work, 1 )
223  bnorm = dasum( n, work, 1 )
224  xnorm = dasum( n, x( 1, j ), 1 )
225  IF( xnorm.LE.zero ) THEN
226  resid = one / eps
227  ELSE
228  resid = max( resid, ( ( bnorm / anorm ) / xnorm ) / eps )
229  END IF
230  10 CONTINUE
231 *
232  RETURN
233 *
234 * End of DTBT02
235 *
236  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:154