LAPACK  3.10.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.

Definition at line 125 of file spot02.f.

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