LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ sgtt02()

subroutine sgtt02 ( character  TRANS,
integer  N,
integer  NRHS,
real, dimension( * )  DL,
real, dimension( * )  D,
real, dimension( * )  DU,
real, dimension( ldx, * )  X,
integer  LDX,
real, dimension( ldb, * )  B,
integer  LDB,
real  RESID 
)

SGTT02

Purpose:
 SGTT02 computes the residual for the solution to a tridiagonal
 system of equations:
    RESID = norm(B - op(A)*X) / (norm(A) * norm(X) * EPS),
 where EPS is the machine epsilon.
Parameters
[in]TRANS
          TRANS is CHARACTER
          Specifies the form of the residual.
          = 'N':  B - A * X  (No transpose)
          = 'T':  B - A'* X  (Transpose)
          = 'C':  B - A'* X  (Conjugate transpose = Transpose)
[in]N
          N is INTEGTER
          The order of the matrix A.  N >= 0.
[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]DL
          DL is REAL array, dimension (N-1)
          The (n-1) sub-diagonal elements of A.
[in]D
          D is REAL array, dimension (N)
          The diagonal elements of A.
[in]DU
          DU is REAL array, dimension (N-1)
          The (n-1) super-diagonal elements of A.
[in]X
          X is REAL array, dimension (LDX,NRHS)
          The computed 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 right hand side vectors for the system of
          linear equations.
          On exit, B is overwritten with the difference B - op(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 - op(A)*X) / (norm(A) * norm(X) * EPS)
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
December 2016

Definition at line 126 of file sgtt02.f.

126 *
127 * -- LAPACK test routine (version 3.7.0) --
128 * -- LAPACK is a software package provided by Univ. of Tennessee, --
129 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
130 * December 2016
131 *
132 * .. Scalar Arguments ..
133  CHARACTER trans
134  INTEGER ldb, ldx, n, nrhs
135  REAL resid
136 * ..
137 * .. Array Arguments ..
138  REAL b( ldb, * ), d( * ), dl( * ), du( * ),
139  $ x( ldx, * )
140 * ..
141 *
142 * =====================================================================
143 *
144 * .. Parameters ..
145  REAL one, zero
146  parameter( one = 1.0e+0, zero = 0.0e+0 )
147 * ..
148 * .. Local Scalars ..
149  INTEGER j
150  REAL anorm, bnorm, eps, xnorm
151 * ..
152 * .. External Functions ..
153  LOGICAL lsame
154  REAL sasum, slamch, slangt
155  EXTERNAL lsame, sasum, slamch, slangt
156 * ..
157 * .. External Subroutines ..
158  EXTERNAL slagtm
159 * ..
160 * .. Intrinsic Functions ..
161  INTRINSIC max
162 * ..
163 * .. Executable Statements ..
164 *
165 * Quick exit if N = 0 or NRHS = 0
166 *
167  resid = zero
168  IF( n.LE.0 .OR. nrhs.EQ.0 )
169  $ RETURN
170 *
171 * Compute the maximum over the number of right hand sides of
172 * norm(B - op(A)*X) / ( norm(A) * norm(X) * EPS ).
173 *
174  IF( lsame( trans, 'N' ) ) THEN
175  anorm = slangt( '1', n, dl, d, du )
176  ELSE
177  anorm = slangt( 'I', n, dl, d, du )
178  END IF
179 *
180 * Exit with RESID = 1/EPS if ANORM = 0.
181 *
182  eps = slamch( 'Epsilon' )
183  IF( anorm.LE.zero ) THEN
184  resid = one / eps
185  RETURN
186  END IF
187 *
188 * Compute B - op(A)*X.
189 *
190  CALL slagtm( trans, n, nrhs, -one, dl, d, du, x, ldx, one, b,
191  $ ldb )
192 *
193  DO 10 j = 1, nrhs
194  bnorm = sasum( n, b( 1, j ), 1 )
195  xnorm = sasum( n, x( 1, j ), 1 )
196  IF( xnorm.LE.zero ) THEN
197  resid = one / eps
198  ELSE
199  resid = max( resid, ( ( bnorm / anorm ) / xnorm ) / eps )
200  END IF
201  10 CONTINUE
202 *
203  RETURN
204 *
205 * End of SGTT02
206 *
real function slangt(NORM, N, DL, D, DU)
SLANGT returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition: slangt.f:108
real function sasum(N, SX, INCX)
SASUM
Definition: sasum.f:74
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
subroutine slagtm(TRANS, N, NRHS, ALPHA, DL, D, DU, X, LDX, BETA, B, LDB)
SLAGTM performs a matrix-matrix product of the form C = αAB+βC, where A is a tridiagonal matrix...
Definition: slagtm.f:147
Here is the call graph for this function:
Here is the caller graph for this function: