root / src / lapack / double / dlabrd.f @ 11
Historique | Voir | Annoter | Télécharger (11,42 ko)
1 | 1 | pfleura2 | SUBROUTINE DLABRD( M, N, NB, A, LDA, D, E, TAUQ, TAUP, X, LDX, Y, |
---|---|---|---|
2 | 1 | pfleura2 | $ LDY ) |
3 | 1 | pfleura2 | * |
4 | 1 | pfleura2 | * -- LAPACK auxiliary routine (version 3.2) -- |
5 | 1 | pfleura2 | * -- LAPACK is a software package provided by Univ. of Tennessee, -- |
6 | 1 | pfleura2 | * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- |
7 | 1 | pfleura2 | * November 2006 |
8 | 1 | pfleura2 | * |
9 | 1 | pfleura2 | * .. Scalar Arguments .. |
10 | 1 | pfleura2 | INTEGER LDA, LDX, LDY, M, N, NB |
11 | 1 | pfleura2 | * .. |
12 | 1 | pfleura2 | * .. Array Arguments .. |
13 | 1 | pfleura2 | DOUBLE PRECISION A( LDA, * ), D( * ), E( * ), TAUP( * ), |
14 | 1 | pfleura2 | $ TAUQ( * ), X( LDX, * ), Y( LDY, * ) |
15 | 1 | pfleura2 | * .. |
16 | 1 | pfleura2 | * |
17 | 1 | pfleura2 | * Purpose |
18 | 1 | pfleura2 | * ======= |
19 | 1 | pfleura2 | * |
20 | 1 | pfleura2 | * DLABRD reduces the first NB rows and columns of a real general |
21 | 1 | pfleura2 | * m by n matrix A to upper or lower bidiagonal form by an orthogonal |
22 | 1 | pfleura2 | * transformation Q' * A * P, and returns the matrices X and Y which |
23 | 1 | pfleura2 | * are needed to apply the transformation to the unreduced part of A. |
24 | 1 | pfleura2 | * |
25 | 1 | pfleura2 | * If m >= n, A is reduced to upper bidiagonal form; if m < n, to lower |
26 | 1 | pfleura2 | * bidiagonal form. |
27 | 1 | pfleura2 | * |
28 | 1 | pfleura2 | * This is an auxiliary routine called by DGEBRD |
29 | 1 | pfleura2 | * |
30 | 1 | pfleura2 | * Arguments |
31 | 1 | pfleura2 | * ========= |
32 | 1 | pfleura2 | * |
33 | 1 | pfleura2 | * M (input) INTEGER |
34 | 1 | pfleura2 | * The number of rows in the matrix A. |
35 | 1 | pfleura2 | * |
36 | 1 | pfleura2 | * N (input) INTEGER |
37 | 1 | pfleura2 | * The number of columns in the matrix A. |
38 | 1 | pfleura2 | * |
39 | 1 | pfleura2 | * NB (input) INTEGER |
40 | 1 | pfleura2 | * The number of leading rows and columns of A to be reduced. |
41 | 1 | pfleura2 | * |
42 | 1 | pfleura2 | * A (input/output) DOUBLE PRECISION array, dimension (LDA,N) |
43 | 1 | pfleura2 | * On entry, the m by n general matrix to be reduced. |
44 | 1 | pfleura2 | * On exit, the first NB rows and columns of the matrix are |
45 | 1 | pfleura2 | * overwritten; the rest of the array is unchanged. |
46 | 1 | pfleura2 | * If m >= n, elements on and below the diagonal in the first NB |
47 | 1 | pfleura2 | * columns, with the array TAUQ, represent the orthogonal |
48 | 1 | pfleura2 | * matrix Q as a product of elementary reflectors; and |
49 | 1 | pfleura2 | * elements above the diagonal in the first NB rows, with the |
50 | 1 | pfleura2 | * array TAUP, represent the orthogonal matrix P as a product |
51 | 1 | pfleura2 | * of elementary reflectors. |
52 | 1 | pfleura2 | * If m < n, elements below the diagonal in the first NB |
53 | 1 | pfleura2 | * columns, with the array TAUQ, represent the orthogonal |
54 | 1 | pfleura2 | * matrix Q as a product of elementary reflectors, and |
55 | 1 | pfleura2 | * elements on and above the diagonal in the first NB rows, |
56 | 1 | pfleura2 | * with the array TAUP, represent the orthogonal matrix P as |
57 | 1 | pfleura2 | * a product of elementary reflectors. |
58 | 1 | pfleura2 | * See Further Details. |
59 | 1 | pfleura2 | * |
60 | 1 | pfleura2 | * LDA (input) INTEGER |
61 | 1 | pfleura2 | * The leading dimension of the array A. LDA >= max(1,M). |
62 | 1 | pfleura2 | * |
63 | 1 | pfleura2 | * D (output) DOUBLE PRECISION array, dimension (NB) |
64 | 1 | pfleura2 | * The diagonal elements of the first NB rows and columns of |
65 | 1 | pfleura2 | * the reduced matrix. D(i) = A(i,i). |
66 | 1 | pfleura2 | * |
67 | 1 | pfleura2 | * E (output) DOUBLE PRECISION array, dimension (NB) |
68 | 1 | pfleura2 | * The off-diagonal elements of the first NB rows and columns of |
69 | 1 | pfleura2 | * the reduced matrix. |
70 | 1 | pfleura2 | * |
71 | 1 | pfleura2 | * TAUQ (output) DOUBLE PRECISION array dimension (NB) |
72 | 1 | pfleura2 | * The scalar factors of the elementary reflectors which |
73 | 1 | pfleura2 | * represent the orthogonal matrix Q. See Further Details. |
74 | 1 | pfleura2 | * |
75 | 1 | pfleura2 | * TAUP (output) DOUBLE PRECISION array, dimension (NB) |
76 | 1 | pfleura2 | * The scalar factors of the elementary reflectors which |
77 | 1 | pfleura2 | * represent the orthogonal matrix P. See Further Details. |
78 | 1 | pfleura2 | * |
79 | 1 | pfleura2 | * X (output) DOUBLE PRECISION array, dimension (LDX,NB) |
80 | 1 | pfleura2 | * The m-by-nb matrix X required to update the unreduced part |
81 | 1 | pfleura2 | * of A. |
82 | 1 | pfleura2 | * |
83 | 1 | pfleura2 | * LDX (input) INTEGER |
84 | 1 | pfleura2 | * The leading dimension of the array X. LDX >= M. |
85 | 1 | pfleura2 | * |
86 | 1 | pfleura2 | * Y (output) DOUBLE PRECISION array, dimension (LDY,NB) |
87 | 1 | pfleura2 | * The n-by-nb matrix Y required to update the unreduced part |
88 | 1 | pfleura2 | * of A. |
89 | 1 | pfleura2 | * |
90 | 1 | pfleura2 | * LDY (input) INTEGER |
91 | 1 | pfleura2 | * The leading dimension of the array Y. LDY >= N. |
92 | 1 | pfleura2 | * |
93 | 1 | pfleura2 | * Further Details |
94 | 1 | pfleura2 | * =============== |
95 | 1 | pfleura2 | * |
96 | 1 | pfleura2 | * The matrices Q and P are represented as products of elementary |
97 | 1 | pfleura2 | * reflectors: |
98 | 1 | pfleura2 | * |
99 | 1 | pfleura2 | * Q = H(1) H(2) . . . H(nb) and P = G(1) G(2) . . . G(nb) |
100 | 1 | pfleura2 | * |
101 | 1 | pfleura2 | * Each H(i) and G(i) has the form: |
102 | 1 | pfleura2 | * |
103 | 1 | pfleura2 | * H(i) = I - tauq * v * v' and G(i) = I - taup * u * u' |
104 | 1 | pfleura2 | * |
105 | 1 | pfleura2 | * where tauq and taup are real scalars, and v and u are real vectors. |
106 | 1 | pfleura2 | * |
107 | 1 | pfleura2 | * If m >= n, v(1:i-1) = 0, v(i) = 1, and v(i:m) is stored on exit in |
108 | 1 | pfleura2 | * A(i:m,i); u(1:i) = 0, u(i+1) = 1, and u(i+1:n) is stored on exit in |
109 | 1 | pfleura2 | * A(i,i+1:n); tauq is stored in TAUQ(i) and taup in TAUP(i). |
110 | 1 | pfleura2 | * |
111 | 1 | pfleura2 | * If m < n, v(1:i) = 0, v(i+1) = 1, and v(i+1:m) is stored on exit in |
112 | 1 | pfleura2 | * A(i+2:m,i); u(1:i-1) = 0, u(i) = 1, and u(i:n) is stored on exit in |
113 | 1 | pfleura2 | * A(i,i+1:n); tauq is stored in TAUQ(i) and taup in TAUP(i). |
114 | 1 | pfleura2 | * |
115 | 1 | pfleura2 | * The elements of the vectors v and u together form the m-by-nb matrix |
116 | 1 | pfleura2 | * V and the nb-by-n matrix U' which are needed, with X and Y, to apply |
117 | 1 | pfleura2 | * the transformation to the unreduced part of the matrix, using a block |
118 | 1 | pfleura2 | * update of the form: A := A - V*Y' - X*U'. |
119 | 1 | pfleura2 | * |
120 | 1 | pfleura2 | * The contents of A on exit are illustrated by the following examples |
121 | 1 | pfleura2 | * with nb = 2: |
122 | 1 | pfleura2 | * |
123 | 1 | pfleura2 | * m = 6 and n = 5 (m > n): m = 5 and n = 6 (m < n): |
124 | 1 | pfleura2 | * |
125 | 1 | pfleura2 | * ( 1 1 u1 u1 u1 ) ( 1 u1 u1 u1 u1 u1 ) |
126 | 1 | pfleura2 | * ( v1 1 1 u2 u2 ) ( 1 1 u2 u2 u2 u2 ) |
127 | 1 | pfleura2 | * ( v1 v2 a a a ) ( v1 1 a a a a ) |
128 | 1 | pfleura2 | * ( v1 v2 a a a ) ( v1 v2 a a a a ) |
129 | 1 | pfleura2 | * ( v1 v2 a a a ) ( v1 v2 a a a a ) |
130 | 1 | pfleura2 | * ( v1 v2 a a a ) |
131 | 1 | pfleura2 | * |
132 | 1 | pfleura2 | * where a denotes an element of the original matrix which is unchanged, |
133 | 1 | pfleura2 | * vi denotes an element of the vector defining H(i), and ui an element |
134 | 1 | pfleura2 | * of the vector defining G(i). |
135 | 1 | pfleura2 | * |
136 | 1 | pfleura2 | * ===================================================================== |
137 | 1 | pfleura2 | * |
138 | 1 | pfleura2 | * .. Parameters .. |
139 | 1 | pfleura2 | DOUBLE PRECISION ZERO, ONE |
140 | 1 | pfleura2 | PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 ) |
141 | 1 | pfleura2 | * .. |
142 | 1 | pfleura2 | * .. Local Scalars .. |
143 | 1 | pfleura2 | INTEGER I |
144 | 1 | pfleura2 | * .. |
145 | 1 | pfleura2 | * .. External Subroutines .. |
146 | 1 | pfleura2 | EXTERNAL DGEMV, DLARFG, DSCAL |
147 | 1 | pfleura2 | * .. |
148 | 1 | pfleura2 | * .. Intrinsic Functions .. |
149 | 1 | pfleura2 | INTRINSIC MIN |
150 | 1 | pfleura2 | * .. |
151 | 1 | pfleura2 | * .. Executable Statements .. |
152 | 1 | pfleura2 | * |
153 | 1 | pfleura2 | * Quick return if possible |
154 | 1 | pfleura2 | * |
155 | 1 | pfleura2 | IF( M.LE.0 .OR. N.LE.0 ) |
156 | 1 | pfleura2 | $ RETURN |
157 | 1 | pfleura2 | * |
158 | 1 | pfleura2 | IF( M.GE.N ) THEN |
159 | 1 | pfleura2 | * |
160 | 1 | pfleura2 | * Reduce to upper bidiagonal form |
161 | 1 | pfleura2 | * |
162 | 1 | pfleura2 | DO 10 I = 1, NB |
163 | 1 | pfleura2 | * |
164 | 1 | pfleura2 | * Update A(i:m,i) |
165 | 1 | pfleura2 | * |
166 | 1 | pfleura2 | CALL DGEMV( 'No transpose', M-I+1, I-1, -ONE, A( I, 1 ), |
167 | 1 | pfleura2 | $ LDA, Y( I, 1 ), LDY, ONE, A( I, I ), 1 ) |
168 | 1 | pfleura2 | CALL DGEMV( 'No transpose', M-I+1, I-1, -ONE, X( I, 1 ), |
169 | 1 | pfleura2 | $ LDX, A( 1, I ), 1, ONE, A( I, I ), 1 ) |
170 | 1 | pfleura2 | * |
171 | 1 | pfleura2 | * Generate reflection Q(i) to annihilate A(i+1:m,i) |
172 | 1 | pfleura2 | * |
173 | 1 | pfleura2 | CALL DLARFG( M-I+1, A( I, I ), A( MIN( I+1, M ), I ), 1, |
174 | 1 | pfleura2 | $ TAUQ( I ) ) |
175 | 1 | pfleura2 | D( I ) = A( I, I ) |
176 | 1 | pfleura2 | IF( I.LT.N ) THEN |
177 | 1 | pfleura2 | A( I, I ) = ONE |
178 | 1 | pfleura2 | * |
179 | 1 | pfleura2 | * Compute Y(i+1:n,i) |
180 | 1 | pfleura2 | * |
181 | 1 | pfleura2 | CALL DGEMV( 'Transpose', M-I+1, N-I, ONE, A( I, I+1 ), |
182 | 1 | pfleura2 | $ LDA, A( I, I ), 1, ZERO, Y( I+1, I ), 1 ) |
183 | 1 | pfleura2 | CALL DGEMV( 'Transpose', M-I+1, I-1, ONE, A( I, 1 ), LDA, |
184 | 1 | pfleura2 | $ A( I, I ), 1, ZERO, Y( 1, I ), 1 ) |
185 | 1 | pfleura2 | CALL DGEMV( 'No transpose', N-I, I-1, -ONE, Y( I+1, 1 ), |
186 | 1 | pfleura2 | $ LDY, Y( 1, I ), 1, ONE, Y( I+1, I ), 1 ) |
187 | 1 | pfleura2 | CALL DGEMV( 'Transpose', M-I+1, I-1, ONE, X( I, 1 ), LDX, |
188 | 1 | pfleura2 | $ A( I, I ), 1, ZERO, Y( 1, I ), 1 ) |
189 | 1 | pfleura2 | CALL DGEMV( 'Transpose', I-1, N-I, -ONE, A( 1, I+1 ), |
190 | 1 | pfleura2 | $ LDA, Y( 1, I ), 1, ONE, Y( I+1, I ), 1 ) |
191 | 1 | pfleura2 | CALL DSCAL( N-I, TAUQ( I ), Y( I+1, I ), 1 ) |
192 | 1 | pfleura2 | * |
193 | 1 | pfleura2 | * Update A(i,i+1:n) |
194 | 1 | pfleura2 | * |
195 | 1 | pfleura2 | CALL DGEMV( 'No transpose', N-I, I, -ONE, Y( I+1, 1 ), |
196 | 1 | pfleura2 | $ LDY, A( I, 1 ), LDA, ONE, A( I, I+1 ), LDA ) |
197 | 1 | pfleura2 | CALL DGEMV( 'Transpose', I-1, N-I, -ONE, A( 1, I+1 ), |
198 | 1 | pfleura2 | $ LDA, X( I, 1 ), LDX, ONE, A( I, I+1 ), LDA ) |
199 | 1 | pfleura2 | * |
200 | 1 | pfleura2 | * Generate reflection P(i) to annihilate A(i,i+2:n) |
201 | 1 | pfleura2 | * |
202 | 1 | pfleura2 | CALL DLARFG( N-I, A( I, I+1 ), A( I, MIN( I+2, N ) ), |
203 | 1 | pfleura2 | $ LDA, TAUP( I ) ) |
204 | 1 | pfleura2 | E( I ) = A( I, I+1 ) |
205 | 1 | pfleura2 | A( I, I+1 ) = ONE |
206 | 1 | pfleura2 | * |
207 | 1 | pfleura2 | * Compute X(i+1:m,i) |
208 | 1 | pfleura2 | * |
209 | 1 | pfleura2 | CALL DGEMV( 'No transpose', M-I, N-I, ONE, A( I+1, I+1 ), |
210 | 1 | pfleura2 | $ LDA, A( I, I+1 ), LDA, ZERO, X( I+1, I ), 1 ) |
211 | 1 | pfleura2 | CALL DGEMV( 'Transpose', N-I, I, ONE, Y( I+1, 1 ), LDY, |
212 | 1 | pfleura2 | $ A( I, I+1 ), LDA, ZERO, X( 1, I ), 1 ) |
213 | 1 | pfleura2 | CALL DGEMV( 'No transpose', M-I, I, -ONE, A( I+1, 1 ), |
214 | 1 | pfleura2 | $ LDA, X( 1, I ), 1, ONE, X( I+1, I ), 1 ) |
215 | 1 | pfleura2 | CALL DGEMV( 'No transpose', I-1, N-I, ONE, A( 1, I+1 ), |
216 | 1 | pfleura2 | $ LDA, A( I, I+1 ), LDA, ZERO, X( 1, I ), 1 ) |
217 | 1 | pfleura2 | CALL DGEMV( 'No transpose', M-I, I-1, -ONE, X( I+1, 1 ), |
218 | 1 | pfleura2 | $ LDX, X( 1, I ), 1, ONE, X( I+1, I ), 1 ) |
219 | 1 | pfleura2 | CALL DSCAL( M-I, TAUP( I ), X( I+1, I ), 1 ) |
220 | 1 | pfleura2 | END IF |
221 | 1 | pfleura2 | 10 CONTINUE |
222 | 1 | pfleura2 | ELSE |
223 | 1 | pfleura2 | * |
224 | 1 | pfleura2 | * Reduce to lower bidiagonal form |
225 | 1 | pfleura2 | * |
226 | 1 | pfleura2 | DO 20 I = 1, NB |
227 | 1 | pfleura2 | * |
228 | 1 | pfleura2 | * Update A(i,i:n) |
229 | 1 | pfleura2 | * |
230 | 1 | pfleura2 | CALL DGEMV( 'No transpose', N-I+1, I-1, -ONE, Y( I, 1 ), |
231 | 1 | pfleura2 | $ LDY, A( I, 1 ), LDA, ONE, A( I, I ), LDA ) |
232 | 1 | pfleura2 | CALL DGEMV( 'Transpose', I-1, N-I+1, -ONE, A( 1, I ), LDA, |
233 | 1 | pfleura2 | $ X( I, 1 ), LDX, ONE, A( I, I ), LDA ) |
234 | 1 | pfleura2 | * |
235 | 1 | pfleura2 | * Generate reflection P(i) to annihilate A(i,i+1:n) |
236 | 1 | pfleura2 | * |
237 | 1 | pfleura2 | CALL DLARFG( N-I+1, A( I, I ), A( I, MIN( I+1, N ) ), LDA, |
238 | 1 | pfleura2 | $ TAUP( I ) ) |
239 | 1 | pfleura2 | D( I ) = A( I, I ) |
240 | 1 | pfleura2 | IF( I.LT.M ) THEN |
241 | 1 | pfleura2 | A( I, I ) = ONE |
242 | 1 | pfleura2 | * |
243 | 1 | pfleura2 | * Compute X(i+1:m,i) |
244 | 1 | pfleura2 | * |
245 | 1 | pfleura2 | CALL DGEMV( 'No transpose', M-I, N-I+1, ONE, A( I+1, I ), |
246 | 1 | pfleura2 | $ LDA, A( I, I ), LDA, ZERO, X( I+1, I ), 1 ) |
247 | 1 | pfleura2 | CALL DGEMV( 'Transpose', N-I+1, I-1, ONE, Y( I, 1 ), LDY, |
248 | 1 | pfleura2 | $ A( I, I ), LDA, ZERO, X( 1, I ), 1 ) |
249 | 1 | pfleura2 | CALL DGEMV( 'No transpose', M-I, I-1, -ONE, A( I+1, 1 ), |
250 | 1 | pfleura2 | $ LDA, X( 1, I ), 1, ONE, X( I+1, I ), 1 ) |
251 | 1 | pfleura2 | CALL DGEMV( 'No transpose', I-1, N-I+1, ONE, A( 1, I ), |
252 | 1 | pfleura2 | $ LDA, A( I, I ), LDA, ZERO, X( 1, I ), 1 ) |
253 | 1 | pfleura2 | CALL DGEMV( 'No transpose', M-I, I-1, -ONE, X( I+1, 1 ), |
254 | 1 | pfleura2 | $ LDX, X( 1, I ), 1, ONE, X( I+1, I ), 1 ) |
255 | 1 | pfleura2 | CALL DSCAL( M-I, TAUP( I ), X( I+1, I ), 1 ) |
256 | 1 | pfleura2 | * |
257 | 1 | pfleura2 | * Update A(i+1:m,i) |
258 | 1 | pfleura2 | * |
259 | 1 | pfleura2 | CALL DGEMV( 'No transpose', M-I, I-1, -ONE, A( I+1, 1 ), |
260 | 1 | pfleura2 | $ LDA, Y( I, 1 ), LDY, ONE, A( I+1, I ), 1 ) |
261 | 1 | pfleura2 | CALL DGEMV( 'No transpose', M-I, I, -ONE, X( I+1, 1 ), |
262 | 1 | pfleura2 | $ LDX, A( 1, I ), 1, ONE, A( I+1, I ), 1 ) |
263 | 1 | pfleura2 | * |
264 | 1 | pfleura2 | * Generate reflection Q(i) to annihilate A(i+2:m,i) |
265 | 1 | pfleura2 | * |
266 | 1 | pfleura2 | CALL DLARFG( M-I, A( I+1, I ), A( MIN( I+2, M ), I ), 1, |
267 | 1 | pfleura2 | $ TAUQ( I ) ) |
268 | 1 | pfleura2 | E( I ) = A( I+1, I ) |
269 | 1 | pfleura2 | A( I+1, I ) = ONE |
270 | 1 | pfleura2 | * |
271 | 1 | pfleura2 | * Compute Y(i+1:n,i) |
272 | 1 | pfleura2 | * |
273 | 1 | pfleura2 | CALL DGEMV( 'Transpose', M-I, N-I, ONE, A( I+1, I+1 ), |
274 | 1 | pfleura2 | $ LDA, A( I+1, I ), 1, ZERO, Y( I+1, I ), 1 ) |
275 | 1 | pfleura2 | CALL DGEMV( 'Transpose', M-I, I-1, ONE, A( I+1, 1 ), LDA, |
276 | 1 | pfleura2 | $ A( I+1, I ), 1, ZERO, Y( 1, I ), 1 ) |
277 | 1 | pfleura2 | CALL DGEMV( 'No transpose', N-I, I-1, -ONE, Y( I+1, 1 ), |
278 | 1 | pfleura2 | $ LDY, Y( 1, I ), 1, ONE, Y( I+1, I ), 1 ) |
279 | 1 | pfleura2 | CALL DGEMV( 'Transpose', M-I, I, ONE, X( I+1, 1 ), LDX, |
280 | 1 | pfleura2 | $ A( I+1, I ), 1, ZERO, Y( 1, I ), 1 ) |
281 | 1 | pfleura2 | CALL DGEMV( 'Transpose', I, N-I, -ONE, A( 1, I+1 ), LDA, |
282 | 1 | pfleura2 | $ Y( 1, I ), 1, ONE, Y( I+1, I ), 1 ) |
283 | 1 | pfleura2 | CALL DSCAL( N-I, TAUQ( I ), Y( I+1, I ), 1 ) |
284 | 1 | pfleura2 | END IF |
285 | 1 | pfleura2 | 20 CONTINUE |
286 | 1 | pfleura2 | END IF |
287 | 1 | pfleura2 | RETURN |
288 | 1 | pfleura2 | * |
289 | 1 | pfleura2 | * End of DLABRD |
290 | 1 | pfleura2 | * |
291 | 1 | pfleura2 | END |