LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine dgbt02 ( character  TRANS,
integer  M,
integer  N,
integer  KL,
integer  KU,
integer  NRHS,
double precision, dimension( lda, * )  A,
integer  LDA,
double precision, dimension( ldx, * )  X,
integer  LDX,
double precision, dimension( ldb, * )  B,
integer  LDB,
double precision  RESID 
)

DGBT02

Purpose:
 DGBT02 computes the residual for a solution of a banded system of
 equations  A*x = b  or  A'*x = b:
    RESID = norm( B - A*X ) / ( norm(A) * norm(X) * EPS).
 where EPS is the machine precision.
Parameters
[in]TRANS
          TRANS is CHARACTER*1
          Specifies the form of the system of equations:
          = 'N':  A *x = b
          = 'T':  A'*x = b, where A' is the transpose of A
          = 'C':  A'*x = b, where A' is the transpose of A
[in]M
          M is INTEGER
          The number of rows of the matrix A.  M >= 0.
[in]N
          N is INTEGER
          The number of columns of the matrix A.  N >= 0.
[in]KL
          KL is INTEGER
          The number of subdiagonals within the band of A.  KL >= 0.
[in]KU
          KU is INTEGER
          The number of superdiagonals within the band of A.  KU >= 0.
[in]NRHS
          NRHS is INTEGER
          The number of columns of B.  NRHS >= 0.
[in]A
          A is DOUBLE PRECISION array, dimension (LDA,N)
          The original matrix A in band storage, stored in rows 1 to
          KL+KU+1.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(1,KL+KU+1).
[in]X
          X is DOUBLE PRECISION array, dimension (LDX,NRHS)
          The computed solution vectors for the system of linear
          equations.
[in]LDX
          LDX is INTEGER
          The leading dimension of the array X.  If TRANS = 'N',
          LDX >= max(1,N); if TRANS = 'T' or 'C', LDX >= max(1,M).
[in,out]B
          B is DOUBLE PRECISION array, dimension (LDB,NRHS)
          On entry, the right hand side vectors for the system of
          linear equations.
          On exit, B is overwritten with the difference B - A*X.
[in]LDB
          LDB is INTEGER
          The leading dimension of the array B.  IF TRANS = 'N',
          LDB >= max(1,M); if TRANS = 'T' or 'C', LDB >= max(1,N).
[out]RESID
          RESID is DOUBLE PRECISION
          The maximum over the number of right hand sides of
          norm(B - A*X) / ( norm(A) * norm(X) * EPS ).
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2011

Definition at line 141 of file dgbt02.f.

141 *
142 * -- LAPACK test routine (version 3.4.0) --
143 * -- LAPACK is a software package provided by Univ. of Tennessee, --
144 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
145 * November 2011
146 *
147 * .. Scalar Arguments ..
148  CHARACTER trans
149  INTEGER kl, ku, lda, ldb, ldx, m, n, nrhs
150  DOUBLE PRECISION resid
151 * ..
152 * .. Array Arguments ..
153  DOUBLE PRECISION a( lda, * ), b( ldb, * ), x( ldx, * )
154 * ..
155 *
156 * =====================================================================
157 *
158 * .. Parameters ..
159  DOUBLE PRECISION zero, one
160  parameter ( zero = 0.0d+0, one = 1.0d+0 )
161 * ..
162 * .. Local Scalars ..
163  INTEGER i1, i2, j, kd, n1
164  DOUBLE PRECISION anorm, bnorm, eps, xnorm
165 * ..
166 * .. External Functions ..
167  LOGICAL lsame
168  DOUBLE PRECISION dasum, dlamch
169  EXTERNAL lsame, dasum, dlamch
170 * ..
171 * .. External Subroutines ..
172  EXTERNAL dgbmv
173 * ..
174 * .. Intrinsic Functions ..
175  INTRINSIC max, min
176 * ..
177 * .. Executable Statements ..
178 *
179 * Quick return if N = 0 pr NRHS = 0
180 *
181  IF( m.LE.0 .OR. n.LE.0 .OR. nrhs.LE.0 ) THEN
182  resid = zero
183  RETURN
184  END IF
185 *
186 * Exit with RESID = 1/EPS if ANORM = 0.
187 *
188  eps = dlamch( 'Epsilon' )
189  kd = ku + 1
190  anorm = zero
191  DO 10 j = 1, n
192  i1 = max( kd+1-j, 1 )
193  i2 = min( kd+m-j, kl+kd )
194  anorm = max( anorm, dasum( i2-i1+1, a( i1, j ), 1 ) )
195  10 CONTINUE
196  IF( anorm.LE.zero ) THEN
197  resid = one / eps
198  RETURN
199  END IF
200 *
201  IF( lsame( trans, 'T' ) .OR. lsame( trans, 'C' ) ) THEN
202  n1 = n
203  ELSE
204  n1 = m
205  END IF
206 *
207 * Compute B - A*X (or B - A'*X )
208 *
209  DO 20 j = 1, nrhs
210  CALL dgbmv( trans, m, n, kl, ku, -one, a, lda, x( 1, j ), 1,
211  $ one, b( 1, j ), 1 )
212  20 CONTINUE
213 *
214 * Compute the maximum over the number of right hand sides of
215 * norm(B - A*X) / ( norm(A) * norm(X) * EPS ).
216 *
217  resid = zero
218  DO 30 j = 1, nrhs
219  bnorm = dasum( n1, b( 1, j ), 1 )
220  xnorm = dasum( n1, x( 1, j ), 1 )
221  IF( xnorm.LE.zero ) THEN
222  resid = one / eps
223  ELSE
224  resid = max( resid, ( ( bnorm / anorm ) / xnorm ) / eps )
225  END IF
226  30 CONTINUE
227 *
228  RETURN
229 *
230 * End of DGBT02
231 *
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65
subroutine dgbmv(TRANS, M, N, KL, KU, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
DGBMV
Definition: dgbmv.f:187
double precision function dasum(N, DX, INCX)
DASUM
Definition: dasum.f:53
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55

Here is the call graph for this function:

Here is the caller graph for this function: