Rate This Document
Findability
Accuracy
Completeness
Readability

?gebrd

Reduce a general matrix to a bidiagonal matrix

Interface Definition

C interface:

sgebrd_(const int *m, const int *n, float *a, const int *lda, float *d, float *e, float *tauq, float *taup, float *work, const int lwork, int *info);

dgebrd_(const int *m, const int *n, double *a, const int *lda, double *d, double *e, double *tauq, double *taup, double *work, const int lwork, int *info);

cgebrd_(const int *m, const int *n, float _Complex *a, const int *lda, float *d, float *e, float _Complex *tauq, float _Complex *taup, float _Complex *work,

const int lwork, int *info);

zgebrd_(const int *m, const int *n, double _Complex *a, const int *lda, double *d, double *e, double _Complex *tauq, double _Complex *taup, double _Complex *work,

const int lwork, int *info);

Fortran interface:

SGEBRD(M, N, A, LDA, D, E, TAUQ, TAUP, WORK, LWORK, INFO);

DGEBRD(M, N, A, LDA, D, E, TAUQ, TAUP, WORK, LWORK, INFO);

CGEBRD(M, N, A, LDA, D, E, TAUQ, TAUP, WORK, LWORK, INFO);

ZGEBRD(M, N, A, LDA, D, E, TAUQ, TAUP, WORK, LWORK, INFO);

Parameters

Parameter

Type

Description

Input/Output

m

Integer

Number of rows in matrix a. m ≥ 0.

Input

n

Integer

Number of columns in matrix a. n ≥ 0.

Input

a

  • A single-precision floating-point array for sgebrd
  • A double-precision floating-point array for dgebrd
  • A single-precision complex array for cgebrd
  • A double-precision complex array for zgebrd

Array with a size of lda*n.

  • On entry: an m x n matrix.
  • On exit:

    If mn, the diagonal and superdiagonal are overwritten by the upper bidiagonal matrix B. The elements below the diagonal contain the tauq array, and the elements above the superdiagonal contain the taup array.

    If m < n, the diagonal and subdiagonal are overwritten by the lower bidiagonal matrix B. The elements below the subdiagonal contain the tauq array, and the elements above the diagonal contain the taup array.

Input/Output

lda

Integer

Leading dimension of matrix a. lda ≥ max(1, m).

Input

d

  • A single-precision floating-point array for sgebrd
  • A double-precision floating-point array for dgebrd
  • A single-precision floating-point array for cgebrd
  • A double-precision floating-point array for zgebrd
  • The length is min(m, n).
  • Bidiagonal.

Input/Output

e

  • A single-precision floating-point array for sgebrd
  • A double-precision floating-point array for dgebrd
  • A single-precision floating-point array for cgebrd
  • A double-precision floating-point array for zgebrd

Array with a size of ldz*n.

  • On entry: If compz = 'V', it is the orthogonal matrix.
  • On exit:
    • If info = 0 and compz = 'V', it contains the orthogonal eigenvectors of the original symmetric matrix.
    • If compz = 'I', it contains the orthogonal eigenvectors of the symmetric tridiagonal matrix.
    • If compz = 'N', it is not used.

Input/Output

tauq

  • A single-precision floating-point array for sgebrd
  • A double-precision floating-point array for dgebrd
  • A single-precision complex array for cgebrd
  • A double-precision complex array for zgebrd

Leading dimension of matrix z. ldz ≥ 1. If eigenvectors are required, ldz ≥ max(1, n).

Input

taup

  • A single-precision floating-point array for sstedc
  • A double-precision floating-point array for dstedc
  • A single-precision complex array for cstedc
  • A double-precision complex array for zstedc
  • Work array, with a size of max(1, lwork).
  • On exit: If info = 0, work(1) returns the optimal lwork size.

Output

work

  • A single-precision floating-point array for sgebrd
  • A double-precision floating-point array for dgebrd
  • A single-precision complex array for cgebrd
  • A double-precision complex array for zgebrd
  • Work array, with a size of max(1, liwork).
  • On exit: If info = 0, iwork(1) returns the optimal liwork size.

Output

lwork

Integer

Size of the iwork array.

  • If compz = 'N' or n ≤ 1, liwork ≥ 1.
  • If compz = 'V' or n > 1, liwork ≥ 6+6*n+5*n*lgn.
  • If compz = 'I' or n > 1, liwork ≥ 3+5*n.
  • If liwork = -1, the function queries only the optimal liwork size.

Input

info

Integer

  • 0: The execution is successful.
  • Smaller than 0: If info = -i, the i-th parameter has an illegal value.
  • Greater than 0: The algorithm cannot compute the eigenvalues when processing the submatrix located in rows INFO/(N+1) to mod(INFO, N+1) and columns INFO/(N+1) to mod(INFO, N+1).

Output

Dependencies

#include "klapack.h"

Examples

C interface:

const int m = 5;
const int n = 5;
const int lda = 5;

double a[] = {72.1673, 66.1857, 64.7644, 28.0199, 91.4151,
              6.5180,  62.8483, 72.4323, 46.5760, 8.6928,
              28.9821, 42.1828, 18.6437, 99.8612, 35.6972,
              67.9812, 5.0880,  85.5035, 79.2945, 54.5920,
              28.6869, 49.7512, 7.5186,  28.6929, 84.6041};

double *d = (double*)malloc(m * sizeof(double));
double *e = (double*)malloc((m-1) * sizeof(double));
double *tauq = (double*)malloc(m * sizeof(double));
double *taup = (double*)malloc(m * sizeof(double));

double qwork;
int lwork = -1;
int info = 0;

dgebrd_(&m, &n, a, &lda, d, e, tauq, taup, &qwork, &lwork, &info);
if (info != 0) {
    printf("Error, info = %d\n", info);
    return info;
}

lwork = (int)qwork;
double *work = (double*)malloc(lwork * sizeof(double));

dgebrd_(&m, &n, a, &lda, d, e, tauq, taup, work, &lwork, &info);
if (info != 0) {
    printf("Error, info = %d\n", info);
    return info;
}
/* output */
* d
* -151.409804     -96.158378      30.604367       -49.958984      -65.000480
* e
* 187.838419      -61.829661      47.241856       4.133032
* tauq
* 1.476636        1.056414        1.268028        1.198872        0.000000
* taup
* 1.401567        1.618720        1.104858        0.000000        0.000000

Fortran interface:

PARAMETER (m = 5) 
PARAMETER (n = 5)
PARAMETER (lda = 5) 
INTEGER :: info = 0 
REAL(8) :: d(m) 
REAL(8) :: e(m-1)
REAL(8) :: tauq(m) 
REAL(8) :: taup(m)
REAL(8), ALLOCATABLE :: work(:) 
INTEGER :: lwork = -1 
REAL(8) :: qwork
  
DATA a / 72.1673, 66.1857, 64.7644, 28.0199, 91.4151,
         6.5180,  62.8483, 72.4323, 46.5760, 8.6928,
         28.9821, 42.1828, 18.6437, 99.8612, 35.6972,
         67.9812, 5.0880,  85.5035, 79.2945, 54.5920,
         28.6869, 49.7512, 7.5186,  28.6929, 84.6041/ 
EXTERNAL DGEBRD
CALL DGEBRD(m, n, a, lda, d, e, tauq, taup, qwork, lwork, info);
lwork = (int)qwork; 
work = (double *)malloc(sizeof(double) * lwork);
CALL DGEBRD(m, n, a, lda, d, e, tauq, taup, work, lwork, info);
* 
* Output: 
* d
* -151.409804     -96.158378      30.604367       -49.958984      -65.000480
* e
* 187.838419      -61.829661      47.241856       4.133032
* tauq
* 1.476636        1.056414        1.268028        1.198872        0.000000
* taup
* 1.401567        1.618720        1.104858        0.000000        0.000000