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

◆ spbt02()

subroutine spbt02 ( character uplo,
integer n,
integer kd,
integer nrhs,
real, dimension( lda, * ) a,
integer lda,
real, dimension( ldx, * ) x,
integer ldx,
real, dimension( ldb, * ) b,
integer ldb,
real, dimension( * ) rwork,
real resid )

SPBT02

Purpose:
!> !> SPBT02 computes the residual for a solution of a symmetric banded !> system of equations A*x = b: !> RESID = norm( B - A*X ) / ( norm(A) * norm(X) * EPS) !> where EPS is the machine precision. !>
Parameters
[in]UPLO
!> UPLO is CHARACTER*1 !> Specifies whether the upper or lower triangular part of the !> symmetric matrix A is stored: !> = 'U': Upper triangular !> = 'L': Lower triangular !>
[in]N
!> N is INTEGER !> The number of rows and columns of the matrix A. N >= 0. !>
[in]KD
!> KD is INTEGER !> The number of super-diagonals of the matrix A if UPLO = 'U', !> or the number of sub-diagonals if UPLO = 'L'. KD >= 0. !>
[in]NRHS
!> NRHS is INTEGER !> The number of right hand sides. NRHS >= 0. !>
[in]A
!> A is REAL array, dimension (LDA,N) !> The original symmetric band matrix A. If UPLO = 'U', the !> upper triangular part of A is stored as a band matrix; if !> UPLO = 'L', the lower triangular part of A is stored. The !> columns of the appropriate triangle are stored in the columns !> of A and the diagonals of the triangle are stored in the rows !> of A. See SPBTRF for further details. !>
[in]LDA
!> LDA is INTEGER. !> The leading dimension of the array A. LDA >= max(1,KD+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. LDX >= max(1,N). !>
[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. LDB >= max(1,N). !>
[out]RWORK
!> RWORK is REAL array, dimension (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 134 of file spbt02.f.

136*
137* -- LAPACK test routine --
138* -- LAPACK is a software package provided by Univ. of Tennessee, --
139* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
140*
141* .. Scalar Arguments ..
142 CHARACTER UPLO
143 INTEGER KD, LDA, LDB, LDX, N, NRHS
144 REAL RESID
145* ..
146* .. Array Arguments ..
147 REAL A( LDA, * ), B( LDB, * ), RWORK( * ),
148 $ X( LDX, * )
149* ..
150*
151* =====================================================================
152*
153* .. Parameters ..
154 REAL ZERO, ONE
155 parameter( zero = 0.0e+0, one = 1.0e+0 )
156* ..
157* .. Local Scalars ..
158 INTEGER J
159 REAL ANORM, BNORM, EPS, XNORM
160* ..
161* .. External Functions ..
162 REAL SASUM, SLAMCH, SLANSB
163 EXTERNAL sasum, slamch, slansb
164* ..
165* .. External Subroutines ..
166 EXTERNAL ssbmv
167* ..
168* .. Intrinsic Functions ..
169 INTRINSIC max
170* ..
171* .. Executable Statements ..
172*
173* Quick exit if N = 0 or NRHS = 0.
174*
175 IF( n.LE.0 .OR. nrhs.LE.0 ) THEN
176 resid = zero
177 RETURN
178 END IF
179*
180* Exit with RESID = 1/EPS if ANORM = 0.
181*
182 eps = slamch( 'Epsilon' )
183 anorm = slansb( '1', uplo, n, kd, a, lda, rwork )
184 IF( anorm.LE.zero ) THEN
185 resid = one / eps
186 RETURN
187 END IF
188*
189* Compute B - A*X
190*
191 DO 10 j = 1, nrhs
192 CALL ssbmv( uplo, n, kd, -one, a, lda, x( 1, j ), 1, one,
193 $ b( 1, j ), 1 )
194 10 CONTINUE
195*
196* Compute the maximum over the number of right hand sides of
197* norm( B - A*X ) / ( norm(A) * norm(X) * EPS )
198*
199 resid = zero
200 DO 20 j = 1, nrhs
201 bnorm = sasum( n, b( 1, j ), 1 )
202 xnorm = sasum( n, x( 1, j ), 1 )
203 IF( xnorm.LE.zero ) THEN
204 resid = one / eps
205 ELSE
206 resid = max( resid, ( ( bnorm / anorm ) / xnorm ) / eps )
207 END IF
208 20 CONTINUE
209*
210 RETURN
211*
212* End of SPBT02
213*
real function sasum(n, sx, incx)
SASUM
Definition sasum.f:72
subroutine ssbmv(uplo, n, k, alpha, a, lda, x, incx, beta, y, incy)
SSBMV
Definition ssbmv.f:184
real function slamch(cmach)
SLAMCH
Definition slamch.f:68
real function slansb(norm, uplo, n, k, ab, ldab, work)
SLANSB returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition slansb.f:127
Here is the call graph for this function:
Here is the caller graph for this function: