LAPACK  3.4.2
LAPACK: Linear Algebra PACKage
 All Files Functions Groups
dpbt02.f
Go to the documentation of this file.
1 *> \brief \b DPBT02
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 DPBT02( UPLO, N, KD, NRHS, A, LDA, X, LDX, B, LDB,
12 * RWORK, RESID )
13 *
14 * .. Scalar Arguments ..
15 * CHARACTER UPLO
16 * INTEGER KD, LDA, LDB, LDX, N, NRHS
17 * DOUBLE PRECISION RESID
18 * ..
19 * .. Array Arguments ..
20 * DOUBLE PRECISION A( LDA, * ), B( LDB, * ), RWORK( * ),
21 * $ X( LDX, * )
22 * ..
23 *
24 *
25 *> \par Purpose:
26 * =============
27 *>
28 *> \verbatim
29 *>
30 *> DPBT02 computes the residual for a solution of a symmetric banded
31 *> system of equations A*x = b:
32 *> RESID = norm( B - A*X ) / ( norm(A) * norm(X) * EPS)
33 *> where EPS is the machine precision.
34 *> \endverbatim
35 *
36 * Arguments:
37 * ==========
38 *
39 *> \param[in] UPLO
40 *> \verbatim
41 *> UPLO is CHARACTER*1
42 *> Specifies whether the upper or lower triangular part of the
43 *> symmetric matrix A is stored:
44 *> = 'U': Upper triangular
45 *> = 'L': Lower triangular
46 *> \endverbatim
47 *>
48 *> \param[in] N
49 *> \verbatim
50 *> N is INTEGER
51 *> The number of rows and columns of the matrix A. N >= 0.
52 *> \endverbatim
53 *>
54 *> \param[in] KD
55 *> \verbatim
56 *> KD is INTEGER
57 *> The number of super-diagonals of the matrix A if UPLO = 'U',
58 *> or the number of sub-diagonals if UPLO = 'L'. KD >= 0.
59 *> \endverbatim
60 *>
61 *> \param[in] NRHS
62 *> \verbatim
63 *> NRHS is INTEGER
64 *> The number of right hand sides. NRHS >= 0.
65 *> \endverbatim
66 *>
67 *> \param[in] A
68 *> \verbatim
69 *> A is DOUBLE PRECISION array, dimension (LDA,N)
70 *> The original symmetric band matrix A. If UPLO = 'U', the
71 *> upper triangular part of A is stored as a band matrix; if
72 *> UPLO = 'L', the lower triangular part of A is stored. The
73 *> columns of the appropriate triangle are stored in the columns
74 *> of A and the diagonals of the triangle are stored in the rows
75 *> of A. See DPBTRF for further details.
76 *> \endverbatim
77 *>
78 *> \param[in] LDA
79 *> \verbatim
80 *> LDA is INTEGER.
81 *> The leading dimension of the array A. LDA >= max(1,KD+1).
82 *> \endverbatim
83 *>
84 *> \param[in] X
85 *> \verbatim
86 *> X is DOUBLE PRECISION array, dimension (LDX,NRHS)
87 *> The computed solution vectors for the system of linear
88 *> equations.
89 *> \endverbatim
90 *>
91 *> \param[in] LDX
92 *> \verbatim
93 *> LDX is INTEGER
94 *> The leading dimension of the array X. LDX >= max(1,N).
95 *> \endverbatim
96 *>
97 *> \param[in,out] B
98 *> \verbatim
99 *> B is DOUBLE PRECISION array, dimension (LDB,NRHS)
100 *> On entry, the right hand side vectors for the system of
101 *> linear equations.
102 *> On exit, B is overwritten with the difference B - A*X.
103 *> \endverbatim
104 *>
105 *> \param[in] LDB
106 *> \verbatim
107 *> LDB is INTEGER
108 *> The leading dimension of the array B. LDB >= max(1,N).
109 *> \endverbatim
110 *>
111 *> \param[out] RWORK
112 *> \verbatim
113 *> RWORK is DOUBLE PRECISION array, dimension (N)
114 *> \endverbatim
115 *>
116 *> \param[out] RESID
117 *> \verbatim
118 *> RESID is DOUBLE PRECISION
119 *> The maximum over the number of right hand sides of
120 *> norm(B - A*X) / ( norm(A) * norm(X) * EPS ).
121 *> \endverbatim
122 *
123 * Authors:
124 * ========
125 *
126 *> \author Univ. of Tennessee
127 *> \author Univ. of California Berkeley
128 *> \author Univ. of Colorado Denver
129 *> \author NAG Ltd.
130 *
131 *> \date November 2011
132 *
133 *> \ingroup double_lin
134 *
135 * =====================================================================
136  SUBROUTINE dpbt02( UPLO, N, KD, NRHS, A, LDA, X, LDX, B, LDB,
137  $ rwork, resid )
138 *
139 * -- LAPACK test routine (version 3.4.0) --
140 * -- LAPACK is a software package provided by Univ. of Tennessee, --
141 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
142 * November 2011
143 *
144 * .. Scalar Arguments ..
145  CHARACTER uplo
146  INTEGER kd, lda, ldb, ldx, n, nrhs
147  DOUBLE PRECISION resid
148 * ..
149 * .. Array Arguments ..
150  DOUBLE PRECISION a( lda, * ), b( ldb, * ), rwork( * ),
151  $ x( ldx, * )
152 * ..
153 *
154 * =====================================================================
155 *
156 * .. Parameters ..
157  DOUBLE PRECISION zero, one
158  parameter( zero = 0.0d+0, one = 1.0d+0 )
159 * ..
160 * .. Local Scalars ..
161  INTEGER j
162  DOUBLE PRECISION anorm, bnorm, eps, xnorm
163 * ..
164 * .. External Functions ..
165  DOUBLE PRECISION dasum, dlamch, dlansb
166  EXTERNAL dasum, dlamch, dlansb
167 * ..
168 * .. External Subroutines ..
169  EXTERNAL dsbmv
170 * ..
171 * .. Intrinsic Functions ..
172  INTRINSIC max
173 * ..
174 * .. Executable Statements ..
175 *
176 * Quick exit if N = 0 or NRHS = 0.
177 *
178  IF( n.LE.0 .OR. nrhs.LE.0 ) THEN
179  resid = zero
180  return
181  END IF
182 *
183 * Exit with RESID = 1/EPS if ANORM = 0.
184 *
185  eps = dlamch( 'Epsilon' )
186  anorm = dlansb( '1', uplo, n, kd, a, lda, rwork )
187  IF( anorm.LE.zero ) THEN
188  resid = one / eps
189  return
190  END IF
191 *
192 * Compute B - A*X
193 *
194  DO 10 j = 1, nrhs
195  CALL dsbmv( uplo, n, kd, -one, a, lda, x( 1, j ), 1, one,
196  $ b( 1, j ), 1 )
197  10 continue
198 *
199 * Compute the maximum over the number of right hand sides of
200 * norm( B - A*X ) / ( norm(A) * norm(X) * EPS )
201 *
202  resid = zero
203  DO 20 j = 1, nrhs
204  bnorm = dasum( n, b( 1, j ), 1 )
205  xnorm = dasum( n, x( 1, j ), 1 )
206  IF( xnorm.LE.zero ) THEN
207  resid = one / eps
208  ELSE
209  resid = max( resid, ( ( bnorm / anorm ) / xnorm ) / eps )
210  END IF
211  20 continue
212 *
213  return
214 *
215 * End of DPBT02
216 *
217  END