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

CPTT02

Purpose:
 CPTT02 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]UPLO
          UPLO is CHARACTER*1
          Specifies whether the superdiagonal or the subdiagonal of the
          tridiagonal matrix A is stored.
          = 'U':  E is the superdiagonal of A
          = 'L':  E is the subdiagonal of A
[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 COMPLEX array, dimension (N-1)
          The (n-1) subdiagonal elements of the tridiagonal matrix A.
[in]X
          X is COMPLEX 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 COMPLEX 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 117 of file cptt02.f.

117 *
118 * -- LAPACK test routine (version 3.4.0) --
119 * -- LAPACK is a software package provided by Univ. of Tennessee, --
120 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
121 * November 2011
122 *
123 * .. Scalar Arguments ..
124  CHARACTER uplo
125  INTEGER ldb, ldx, n, nrhs
126  REAL resid
127 * ..
128 * .. Array Arguments ..
129  REAL d( * )
130  COMPLEX b( ldb, * ), e( * ), x( ldx, * )
131 * ..
132 *
133 * =====================================================================
134 *
135 * .. Parameters ..
136  REAL one, zero
137  parameter ( one = 1.0e+0, zero = 0.0e+0 )
138 * ..
139 * .. Local Scalars ..
140  INTEGER j
141  REAL anorm, bnorm, eps, xnorm
142 * ..
143 * .. External Functions ..
144  REAL clanht, scasum, slamch
145  EXTERNAL clanht, scasum, slamch
146 * ..
147 * .. Intrinsic Functions ..
148  INTRINSIC max
149 * ..
150 * .. External Subroutines ..
151  EXTERNAL claptm
152 * ..
153 * .. Executable Statements ..
154 *
155 * Quick return if possible
156 *
157  IF( n.LE.0 ) THEN
158  resid = zero
159  RETURN
160  END IF
161 *
162 * Compute the 1-norm of the tridiagonal matrix A.
163 *
164  anorm = clanht( '1', n, d, e )
165 *
166 * Exit with RESID = 1/EPS if ANORM = 0.
167 *
168  eps = slamch( 'Epsilon' )
169  IF( anorm.LE.zero ) THEN
170  resid = one / eps
171  RETURN
172  END IF
173 *
174 * Compute B - A*X.
175 *
176  CALL claptm( uplo, n, nrhs, -one, d, e, x, ldx, one, b, ldb )
177 *
178 * Compute the maximum over the number of right hand sides of
179 * norm(B - A*X) / ( norm(A) * norm(X) * EPS ).
180 *
181  resid = zero
182  DO 10 j = 1, nrhs
183  bnorm = scasum( n, b( 1, j ), 1 )
184  xnorm = scasum( n, x( 1, j ), 1 )
185  IF( xnorm.LE.zero ) THEN
186  resid = one / eps
187  ELSE
188  resid = max( resid, ( ( bnorm / anorm ) / xnorm ) / eps )
189  END IF
190  10 CONTINUE
191 *
192  RETURN
193 *
194 * End of CPTT02
195 *
subroutine claptm(UPLO, N, NRHS, ALPHA, D, E, X, LDX, BETA, B, LDB)
CLAPTM
Definition: claptm.f:131
real function scasum(N, CX, INCX)
SCASUM
Definition: scasum.f:54
real function clanht(NORM, N, D, E)
CLANHT returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a complex Hermitian tridiagonal matrix.
Definition: clanht.f:103
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: