LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ sspt01()

subroutine sspt01 ( character  uplo,
integer  n,
real, dimension( * )  a,
real, dimension( * )  afac,
integer, dimension( * )  ipiv,
real, dimension( ldc, * )  c,
integer  ldc,
real, dimension( * )  rwork,
real  resid 
)

SSPT01

Purpose:
 SSPT01 reconstructs a symmetric indefinite packed matrix A from its
 block L*D*L' or U*D*U' factorization and computes the residual
      norm( C - A ) / ( N * norm(A) * EPS ),
 where C is the reconstructed matrix and 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 (N*(N+1)/2)
          The original symmetric matrix A, stored as a packed
          triangular matrix.
[in]AFAC
          AFAC is REAL array, dimension (N*(N+1)/2)
          The factored form of the matrix A, stored as a packed
          triangular matrix.  AFAC contains the block diagonal matrix D
          and the multipliers used to obtain the factor L or U from the
          block L*D*L' or U*D*U' factorization as computed by SSPTRF.
[in]IPIV
          IPIV is INTEGER array, dimension (N)
          The pivot indices from SSPTRF.
[out]C
          C is REAL array, dimension (LDC,N)
[in]LDC
          LDC is INTEGER
          The leading dimension of the array C.  LDC >= max(1,N).
[out]RWORK
          RWORK is REAL array, dimension (N)
[out]RESID
          RESID is REAL
          If UPLO = 'L', norm(L*D*L' - A) / ( N * norm(A) * EPS )
          If UPLO = 'U', norm(U*D*U' - A) / ( N * norm(A) * EPS )
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 109 of file sspt01.f.

110*
111* -- LAPACK test routine --
112* -- LAPACK is a software package provided by Univ. of Tennessee, --
113* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
114*
115* .. Scalar Arguments ..
116 CHARACTER UPLO
117 INTEGER LDC, N
118 REAL RESID
119* ..
120* .. Array Arguments ..
121 INTEGER IPIV( * )
122 REAL A( * ), AFAC( * ), C( LDC, * ), RWORK( * )
123* ..
124*
125* =====================================================================
126*
127* .. Parameters ..
128 REAL ZERO, ONE
129 parameter( zero = 0.0e+0, one = 1.0e+0 )
130* ..
131* .. Local Scalars ..
132 INTEGER I, INFO, J, JC
133 REAL ANORM, EPS
134* ..
135* .. External Functions ..
136 LOGICAL LSAME
137 REAL SLAMCH, SLANSP, SLANSY
138 EXTERNAL lsame, slamch, slansp, slansy
139* ..
140* .. External Subroutines ..
141 EXTERNAL slavsp, slaset
142* ..
143* .. Intrinsic Functions ..
144 INTRINSIC real
145* ..
146* .. Executable Statements ..
147*
148* Quick exit if N = 0.
149*
150 IF( n.LE.0 ) THEN
151 resid = zero
152 RETURN
153 END IF
154*
155* Determine EPS and the norm of A.
156*
157 eps = slamch( 'Epsilon' )
158 anorm = slansp( '1', uplo, n, a, rwork )
159*
160* Initialize C to the identity matrix.
161*
162 CALL slaset( 'Full', n, n, zero, one, c, ldc )
163*
164* Call SLAVSP to form the product D * U' (or D * L' ).
165*
166 CALL slavsp( uplo, 'Transpose', 'Non-unit', n, n, afac, ipiv, c,
167 $ ldc, info )
168*
169* Call SLAVSP again to multiply by U ( or L ).
170*
171 CALL slavsp( uplo, 'No transpose', 'Unit', n, n, afac, ipiv, c,
172 $ ldc, info )
173*
174* Compute the difference C - A .
175*
176 IF( lsame( uplo, 'U' ) ) THEN
177 jc = 0
178 DO 20 j = 1, n
179 DO 10 i = 1, j
180 c( i, j ) = c( i, j ) - a( jc+i )
181 10 CONTINUE
182 jc = jc + j
183 20 CONTINUE
184 ELSE
185 jc = 1
186 DO 40 j = 1, n
187 DO 30 i = j, n
188 c( i, j ) = c( i, j ) - a( jc+i-j )
189 30 CONTINUE
190 jc = jc + n - j + 1
191 40 CONTINUE
192 END IF
193*
194* Compute norm( C - A ) / ( N * norm(A) * EPS )
195*
196 resid = slansy( '1', uplo, n, c, ldc, rwork )
197*
198 IF( anorm.LE.zero ) THEN
199 IF( resid.NE.zero )
200 $ resid = one / eps
201 ELSE
202 resid = ( ( resid / real( n ) ) / anorm ) / eps
203 END IF
204*
205 RETURN
206*
207* End of SSPT01
208*
real function slamch(cmach)
SLAMCH
Definition slamch.f:68
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 slansp(norm, uplo, n, ap, work)
SLANSP returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition slansp.f:114
subroutine slaset(uplo, m, n, alpha, beta, a, lda)
SLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
Definition slaset.f:110
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
subroutine slavsp(uplo, trans, diag, n, nrhs, a, ipiv, b, ldb, info)
SLAVSP
Definition slavsp.f:130
Here is the call graph for this function:
Here is the caller graph for this function: