LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ cptt02()

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.

Definition at line 114 of file cptt02.f.

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