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

Definition at line 123 of file spot03.f.

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