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

DSYTD2 reduces a symmetric matrix to real symmetric tridiagonal form by an orthogonal similarity transformation (unblocked algorithm).

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

Purpose:
 DSYTD2 reduces a real symmetric matrix A to symmetric tridiagonal
 form T by an orthogonal similarity transformation: Q**T * A * Q = T.
Parameters
[in]UPLO
          UPLO is CHARACTER*1
          Specifies whether the upper or lower triangular part of the
          symmetric 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 DOUBLE PRECISION array, dimension (LDA,N)
          On entry, the symmetric 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 orthogonal
          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 orthogonal 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 DOUBLE PRECISION 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**T

  where tau is a real scalar, and v is a real 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**T

  where tau is a real scalar, and v is a real 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 175 of file dsytd2.f.

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

Here is the call graph for this function:

Here is the caller graph for this function: