LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine sptt02 ( integer  N,
integer  NRHS,
real, dimension( * )  D,
real, dimension( * )  E,
real, dimension( ldx, * )  X,
integer  LDX,
real, dimension( ldb, * )  B,
integer  LDB,
real  RESID 
)

SPTT02

Purpose:
 SPTT02 computes the residual for the solution to a symmetric
 tridiagonal system of equations:
    RESID = norm(B - A*X) / (norm(A) * norm(X) * EPS),
 where EPS is the machine epsilon.
Parameters
[in]N
          N is INTEGTER
          The order of the matrix A.
[in]NRHS
          NRHS is INTEGER
          The number of right hand sides, i.e., the number of columns
          of the matrices B and X.  NRHS >= 0.
[in]D
          D is REAL array, dimension (N)
          The n diagonal elements of the tridiagonal matrix A.
[in]E
          E is REAL array, dimension (N-1)
          The (n-1) subdiagonal elements of the tridiagonal matrix A.
[in]X
          X is REAL array, dimension (LDX,NRHS)
          The n by nrhs matrix of solution vectors X.
[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 n by nrhs matrix of right hand side vectors B.
          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]RESID
          RESID is REAL
          norm(B - A*X) / (norm(A) * norm(X) * EPS)
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2011

Definition at line 106 of file sptt02.f.

106 *
107 * -- LAPACK test routine (version 3.4.0) --
108 * -- LAPACK is a software package provided by Univ. of Tennessee, --
109 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
110 * November 2011
111 *
112 * .. Scalar Arguments ..
113  INTEGER ldb, ldx, n, nrhs
114  REAL resid
115 * ..
116 * .. Array Arguments ..
117  REAL b( ldb, * ), d( * ), e( * ), x( ldx, * )
118 * ..
119 *
120 * =====================================================================
121 *
122 * .. Parameters ..
123  REAL one, zero
124  parameter ( one = 1.0e+0, zero = 0.0e+0 )
125 * ..
126 * .. Local Scalars ..
127  INTEGER j
128  REAL anorm, bnorm, eps, xnorm
129 * ..
130 * .. External Functions ..
131  REAL sasum, slamch, slanst
132  EXTERNAL sasum, slamch, slanst
133 * ..
134 * .. Intrinsic Functions ..
135  INTRINSIC max
136 * ..
137 * .. External Subroutines ..
138  EXTERNAL slaptm
139 * ..
140 * .. Executable Statements ..
141 *
142 * Quick return if possible
143 *
144  IF( n.LE.0 ) THEN
145  resid = zero
146  RETURN
147  END IF
148 *
149 * Compute the 1-norm of the tridiagonal matrix A.
150 *
151  anorm = slanst( '1', n, d, e )
152 *
153 * Exit with RESID = 1/EPS if ANORM = 0.
154 *
155  eps = slamch( 'Epsilon' )
156  IF( anorm.LE.zero ) THEN
157  resid = one / eps
158  RETURN
159  END IF
160 *
161 * Compute B - A*X.
162 *
163  CALL slaptm( n, nrhs, -one, d, e, x, ldx, one, b, ldb )
164 *
165 * Compute the maximum over the number of right hand sides of
166 * norm(B - A*X) / ( norm(A) * norm(X) * EPS ).
167 *
168  resid = zero
169  DO 10 j = 1, nrhs
170  bnorm = sasum( n, b( 1, j ), 1 )
171  xnorm = sasum( n, x( 1, j ), 1 )
172  IF( xnorm.LE.zero ) THEN
173  resid = one / eps
174  ELSE
175  resid = max( resid, ( ( bnorm / anorm ) / xnorm ) / eps )
176  END IF
177  10 CONTINUE
178 *
179  RETURN
180 *
181 * End of SPTT02
182 *
real function slanst(NORM, N, D, E)
SLANST returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a real symmetric tridiagonal matrix.
Definition: slanst.f:102
real function sasum(N, SX, INCX)
SASUM
Definition: sasum.f:54
subroutine slaptm(N, NRHS, ALPHA, D, E, X, LDX, BETA, B, LDB)
SLAPTM
Definition: slaptm.f:118
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69

Here is the call graph for this function:

Here is the caller graph for this function: