 LAPACK  3.10.1 LAPACK: Linear Algebra PACKage

## ◆ cspt01()

 subroutine cspt01 ( character UPLO, integer N, complex, dimension( * ) A, complex, dimension( * ) AFAC, integer, dimension( * ) IPIV, complex, dimension( ldc, * ) C, integer LDC, real, dimension( * ) RWORK, real RESID )

CSPT01

Purpose:
``` CSPT01 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 array, dimension (N*(N+1)/2) The original symmetric matrix A, stored as a packed triangular matrix.``` [in] AFAC ``` AFAC is COMPLEX 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 CSPTRF.``` [in] IPIV ``` IPIV is INTEGER array, dimension (N) The pivot indices from CSPTRF.``` [out] C ` C is COMPLEX 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 )```

Definition at line 111 of file cspt01.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  REAL RESID
121 * ..
122 * .. Array Arguments ..
123  INTEGER IPIV( * )
124  REAL RWORK( * )
125  COMPLEX A( * ), AFAC( * ), C( LDC, * )
126 * ..
127 *
128 * =====================================================================
129 *
130 * .. Parameters ..
131  REAL ZERO, ONE
132  parameter( zero = 0.0e+0, one = 1.0e+0 )
133  COMPLEX CZERO, CONE
134  parameter( czero = ( 0.0e+0, 0.0e+0 ),
135  \$ cone = ( 1.0e+0, 0.0e+0 ) )
136 * ..
137 * .. Local Scalars ..
138  INTEGER I, INFO, J, JC
139  REAL ANORM, EPS
140 * ..
141 * .. External Functions ..
142  LOGICAL LSAME
143  REAL CLANSP, CLANSY, SLAMCH
144  EXTERNAL lsame, clansp, clansy, slamch
145 * ..
146 * .. External Subroutines ..
147  EXTERNAL clavsp, claset
148 * ..
149 * .. Intrinsic Functions ..
150  INTRINSIC real
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 = slamch( 'Epsilon' )
164  anorm = clansp( '1', uplo, n, a, rwork )
165 *
166 * Initialize C to the identity matrix.
167 *
168  CALL claset( 'Full', n, n, czero, cone, c, ldc )
169 *
170 * Call CLAVSP to form the product D * U' (or D * L' ).
171 *
172  CALL clavsp( uplo, 'Transpose', 'Non-unit', n, n, afac, ipiv, c,
173  \$ ldc, info )
174 *
175 * Call CLAVSP again to multiply by U ( or L ).
176 *
177  CALL clavsp( 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 = clansy( '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/real( n ) )/anorm ) / eps
209  END IF
210 *
211  RETURN
212 *
213 * End of CSPT01
214 *
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:53
subroutine clavsp(UPLO, TRANS, DIAG, N, NRHS, A, IPIV, B, LDB, INFO)
CLAVSP
Definition: clavsp.f:131
subroutine claset(UPLO, M, N, ALPHA, BETA, A, LDA)
CLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
Definition: claset.f:106
real function clansp(NORM, UPLO, N, AP, WORK)
CLANSP returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition: clansp.f:115
real function clansy(NORM, UPLO, N, A, LDA, WORK)
CLANSY returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition: clansy.f:123
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: