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

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

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

Purpose:
 SSYTD2 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 REAL 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 REAL array, dimension (N)
          The diagonal elements of the tridiagonal matrix T:
          D(i) = A(i,i).
[out]E
          E is REAL 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 REAL 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 ssytd2.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  REAL a( lda, * ), d( * ), e( * ), tau( * )
187 * ..
188 *
189 * =====================================================================
190 *
191 * .. Parameters ..
192  REAL one, zero, half
193  parameter ( one = 1.0, zero = 0.0, half = 1.0 / 2.0 )
194 * ..
195 * .. Local Scalars ..
196  LOGICAL upper
197  INTEGER i
198  REAL alpha, taui
199 * ..
200 * .. External Subroutines ..
201  EXTERNAL saxpy, slarfg, ssymv, ssyr2, xerbla
202 * ..
203 * .. External Functions ..
204  LOGICAL lsame
205  REAL sdot
206  EXTERNAL lsame, sdot
207 * ..
208 * .. Intrinsic Functions ..
209  INTRINSIC max, min
210 * ..
211 * .. Executable Statements ..
212 *
213 * Test the input parameters
214 *
215  info = 0
216  upper = lsame( uplo, 'U' )
217  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
218  info = -1
219  ELSE IF( n.LT.0 ) THEN
220  info = -2
221  ELSE IF( lda.LT.max( 1, n ) ) THEN
222  info = -4
223  END IF
224  IF( info.NE.0 ) THEN
225  CALL xerbla( 'SSYTD2', -info )
226  RETURN
227  END IF
228 *
229 * Quick return if possible
230 *
231  IF( n.LE.0 )
232  $ RETURN
233 *
234  IF( upper ) THEN
235 *
236 * Reduce the upper triangle of A
237 *
238  DO 10 i = n - 1, 1, -1
239 *
240 * Generate elementary reflector H(i) = I - tau * v * v**T
241 * to annihilate A(1:i-1,i+1)
242 *
243  CALL slarfg( i, a( i, i+1 ), a( 1, i+1 ), 1, taui )
244  e( i ) = a( i, i+1 )
245 *
246  IF( taui.NE.zero ) THEN
247 *
248 * Apply H(i) from both sides to A(1:i,1:i)
249 *
250  a( i, i+1 ) = one
251 *
252 * Compute x := tau * A * v storing x in TAU(1:i)
253 *
254  CALL ssymv( uplo, i, taui, a, lda, a( 1, i+1 ), 1, zero,
255  $ tau, 1 )
256 *
257 * Compute w := x - 1/2 * tau * (x**T * v) * v
258 *
259  alpha = -half*taui*sdot( i, tau, 1, a( 1, i+1 ), 1 )
260  CALL saxpy( i, alpha, a( 1, i+1 ), 1, tau, 1 )
261 *
262 * Apply the transformation as a rank-2 update:
263 * A := A - v * w**T - w * v**T
264 *
265  CALL ssyr2( uplo, i, -one, a( 1, i+1 ), 1, tau, 1, a,
266  $ lda )
267 *
268  a( i, i+1 ) = e( i )
269  END IF
270  d( i+1 ) = a( i+1, i+1 )
271  tau( i ) = taui
272  10 CONTINUE
273  d( 1 ) = a( 1, 1 )
274  ELSE
275 *
276 * Reduce the lower triangle of A
277 *
278  DO 20 i = 1, n - 1
279 *
280 * Generate elementary reflector H(i) = I - tau * v * v**T
281 * to annihilate A(i+2:n,i)
282 *
283  CALL slarfg( n-i, a( i+1, i ), a( min( i+2, n ), i ), 1,
284  $ taui )
285  e( i ) = a( i+1, i )
286 *
287  IF( taui.NE.zero ) THEN
288 *
289 * Apply H(i) from both sides to A(i+1:n,i+1:n)
290 *
291  a( i+1, i ) = one
292 *
293 * Compute x := tau * A * v storing y in TAU(i:n-1)
294 *
295  CALL ssymv( uplo, n-i, taui, a( i+1, i+1 ), lda,
296  $ a( i+1, i ), 1, zero, tau( i ), 1 )
297 *
298 * Compute w := x - 1/2 * tau * (x**T * v) * v
299 *
300  alpha = -half*taui*sdot( n-i, tau( i ), 1, a( i+1, i ),
301  $ 1 )
302  CALL saxpy( n-i, alpha, a( i+1, i ), 1, tau( i ), 1 )
303 *
304 * Apply the transformation as a rank-2 update:
305 * A := A - v * w**T - w * v**T
306 *
307  CALL ssyr2( uplo, n-i, -one, a( i+1, i ), 1, tau( i ), 1,
308  $ a( i+1, i+1 ), lda )
309 *
310  a( i+1, i ) = e( i )
311  END IF
312  d( i ) = a( i, i )
313  tau( i ) = taui
314  20 CONTINUE
315  d( n ) = a( n, n )
316  END IF
317 *
318  RETURN
319 *
320 * End of SSYTD2
321 *
subroutine ssyr2(UPLO, N, ALPHA, X, INCX, Y, INCY, A, LDA)
SSYR2
Definition: ssyr2.f:149
subroutine slarfg(N, ALPHA, X, INCX, TAU)
SLARFG generates an elementary reflector (Householder matrix).
Definition: slarfg.f:108
real function sdot(N, SX, INCX, SY, INCY)
SDOT
Definition: sdot.f:53
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine saxpy(N, SA, SX, INCX, SY, INCY)
SAXPY
Definition: saxpy.f:54
subroutine ssymv(UPLO, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
SSYMV
Definition: ssymv.f:154
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: