LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine chpt01 ( character  UPLO,
integer  N,
complex, dimension( * )  A,
complex, dimension( * )  AFAC,
integer, dimension( * )  IPIV,
complex, dimension( ldc, * )  C,
integer  LDC,
real, dimension( * )  RWORK,
real  RESID 
)

CHPT01

Purpose:
 CHPT01 reconstructs a Hermitian indefinite packed 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, EPS is the machine epsilon,
 L' is the conjugate transpose of L, and U' is the conjugate transpose
 of U.
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 (N*(N+1)/2)
          The original Hermitian 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
          block L*D*L' or U*D*U' factorization as computed by CHPTRF.
[in]IPIV
          IPIV is INTEGER array, dimension (N)
          The pivot indices from CHPTRF.
[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.
Date
November 2011

Definition at line 115 of file chpt01.f.

115 *
116 * -- LAPACK test routine (version 3.4.0) --
117 * -- LAPACK is a software package provided by Univ. of Tennessee, --
118 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
119 * November 2011
120 *
121 * .. Scalar Arguments ..
122  CHARACTER uplo
123  INTEGER ldc, n
124  REAL resid
125 * ..
126 * .. Array Arguments ..
127  INTEGER ipiv( * )
128  REAL rwork( * )
129  COMPLEX a( * ), afac( * ), c( ldc, * )
130 * ..
131 *
132 * =====================================================================
133 *
134 * .. Parameters ..
135  REAL zero, one
136  parameter ( zero = 0.0e+0, one = 1.0e+0 )
137  COMPLEX czero, cone
138  parameter ( czero = ( 0.0e+0, 0.0e+0 ),
139  $ cone = ( 1.0e+0, 0.0e+0 ) )
140 * ..
141 * .. Local Scalars ..
142  INTEGER i, info, j, jc
143  REAL anorm, eps
144 * ..
145 * .. External Functions ..
146  LOGICAL lsame
147  REAL clanhe, clanhp, slamch
148  EXTERNAL lsame, clanhe, clanhp, slamch
149 * ..
150 * .. External Subroutines ..
151  EXTERNAL clavhp, claset
152 * ..
153 * .. Intrinsic Functions ..
154  INTRINSIC aimag, real
155 * ..
156 * .. Executable Statements ..
157 *
158 * Quick exit if N = 0.
159 *
160  IF( n.LE.0 ) THEN
161  resid = zero
162  RETURN
163  END IF
164 *
165 * Determine EPS and the norm of A.
166 *
167  eps = slamch( 'Epsilon' )
168  anorm = clanhp( '1', uplo, n, a, rwork )
169 *
170 * Check the imaginary parts of the diagonal elements and return with
171 * an error code if any are nonzero.
172 *
173  jc = 1
174  IF( lsame( uplo, 'U' ) ) THEN
175  DO 10 j = 1, n
176  IF( aimag( afac( jc ) ).NE.zero ) THEN
177  resid = one / eps
178  RETURN
179  END IF
180  jc = jc + j + 1
181  10 CONTINUE
182  ELSE
183  DO 20 j = 1, n
184  IF( aimag( afac( jc ) ).NE.zero ) THEN
185  resid = one / eps
186  RETURN
187  END IF
188  jc = jc + n - j + 1
189  20 CONTINUE
190  END IF
191 *
192 * Initialize C to the identity matrix.
193 *
194  CALL claset( 'Full', n, n, czero, cone, c, ldc )
195 *
196 * Call CLAVHP to form the product D * U' (or D * L' ).
197 *
198  CALL clavhp( uplo, 'Conjugate', 'Non-unit', n, n, afac, ipiv, c,
199  $ ldc, info )
200 *
201 * Call CLAVHP again to multiply by U ( or L ).
202 *
203  CALL clavhp( uplo, 'No transpose', 'Unit', n, n, afac, ipiv, c,
204  $ ldc, info )
205 *
206 * Compute the difference C - A .
207 *
208  IF( lsame( uplo, 'U' ) ) THEN
209  jc = 0
210  DO 40 j = 1, n
211  DO 30 i = 1, j - 1
212  c( i, j ) = c( i, j ) - a( jc+i )
213  30 CONTINUE
214  c( j, j ) = c( j, j ) - REAL( A( JC+J ) )
215  jc = jc + j
216  40 CONTINUE
217  ELSE
218  jc = 1
219  DO 60 j = 1, n
220  c( j, j ) = c( j, j ) - REAL( A( JC ) )
221  DO 50 i = j + 1, n
222  c( i, j ) = c( i, j ) - a( jc+i-j )
223  50 CONTINUE
224  jc = jc + n - j + 1
225  60 CONTINUE
226  END IF
227 *
228 * Compute norm( C - A ) / ( N * norm(A) * EPS )
229 *
230  resid = clanhe( '1', uplo, n, c, ldc, rwork )
231 *
232  IF( anorm.LE.zero ) THEN
233  IF( resid.NE.zero )
234  $ resid = one / eps
235  ELSE
236  resid = ( ( resid / REAL( N ) ) / anorm ) / eps
237  END IF
238 *
239  RETURN
240 *
241 * End of CHPT01
242 *
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
subroutine clavhp(UPLO, TRANS, DIAG, N, NRHS, A, IPIV, B, LDB, INFO)
CLAVHP
Definition: clavhp.f:133
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
real function clanhp(NORM, UPLO, N, AP, WORK)
CLANHP 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 supplied in packed form.
Definition: clanhp.f:119
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55

Here is the call graph for this function:

Here is the caller graph for this function: