?gebrd

Reduces a general matrix to bidiagonal form.

Syntax

FORTRAN 77:

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

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

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

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

FORTRAN 95:

call gebrd(a [, d] [,e] [,tauq] [,taup] [,info])

C:

lapack_int LAPACKE_sgebrd( int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, float* d, float* e, float* tauq, float* taup );

lapack_int LAPACKE_dgebrd( int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, double* d, double* e, double* tauq, double* taup );

lapack_int LAPACKE_cgebrd( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, float* d, float* e, lapack_complex_float* tauq, lapack_complex_float* taup );

lapack_int LAPACKE_zgebrd( int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, double* d, double* e, lapack_complex_double* tauq, lapack_complex_double* taup );

Include Files

Description

The routine reduces a general m-by-n matrix A to a bidiagonal matrix B by an orthogonal (unitary) transformation.

If m n, the reduction is given by Equation

where B1 is an n-by-n upper diagonal matrix, Q and P are orthogonal or, for a complex A, unitary matrices; Q1 consists of the first n columns of Q.

If m < n, the reduction is given by

A = Q*B*PH = Q*(B10)*PH = Q1*B1*P1H,

where B1 is an m-by-m lower diagonal matrix, Q and P are orthogonal or, for a complex A, unitary matrices; P1 consists of the first m rows of P.

The routine does not form the matrices Q and P explicitly, but represents them as products of elementary reflectors. Routines are provided to work with the matrices Q and P in this representation:

If the matrix A is real,

If the matrix A is complex,

Input Parameters

The data types are given for the Fortran interface. A <datatype> placeholder, if present, is used for the C interface data types in the C interface section above. See C Interface Conventions for the C interface principal conventions and type definitions.

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 sgebrd

DOUBLE PRECISION for dgebrd

COMPLEX for cgebrd

DOUBLE COMPLEX for zgebrd.

Arrays:

a(lda,*) contains the matrix A.

The second dimension of a must be at least max(1, n).

work is a workspace array, its dimension max(1, lwork).

lda

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

lwork

INTEGER.

The dimension of work; at least max(1, m, n).

If lwork = -1, then a workspace query is assumed; the routine only calculates the optimal size of the work array, returns this value as the first entry of the work array, and no error message related to lwork is issued by xerbla.

See Application Notes for the suggested value of lwork.

Output Parameters

a

If m n, the diagonal and first super-diagonal of a are overwritten by the upper bidiagonal matrix B. Elements below the diagonal are overwritten by details of Q, and the remaining elements are overwritten by details of P.

If m < n, the diagonal and first sub-diagonal of a are overwritten by the lower bidiagonal matrix B. Elements above the diagonal are overwritten by details of P, and the remaining elements are overwritten by details of Q.

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 B.

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 B.

tauq, taup

REAL for sgebrd

DOUBLE PRECISION for dgebrd

COMPLEX for cgebrd

DOUBLE COMPLEX for zgebrd.

Arrays, DIMENSION at least max (1, min(m, n)). Contain further details of the matrices Q and P.

work(1)

If info = 0, on exit work(1) contains the minimum value of lwork required for optimum performance. Use this lwork for subsequent runs.

info

INTEGER.

If info = 0, the execution is successful.

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

Fortran 95 Interface Notes

Routines in Fortran 95 interface have fewer arguments in the calling sequence than their FORTRAN 77 counterparts. For general conventions applied to skip redundant or restorable arguments, see Fortran 95 Interface Conventions.

Specific details for the routine gebrd interface are the following:

a

Holds the matrix A of size (m,n).

d

Holds the vector of length min(m,n).

e

Holds the vector of length min(m,n)-1.

tauq

Holds the vector of length min(m,n).

taup

Holds the vector of length min(m,n).

Application Notes

For better performance, try using lwork = (m + n)*blocksize, where blocksize is a machine-dependent value (typically, 16 to 64) required for optimum performance of the blocked algorithm.

If you are in doubt how much workspace to supply, use a generous value of lwork for the first run or set lwork = -1.

If you choose the first option and set any of admissible lwork sizes, which is no less than the minimal value described, the routine completes the task, though probably not so fast as with a recommended workspace, and provides the recommended workspace in the first element of the corresponding array work on exit. Use this value (work(1)) for subsequent runs.

If you set lwork = -1, the routine returns immediately and provides the recommended workspace in the first element of the corresponding array (work). This operation is called a workspace query.

Note that if you set lwork to less than the minimal required value and not -1, the routine returns immediately with an error exit and does not provide any information on the recommended workspace.

The computed matrices Q, B, and P satisfy QBPH = A + E, where ||E||2 = c(n)ε ||A||2, c(n) is a modestly increasing function of n, and ε is the machine precision.

The approximate number of floating-point operations for real flavors is

(4/3)*n2*(3*m - n) for m n,

(4/3)*m2*(3*n - m) for m < n.

The number of operations for complex flavors is four times greater.

If n is much less than m, it can be more efficient to first form the QR factorization of A by calling geqrf and then reduce the factor R to bidiagonal form. This requires approximately 2*n2*(m + n) floating-point operations.

If m is much less than n, it can be more efficient to first form the LQ factorization of A by calling gelqf and then reduce the factor L to bidiagonal form. This requires approximately 2*m2*(m + n) floating-point operations.


Submit feedback on this help topic