LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
dlabrd.f
Go to the documentation of this file.
1*> \brief \b DLABRD reduces the first nb rows and columns of a general matrix to a bidiagonal form.
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download DLABRD + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlabrd.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlabrd.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlabrd.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE DLABRD( M, N, NB, A, LDA, D, E, TAUQ, TAUP, X, LDX, Y,
20* LDY )
21*
22* .. Scalar Arguments ..
23* INTEGER LDA, LDX, LDY, M, N, NB
24* ..
25* .. Array Arguments ..
26* DOUBLE PRECISION A( LDA, * ), D( * ), E( * ), TAUP( * ),
27* $ TAUQ( * ), X( LDX, * ), Y( LDY, * )
28* ..
29*
30*
31*> \par Purpose:
32* =============
33*>
34*> \verbatim
35*>
36*> DLABRD reduces the first NB rows and columns of a real general
37*> m by n matrix A to upper or lower bidiagonal form by an orthogonal
38*> transformation Q**T * A * P, and returns the matrices X and Y which
39*> are needed to apply the transformation to the unreduced part of A.
40*>
41*> If m >= n, A is reduced to upper bidiagonal form; if m < n, to lower
42*> bidiagonal form.
43*>
44*> This is an auxiliary routine called by DGEBRD
45*> \endverbatim
46*
47* Arguments:
48* ==========
49*
50*> \param[in] M
51*> \verbatim
52*> M is INTEGER
53*> The number of rows in the matrix A.
54*> \endverbatim
55*>
56*> \param[in] N
57*> \verbatim
58*> N is INTEGER
59*> The number of columns in the matrix A.
60*> \endverbatim
61*>
62*> \param[in] NB
63*> \verbatim
64*> NB is INTEGER
65*> The number of leading rows and columns of A to be reduced.
66*> \endverbatim
67*>
68*> \param[in,out] A
69*> \verbatim
70*> A is DOUBLE PRECISION array, dimension (LDA,N)
71*> On entry, the m by n general matrix to be reduced.
72*> On exit, the first NB rows and columns of the matrix are
73*> overwritten; the rest of the array is unchanged.
74*> If m >= n, elements on and below the diagonal in the first NB
75*> columns, with the array TAUQ, represent the orthogonal
76*> matrix Q as a product of elementary reflectors; and
77*> elements above the diagonal in the first NB rows, with the
78*> array TAUP, represent the orthogonal matrix P as a product
79*> of elementary reflectors.
80*> If m < n, elements below the diagonal in the first NB
81*> columns, with the array TAUQ, represent the orthogonal
82*> matrix Q as a product of elementary reflectors, and
83*> elements on and above the diagonal in the first NB rows,
84*> with the array TAUP, represent the orthogonal matrix P as
85*> a product of elementary reflectors.
86*> See Further Details.
87*> \endverbatim
88*>
89*> \param[in] LDA
90*> \verbatim
91*> LDA is INTEGER
92*> The leading dimension of the array A. LDA >= max(1,M).
93*> \endverbatim
94*>
95*> \param[out] D
96*> \verbatim
97*> D is DOUBLE PRECISION array, dimension (NB)
98*> The diagonal elements of the first NB rows and columns of
99*> the reduced matrix. D(i) = A(i,i).
100*> \endverbatim
101*>
102*> \param[out] E
103*> \verbatim
104*> E is DOUBLE PRECISION array, dimension (NB)
105*> The off-diagonal elements of the first NB rows and columns of
106*> the reduced matrix.
107*> \endverbatim
108*>
109*> \param[out] TAUQ
110*> \verbatim
111*> TAUQ is DOUBLE PRECISION array, dimension (NB)
112*> The scalar factors of the elementary reflectors which
113*> represent the orthogonal matrix Q. See Further Details.
114*> \endverbatim
115*>
116*> \param[out] TAUP
117*> \verbatim
118*> TAUP is DOUBLE PRECISION array, dimension (NB)
119*> The scalar factors of the elementary reflectors which
120*> represent the orthogonal matrix P. See Further Details.
121*> \endverbatim
122*>
123*> \param[out] X
124*> \verbatim
125*> X is DOUBLE PRECISION array, dimension (LDX,NB)
126*> The m-by-nb matrix X required to update the unreduced part
127*> of A.
128*> \endverbatim
129*>
130*> \param[in] LDX
131*> \verbatim
132*> LDX is INTEGER
133*> The leading dimension of the array X. LDX >= max(1,M).
134*> \endverbatim
135*>
136*> \param[out] Y
137*> \verbatim
138*> Y is DOUBLE PRECISION array, dimension (LDY,NB)
139*> The n-by-nb matrix Y required to update the unreduced part
140*> of A.
141*> \endverbatim
142*>
143*> \param[in] LDY
144*> \verbatim
145*> LDY is INTEGER
146*> The leading dimension of the array Y. LDY >= max(1,N).
147*> \endverbatim
148*
149* Authors:
150* ========
151*
152*> \author Univ. of Tennessee
153*> \author Univ. of California Berkeley
154*> \author Univ. of Colorado Denver
155*> \author NAG Ltd.
156*
157*> \ingroup labrd
158*
159*> \par Further Details:
160* =====================
161*>
162*> \verbatim
163*>
164*> The matrices Q and P are represented as products of elementary
165*> reflectors:
166*>
167*> Q = H(1) H(2) . . . H(nb) and P = G(1) G(2) . . . G(nb)
168*>
169*> Each H(i) and G(i) has the form:
170*>
171*> H(i) = I - tauq * v * v**T and G(i) = I - taup * u * u**T
172*>
173*> where tauq and taup are real scalars, and v and u are real vectors.
174*>
175*> If m >= n, v(1:i-1) = 0, v(i) = 1, and v(i:m) is stored on exit in
176*> A(i:m,i); u(1:i) = 0, u(i+1) = 1, and u(i+1:n) is stored on exit in
177*> A(i,i+1:n); tauq is stored in TAUQ(i) and taup in TAUP(i).
178*>
179*> If m < n, v(1:i) = 0, v(i+1) = 1, and v(i+1:m) is stored on exit in
180*> A(i+2:m,i); u(1:i-1) = 0, u(i) = 1, and u(i:n) is stored on exit in
181*> A(i,i+1:n); tauq is stored in TAUQ(i) and taup in TAUP(i).
182*>
183*> The elements of the vectors v and u together form the m-by-nb matrix
184*> V and the nb-by-n matrix U**T which are needed, with X and Y, to apply
185*> the transformation to the unreduced part of the matrix, using a block
186*> update of the form: A := A - V*Y**T - X*U**T.
187*>
188*> The contents of A on exit are illustrated by the following examples
189*> with nb = 2:
190*>
191*> m = 6 and n = 5 (m > n): m = 5 and n = 6 (m < n):
192*>
193*> ( 1 1 u1 u1 u1 ) ( 1 u1 u1 u1 u1 u1 )
194*> ( v1 1 1 u2 u2 ) ( 1 1 u2 u2 u2 u2 )
195*> ( v1 v2 a a a ) ( v1 1 a a a a )
196*> ( v1 v2 a a a ) ( v1 v2 a a a a )
197*> ( v1 v2 a a a ) ( v1 v2 a a a a )
198*> ( v1 v2 a a a )
199*>
200*> where a denotes an element of the original matrix which is unchanged,
201*> vi denotes an element of the vector defining H(i), and ui an element
202*> of the vector defining G(i).
203*> \endverbatim
204*>
205* =====================================================================
206 SUBROUTINE dlabrd( M, N, NB, A, LDA, D, E, TAUQ, TAUP, X, LDX,
207 $ Y,
208 $ LDY )
209*
210* -- LAPACK auxiliary routine --
211* -- LAPACK is a software package provided by Univ. of Tennessee, --
212* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
213*
214* .. Scalar Arguments ..
215 INTEGER LDA, LDX, LDY, M, N, NB
216* ..
217* .. Array Arguments ..
218 DOUBLE PRECISION A( LDA, * ), D( * ), E( * ), TAUP( * ),
219 $ TAUQ( * ), X( LDX, * ), Y( LDY, * )
220* ..
221*
222* =====================================================================
223*
224* .. Parameters ..
225 DOUBLE PRECISION ZERO, ONE
226 PARAMETER ( ZERO = 0.0d0, one = 1.0d0 )
227* ..
228* .. Local Scalars ..
229 INTEGER I
230* ..
231* .. External Subroutines ..
232 EXTERNAL dgemv, dlarfg, dscal
233* ..
234* .. Intrinsic Functions ..
235 INTRINSIC min
236* ..
237* .. Executable Statements ..
238*
239* Quick return if possible
240*
241 IF( m.LE.0 .OR. n.LE.0 )
242 $ RETURN
243*
244 IF( m.GE.n ) THEN
245*
246* Reduce to upper bidiagonal form
247*
248 DO 10 i = 1, nb
249*
250* Update A(i:m,i)
251*
252 CALL dgemv( 'No transpose', m-i+1, i-1, -one, a( i, 1 ),
253 $ lda, y( i, 1 ), ldy, one, a( i, i ), 1 )
254 CALL dgemv( 'No transpose', m-i+1, i-1, -one, x( i, 1 ),
255 $ ldx, a( 1, i ), 1, one, a( i, i ), 1 )
256*
257* Generate reflection Q(i) to annihilate A(i+1:m,i)
258*
259 CALL dlarfg( m-i+1, a( i, i ), a( min( i+1, m ), i ), 1,
260 $ tauq( i ) )
261 d( i ) = a( i, i )
262 IF( i.LT.n ) THEN
263 a( i, i ) = one
264*
265* Compute Y(i+1:n,i)
266*
267 CALL dgemv( 'Transpose', m-i+1, n-i, one, a( i, i+1 ),
268 $ lda, a( i, i ), 1, zero, y( i+1, i ), 1 )
269 CALL dgemv( 'Transpose', m-i+1, i-1, one, a( i, 1 ),
270 $ lda,
271 $ a( i, i ), 1, zero, y( 1, i ), 1 )
272 CALL dgemv( 'No transpose', n-i, i-1, -one, y( i+1,
273 $ 1 ),
274 $ ldy, y( 1, i ), 1, one, y( i+1, i ), 1 )
275 CALL dgemv( 'Transpose', m-i+1, i-1, one, x( i, 1 ),
276 $ ldx,
277 $ a( i, i ), 1, zero, y( 1, i ), 1 )
278 CALL dgemv( 'Transpose', i-1, n-i, -one, a( 1, i+1 ),
279 $ lda, y( 1, i ), 1, one, y( i+1, i ), 1 )
280 CALL dscal( n-i, tauq( i ), y( i+1, i ), 1 )
281*
282* Update A(i,i+1:n)
283*
284 CALL dgemv( 'No transpose', n-i, i, -one, y( i+1, 1 ),
285 $ ldy, a( i, 1 ), lda, one, a( i, i+1 ), lda )
286 CALL dgemv( 'Transpose', i-1, n-i, -one, a( 1, i+1 ),
287 $ lda, x( i, 1 ), ldx, one, a( i, i+1 ), lda )
288*
289* Generate reflection P(i) to annihilate A(i,i+2:n)
290*
291 CALL dlarfg( n-i, a( i, i+1 ), a( i, min( i+2, n ) ),
292 $ lda, taup( i ) )
293 e( i ) = a( i, i+1 )
294 a( i, i+1 ) = one
295*
296* Compute X(i+1:m,i)
297*
298 CALL dgemv( 'No transpose', m-i, n-i, one, a( i+1,
299 $ i+1 ),
300 $ lda, a( i, i+1 ), lda, zero, x( i+1, i ), 1 )
301 CALL dgemv( 'Transpose', n-i, i, one, y( i+1, 1 ),
302 $ ldy,
303 $ a( i, i+1 ), lda, zero, x( 1, i ), 1 )
304 CALL dgemv( 'No transpose', m-i, i, -one, a( i+1, 1 ),
305 $ lda, x( 1, i ), 1, one, x( i+1, i ), 1 )
306 CALL dgemv( 'No transpose', i-1, n-i, one, a( 1,
307 $ i+1 ),
308 $ lda, a( i, i+1 ), lda, zero, x( 1, i ), 1 )
309 CALL dgemv( 'No transpose', m-i, i-1, -one, x( i+1,
310 $ 1 ),
311 $ ldx, x( 1, i ), 1, one, x( i+1, i ), 1 )
312 CALL dscal( m-i, taup( i ), x( i+1, i ), 1 )
313 END IF
314 10 CONTINUE
315 ELSE
316*
317* Reduce to lower bidiagonal form
318*
319 DO 20 i = 1, nb
320*
321* Update A(i,i:n)
322*
323 CALL dgemv( 'No transpose', n-i+1, i-1, -one, y( i, 1 ),
324 $ ldy, a( i, 1 ), lda, one, a( i, i ), lda )
325 CALL dgemv( 'Transpose', i-1, n-i+1, -one, a( 1, i ),
326 $ lda,
327 $ x( i, 1 ), ldx, one, a( i, i ), lda )
328*
329* Generate reflection P(i) to annihilate A(i,i+1:n)
330*
331 CALL dlarfg( n-i+1, a( i, i ), a( i, min( i+1, n ) ),
332 $ lda,
333 $ taup( i ) )
334 d( i ) = a( i, i )
335 IF( i.LT.m ) THEN
336 a( i, i ) = one
337*
338* Compute X(i+1:m,i)
339*
340 CALL dgemv( 'No transpose', m-i, n-i+1, one, a( i+1,
341 $ i ),
342 $ lda, a( i, i ), lda, zero, x( i+1, i ), 1 )
343 CALL dgemv( 'Transpose', n-i+1, i-1, one, y( i, 1 ),
344 $ ldy,
345 $ a( i, i ), lda, zero, x( 1, i ), 1 )
346 CALL dgemv( 'No transpose', m-i, i-1, -one, a( i+1,
347 $ 1 ),
348 $ lda, x( 1, i ), 1, one, x( i+1, i ), 1 )
349 CALL dgemv( 'No transpose', i-1, n-i+1, one, a( 1,
350 $ i ),
351 $ lda, a( i, i ), lda, zero, x( 1, i ), 1 )
352 CALL dgemv( 'No transpose', m-i, i-1, -one, x( i+1,
353 $ 1 ),
354 $ ldx, x( 1, i ), 1, one, x( i+1, i ), 1 )
355 CALL dscal( m-i, taup( i ), x( i+1, i ), 1 )
356*
357* Update A(i+1:m,i)
358*
359 CALL dgemv( 'No transpose', m-i, i-1, -one, a( i+1,
360 $ 1 ),
361 $ lda, y( i, 1 ), ldy, one, a( i+1, i ), 1 )
362 CALL dgemv( 'No transpose', m-i, i, -one, x( i+1, 1 ),
363 $ ldx, a( 1, i ), 1, one, a( i+1, i ), 1 )
364*
365* Generate reflection Q(i) to annihilate A(i+2:m,i)
366*
367 CALL dlarfg( m-i, a( i+1, i ), a( min( i+2, m ), i ),
368 $ 1,
369 $ tauq( i ) )
370 e( i ) = a( i+1, i )
371 a( i+1, i ) = one
372*
373* Compute Y(i+1:n,i)
374*
375 CALL dgemv( 'Transpose', m-i, n-i, one, a( i+1, i+1 ),
376 $ lda, a( i+1, i ), 1, zero, y( i+1, i ), 1 )
377 CALL dgemv( 'Transpose', m-i, i-1, one, a( i+1, 1 ),
378 $ lda,
379 $ a( i+1, i ), 1, zero, y( 1, i ), 1 )
380 CALL dgemv( 'No transpose', n-i, i-1, -one, y( i+1,
381 $ 1 ),
382 $ ldy, y( 1, i ), 1, one, y( i+1, i ), 1 )
383 CALL dgemv( 'Transpose', m-i, i, one, x( i+1, 1 ),
384 $ ldx,
385 $ a( i+1, i ), 1, zero, y( 1, i ), 1 )
386 CALL dgemv( 'Transpose', i, n-i, -one, a( 1, i+1 ),
387 $ lda,
388 $ y( 1, i ), 1, one, y( i+1, i ), 1 )
389 CALL dscal( n-i, tauq( i ), y( i+1, i ), 1 )
390 END IF
391 20 CONTINUE
392 END IF
393 RETURN
394*
395* End of DLABRD
396*
397 END
subroutine dgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
DGEMV
Definition dgemv.f:158
subroutine dlabrd(m, n, nb, a, lda, d, e, tauq, taup, x, ldx, y, ldy)
DLABRD reduces the first nb rows and columns of a general matrix to a bidiagonal form.
Definition dlabrd.f:209
subroutine dlarfg(n, alpha, x, incx, tau)
DLARFG generates an elementary reflector (Householder matrix).
Definition dlarfg.f:104
subroutine dscal(n, da, dx, incx)
DSCAL
Definition dscal.f:79