# ?gebd2

Reduces a general matrix to bidiagonal form using an unblocked algorithm.

## Syntax

call sgebd2( m, n, a, lda, d, e, tauq, taup, work, info )

call dgebd2( m, n, a, lda, d, e, tauq, taup, work, info )

call cgebd2( m, n, a, lda, d, e, tauq, taup, work, info )

call zgebd2( m, n, a, lda, d, e, tauq, taup, work, info )

## Description

The routine reduces a general m-by-n matrix A to upper or lower bidiagonal form B by an orthogonal (unitary) transformation: `Q'*A*P = B`

If `m ≥ n`, B is upper bidiagonal; if `m < n`, B is lower bidiagonal.

The routine does not form the matrices Q and P explicitly, but represents them as products of elementary reflectors. if `m ≥ n`,

`Q = H(1)*H(2)*...*H(n)`, and `P = G(1)*G(2)*...*G(n-1)`

if `m < n`,

`Q = H(1)*H(2)*...*H(m-1)`, and `P = G(1)*G(2)*...*G(m)`

Each `H(i)` and `G(i)` has the form

`H(i) = I - tauq*v*v'` and `G(i) = I - taup*u*u'`

where tauq and taup are scalars (real for sgebd2/dgebd2, complex for cgebd2/zgebd2), and v and u are vectors (real for sgebd2/dgebd2, complex for cgebd2/zgebd2).

## Input Parameters

m

  INTEGER. The number of rows in the matrix A (`m ≥ 0`).

n

  INTEGER. The number of columns in A (`n ≥ 0`).

a, work

  REAL for sgebd2

  DOUBLE PRECISION for dgebd2

  COMPLEX for cgebd2

  COMPLEX*16 for zgebd2.

  Arrays:

  `a(lda,*)` contains the m-by-n general matrix A to be reduced. The second dimension of a must be at least max(1, n).

  work(*) is a workspace array, the dimension of work must be at least max(1, m, n).

lda

  INTEGER. The first dimension of a; at least `max(1, m)`.

## Output Parameters

a

  if `m ≥ n`, the diagonal and first super-diagonal of a are overwritten with the upper bidiagonal matrix B. Elements below the diagonal, with the array tauq, represent the orthogonal/unitary matrix Q as a product of elementary reflectors, and elements above the first superdiagonal, with the array taup, represent the orthogonal/unitary matrix p as a product of elementary reflectors.

  if `m < n`, the diagonal and first sub-diagonal of a are overwritten by the lower bidiagonal matrix B. Elements below the first subdiagonal, with the array tauq, represent the orthogonal/unitary matrix Q as a product of elementary reflectors, and elements above the diagonal, with the array taup, represent the orthogonal/unitary matrix p as a product of elementary reflectors.

d

  REAL for single-precision flavors

  DOUBLE PRECISION for double-precision flavors.

  Array, DIMENSION at least `max(1, min(m, n))`.

  Contains the diagonal elements of the bidiagonal matrix B: `d(i) = a(i, i)`.

e

  REAL for single-precision flavors

  DOUBLE PRECISION for double-precision flavors. Array, DIMENSION at least max(1, min(m, n) - 1).

  Contains the off-diagonal elements of the bidiagonal matrix B:

  if `m ≥ n`, `e(i) = a(i, i+1)` for `i = 1,2,..., n-1`;

  if `m < n`, `e(i) = a(i+1, i)` for `i = 1,2,..., m-1`.

tauq, taup

  REAL for sgebd2

  DOUBLE PRECISION for dgebd2

  COMPLEX for cgebd2

  COMPLEX*16 for zgebd2.

  Arrays, DIMENSION at least max `(1, min(m, n))`.

  Contain scalar factors of the elementary reflectors which represent orthogonal/unitary matrices Q and p, respectively.

info

  INTEGER.

  If `info = 0`, the execution is successful.

  If `info = -i`, the ith parameter had an illegal value.

Parent topic: Auxiliary Routines