LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages

◆ stbt03()

subroutine stbt03 ( character uplo,
character trans,
character diag,
integer n,
integer kd,
integer nrhs,
real, dimension( ldab, * ) ab,
integer ldab,
real scale,
real, dimension( * ) cnorm,
real tscal,
real, dimension( ldx, * ) x,
integer ldx,
real, dimension( ldb, * ) b,
integer ldb,
real, dimension( * ) work,
real resid )

STBT03

Purpose:
!> !> STBT03 computes the residual for the solution to a scaled triangular !> system of equations A*x = s*b or A'*x = s*b when A is a !> triangular band matrix. Here A' is the transpose of A, s is a scalar, !> and x and b are N by NRHS matrices. The test ratio is the maximum !> over the number of right hand sides of !> norm(s*b - op(A)*x) / ( norm(op(A)) * norm(x) * EPS ), !> where op(A) denotes A or A' and EPS is the machine epsilon. !>
Parameters
[in]UPLO
!> UPLO is CHARACTER*1 !> Specifies whether the matrix A is upper or lower triangular. !> = 'U': Upper triangular !> = 'L': Lower triangular !>
[in]TRANS
!> TRANS is CHARACTER*1 !> Specifies the operation applied to A. !> = 'N': A *x = b (No transpose) !> = 'T': A'*x = b (Transpose) !> = 'C': A'*x = b (Conjugate transpose = Transpose) !>
[in]DIAG
!> DIAG is CHARACTER*1 !> Specifies whether or not the matrix A is unit triangular. !> = 'N': Non-unit triangular !> = 'U': Unit triangular !>
[in]N
!> N is INTEGER !> The order of the matrix A. N >= 0. !>
[in]KD
!> KD is INTEGER !> The number of superdiagonals or subdiagonals of the !> triangular band matrix A. KD >= 0. !>
[in]NRHS
!> NRHS is INTEGER !> The number of right hand sides, i.e., the number of columns !> of the matrices X and B. NRHS >= 0. !>
[in]AB
!> AB is REAL array, dimension (LDAB,N) !> The upper or lower triangular band matrix A, stored in the !> first kd+1 rows of the array. The j-th column of A is stored !> in the j-th column of the array AB as follows: !> if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j; !> if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+kd). !>
[in]LDAB
!> LDAB is INTEGER !> The leading dimension of the array AB. LDAB >= KD+1. !>
[in]SCALE
!> SCALE is REAL !> The scaling factor s used in solving the triangular system. !>
[in]CNORM
!> CNORM is REAL array, dimension (N) !> The 1-norms of the columns of A, not counting the diagonal. !>
[in]TSCAL
!> TSCAL is REAL !> The scaling factor used in computing the 1-norms in CNORM. !> CNORM actually contains the column norms of TSCAL*A. !>
[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. LDX >= max(1,N). !>
[in]B
!> B is REAL array, dimension (LDB,NRHS) !> The right hand side vectors for the system of linear !> equations. !>
[in]LDB
!> LDB is INTEGER !> The leading dimension of the array B. LDB >= max(1,N). !>
[out]WORK
!> WORK is REAL array, dimension (N) !>
[out]RESID
!> RESID is REAL !> The maximum over the number of right hand sides of !> norm(op(A)*x - s*b) / ( norm(op(A)) * norm(x) * EPS ). !>
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 172 of file stbt03.f.

175*
176* -- LAPACK test routine --
177* -- LAPACK is a software package provided by Univ. of Tennessee, --
178* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
179*
180* .. Scalar Arguments ..
181 CHARACTER DIAG, TRANS, UPLO
182 INTEGER KD, LDAB, LDB, LDX, N, NRHS
183 REAL RESID, SCALE, TSCAL
184* ..
185* .. Array Arguments ..
186 REAL AB( LDAB, * ), B( LDB, * ), CNORM( * ),
187 $ WORK( * ), X( LDX, * )
188* ..
189*
190* =====================================================================
191*
192* .. Parameters ..
193 REAL ONE, ZERO
194 parameter( one = 1.0e+0, zero = 0.0e+0 )
195* ..
196* .. Local Scalars ..
197 INTEGER IX, J
198 REAL BIGNUM, EPS, ERR, SMLNUM, TNORM, XNORM, XSCAL
199* ..
200* .. External Functions ..
201 LOGICAL LSAME
202 INTEGER ISAMAX
203 REAL SLAMCH
204 EXTERNAL lsame, isamax, slamch
205* ..
206* .. External Subroutines ..
207 EXTERNAL saxpy, scopy, sscal, stbmv
208* ..
209* .. Intrinsic Functions ..
210 INTRINSIC abs, max, real
211* ..
212* .. Executable Statements ..
213*
214* Quick exit if N = 0
215*
216 IF( n.LE.0 .OR. nrhs.LE.0 ) THEN
217 resid = zero
218 RETURN
219 END IF
220 eps = slamch( 'Epsilon' )
221 smlnum = slamch( 'Safe minimum' )
222 bignum = one / smlnum
223*
224* Compute the norm of the triangular matrix A using the column
225* norms already computed by SLATBS.
226*
227 tnorm = zero
228 IF( lsame( diag, 'N' ) ) THEN
229 IF( lsame( uplo, 'U' ) ) THEN
230 DO 10 j = 1, n
231 tnorm = max( tnorm, tscal*abs( ab( kd+1, j ) )+
232 $ cnorm( j ) )
233 10 CONTINUE
234 ELSE
235 DO 20 j = 1, n
236 tnorm = max( tnorm, tscal*abs( ab( 1, j ) )+cnorm( j ) )
237 20 CONTINUE
238 END IF
239 ELSE
240 DO 30 j = 1, n
241 tnorm = max( tnorm, tscal+cnorm( j ) )
242 30 CONTINUE
243 END IF
244*
245* Compute the maximum over the number of right hand sides of
246* norm(op(A)*x - s*b) / ( norm(op(A)) * norm(x) * EPS ).
247*
248 resid = zero
249 DO 40 j = 1, nrhs
250 CALL scopy( n, x( 1, j ), 1, work, 1 )
251 ix = isamax( n, work, 1 )
252 xnorm = max( one, abs( x( ix, j ) ) )
253 xscal = ( one / xnorm ) / real( kd+1 )
254 CALL sscal( n, xscal, work, 1 )
255 CALL stbmv( uplo, trans, diag, n, kd, ab, ldab, work, 1 )
256 CALL saxpy( n, -scale*xscal, b( 1, j ), 1, work, 1 )
257 ix = isamax( n, work, 1 )
258 err = tscal*abs( work( ix ) )
259 ix = isamax( n, x( 1, j ), 1 )
260 xnorm = abs( x( ix, j ) )
261 IF( err*smlnum.LE.xnorm ) THEN
262 IF( xnorm.GT.zero )
263 $ err = err / xnorm
264 ELSE
265 IF( err.GT.zero )
266 $ err = one / eps
267 END IF
268 IF( err*smlnum.LE.tnorm ) THEN
269 IF( tnorm.GT.zero )
270 $ err = err / tnorm
271 ELSE
272 IF( err.GT.zero )
273 $ err = one / eps
274 END IF
275 resid = max( resid, err )
276 40 CONTINUE
277*
278 RETURN
279*
280* End of STBT03
281*
subroutine saxpy(n, sa, sx, incx, sy, incy)
SAXPY
Definition saxpy.f:89
subroutine scopy(n, sx, incx, sy, incy)
SCOPY
Definition scopy.f:82
integer function isamax(n, sx, incx)
ISAMAX
Definition isamax.f:71
real function slamch(cmach)
SLAMCH
Definition slamch.f:68
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
subroutine sscal(n, sa, sx, incx)
SSCAL
Definition sscal.f:79
subroutine stbmv(uplo, trans, diag, n, k, a, lda, x, incx)
STBMV
Definition stbmv.f:186
Here is the call graph for this function:
Here is the caller graph for this function: