annotate libcruft/lapack/dsytrd.f @ 7034:68db500cb558

[project @ 2007-10-16 18:54:19 by jwe]
author jwe
date Tue, 16 Oct 2007 18:54:23 +0000
parents 15cddaacbc2d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2814
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
1 SUBROUTINE DSYTRD( UPLO, N, A, LDA, D, E, TAU, WORK, LWORK, INFO )
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
2 *
7034
68db500cb558 [project @ 2007-10-16 18:54:19 by jwe]
jwe
parents: 3333
diff changeset
3 * -- LAPACK routine (version 3.1) --
68db500cb558 [project @ 2007-10-16 18:54:19 by jwe]
jwe
parents: 3333
diff changeset
4 * Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
68db500cb558 [project @ 2007-10-16 18:54:19 by jwe]
jwe
parents: 3333
diff changeset
5 * November 2006
2814
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
6 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
7 * .. Scalar Arguments ..
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
8 CHARACTER UPLO
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
9 INTEGER INFO, LDA, LWORK, N
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
10 * ..
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
11 * .. Array Arguments ..
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
12 DOUBLE PRECISION A( LDA, * ), D( * ), E( * ), TAU( * ),
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
13 $ WORK( * )
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
14 * ..
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
15 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
16 * Purpose
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
17 * =======
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
18 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
19 * DSYTRD reduces a real symmetric matrix A to real symmetric
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
20 * tridiagonal form T by an orthogonal similarity transformation:
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
21 * Q**T * A * Q = T.
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
22 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
23 * Arguments
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
24 * =========
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
25 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
26 * UPLO (input) CHARACTER*1
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
27 * = 'U': Upper triangle of A is stored;
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
28 * = 'L': Lower triangle of A is stored.
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
29 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
30 * N (input) INTEGER
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
31 * The order of the matrix A. N >= 0.
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
32 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
33 * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
34 * On entry, the symmetric matrix A. If UPLO = 'U', the leading
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
35 * N-by-N upper triangular part of A contains the upper
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
36 * triangular part of the matrix A, and the strictly lower
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
37 * triangular part of A is not referenced. If UPLO = 'L', the
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
38 * leading N-by-N lower triangular part of A contains the lower
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
39 * triangular part of the matrix A, and the strictly upper
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
40 * triangular part of A is not referenced.
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
41 * On exit, if UPLO = 'U', the diagonal and first superdiagonal
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
42 * of A are overwritten by the corresponding elements of the
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
43 * tridiagonal matrix T, and the elements above the first
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
44 * superdiagonal, with the array TAU, represent the orthogonal
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
45 * matrix Q as a product of elementary reflectors; if UPLO
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
46 * = 'L', the diagonal and first subdiagonal of A are over-
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
47 * written by the corresponding elements of the tridiagonal
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
48 * matrix T, and the elements below the first subdiagonal, with
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
49 * the array TAU, represent the orthogonal matrix Q as a product
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
50 * of elementary reflectors. See Further Details.
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
51 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
52 * LDA (input) INTEGER
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
53 * The leading dimension of the array A. LDA >= max(1,N).
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
54 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
55 * D (output) DOUBLE PRECISION array, dimension (N)
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
56 * The diagonal elements of the tridiagonal matrix T:
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
57 * D(i) = A(i,i).
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
58 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
59 * E (output) DOUBLE PRECISION array, dimension (N-1)
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
60 * The off-diagonal elements of the tridiagonal matrix T:
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
61 * E(i) = A(i,i+1) if UPLO = 'U', E(i) = A(i+1,i) if UPLO = 'L'.
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
62 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
63 * TAU (output) DOUBLE PRECISION array, dimension (N-1)
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
64 * The scalar factors of the elementary reflectors (see Further
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
65 * Details).
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
66 *
7034
68db500cb558 [project @ 2007-10-16 18:54:19 by jwe]
jwe
parents: 3333
diff changeset
67 * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
2814
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
68 * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
69 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
70 * LWORK (input) INTEGER
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
71 * The dimension of the array WORK. LWORK >= 1.
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
72 * For optimum performance LWORK >= N*NB, where NB is the
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
73 * optimal blocksize.
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
74 *
3333
15cddaacbc2d [project @ 1999-11-03 19:53:59 by jwe]
jwe
parents: 2814
diff changeset
75 * If LWORK = -1, then a workspace query is assumed; the routine
15cddaacbc2d [project @ 1999-11-03 19:53:59 by jwe]
jwe
parents: 2814
diff changeset
76 * only calculates the optimal size of the WORK array, returns
15cddaacbc2d [project @ 1999-11-03 19:53:59 by jwe]
jwe
parents: 2814
diff changeset
77 * this value as the first entry of the WORK array, and no error
15cddaacbc2d [project @ 1999-11-03 19:53:59 by jwe]
jwe
parents: 2814
diff changeset
78 * message related to LWORK is issued by XERBLA.
15cddaacbc2d [project @ 1999-11-03 19:53:59 by jwe]
jwe
parents: 2814
diff changeset
79 *
2814
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
80 * INFO (output) INTEGER
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
81 * = 0: successful exit
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
82 * < 0: if INFO = -i, the i-th argument had an illegal value
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
83 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
84 * Further Details
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
85 * ===============
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
86 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
87 * If UPLO = 'U', the matrix Q is represented as a product of elementary
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
88 * reflectors
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
89 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
90 * Q = H(n-1) . . . H(2) H(1).
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
91 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
92 * Each H(i) has the form
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
93 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
94 * H(i) = I - tau * v * v'
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
95 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
96 * where tau is a real scalar, and v is a real vector with
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
97 * v(i+1:n) = 0 and v(i) = 1; v(1:i-1) is stored on exit in
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
98 * A(1:i-1,i+1), and tau in TAU(i).
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
99 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
100 * If UPLO = 'L', the matrix Q is represented as a product of elementary
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
101 * reflectors
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
102 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
103 * Q = H(1) H(2) . . . H(n-1).
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
104 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
105 * Each H(i) has the form
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
106 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
107 * H(i) = I - tau * v * v'
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
108 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
109 * where tau is a real scalar, and v is a real vector with
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
110 * v(1:i) = 0 and v(i+1) = 1; v(i+2:n) is stored on exit in A(i+2:n,i),
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
111 * and tau in TAU(i).
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
112 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
113 * The contents of A on exit are illustrated by the following examples
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
114 * with n = 5:
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
115 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
116 * if UPLO = 'U': if UPLO = 'L':
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
117 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
118 * ( d e v2 v3 v4 ) ( d )
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
119 * ( d e v3 v4 ) ( e d )
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
120 * ( d e v4 ) ( v1 e d )
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
121 * ( d e ) ( v1 v2 e d )
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
122 * ( d ) ( v1 v2 v3 e d )
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
123 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
124 * where d and e denote diagonal and off-diagonal elements of T, and vi
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
125 * denotes an element of the vector defining H(i).
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
126 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
127 * =====================================================================
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
128 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
129 * .. Parameters ..
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
130 DOUBLE PRECISION ONE
3333
15cddaacbc2d [project @ 1999-11-03 19:53:59 by jwe]
jwe
parents: 2814
diff changeset
131 PARAMETER ( ONE = 1.0D+0 )
2814
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
132 * ..
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
133 * .. Local Scalars ..
3333
15cddaacbc2d [project @ 1999-11-03 19:53:59 by jwe]
jwe
parents: 2814
diff changeset
134 LOGICAL LQUERY, UPPER
15cddaacbc2d [project @ 1999-11-03 19:53:59 by jwe]
jwe
parents: 2814
diff changeset
135 INTEGER I, IINFO, IWS, J, KK, LDWORK, LWKOPT, NB,
15cddaacbc2d [project @ 1999-11-03 19:53:59 by jwe]
jwe
parents: 2814
diff changeset
136 $ NBMIN, NX
2814
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
137 * ..
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
138 * .. External Subroutines ..
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
139 EXTERNAL DLATRD, DSYR2K, DSYTD2, XERBLA
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
140 * ..
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
141 * .. Intrinsic Functions ..
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
142 INTRINSIC MAX
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
143 * ..
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
144 * .. External Functions ..
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
145 LOGICAL LSAME
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
146 INTEGER ILAENV
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
147 EXTERNAL LSAME, ILAENV
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
148 * ..
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
149 * .. Executable Statements ..
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
150 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
151 * Test the input parameters
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
152 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
153 INFO = 0
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
154 UPPER = LSAME( UPLO, 'U' )
3333
15cddaacbc2d [project @ 1999-11-03 19:53:59 by jwe]
jwe
parents: 2814
diff changeset
155 LQUERY = ( LWORK.EQ.-1 )
2814
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
156 IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
157 INFO = -1
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
158 ELSE IF( N.LT.0 ) THEN
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
159 INFO = -2
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
160 ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
161 INFO = -4
3333
15cddaacbc2d [project @ 1999-11-03 19:53:59 by jwe]
jwe
parents: 2814
diff changeset
162 ELSE IF( LWORK.LT.1 .AND. .NOT.LQUERY ) THEN
2814
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
163 INFO = -9
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
164 END IF
3333
15cddaacbc2d [project @ 1999-11-03 19:53:59 by jwe]
jwe
parents: 2814
diff changeset
165 *
15cddaacbc2d [project @ 1999-11-03 19:53:59 by jwe]
jwe
parents: 2814
diff changeset
166 IF( INFO.EQ.0 ) THEN
15cddaacbc2d [project @ 1999-11-03 19:53:59 by jwe]
jwe
parents: 2814
diff changeset
167 *
15cddaacbc2d [project @ 1999-11-03 19:53:59 by jwe]
jwe
parents: 2814
diff changeset
168 * Determine the block size.
15cddaacbc2d [project @ 1999-11-03 19:53:59 by jwe]
jwe
parents: 2814
diff changeset
169 *
15cddaacbc2d [project @ 1999-11-03 19:53:59 by jwe]
jwe
parents: 2814
diff changeset
170 NB = ILAENV( 1, 'DSYTRD', UPLO, N, -1, -1, -1 )
15cddaacbc2d [project @ 1999-11-03 19:53:59 by jwe]
jwe
parents: 2814
diff changeset
171 LWKOPT = N*NB
15cddaacbc2d [project @ 1999-11-03 19:53:59 by jwe]
jwe
parents: 2814
diff changeset
172 WORK( 1 ) = LWKOPT
15cddaacbc2d [project @ 1999-11-03 19:53:59 by jwe]
jwe
parents: 2814
diff changeset
173 END IF
15cddaacbc2d [project @ 1999-11-03 19:53:59 by jwe]
jwe
parents: 2814
diff changeset
174 *
2814
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
175 IF( INFO.NE.0 ) THEN
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
176 CALL XERBLA( 'DSYTRD', -INFO )
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
177 RETURN
3333
15cddaacbc2d [project @ 1999-11-03 19:53:59 by jwe]
jwe
parents: 2814
diff changeset
178 ELSE IF( LQUERY ) THEN
15cddaacbc2d [project @ 1999-11-03 19:53:59 by jwe]
jwe
parents: 2814
diff changeset
179 RETURN
2814
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
180 END IF
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
181 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
182 * Quick return if possible
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
183 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
184 IF( N.EQ.0 ) THEN
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
185 WORK( 1 ) = 1
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
186 RETURN
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
187 END IF
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
188 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
189 NX = N
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
190 IWS = 1
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
191 IF( NB.GT.1 .AND. NB.LT.N ) THEN
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
192 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
193 * Determine when to cross over from blocked to unblocked code
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
194 * (last block is always handled by unblocked code).
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
195 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
196 NX = MAX( NB, ILAENV( 3, 'DSYTRD', UPLO, N, -1, -1, -1 ) )
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
197 IF( NX.LT.N ) THEN
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
198 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
199 * Determine if workspace is large enough for blocked code.
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
200 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
201 LDWORK = N
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
202 IWS = LDWORK*NB
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
203 IF( LWORK.LT.IWS ) THEN
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
204 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
205 * Not enough workspace to use optimal NB: determine the
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
206 * minimum value of NB, and reduce NB or force use of
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
207 * unblocked code by setting NX = N.
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
208 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
209 NB = MAX( LWORK / LDWORK, 1 )
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
210 NBMIN = ILAENV( 2, 'DSYTRD', UPLO, N, -1, -1, -1 )
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
211 IF( NB.LT.NBMIN )
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
212 $ NX = N
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
213 END IF
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
214 ELSE
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
215 NX = N
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
216 END IF
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
217 ELSE
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
218 NB = 1
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
219 END IF
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
220 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
221 IF( UPPER ) THEN
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
222 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
223 * Reduce the upper triangle of A.
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
224 * Columns 1:kk are handled by the unblocked method.
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
225 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
226 KK = N - ( ( N-NX+NB-1 ) / NB )*NB
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
227 DO 20 I = N - NB + 1, KK + 1, -NB
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
228 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
229 * Reduce columns i:i+nb-1 to tridiagonal form and form the
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
230 * matrix W which is needed to update the unreduced part of
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
231 * the matrix
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
232 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
233 CALL DLATRD( UPLO, I+NB-1, NB, A, LDA, E, TAU, WORK,
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
234 $ LDWORK )
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
235 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
236 * Update the unreduced submatrix A(1:i-1,1:i-1), using an
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
237 * update of the form: A := A - V*W' - W*V'
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
238 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
239 CALL DSYR2K( UPLO, 'No transpose', I-1, NB, -ONE, A( 1, I ),
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
240 $ LDA, WORK, LDWORK, ONE, A, LDA )
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
241 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
242 * Copy superdiagonal elements back into A, and diagonal
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
243 * elements into D
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
244 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
245 DO 10 J = I, I + NB - 1
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
246 A( J-1, J ) = E( J-1 )
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
247 D( J ) = A( J, J )
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
248 10 CONTINUE
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
249 20 CONTINUE
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
250 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
251 * Use unblocked code to reduce the last or only block
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
252 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
253 CALL DSYTD2( UPLO, KK, A, LDA, D, E, TAU, IINFO )
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
254 ELSE
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
255 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
256 * Reduce the lower triangle of A
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
257 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
258 DO 40 I = 1, N - NX, NB
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
259 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
260 * Reduce columns i:i+nb-1 to tridiagonal form and form the
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
261 * matrix W which is needed to update the unreduced part of
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
262 * the matrix
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
263 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
264 CALL DLATRD( UPLO, N-I+1, NB, A( I, I ), LDA, E( I ),
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
265 $ TAU( I ), WORK, LDWORK )
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
266 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
267 * Update the unreduced submatrix A(i+ib:n,i+ib:n), using
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
268 * an update of the form: A := A - V*W' - W*V'
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
269 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
270 CALL DSYR2K( UPLO, 'No transpose', N-I-NB+1, NB, -ONE,
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
271 $ A( I+NB, I ), LDA, WORK( NB+1 ), LDWORK, ONE,
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
272 $ A( I+NB, I+NB ), LDA )
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
273 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
274 * Copy subdiagonal elements back into A, and diagonal
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
275 * elements into D
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
276 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
277 DO 30 J = I, I + NB - 1
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
278 A( J+1, J ) = E( J )
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
279 D( J ) = A( J, J )
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
280 30 CONTINUE
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
281 40 CONTINUE
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
282 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
283 * Use unblocked code to reduce the last or only block
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
284 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
285 CALL DSYTD2( UPLO, N-I+1, A( I, I ), LDA, D( I ), E( I ),
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
286 $ TAU( I ), IINFO )
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
287 END IF
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
288 *
3333
15cddaacbc2d [project @ 1999-11-03 19:53:59 by jwe]
jwe
parents: 2814
diff changeset
289 WORK( 1 ) = LWKOPT
2814
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
290 RETURN
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
291 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
292 * End of DSYTRD
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
293 *
ffa60dc8e49b [project @ 1997-03-14 04:30:59 by jwe]
jwe
parents:
diff changeset
294 END