LAPACK  3.9.1
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.

Definition at line 137 of file zgbt02.f.

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