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