LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ zgbt02()

subroutine zgbt02 ( character  TRANS,
integer  M,
integer  N,
integer  KL,
integer  KU,
integer  NRHS,
complex*16, dimension( lda, * )  A,
integer  LDA,
complex*16, dimension( ldx, * )  X,
integer  LDX,
complex*16, dimension( ldb, * )  B,
integer  LDB,
double precision  RESID 
)

ZGBT02

Purpose:
 ZGBT02 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*16 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*16 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*16 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
December 2016

Definition at line 141 of file zgbt02.f.

141 *
142 * -- LAPACK test routine (version 3.7.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 * December 2016
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  COMPLEX*16 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  COMPLEX*16 cone
162  parameter( cone = ( 1.0d+0, 0.0d+0 ) )
163 * ..
164 * .. Local Scalars ..
165  INTEGER i1, i2, j, kd, n1
166  DOUBLE PRECISION anorm, bnorm, eps, xnorm
167 * ..
168 * .. External Functions ..
169  LOGICAL lsame
170  DOUBLE PRECISION dlamch, dzasum
171  EXTERNAL lsame, dlamch, dzasum
172 * ..
173 * .. External Subroutines ..
174  EXTERNAL zgbmv
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 = dlamch( '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, dzasum( 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 zgbmv( 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 = dzasum( n1, b( 1, j ), 1 )
222  xnorm = dzasum( 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 ZGBT02
233 *
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65
subroutine zgbmv(TRANS, M, N, KL, KU, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
ZGBMV
Definition: zgbmv.f:189
double precision function dzasum(N, ZX, INCX)
DZASUM
Definition: dzasum.f:74
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: