LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ zsyt01_aa()

subroutine zsyt01_aa ( character  UPLO,
integer  N,
complex*16, dimension( lda, * )  A,
integer  LDA,
complex*16, dimension( ldafac, * )  AFAC,
integer  LDAFAC,
integer, dimension( * )  IPIV,
complex*16, dimension( ldc, * )  C,
integer  LDC,
double precision, dimension( * )  RWORK,
double precision  RESID 
)

ZSYT01

Purpose:
 ZSYT01 reconstructs a hermitian indefinite 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
          hermitian 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*16 array, dimension (LDA,N)
          The original hermitian matrix A.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(1,N)
[in]AFAC
          AFAC is COMPLEX*16 array, dimension (LDAFAC,N)
          The factored form of the matrix A.  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 ZSYTRF.
[in]LDAFAC
          LDAFAC is INTEGER
          The leading dimension of the array AFAC.  LDAFAC >= max(1,N).
[in]IPIV
          IPIV is INTEGER array, dimension (N)
          The pivot indices from ZSYTRF.
[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 COMPLEX*16 array, dimension (N)
[out]RESID
          RESID is COMPLEX*16
          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.
Date
December 2016

Definition at line 128 of file zsyt01_aa.f.

128 *
129 * -- LAPACK test routine (version 3.7.0) --
130 * -- LAPACK is a software package provided by Univ. of Tennessee, --
131 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
132 * December 2016
133 *
134 * .. Scalar Arguments ..
135  CHARACTER uplo
136  INTEGER lda, ldafac, ldc, n
137  DOUBLE PRECISION resid
138 * ..
139 * .. Array Arguments ..
140  INTEGER ipiv( * )
141  COMPLEX*16 a( lda, * ), afac( ldafac, * ), c( ldc, * )
142  DOUBLE PRECISION rwork( * )
143 * ..
144 *
145 * =====================================================================
146 *
147 * .. Parameters ..
148  DOUBLE PRECISION zero, one
149  parameter( zero = 0.0d+0, one = 1.0d+0 )
150  COMPLEX*16 czero, cone
151  parameter( czero = 0.0e+0, cone = 1.0e+0 )
152 * ..
153 * .. Local Scalars ..
154  INTEGER i, j
155  DOUBLE PRECISION anorm, eps
156 * ..
157 * .. External Functions ..
158  LOGICAL lsame
159  DOUBLE PRECISION dlamch, zlansy
160  EXTERNAL lsame, dlamch, zlansy
161 * ..
162 * .. External Subroutines ..
163  EXTERNAL zlaset, zlavsy
164 * ..
165 * .. Intrinsic Functions ..
166  INTRINSIC dble
167 * ..
168 * .. Executable Statements ..
169 *
170 * Quick exit if N = 0.
171 *
172  IF( n.LE.0 ) THEN
173  resid = zero
174  RETURN
175  END IF
176 *
177 * Determine EPS and the norm of A.
178 *
179  eps = dlamch( 'Epsilon' )
180  anorm = zlansy( '1', uplo, n, a, lda, rwork )
181 *
182 * Initialize C to the tridiagonal matrix T.
183 *
184  CALL zlaset( 'Full', n, n, czero, czero, c, ldc )
185  CALL zlacpy( 'F', 1, n, afac( 1, 1 ), ldafac+1, c( 1, 1 ), ldc+1 )
186  IF( n.GT.1 ) THEN
187  IF( lsame( uplo, 'U' ) ) THEN
188  CALL zlacpy( 'F', 1, n-1, afac( 1, 2 ), ldafac+1, c( 1, 2 ),
189  $ ldc+1 )
190  CALL zlacpy( 'F', 1, n-1, afac( 1, 2 ), ldafac+1, c( 2, 1 ),
191  $ ldc+1 )
192  ELSE
193  CALL zlacpy( 'F', 1, n-1, afac( 2, 1 ), ldafac+1, c( 1, 2 ),
194  $ ldc+1 )
195  CALL zlacpy( 'F', 1, n-1, afac( 2, 1 ), ldafac+1, c( 2, 1 ),
196  $ ldc+1 )
197  ENDIF
198 *
199 * Call ZTRMM to form the product U' * D (or L * D ).
200 *
201  IF( lsame( uplo, 'U' ) ) THEN
202  CALL ztrmm( 'Left', uplo, 'Transpose', 'Unit', n-1, n,
203  $ cone, afac( 1, 2 ), ldafac, c( 2, 1 ), ldc )
204  ELSE
205  CALL ztrmm( 'Left', uplo, 'No transpose', 'Unit', n-1, n,
206  $ cone, afac( 2, 1 ), ldafac, c( 2, 1 ), ldc )
207  END IF
208 *
209 * Call ZTRMM again to multiply by U (or L ).
210 *
211  IF( lsame( uplo, 'U' ) ) THEN
212  CALL ztrmm( 'Right', uplo, 'No transpose', 'Unit', n, n-1,
213  $ cone, afac( 1, 2 ), ldafac, c( 1, 2 ), ldc )
214  ELSE
215  CALL ztrmm( 'Right', uplo, 'Transpose', 'Unit', n, n-1,
216  $ cone, afac( 2, 1 ), ldafac, c( 1, 2 ), ldc )
217  END IF
218  ENDIF
219 *
220 * Apply symmetric pivots
221 *
222  DO j = n, 1, -1
223  i = ipiv( j )
224  IF( i.NE.j )
225  $ CALL zswap( n, c( j, 1 ), ldc, c( i, 1 ), ldc )
226  END DO
227  DO j = n, 1, -1
228  i = ipiv( j )
229  IF( i.NE.j )
230  $ CALL zswap( n, c( 1, j ), 1, c( 1, i ), 1 )
231  END DO
232 *
233 *
234 * Compute the difference C - A .
235 *
236  IF( lsame( uplo, 'U' ) ) THEN
237  DO j = 1, n
238  DO i = 1, j
239  c( i, j ) = c( i, j ) - a( i, j )
240  END DO
241  END DO
242  ELSE
243  DO j = 1, n
244  DO i = j, n
245  c( i, j ) = c( i, j ) - a( i, j )
246  END DO
247  END DO
248  END IF
249 *
250 * Compute norm( C - A ) / ( N * norm(A) * EPS )
251 *
252  resid = zlansy( '1', uplo, n, c, ldc, rwork )
253 *
254  IF( anorm.LE.zero ) THEN
255  IF( resid.NE.zero )
256  $ resid = one / eps
257  ELSE
258  resid = ( ( resid / dble( n ) ) / anorm ) / eps
259  END IF
260 *
261  RETURN
262 *
263 * End of ZSYT01
264 *
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65
subroutine zswap(N, ZX, INCX, ZY, INCY)
ZSWAP
Definition: zswap.f:83
subroutine zlacpy(UPLO, M, N, A, LDA, B, LDB)
ZLACPY copies all or part of one two-dimensional array to another.
Definition: zlacpy.f:105
subroutine ztrmm(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)
ZTRMM
Definition: ztrmm.f:179
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, or the element of largest absolute value of a complex symmetric matrix.
Definition: zlansy.f:125
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:108
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine zlavsy(UPLO, TRANS, DIAG, N, NRHS, A, LDA, IPIV, B, LDB, INFO)
ZLAVSY
Definition: zlavsy.f:155
Here is the call graph for this function:
Here is the caller graph for this function: