LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ slabrd()

subroutine slabrd ( integer m,
integer n,
integer nb,
real, dimension( lda, * ) a,
integer lda,
real, dimension( * ) d,
real, dimension( * ) e,
real, dimension( * ) tauq,
real, dimension( * ) taup,
real, dimension( ldx, * ) x,
integer ldx,
real, dimension( ldy, * ) y,
integer ldy )

SLABRD reduces the first nb rows and columns of a general matrix to a bidiagonal form.

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

Purpose:
!>
!> SLABRD reduces the first NB rows and columns of a real general
!> m by n matrix A to upper or lower bidiagonal form by an orthogonal
!> transformation Q**T * A * P, and returns the matrices X and Y which
!> are needed to apply the transformation to the unreduced part of A.
!>
!> If m >= n, A is reduced to upper bidiagonal form; if m < n, to lower
!> bidiagonal form.
!>
!> This is an auxiliary routine called by SGEBRD
!> 
Parameters
[in]M
!>          M is INTEGER
!>          The number of rows in the matrix A.
!> 
[in]N
!>          N is INTEGER
!>          The number of columns in the matrix A.
!> 
[in]NB
!>          NB is INTEGER
!>          The number of leading rows and columns of A to be reduced.
!> 
[in,out]A
!>          A is REAL array, dimension (LDA,N)
!>          On entry, the m by n general matrix to be reduced.
!>          On exit, the first NB rows and columns of the matrix are
!>          overwritten; the rest of the array is unchanged.
!>          If m >= n, elements on and below the diagonal in the first NB
!>            columns, with the array TAUQ, represent the orthogonal
!>            matrix Q as a product of elementary reflectors; and
!>            elements above the diagonal in the first NB rows, with the
!>            array TAUP, represent the orthogonal matrix P as a product
!>            of elementary reflectors.
!>          If m < n, elements below the diagonal in the first NB
!>            columns, with the array TAUQ, represent the orthogonal
!>            matrix Q as a product of elementary reflectors, and
!>            elements on and above the diagonal in the first NB rows,
!>            with the array TAUP, represent the orthogonal matrix P as
!>            a product of elementary reflectors.
!>          See Further Details.
!> 
[in]LDA
!>          LDA is INTEGER
!>          The leading dimension of the array A.  LDA >= max(1,M).
!> 
[out]D
!>          D is REAL array, dimension (NB)
!>          The diagonal elements of the first NB rows and columns of
!>          the reduced matrix.  D(i) = A(i,i).
!> 
[out]E
!>          E is REAL array, dimension (NB)
!>          The off-diagonal elements of the first NB rows and columns of
!>          the reduced matrix.
!> 
[out]TAUQ
!>          TAUQ is REAL array, dimension (NB)
!>          The scalar factors of the elementary reflectors which
!>          represent the orthogonal matrix Q. See Further Details.
!> 
[out]TAUP
!>          TAUP is REAL array, dimension (NB)
!>          The scalar factors of the elementary reflectors which
!>          represent the orthogonal matrix P. See Further Details.
!> 
[out]X
!>          X is REAL array, dimension (LDX,NB)
!>          The m-by-nb matrix X required to update the unreduced part
!>          of A.
!> 
[in]LDX
!>          LDX is INTEGER
!>          The leading dimension of the array X. LDX >= max(1,M).
!> 
[out]Y
!>          Y is REAL array, dimension (LDY,NB)
!>          The n-by-nb matrix Y required to update the unreduced part
!>          of A.
!> 
[in]LDY
!>          LDY is INTEGER
!>          The leading dimension of the array Y. LDY >= max(1,N).
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details:
!>
!>  The matrices Q and P are represented as products of elementary
!>  reflectors:
!>
!>     Q = H(1) H(2) . . . H(nb)  and  P = G(1) G(2) . . . G(nb)
!>
!>  Each H(i) and G(i) has the form:
!>
!>     H(i) = I - tauq * v * v**T  and G(i) = I - taup * u * u**T
!>
!>  where tauq and taup are real scalars, and v and u are real vectors.
!>
!>  If m >= n, v(1:i-1) = 0, v(i) = 1, and v(i:m) is stored on exit in
!>  A(i:m,i); u(1:i) = 0, u(i+1) = 1, and u(i+1:n) is stored on exit in
!>  A(i,i+1:n); tauq is stored in TAUQ(i) and taup in TAUP(i).
!>
!>  If m < n, v(1:i) = 0, v(i+1) = 1, and v(i+1:m) is stored on exit in
!>  A(i+2:m,i); u(1:i-1) = 0, u(i) = 1, and u(i:n) is stored on exit in
!>  A(i,i+1:n); tauq is stored in TAUQ(i) and taup in TAUP(i).
!>
!>  The elements of the vectors v and u together form the m-by-nb matrix
!>  V and the nb-by-n matrix U**T which are needed, with X and Y, to apply
!>  the transformation to the unreduced part of the matrix, using a block
!>  update of the form:  A := A - V*Y**T - X*U**T.
!>
!>  The contents of A on exit are illustrated by the following examples
!>  with nb = 2:
!>
!>  m = 6 and n = 5 (m > n):          m = 5 and n = 6 (m < n):
!>
!>    (  1   1   u1  u1  u1 )           (  1   u1  u1  u1  u1  u1 )
!>    (  v1  1   1   u2  u2 )           (  1   1   u2  u2  u2  u2 )
!>    (  v1  v2  a   a   a  )           (  v1  1   a   a   a   a  )
!>    (  v1  v2  a   a   a  )           (  v1  v2  a   a   a   a  )
!>    (  v1  v2  a   a   a  )           (  v1  v2  a   a   a   a  )
!>    (  v1  v2  a   a   a  )
!>
!>  where a denotes an element of the original matrix which is unchanged,
!>  vi denotes an element of the vector defining H(i), and ui an element
!>  of the vector defining G(i).
!> 

Definition at line 206 of file slabrd.f.

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 REAL A( LDA, * ), D( * ), E( * ), TAUP( * ),
219 $ TAUQ( * ), X( LDX, * ), Y( LDY, * )
220* ..
221*
222* =====================================================================
223*
224* .. Parameters ..
225 REAL ZERO, ONE
226 parameter( zero = 0.0e0, one = 1.0e0 )
227* ..
228* .. Local Scalars ..
229 INTEGER I
230* ..
231* .. External Subroutines ..
232 EXTERNAL sgemv, slarfg, sscal
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 sgemv( 'No transpose', m-i+1, i-1, -one, a( i, 1 ),
253 $ lda, y( i, 1 ), ldy, one, a( i, i ), 1 )
254 CALL sgemv( '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 slarfg( 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 sgemv( '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 sgemv( 'Transpose', m-i+1, i-1, one, a( i, 1 ),
270 $ lda,
271 $ a( i, i ), 1, zero, y( 1, i ), 1 )
272 CALL sgemv( '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 sgemv( 'Transpose', m-i+1, i-1, one, x( i, 1 ),
276 $ ldx,
277 $ a( i, i ), 1, zero, y( 1, i ), 1 )
278 CALL sgemv( 'Transpose', i-1, n-i, -one, a( 1, i+1 ),
279 $ lda, y( 1, i ), 1, one, y( i+1, i ), 1 )
280 CALL sscal( n-i, tauq( i ), y( i+1, i ), 1 )
281*
282* Update A(i,i+1:n)
283*
284 CALL sgemv( 'No transpose', n-i, i, -one, y( i+1, 1 ),
285 $ ldy, a( i, 1 ), lda, one, a( i, i+1 ), lda )
286 CALL sgemv( '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 slarfg( 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 sgemv( '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 sgemv( 'Transpose', n-i, i, one, y( i+1, 1 ),
302 $ ldy,
303 $ a( i, i+1 ), lda, zero, x( 1, i ), 1 )
304 CALL sgemv( 'No transpose', m-i, i, -one, a( i+1, 1 ),
305 $ lda, x( 1, i ), 1, one, x( i+1, i ), 1 )
306 CALL sgemv( '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 sgemv( '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 sscal( 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 sgemv( 'No transpose', n-i+1, i-1, -one, y( i, 1 ),
324 $ ldy, a( i, 1 ), lda, one, a( i, i ), lda )
325 CALL sgemv( '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 slarfg( 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 sgemv( '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 sgemv( 'Transpose', n-i+1, i-1, one, y( i, 1 ),
344 $ ldy,
345 $ a( i, i ), lda, zero, x( 1, i ), 1 )
346 CALL sgemv( '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 sgemv( '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 sgemv( '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 sscal( m-i, taup( i ), x( i+1, i ), 1 )
356*
357* Update A(i+1:m,i)
358*
359 CALL sgemv( '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 sgemv( '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 slarfg( 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 sgemv( '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 sgemv( '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 sgemv( '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 sgemv( 'Transpose', m-i, i, one, x( i+1, 1 ),
384 $ ldx,
385 $ a( i+1, i ), 1, zero, y( 1, i ), 1 )
386 CALL sgemv( 'Transpose', i, n-i, -one, a( 1, i+1 ),
387 $ lda,
388 $ y( 1, i ), 1, one, y( i+1, i ), 1 )
389 CALL sscal( n-i, tauq( i ), y( i+1, i ), 1 )
390 END IF
391 20 CONTINUE
392 END IF
393 RETURN
394*
395* End of SLABRD
396*
subroutine sgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
SGEMV
Definition sgemv.f:158
subroutine slarfg(n, alpha, x, incx, tau)
SLARFG generates an elementary reflector (Householder matrix).
Definition slarfg.f:104
subroutine sscal(n, sa, sx, incx)
SSCAL
Definition sscal.f:79
Here is the call graph for this function:
Here is the caller graph for this function: