 LAPACK  3.8.0 LAPACK: Linear Algebra PACKage

## ◆ chet01_aa()

 subroutine chet01_aa ( character UPLO, integer N, complex, dimension( lda, * ) A, integer LDA, complex, dimension( ldafac, * ) AFAC, integer LDAFAC, integer, dimension( * ) IPIV, complex, dimension( ldc, * ) C, integer LDC, real, dimension( * ) RWORK, real RESID )

CHET01_AA

Purpose:
``` CHET01_AA 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 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 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 CHETRF.``` [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 CHETRF.``` [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 COMPLEX array, dimension (N)` [out] RESID ``` RESID is COMPLEX If UPLO = 'L', norm(L*D*L' - A) / ( N * norm(A) * EPS ) If UPLO = 'U', norm(U*D*U' - A) / ( N * norm(A) * EPS )```
Date
December 2016

Definition at line 127 of file chet01_aa.f.

127 *
128 * -- LAPACK test routine (version 3.7.0) --
129 * -- LAPACK is a software package provided by Univ. of Tennessee, --
130 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
131 * December 2016
132 *
133 * .. Scalar Arguments ..
134  CHARACTER uplo
135  INTEGER lda, ldafac, ldc, n
136  REAL resid
137 * ..
138 * .. Array Arguments ..
139  INTEGER ipiv( * )
140  REAL rwork( * )
141  COMPLEX a( lda, * ), afac( ldafac, * ), c( ldc, * )
142 * ..
143 *
144 * =====================================================================
145 *
146 * .. Parameters ..
147  COMPLEX czero, cone
148  parameter( czero = ( 0.0e+0, 0.0e+0 ),
149  \$ cone = ( 1.0e+0, 0.0e+0 ) )
150  REAL zero, one
151  parameter( zero = 0.0e+0, one = 1.0e+0 )
152 * ..
153 * .. Local Scalars ..
154  INTEGER i, j
155  REAL anorm, eps
156 * ..
157 * .. External Functions ..
158  LOGICAL lsame
159  REAL slamch, clanhe
160  EXTERNAL lsame, slamch, clanhe
161 * ..
162 * .. External Subroutines ..
163  EXTERNAL claset, clavhe
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 = slamch( 'Epsilon' )
180  anorm = clanhe( '1', uplo, n, a, lda, rwork )
181 *
182 * Initialize C to the tridiagonal matrix T.
183 *
184  CALL claset( 'Full', n, n, czero, czero, c, ldc )
185  CALL clacpy( '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 clacpy( 'F', 1, n-1, afac( 1, 2 ), ldafac+1, c( 1, 2 ),
189  \$ ldc+1 )
190  CALL clacpy( 'F', 1, n-1, afac( 1, 2 ), ldafac+1, c( 2, 1 ),
191  \$ ldc+1 )
192  CALL clacgv( n-1, c( 2, 1 ), ldc+1 )
193  ELSE
194  CALL clacpy( 'F', 1, n-1, afac( 2, 1 ), ldafac+1, c( 1, 2 ),
195  \$ ldc+1 )
196  CALL clacpy( 'F', 1, n-1, afac( 2, 1 ), ldafac+1, c( 2, 1 ),
197  \$ ldc+1 )
198  CALL clacgv( n-1, c( 1, 2 ), ldc+1 )
199  ENDIF
200 *
201 * Call CTRMM to form the product U' * D (or L * D ).
202 *
203  IF( lsame( uplo, 'U' ) ) THEN
204  CALL ctrmm( 'Left', uplo, 'Conjugate transpose', 'Unit',
205  \$ n-1, n, cone, afac( 1, 2 ), ldafac, c( 2, 1 ),
206  \$ ldc )
207  ELSE
208  CALL ctrmm( 'Left', uplo, 'No transpose', 'Unit', n-1, n,
209  \$ cone, afac( 2, 1 ), ldafac, c( 2, 1 ), ldc )
210  END IF
211 *
212 * Call CTRMM again to multiply by U (or L ).
213 *
214  IF( lsame( uplo, 'U' ) ) THEN
215  CALL ctrmm( 'Right', uplo, 'No transpose', 'Unit', n, n-1,
216  \$ cone, afac( 1, 2 ), ldafac, c( 1, 2 ), ldc )
217  ELSE
218  CALL ctrmm( 'Right', uplo, 'Conjugate transpose', 'Unit', n,
219  \$ n-1, cone, afac( 2, 1 ), ldafac, c( 1, 2 ),
220  \$ ldc )
221  END IF
222  ENDIF
223 *
224 * Apply hermitian pivots
225 *
226  DO j = n, 1, -1
227  i = ipiv( j )
228  IF( i.NE.j )
229  \$ CALL cswap( n, c( j, 1 ), ldc, c( i, 1 ), ldc )
230  END DO
231  DO j = n, 1, -1
232  i = ipiv( j )
233  IF( i.NE.j )
234  \$ CALL cswap( n, c( 1, j ), 1, c( 1, i ), 1 )
235  END DO
236 *
237 *
238 * Compute the difference C - A .
239 *
240  IF( lsame( uplo, 'U' ) ) THEN
241  DO j = 1, n
242  DO i = 1, j
243  c( i, j ) = c( i, j ) - a( i, j )
244  END DO
245  END DO
246  ELSE
247  DO j = 1, n
248  DO i = j, n
249  c( i, j ) = c( i, j ) - a( i, j )
250  END DO
251  END DO
252  END IF
253 *
254 * Compute norm( C - A ) / ( N * norm(A) * EPS )
255 *
256  resid = clanhe( '1', uplo, n, c, ldc, rwork )
257 *
258  IF( anorm.LE.zero ) THEN
259  IF( resid.NE.zero )
260  \$ resid = one / eps
261  ELSE
262  resid = ( ( resid / dble( n ) ) / anorm ) / eps
263  END IF
264 *
265  RETURN
266 *
267 * End of CHET01_AA
268 *
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:108
subroutine clavhe(UPLO, TRANS, DIAG, N, NRHS, A, LDA, IPIV, B, LDB, INFO)
CLAVHE
Definition: clavhe.f:155
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
subroutine clacpy(UPLO, M, N, A, LDA, B, LDB)
CLACPY copies all or part of one two-dimensional array to another.
Definition: clacpy.f:105
subroutine clacgv(N, X, INCX)
CLACGV conjugates a complex vector.
Definition: clacgv.f:76
subroutine ctrmm(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)
CTRMM
Definition: ctrmm.f:179
subroutine cswap(N, CX, INCX, CY, INCY)
CSWAP
Definition: cswap.f:83
real function clanhe(NORM, UPLO, N, A, LDA, WORK)
CLANHE 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 Hermitian matrix.
Definition: clanhe.f:126
Here is the call graph for this function:
Here is the caller graph for this function: