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

CGBT02

Purpose:
 CGBT02 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 COMPLEX 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 COMPLEX 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 COMPLEX 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 REAL
          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 cgbt02.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  REAL resid
151 * ..
152 * .. Array Arguments ..
153  COMPLEX a( lda, * ), b( ldb, * ), x( ldx, * )
154 * ..
155 *
156 * =====================================================================
157 *
158 * .. Parameters ..
159  REAL zero, one
160  parameter ( zero = 0.0e+0, one = 1.0e+0 )
161  COMPLEX cone
162  parameter ( cone = ( 1.0e+0, 0.0e+0 ) )
163 * ..
164 * .. Local Scalars ..
165  INTEGER i1, i2, j, kd, n1
166  REAL anorm, bnorm, eps, xnorm
167 * ..
168 * .. External Functions ..
169  LOGICAL lsame
170  REAL scasum, slamch
171  EXTERNAL lsame, scasum, slamch
172 * ..
173 * .. External Subroutines ..
174  EXTERNAL cgbmv
175 * ..
176 * .. Intrinsic Functions ..
177  INTRINSIC max, min
178 * ..
179 * .. Executable Statements ..
180 *
181 * Quick return if N = 0 pr NRHS = 0
182 *
183  IF( m.LE.0 .OR. n.LE.0 .OR. nrhs.LE.0 ) THEN
184  resid = zero
185  RETURN
186  END IF
187 *
188 * Exit with RESID = 1/EPS if ANORM = 0.
189 *
190  eps = slamch( 'Epsilon' )
191  kd = ku + 1
192  anorm = zero
193  DO 10 j = 1, n
194  i1 = max( kd+1-j, 1 )
195  i2 = min( kd+m-j, kl+kd )
196  anorm = max( anorm, scasum( i2-i1+1, a( i1, j ), 1 ) )
197  10 CONTINUE
198  IF( anorm.LE.zero ) THEN
199  resid = one / eps
200  RETURN
201  END IF
202 *
203  IF( lsame( trans, 'T' ) .OR. lsame( trans, 'C' ) ) THEN
204  n1 = n
205  ELSE
206  n1 = m
207  END IF
208 *
209 * Compute B - A*X (or B - A'*X )
210 *
211  DO 20 j = 1, nrhs
212  CALL cgbmv( trans, m, n, kl, ku, -cone, a, lda, x( 1, j ), 1,
213  $ cone, b( 1, j ), 1 )
214  20 CONTINUE
215 *
216 * Compute the maximum over the number of right hand sides of
217 * norm(B - A*X) / ( norm(A) * norm(X) * EPS ).
218 *
219  resid = zero
220  DO 30 j = 1, nrhs
221  bnorm = scasum( n1, b( 1, j ), 1 )
222  xnorm = scasum( n1, x( 1, j ), 1 )
223  IF( xnorm.LE.zero ) THEN
224  resid = one / eps
225  ELSE
226  resid = max( resid, ( ( bnorm/anorm )/xnorm )/eps )
227  END IF
228  30 CONTINUE
229 *
230  RETURN
231 *
232 * End of CGBT02
233 *
real function scasum(N, CX, INCX)
SCASUM
Definition: scasum.f:54
subroutine cgbmv(TRANS, M, N, KL, KU, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
CGBMV
Definition: cgbmv.f:189
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
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: