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

◆ csyt01_3()

subroutine csyt01_3 ( character  uplo,
integer  n,
complex, dimension( lda, * )  a,
integer  lda,
complex, dimension( ldafac, * )  afac,
integer  ldafac,
complex, dimension( * )  e,
integer, dimension( * )  ipiv,
complex, dimension( ldc, * )  c,
integer  ldc,
real, dimension( * )  rwork,
real  resid 
)

CSYT01_3

Purpose:
 CSYT01_3 reconstructs a symmetric indefinite matrix A from its
 block L*D*L' or U*D*U' factorization computed by CSYTRF_RK
 (or CSYTRF_BK) 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 COMPLEX 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]AFAC
          AFAC is COMPLEX array, dimension (LDAFAC,N)
          Diagonal of the block diagonal matrix D and factors U or L
          as computed by CSYTRF_RK and CSYTRF_BK:
            a) ONLY diagonal elements of the symmetric block diagonal
               matrix D on the diagonal of A, i.e. D(k,k) = A(k,k);
               (superdiagonal (or subdiagonal) elements of D
                should be provided on entry in array E), and
            b) If UPLO = 'U': factor U in the superdiagonal part of A.
               If UPLO = 'L': factor L in the subdiagonal part of A.
[in]LDAFAC
          LDAFAC is INTEGER
          The leading dimension of the array AFAC.
          LDAFAC >= max(1,N).
[in]E
          E is COMPLEX array, dimension (N)
          On entry, contains the superdiagonal (or subdiagonal)
          elements of the symmetric block diagonal matrix D
          with 1-by-1 or 2-by-2 diagonal blocks, where
          If UPLO = 'U': E(i) = D(i-1,i),i=2:N, E(1) not referenced;
          If UPLO = 'L': E(i) = D(i+1,i),i=1:N-1, E(N) not referenced.
[in]IPIV
          IPIV is INTEGER array, dimension (N)
          The pivot indices from CSYTRF_RK (or CSYTRF_BK).
[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 )
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 139 of file csyt01_3.f.

141*
142* -- LAPACK test routine --
143* -- LAPACK is a software package provided by Univ. of Tennessee, --
144* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
145*
146* .. Scalar Arguments ..
147 CHARACTER UPLO
148 INTEGER LDA, LDAFAC, LDC, N
149 REAL RESID
150* ..
151* .. Array Arguments ..
152 INTEGER IPIV( * )
153 REAL RWORK( * )
154 COMPLEX A( LDA, * ), AFAC( LDAFAC, * ), C( LDC, * ),
155 $ E( * )
156* ..
157*
158* =====================================================================
159*
160* .. Parameters ..
161 REAL ZERO, ONE
162 parameter( zero = 0.0e+0, one = 1.0e+0 )
163 COMPLEX CZERO, CONE
164 parameter( czero = ( 0.0e+0, 0.0e+0 ),
165 $ cone = ( 1.0e+0, 0.0e+0 ) )
166* ..
167* .. Local Scalars ..
168 INTEGER I, INFO, J
169 REAL ANORM, EPS
170* ..
171* .. External Functions ..
172 LOGICAL LSAME
173 REAL SLAMCH, CLANSY
174 EXTERNAL lsame, slamch, clansy
175* ..
176* .. External Subroutines ..
178* ..
179* .. Intrinsic Functions ..
180 INTRINSIC real
181* ..
182* .. Executable Statements ..
183*
184* Quick exit if N = 0.
185*
186 IF( n.LE.0 ) THEN
187 resid = zero
188 RETURN
189 END IF
190*
191* a) Revert to multipliers of L
192*
193 CALL csyconvf_rook( uplo, 'R', n, afac, ldafac, e, ipiv, info )
194*
195* 1) Determine EPS and the norm of A.
196*
197 eps = slamch( 'Epsilon' )
198 anorm = clansy( '1', uplo, n, a, lda, rwork )
199*
200* 2) Initialize C to the identity matrix.
201*
202 CALL claset( 'Full', n, n, czero, cone, c, ldc )
203*
204* 3) Call ZLAVSY_ROOK to form the product D * U' (or D * L' ).
205*
206 CALL clavsy_rook( uplo, 'Transpose', 'Non-unit', n, n, afac,
207 $ ldafac, ipiv, c, ldc, info )
208*
209* 4) Call ZLAVSY_ROOK again to multiply by U (or L ).
210*
211 CALL clavsy_rook( uplo, 'No transpose', 'Unit', n, n, afac,
212 $ ldafac, ipiv, c, ldc, info )
213*
214* 5) Compute the difference C - A .
215*
216 IF( lsame( uplo, 'U' ) ) THEN
217 DO j = 1, n
218 DO i = 1, j
219 c( i, j ) = c( i, j ) - a( i, j )
220 END DO
221 END DO
222 ELSE
223 DO j = 1, n
224 DO i = j, n
225 c( i, j ) = c( i, j ) - a( i, j )
226 END DO
227 END DO
228 END IF
229*
230* 6) Compute norm( C - A ) / ( N * norm(A) * EPS )
231*
232 resid = clansy( '1', uplo, n, c, ldc, rwork )
233*
234 IF( anorm.LE.zero ) THEN
235 IF( resid.NE.zero )
236 $ resid = one / eps
237 ELSE
238 resid = ( ( resid / real( n ) ) / anorm ) / eps
239 END IF
240
241*
242* b) Convert to factor of L (or U)
243*
244 CALL csyconvf_rook( uplo, 'C', n, afac, ldafac, e, ipiv, info )
245*
246 RETURN
247*
248* End of CSYT01_3
249*
subroutine clavsy_rook(uplo, trans, diag, n, nrhs, a, lda, ipiv, b, ldb, info)
CLAVSY_ROOK
real function slamch(cmach)
SLAMCH
Definition slamch.f:68
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
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
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
subroutine csyconvf_rook(uplo, way, n, a, lda, e, ipiv, info)
CSYCONVF_ROOK
Here is the call graph for this function:
Here is the caller graph for this function: