LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ spot02()

subroutine spot02 ( character  UPLO,
integer  N,
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 
)

SPOT02

Purpose:
 SPOT02 computes the residual for the solution of a symmetric system
 of linear equations  A*x = b:

    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 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]NRHS
          NRHS is INTEGER
          The number of columns of B, the matrix of right hand sides.
          NRHS >= 0.
[in]A
          A is REAL array, dimension (LDA,N)
          The original symmetric matrix A.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(1,N)
[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.
Date
December 2016

Definition at line 129 of file spot02.f.

129 *
130 * -- LAPACK test routine (version 3.7.0) --
131 * -- LAPACK is a software package provided by Univ. of Tennessee, --
132 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
133 * December 2016
134 *
135 * .. Scalar Arguments ..
136  CHARACTER uplo
137  INTEGER lda, ldb, ldx, n, nrhs
138  REAL resid
139 * ..
140 * .. Array Arguments ..
141  REAL a( lda, * ), b( ldb, * ), rwork( * ),
142  $ x( ldx, * )
143 * ..
144 *
145 * =====================================================================
146 *
147 * .. Parameters ..
148  REAL zero, one
149  parameter( zero = 0.0e+0, one = 1.0e+0 )
150 * ..
151 * .. Local Scalars ..
152  INTEGER j
153  REAL anorm, bnorm, eps, xnorm
154 * ..
155 * .. External Functions ..
156  REAL sasum, slamch, slansy
157  EXTERNAL sasum, slamch, slansy
158 * ..
159 * .. External Subroutines ..
160  EXTERNAL ssymm
161 * ..
162 * .. Intrinsic Functions ..
163  INTRINSIC max
164 * ..
165 * .. Executable Statements ..
166 *
167 * Quick exit if N = 0 or NRHS = 0.
168 *
169  IF( n.LE.0 .OR. nrhs.LE.0 ) THEN
170  resid = zero
171  RETURN
172  END IF
173 *
174 * Exit with RESID = 1/EPS if ANORM = 0.
175 *
176  eps = slamch( 'Epsilon' )
177  anorm = slansy( '1', uplo, n, a, lda, rwork )
178  IF( anorm.LE.zero ) THEN
179  resid = one / eps
180  RETURN
181  END IF
182 *
183 * Compute B - A*X
184 *
185  CALL ssymm( 'Left', uplo, n, nrhs, -one, a, lda, x, ldx, one, b,
186  $ ldb )
187 *
188 * Compute the maximum over the number of right hand sides of
189 * norm( B - A*X ) / ( norm(A) * norm(X) * EPS ) .
190 *
191  resid = zero
192  DO 10 j = 1, nrhs
193  bnorm = sasum( n, b( 1, j ), 1 )
194  xnorm = sasum( n, x( 1, j ), 1 )
195  IF( xnorm.LE.zero ) THEN
196  resid = one / eps
197  ELSE
198  resid = max( resid, ( ( bnorm / anorm ) / xnorm ) / eps )
199  END IF
200  10 CONTINUE
201 *
202  RETURN
203 *
204 * End of SPOT02
205 *
real function sasum(N, SX, INCX)
SASUM
Definition: sasum.f:74
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
subroutine ssymm(SIDE, UPLO, M, N, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
SSYMM
Definition: ssymm.f:191
real function slansy(NORM, UPLO, N, A, LDA, WORK)
SLANSY 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 matrix.
Definition: slansy.f:124
Here is the call graph for this function:
Here is the caller graph for this function: