LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ spot03()

subroutine spot03 ( character  UPLO,
integer  N,
real, dimension( lda, * )  A,
integer  LDA,
real, dimension( ldainv, * )  AINV,
integer  LDAINV,
real, dimension( ldwork, * )  WORK,
integer  LDWORK,
real, dimension( * )  RWORK,
real  RCOND,
real  RESID 
)

SPOT03

Purpose:
 SPOT03 computes the residual for a symmetric matrix times its
 inverse:
    norm( I - A*AINV ) / ( N * norm(A) * norm(AINV) * 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]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,out]AINV
          AINV is REAL array, dimension (LDAINV,N)
          On entry, the inverse of the matrix A, stored as a symmetric
          matrix in the same format as A.
          In this version, AINV is expanded into a full matrix and
          multiplied by A, so the opposing triangle of AINV will be
          changed; i.e., if the upper triangular part of AINV is
          stored, the lower triangular part will be used as work space.
[in]LDAINV
          LDAINV is INTEGER
          The leading dimension of the array AINV.  LDAINV >= max(1,N).
[out]WORK
          WORK is REAL array, dimension (LDWORK,N)
[in]LDWORK
          LDWORK is INTEGER
          The leading dimension of the array WORK.  LDWORK >= max(1,N).
[out]RWORK
          RWORK is REAL array, dimension (N)
[out]RCOND
          RCOND is REAL
          The reciprocal of the condition number of A, computed as
          ( 1/norm(A) ) / norm(AINV).
[out]RESID
          RESID is REAL
          norm(I - A*AINV) / ( N * norm(A) * norm(AINV) * EPS )
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
December 2016

Definition at line 127 of file spot03.f.

127 *
128 * -- LAPACK test routine (version 3.7.0) --
129 * -- LAPACK is a software package provided by Univ. of Tennessee, --
130 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
131 * December 2016
132 *
133 * .. Scalar Arguments ..
134  CHARACTER uplo
135  INTEGER lda, ldainv, ldwork, n
136  REAL rcond, resid
137 * ..
138 * .. Array Arguments ..
139  REAL a( lda, * ), ainv( ldainv, * ), rwork( * ),
140  $ work( ldwork, * )
141 * ..
142 *
143 * =====================================================================
144 *
145 * .. Parameters ..
146  REAL zero, one
147  parameter( zero = 0.0e+0, one = 1.0e+0 )
148 * ..
149 * .. Local Scalars ..
150  INTEGER i, j
151  REAL ainvnm, anorm, eps
152 * ..
153 * .. External Functions ..
154  LOGICAL lsame
155  REAL slamch, slange, slansy
156  EXTERNAL lsame, slamch, slange, slansy
157 * ..
158 * .. External Subroutines ..
159  EXTERNAL ssymm
160 * ..
161 * .. Intrinsic Functions ..
162  INTRINSIC real
163 * ..
164 * .. Executable Statements ..
165 *
166 * Quick exit if N = 0.
167 *
168  IF( n.LE.0 ) THEN
169  rcond = one
170  resid = zero
171  RETURN
172  END IF
173 *
174 * Exit with RESID = 1/EPS if ANORM = 0 or AINVNM = 0.
175 *
176  eps = slamch( 'Epsilon' )
177  anorm = slansy( '1', uplo, n, a, lda, rwork )
178  ainvnm = slansy( '1', uplo, n, ainv, ldainv, rwork )
179  IF( anorm.LE.zero .OR. ainvnm.LE.zero ) THEN
180  rcond = zero
181  resid = one / eps
182  RETURN
183  END IF
184  rcond = ( one / anorm ) / ainvnm
185 *
186 * Expand AINV into a full matrix and call SSYMM to multiply
187 * AINV on the left by A.
188 *
189  IF( lsame( uplo, 'U' ) ) THEN
190  DO 20 j = 1, n
191  DO 10 i = 1, j - 1
192  ainv( j, i ) = ainv( i, j )
193  10 CONTINUE
194  20 CONTINUE
195  ELSE
196  DO 40 j = 1, n
197  DO 30 i = j + 1, n
198  ainv( j, i ) = ainv( i, j )
199  30 CONTINUE
200  40 CONTINUE
201  END IF
202  CALL ssymm( 'Left', uplo, n, n, -one, a, lda, ainv, ldainv, zero,
203  $ work, ldwork )
204 *
205 * Add the identity matrix to WORK .
206 *
207  DO 50 i = 1, n
208  work( i, i ) = work( i, i ) + one
209  50 CONTINUE
210 *
211 * Compute norm(I - A*AINV) / (N * norm(A) * norm(AINV) * EPS)
212 *
213  resid = slange( '1', n, n, work, ldwork, rwork )
214 *
215  resid = ( ( resid*rcond ) / eps ) / REAL( n )
216 *
217  RETURN
218 *
219 * End of SPOT03
220 *
real function slange(NORM, M, N, A, LDA, WORK)
SLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition: slange.f:116
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
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: