 LAPACK 3.11.0 LAPACK: Linear Algebra PACKage
Searching...
No Matches

## ◆ zspt01()

 subroutine zspt01 ( character UPLO, integer N, complex*16, dimension( * ) A, complex*16, dimension( * ) AFAC, integer, dimension( * ) IPIV, complex*16, dimension( ldc, * ) C, integer LDC, double precision, dimension( * ) RWORK, double precision RESID )

ZSPT01

Purpose:
``` ZSPT01 reconstructs a symmetric indefinite packed matrix A from its
diagonal pivoting factorization A = U*D*U' or A = L*D*L' 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 Hermitian matrix A is stored: = 'U': Upper triangular = 'L': Lower triangular``` [in] N ``` N is INTEGER The order of the matrix A. N >= 0.``` [in] A ``` A is COMPLEX*16 array, dimension (N*(N+1)/2) The original symmetric matrix A, stored as a packed triangular matrix.``` [in] AFAC ``` AFAC is COMPLEX*16 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 L*D*L' or U*D*U' factorization as computed by ZSPTRF.``` [in] IPIV ``` IPIV is INTEGER array, dimension (N) The pivot indices from ZSPTRF.``` [out] C ` C is COMPLEX*16 array, dimension (LDC,N)` [in] LDC ``` LDC is INTEGER The leading dimension of the array C. LDC >= max(1,N).``` [out] RWORK ` RWORK is DOUBLE PRECISION array, dimension (N)` [out] RESID ``` RESID is DOUBLE PRECISION If UPLO = 'L', norm(L*D*L' - A) / ( N * norm(A) * EPS ) If UPLO = 'U', norm(U*D*U' - A) / ( N * norm(A) * EPS )```

Definition at line 111 of file zspt01.f.

112*
113* -- LAPACK test routine --
114* -- LAPACK is a software package provided by Univ. of Tennessee, --
115* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
116*
117* .. Scalar Arguments ..
118 CHARACTER UPLO
119 INTEGER LDC, N
120 DOUBLE PRECISION RESID
121* ..
122* .. Array Arguments ..
123 INTEGER IPIV( * )
124 DOUBLE PRECISION RWORK( * )
125 COMPLEX*16 A( * ), AFAC( * ), C( LDC, * )
126* ..
127*
128* =====================================================================
129*
130* .. Parameters ..
131 DOUBLE PRECISION ZERO, ONE
132 parameter( zero = 0.0d+0, one = 1.0d+0 )
133 COMPLEX*16 CZERO, CONE
134 parameter( czero = ( 0.0d+0, 0.0d+0 ),
135 \$ cone = ( 1.0d+0, 0.0d+0 ) )
136* ..
137* .. Local Scalars ..
138 INTEGER I, INFO, J, JC
139 DOUBLE PRECISION ANORM, EPS
140* ..
141* .. External Functions ..
142 LOGICAL LSAME
143 DOUBLE PRECISION DLAMCH, ZLANSP, ZLANSY
144 EXTERNAL lsame, dlamch, zlansp, zlansy
145* ..
146* .. External Subroutines ..
147 EXTERNAL zlaset, zlavsp
148* ..
149* .. Intrinsic Functions ..
150 INTRINSIC dble
151* ..
152* .. Executable Statements ..
153*
154* Quick exit if N = 0.
155*
156 IF( n.LE.0 ) THEN
157 resid = zero
158 RETURN
159 END IF
160*
161* Determine EPS and the norm of A.
162*
163 eps = dlamch( 'Epsilon' )
164 anorm = zlansp( '1', uplo, n, a, rwork )
165*
166* Initialize C to the identity matrix.
167*
168 CALL zlaset( 'Full', n, n, czero, cone, c, ldc )
169*
170* Call ZLAVSP to form the product D * U' (or D * L' ).
171*
172 CALL zlavsp( uplo, 'Transpose', 'Non-unit', n, n, afac, ipiv, c,
173 \$ ldc, info )
174*
175* Call ZLAVSP again to multiply by U ( or L ).
176*
177 CALL zlavsp( uplo, 'No transpose', 'Unit', n, n, afac, ipiv, c,
178 \$ ldc, info )
179*
180* Compute the difference C - A .
181*
182 IF( lsame( uplo, 'U' ) ) THEN
183 jc = 0
184 DO 20 j = 1, n
185 DO 10 i = 1, j
186 c( i, j ) = c( i, j ) - a( jc+i )
187 10 CONTINUE
188 jc = jc + j
189 20 CONTINUE
190 ELSE
191 jc = 1
192 DO 40 j = 1, n
193 DO 30 i = j, n
194 c( i, j ) = c( i, j ) - a( jc+i-j )
195 30 CONTINUE
196 jc = jc + n - j + 1
197 40 CONTINUE
198 END IF
199*
200* Compute norm( C - A ) / ( N * norm(A) * EPS )
201*
202 resid = zlansy( '1', uplo, n, c, ldc, rwork )
203*
204 IF( anorm.LE.zero ) THEN
205 IF( resid.NE.zero )
206 \$ resid = one / eps
207 ELSE
208 resid = ( ( resid / dble( n ) ) / anorm ) / eps
209 END IF
210*
211 RETURN
212*
213* End of ZSPT01
214*
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:69
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:53
subroutine zlavsp(UPLO, TRANS, DIAG, N, NRHS, A, IPIV, B, LDB, INFO)
ZLAVSP
Definition: zlavsp.f:131
double precision function zlansp(NORM, UPLO, N, AP, WORK)
ZLANSP returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition: zlansp.f:115
subroutine zlaset(UPLO, M, N, ALPHA, BETA, A, LDA)
ZLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
Definition: zlaset.f:106
double precision function zlansy(NORM, UPLO, N, A, LDA, WORK)
ZLANSY returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition: zlansy.f:123
Here is the call graph for this function:
Here is the caller graph for this function: