LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine cppt01 ( character  UPLO,
integer  N,
complex, dimension( * )  A,
complex, dimension( * )  AFAC,
real, dimension( * )  RWORK,
real  RESID 
)

CPPT01

Purpose:
 CPPT01 reconstructs a Hermitian positive definite packed matrix A
 from its L*L' or U'*U factorization and computes the residual
    norm( L*L' - A ) / ( N * norm(A) * EPS ) or
    norm( U'*U - A ) / ( N * norm(A) * EPS ),
 where 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,out]AFAC
          AFAC is COMPLEX array, dimension (N*(N+1)/2)
          On entry, the factor L or U from the L*L' or U'*U
          factorization of A, stored as a packed triangular matrix.
          Overwritten with the reconstructed matrix, and then with the
          difference L*L' - A (or U'*U - A).
[out]RWORK
          RWORK is REAL array, dimension (N)
[out]RESID
          RESID is REAL
          If UPLO = 'L', norm(L*L' - A) / ( N * norm(A) * EPS )
          If UPLO = 'U', norm(U'*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 97 of file cppt01.f.

97 *
98 * -- LAPACK test routine (version 3.4.0) --
99 * -- LAPACK is a software package provided by Univ. of Tennessee, --
100 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
101 * November 2011
102 *
103 * .. Scalar Arguments ..
104  CHARACTER uplo
105  INTEGER n
106  REAL resid
107 * ..
108 * .. Array Arguments ..
109  REAL rwork( * )
110  COMPLEX a( * ), afac( * )
111 * ..
112 *
113 * =====================================================================
114 *
115 * .. Parameters ..
116  REAL zero, one
117  parameter ( zero = 0.0e+0, one = 1.0e+0 )
118 * ..
119 * .. Local Scalars ..
120  INTEGER i, k, kc
121  REAL anorm, eps, tr
122  COMPLEX tc
123 * ..
124 * .. External Functions ..
125  LOGICAL lsame
126  REAL clanhp, slamch
127  COMPLEX cdotc
128  EXTERNAL lsame, clanhp, slamch, cdotc
129 * ..
130 * .. External Subroutines ..
131  EXTERNAL chpr, cscal, ctpmv
132 * ..
133 * .. Intrinsic Functions ..
134  INTRINSIC aimag, real
135 * ..
136 * .. Executable Statements ..
137 *
138 * Quick exit if N = 0
139 *
140  IF( n.LE.0 ) THEN
141  resid = zero
142  RETURN
143  END IF
144 *
145 * Exit with RESID = 1/EPS if ANORM = 0.
146 *
147  eps = slamch( 'Epsilon' )
148  anorm = clanhp( '1', uplo, n, a, rwork )
149  IF( anorm.LE.zero ) THEN
150  resid = one / eps
151  RETURN
152  END IF
153 *
154 * Check the imaginary parts of the diagonal elements and return with
155 * an error code if any are nonzero.
156 *
157  kc = 1
158  IF( lsame( uplo, 'U' ) ) THEN
159  DO 10 k = 1, n
160  IF( aimag( afac( kc ) ).NE.zero ) THEN
161  resid = one / eps
162  RETURN
163  END IF
164  kc = kc + k + 1
165  10 CONTINUE
166  ELSE
167  DO 20 k = 1, n
168  IF( aimag( afac( kc ) ).NE.zero ) THEN
169  resid = one / eps
170  RETURN
171  END IF
172  kc = kc + n - k + 1
173  20 CONTINUE
174  END IF
175 *
176 * Compute the product U'*U, overwriting U.
177 *
178  IF( lsame( uplo, 'U' ) ) THEN
179  kc = ( n*( n-1 ) ) / 2 + 1
180  DO 30 k = n, 1, -1
181 *
182 * Compute the (K,K) element of the result.
183 *
184  tr = cdotc( k, afac( kc ), 1, afac( kc ), 1 )
185  afac( kc+k-1 ) = tr
186 *
187 * Compute the rest of column K.
188 *
189  IF( k.GT.1 ) THEN
190  CALL ctpmv( 'Upper', 'Conjugate', 'Non-unit', k-1, afac,
191  $ afac( kc ), 1 )
192  kc = kc - ( k-1 )
193  END IF
194  30 CONTINUE
195 *
196 * Compute the difference L*L' - A
197 *
198  kc = 1
199  DO 50 k = 1, n
200  DO 40 i = 1, k - 1
201  afac( kc+i-1 ) = afac( kc+i-1 ) - a( kc+i-1 )
202  40 CONTINUE
203  afac( kc+k-1 ) = afac( kc+k-1 ) - REAL( A( KC+K-1 ) )
204  kc = kc + k
205  50 CONTINUE
206 *
207 * Compute the product L*L', overwriting L.
208 *
209  ELSE
210  kc = ( n*( n+1 ) ) / 2
211  DO 60 k = n, 1, -1
212 *
213 * Add a multiple of column K of the factor L to each of
214 * columns K+1 through N.
215 *
216  IF( k.LT.n )
217  $ CALL chpr( 'Lower', n-k, one, afac( kc+1 ), 1,
218  $ afac( kc+n-k+1 ) )
219 *
220 * Scale column K by the diagonal element.
221 *
222  tc = afac( kc )
223  CALL cscal( n-k+1, tc, afac( kc ), 1 )
224 *
225  kc = kc - ( n-k+2 )
226  60 CONTINUE
227 *
228 * Compute the difference U'*U - A
229 *
230  kc = 1
231  DO 80 k = 1, n
232  afac( kc ) = afac( kc ) - REAL( A( KC ) )
233  DO 70 i = k + 1, n
234  afac( kc+i-k ) = afac( kc+i-k ) - a( kc+i-k )
235  70 CONTINUE
236  kc = kc + n - k + 1
237  80 CONTINUE
238  END IF
239 *
240 * Compute norm( L*U - A ) / ( N * norm(A) * EPS )
241 *
242  resid = clanhp( '1', uplo, n, afac, rwork )
243 *
244  resid = ( ( resid / REAL( N ) ) / anorm ) / eps
245 *
246  RETURN
247 *
248 * End of CPPT01
249 *
subroutine ctpmv(UPLO, TRANS, DIAG, N, AP, X, INCX)
CTPMV
Definition: ctpmv.f:144
subroutine cscal(N, CA, CX, INCX)
CSCAL
Definition: cscal.f:54
subroutine chpr(UPLO, N, ALPHA, X, INCX, AP)
CHPR
Definition: chpr.f:132
complex function cdotc(N, CX, INCX, CY, INCY)
CDOTC
Definition: cdotc.f:54
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: