LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine zppt01 ( character  UPLO,
integer  N,
complex*16, dimension( * )  A,
complex*16, dimension( * )  AFAC,
double precision, dimension( * )  RWORK,
double precision  RESID 
)

ZPPT01

Purpose:
 ZPPT01 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*16 array, dimension (N*(N+1)/2)
          The original Hermitian matrix A, stored as a packed
          triangular matrix.
[in,out]AFAC
          AFAC is COMPLEX*16 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 DOUBLE PRECISION array, dimension (N)
[out]RESID
          RESID is DOUBLE PRECISION
          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 zppt01.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  DOUBLE PRECISION resid
107 * ..
108 * .. Array Arguments ..
109  DOUBLE PRECISION rwork( * )
110  COMPLEX*16 a( * ), afac( * )
111 * ..
112 *
113 * =====================================================================
114 *
115 * .. Parameters ..
116  DOUBLE PRECISION zero, one
117  parameter ( zero = 0.0d+0, one = 1.0d+0 )
118 * ..
119 * .. Local Scalars ..
120  INTEGER i, k, kc
121  DOUBLE PRECISION anorm, eps, tr
122  COMPLEX*16 tc
123 * ..
124 * .. External Functions ..
125  LOGICAL lsame
126  DOUBLE PRECISION dlamch, zlanhp
127  COMPLEX*16 zdotc
128  EXTERNAL lsame, dlamch, zlanhp, zdotc
129 * ..
130 * .. External Subroutines ..
131  EXTERNAL zhpr, zscal, ztpmv
132 * ..
133 * .. Intrinsic Functions ..
134  INTRINSIC dble, dimag
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 = dlamch( 'Epsilon' )
148  anorm = zlanhp( '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( dimag( 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( dimag( 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 = zdotc( 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 ztpmv( '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 ) - dble( 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 zhpr( '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 zscal( 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 ) - dble( 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 = zlanhp( '1', uplo, n, afac, rwork )
243 *
244  resid = ( ( resid / dble( n ) ) / anorm ) / eps
245 *
246  RETURN
247 *
248 * End of ZPPT01
249 *
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65
double precision function zlanhp(NORM, UPLO, N, AP, WORK)
ZLANHP 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: zlanhp.f:119
complex *16 function zdotc(N, ZX, INCX, ZY, INCY)
ZDOTC
Definition: zdotc.f:54
subroutine ztpmv(UPLO, TRANS, DIAG, N, AP, X, INCX)
ZTPMV
Definition: ztpmv.f:144
subroutine zhpr(UPLO, N, ALPHA, X, INCX, AP)
ZHPR
Definition: zhpr.f:132
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine zscal(N, ZA, ZX, INCX)
ZSCAL
Definition: zscal.f:54

Here is the call graph for this function:

Here is the caller graph for this function: