LAPACK  3.9.1
LAPACK: Linear Algebra PACKage

◆ sgbt02()

subroutine sgbt02 ( character  TRANS,
integer  M,
integer  N,
integer  KL,
integer  KU,
integer  NRHS,
real, dimension( lda, * )  A,
integer  LDA,
real, dimension( ldx, * )  X,
integer  LDX,
real, dimension( ldb, * )  B,
integer  LDB,
real  RESID 
)

SGBT02

Purpose:
 SGBT02 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 REAL 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 REAL 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 REAL 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.

Definition at line 137 of file sgbt02.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  REAL RESID
148 * ..
149 * .. Array Arguments ..
150  REAL A( LDA, * ), B( LDB, * ), X( LDX, * )
151 * ..
152 *
153 * =====================================================================
154 *
155 * .. Parameters ..
156  REAL ZERO, ONE
157  parameter( zero = 0.0e+0, one = 1.0e+0 )
158 * ..
159 * .. Local Scalars ..
160  INTEGER I1, I2, J, KD, N1
161  REAL ANORM, BNORM, EPS, XNORM
162 * ..
163 * .. External Functions ..
164  LOGICAL LSAME
165  REAL SASUM, SLAMCH
166  EXTERNAL lsame, sasum, slamch
167 * ..
168 * .. External Subroutines ..
169  EXTERNAL sgbmv
170 * ..
171 * .. Intrinsic Functions ..
172  INTRINSIC max, min
173 * ..
174 * .. Executable Statements ..
175 *
176 * Quick return if N = 0 pr NRHS = 0
177 *
178  IF( m.LE.0 .OR. 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 = slamch( 'Epsilon' )
186  kd = ku + 1
187  anorm = zero
188  DO 10 j = 1, n
189  i1 = max( kd+1-j, 1 )
190  i2 = min( kd+m-j, kl+kd )
191  anorm = max( anorm, sasum( i2-i1+1, a( i1, j ), 1 ) )
192  10 CONTINUE
193  IF( anorm.LE.zero ) THEN
194  resid = one / eps
195  RETURN
196  END IF
197 *
198  IF( lsame( trans, 'T' ) .OR. lsame( trans, 'C' ) ) THEN
199  n1 = n
200  ELSE
201  n1 = m
202  END IF
203 *
204 * Compute B - A*X (or B - A'*X )
205 *
206  DO 20 j = 1, nrhs
207  CALL sgbmv( trans, m, n, kl, ku, -one, a, lda, x( 1, j ), 1,
208  $ one, b( 1, j ), 1 )
209  20 CONTINUE
210 *
211 * Compute the maximum over the number of right hand sides of
212 * norm(B - A*X) / ( norm(A) * norm(X) * EPS ).
213 *
214  resid = zero
215  DO 30 j = 1, nrhs
216  bnorm = sasum( n1, b( 1, j ), 1 )
217  xnorm = sasum( n1, x( 1, j ), 1 )
218  IF( xnorm.LE.zero ) THEN
219  resid = one / eps
220  ELSE
221  resid = max( resid, ( ( bnorm / anorm ) / xnorm ) / eps )
222  END IF
223  30 CONTINUE
224 *
225  RETURN
226 *
227 * End of SGBT02
228 *
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:53
real function sasum(N, SX, INCX)
SASUM
Definition: sasum.f:72
subroutine sgbmv(TRANS, M, N, KL, KU, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
SGBMV
Definition: sgbmv.f:185
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:68
Here is the call graph for this function:
Here is the caller graph for this function: