LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine zhetd2 ( character  UPLO,
integer  N,
complex*16, dimension( lda, * )  A,
integer  LDA,
double precision, dimension( * )  D,
double precision, dimension( * )  E,
complex*16, dimension( * )  TAU,
integer  INFO 
)

ZHETD2 reduces a Hermitian matrix to real symmetric tridiagonal form by an unitary similarity transformation (unblocked algorithm).

Download ZHETD2 + dependencies [TGZ] [ZIP] [TXT]

Purpose:
 ZHETD2 reduces a complex Hermitian matrix A to real symmetric
 tridiagonal form T by a unitary similarity transformation:
 Q**H * A * Q = T.
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 order of the matrix A.  N >= 0.
[in,out]A
          A is COMPLEX*16 array, dimension (LDA,N)
          On entry, the Hermitian matrix A.  If UPLO = 'U', the leading
          n-by-n upper triangular part of A contains the upper
          triangular part of the matrix A, and the strictly lower
          triangular part of A is not referenced.  If UPLO = 'L', the
          leading n-by-n lower triangular part of A contains the lower
          triangular part of the matrix A, and the strictly upper
          triangular part of A is not referenced.
          On exit, if UPLO = 'U', the diagonal and first superdiagonal
          of A are overwritten by the corresponding elements of the
          tridiagonal matrix T, and the elements above the first
          superdiagonal, with the array TAU, represent the unitary
          matrix Q as a product of elementary reflectors; if UPLO
          = 'L', the diagonal and first subdiagonal of A are over-
          written by the corresponding elements of the tridiagonal
          matrix T, and the elements below the first subdiagonal, with
          the array TAU, represent the unitary matrix Q as a product
          of elementary reflectors. See Further Details.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(1,N).
[out]D
          D is DOUBLE PRECISION array, dimension (N)
          The diagonal elements of the tridiagonal matrix T:
          D(i) = A(i,i).
[out]E
          E is DOUBLE PRECISION array, dimension (N-1)
          The off-diagonal elements of the tridiagonal matrix T:
          E(i) = A(i,i+1) if UPLO = 'U', E(i) = A(i+1,i) if UPLO = 'L'.
[out]TAU
          TAU is COMPLEX*16 array, dimension (N-1)
          The scalar factors of the elementary reflectors (see Further
          Details).
[out]INFO
          INFO is INTEGER
          = 0:  successful exit
          < 0:  if INFO = -i, the i-th argument had an illegal value.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
September 2012
Further Details:
  If UPLO = 'U', the matrix Q is represented as a product of elementary
  reflectors

     Q = H(n-1) . . . H(2) H(1).

  Each H(i) has the form

     H(i) = I - tau * v * v**H

  where tau is a complex scalar, and v is a complex vector with
  v(i+1:n) = 0 and v(i) = 1; v(1:i-1) is stored on exit in
  A(1:i-1,i+1), and tau in TAU(i).

  If UPLO = 'L', the matrix Q is represented as a product of elementary
  reflectors

     Q = H(1) H(2) . . . H(n-1).

  Each H(i) has the form

     H(i) = I - tau * v * v**H

  where tau is a complex scalar, and v is a complex vector with
  v(1:i) = 0 and v(i+1) = 1; v(i+2:n) is stored on exit in A(i+2:n,i),
  and tau in TAU(i).

  The contents of A on exit are illustrated by the following examples
  with n = 5:

  if UPLO = 'U':                       if UPLO = 'L':

    (  d   e   v2  v3  v4 )              (  d                  )
    (      d   e   v3  v4 )              (  e   d              )
    (          d   e   v4 )              (  v1  e   d          )
    (              d   e  )              (  v1  v2  e   d      )
    (                  d  )              (  v1  v2  v3  e   d  )

  where d and e denote diagonal and off-diagonal elements of T, and vi
  denotes an element of the vector defining H(i).

Definition at line 177 of file zhetd2.f.

177 *
178 * -- LAPACK computational routine (version 3.4.2) --
179 * -- LAPACK is a software package provided by Univ. of Tennessee, --
180 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
181 * September 2012
182 *
183 * .. Scalar Arguments ..
184  CHARACTER uplo
185  INTEGER info, lda, n
186 * ..
187 * .. Array Arguments ..
188  DOUBLE PRECISION d( * ), e( * )
189  COMPLEX*16 a( lda, * ), tau( * )
190 * ..
191 *
192 * =====================================================================
193 *
194 * .. Parameters ..
195  COMPLEX*16 one, zero, half
196  parameter ( one = ( 1.0d+0, 0.0d+0 ),
197  $ zero = ( 0.0d+0, 0.0d+0 ),
198  $ half = ( 0.5d+0, 0.0d+0 ) )
199 * ..
200 * .. Local Scalars ..
201  LOGICAL upper
202  INTEGER i
203  COMPLEX*16 alpha, taui
204 * ..
205 * .. External Subroutines ..
206  EXTERNAL xerbla, zaxpy, zhemv, zher2, zlarfg
207 * ..
208 * .. External Functions ..
209  LOGICAL lsame
210  COMPLEX*16 zdotc
211  EXTERNAL lsame, zdotc
212 * ..
213 * .. Intrinsic Functions ..
214  INTRINSIC dble, max, min
215 * ..
216 * .. Executable Statements ..
217 *
218 * Test the input parameters
219 *
220  info = 0
221  upper = lsame( uplo, 'U')
222  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
223  info = -1
224  ELSE IF( n.LT.0 ) THEN
225  info = -2
226  ELSE IF( lda.LT.max( 1, n ) ) THEN
227  info = -4
228  END IF
229  IF( info.NE.0 ) THEN
230  CALL xerbla( 'ZHETD2', -info )
231  RETURN
232  END IF
233 *
234 * Quick return if possible
235 *
236  IF( n.LE.0 )
237  $ RETURN
238 *
239  IF( upper ) THEN
240 *
241 * Reduce the upper triangle of A
242 *
243  a( n, n ) = dble( a( n, n ) )
244  DO 10 i = n - 1, 1, -1
245 *
246 * Generate elementary reflector H(i) = I - tau * v * v**H
247 * to annihilate A(1:i-1,i+1)
248 *
249  alpha = a( i, i+1 )
250  CALL zlarfg( i, alpha, a( 1, i+1 ), 1, taui )
251  e( i ) = alpha
252 *
253  IF( taui.NE.zero ) THEN
254 *
255 * Apply H(i) from both sides to A(1:i,1:i)
256 *
257  a( i, i+1 ) = one
258 *
259 * Compute x := tau * A * v storing x in TAU(1:i)
260 *
261  CALL zhemv( uplo, i, taui, a, lda, a( 1, i+1 ), 1, zero,
262  $ tau, 1 )
263 *
264 * Compute w := x - 1/2 * tau * (x**H * v) * v
265 *
266  alpha = -half*taui*zdotc( i, tau, 1, a( 1, i+1 ), 1 )
267  CALL zaxpy( i, alpha, a( 1, i+1 ), 1, tau, 1 )
268 *
269 * Apply the transformation as a rank-2 update:
270 * A := A - v * w**H - w * v**H
271 *
272  CALL zher2( uplo, i, -one, a( 1, i+1 ), 1, tau, 1, a,
273  $ lda )
274 *
275  ELSE
276  a( i, i ) = dble( a( i, i ) )
277  END IF
278  a( i, i+1 ) = e( i )
279  d( i+1 ) = a( i+1, i+1 )
280  tau( i ) = taui
281  10 CONTINUE
282  d( 1 ) = a( 1, 1 )
283  ELSE
284 *
285 * Reduce the lower triangle of A
286 *
287  a( 1, 1 ) = dble( a( 1, 1 ) )
288  DO 20 i = 1, n - 1
289 *
290 * Generate elementary reflector H(i) = I - tau * v * v**H
291 * to annihilate A(i+2:n,i)
292 *
293  alpha = a( i+1, i )
294  CALL zlarfg( n-i, alpha, a( min( i+2, n ), i ), 1, taui )
295  e( i ) = alpha
296 *
297  IF( taui.NE.zero ) THEN
298 *
299 * Apply H(i) from both sides to A(i+1:n,i+1:n)
300 *
301  a( i+1, i ) = one
302 *
303 * Compute x := tau * A * v storing y in TAU(i:n-1)
304 *
305  CALL zhemv( uplo, n-i, taui, a( i+1, i+1 ), lda,
306  $ a( i+1, i ), 1, zero, tau( i ), 1 )
307 *
308 * Compute w := x - 1/2 * tau * (x**H * v) * v
309 *
310  alpha = -half*taui*zdotc( n-i, tau( i ), 1, a( i+1, i ),
311  $ 1 )
312  CALL zaxpy( n-i, alpha, a( i+1, i ), 1, tau( i ), 1 )
313 *
314 * Apply the transformation as a rank-2 update:
315 * A := A - v * w**H - w * v**H
316 *
317  CALL zher2( uplo, n-i, -one, a( i+1, i ), 1, tau( i ), 1,
318  $ a( i+1, i+1 ), lda )
319 *
320  ELSE
321  a( i+1, i+1 ) = dble( a( i+1, i+1 ) )
322  END IF
323  a( i+1, i ) = e( i )
324  d( i ) = a( i, i )
325  tau( i ) = taui
326  20 CONTINUE
327  d( n ) = a( n, n )
328  END IF
329 *
330  RETURN
331 *
332 * End of ZHETD2
333 *
subroutine zhemv(UPLO, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
ZHEMV
Definition: zhemv.f:156
subroutine zlarfg(N, ALPHA, X, INCX, TAU)
ZLARFG generates an elementary reflector (Householder matrix).
Definition: zlarfg.f:108
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
complex *16 function zdotc(N, ZX, INCX, ZY, INCY)
ZDOTC
Definition: zdotc.f:54
subroutine zher2(UPLO, N, ALPHA, X, INCX, Y, INCY, A, LDA)
ZHER2
Definition: zher2.f:152
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine zaxpy(N, ZA, ZX, INCX, ZY, INCY)
ZAXPY
Definition: zaxpy.f:53

Here is the call graph for this function:

Here is the caller graph for this function: