Rate This Document
Findability
Accuracy
Completeness
Readability

?steqr

Compute eigenvalues and eigenvectors of a symmetric tridiagonal matrix through QL or QR factorization.

Interface Definition

C interface:

ssteqr_(const char *compz, const int *n, float *d, float *e, float *z, const int *ldz, float *work, int *info);

dsteqr_(const char *compz, const int *n, double *d, double *e, double *z, const int *ldz, double *work, int *info);

csteqr_(const char *compz, const int *n, float *d, float *e, float _Complex *z, const int *ldz, float *work, int *info);

zsteqr_(const char *compz, const int *n, double *d, double *e, double _Complex *z, const int *ldz, double *work, int *info);

Fortran interface:

SSTEQR(COMPZ, N, D, E, Z, LDZ, WORK, INFO);

DSTEQR(COMPZ, N, D, E, Z, LDZ, WORK, INFO);

CSTEQR(COMPZ, N, D, E, Z, LDZ, WORK, INFO);

ZSTEQR(COMPZ, N, D, E, Z, LDZ, WORK, INFO);

Parameters

Parameters

Type

Description

Input/Output

compz

Character

  • 'N': Computes only eigenvalues.
  • 'V': Computes eigenvalues and eigenvectors.
  • 'I': Computes eigenvalues and eigenvectors.

Input

n

Integer

Matrix dimension, N ≥ 0.

Input

d

  • A single-precision floating-point array for ssteqr
  • A double-precision floating-point array for dsteqr
  • A single-precision floating-point array for csteqr
  • A double-precision floating-point array for zsteqr

Array with a length of n.

  • On entry: diagonal elements of the tridiagonal matrix.
  • On exit: If info=0, it stores the eigenvalues in ascending order.

Input/Output

e

  • A single-precision floating-point array for ssteqr
  • A double-precision floating-point array for dsteqr
  • A single-precision floating-point array for csteqr
  • A double-precision floating-point array for zsteqr

Array with a length of n-1.

  • On entry: sub-diagonal elements of the tridiagonal matrix.
  • On exit: The array is destroyed.

Input/Output

z

  • A single-precision floating-point array for ssteqr
  • A double-precision floating-point array for dsteqr
  • A complex single-precision array for csteqr
  • A complex double-precision array for zsteqr

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', this array is not used.

Input/Output

ldz

Integer

Leading dimension of matrix z. ldz ≥ max(1, n).

Input

work

  • A single-precision floating-point array for ssteqr
  • A double-precision floating-point array for dsteqr
  • A single-precision floating-point array for csteqr
  • A double-precision floating-point array for zsteqr

Work array, with a size of max(1, 2*n-2). If compz='N', this array is not used.

Output

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 failed to find all the eigenvalues after 30*n iterations.

Output

Dependency

#include "klapack.h"

Example

C interface:

const char compz = 'N';
const int n = 4;
const int ldz = 4;

int info = 0;

double d[] = {72.1673, 66.1857, 64.7644, 28.0199, 91.4151};
double e[] = {6.8955, 7.2465, 3.5019, 8.2268, 3.5287};
int *ipiv = (int*)malloc(n * sizeof(int));
double b[] = {9.4532, 1.5204, 2.2127, 0.9891, 7.1778,
              6.8955, 7.2465, 3.5019, 8.2268, 3.5287};

double *z = (double*)malloc(ldz * n * sizeof(double));
double *work = (double*)malloc(n * sizeof(double));

dsteqr_(&compz, &n, d, e, z, &ldz, work, &info);
if (info != 0) {
    printf("ERROR, info = %d\n", info);
}
/* output */
* d
* 27.676252       56.816901       68.501999       78.142148
* e
* 0.000000        0.000000        0.000000

Fortran interface:

CHARACTER :: compz = "N"
PARAMETER (n = 4) 
PARAMETER (ldz = 4) 
INTEGER :: info = 0 
REAL(8) :: d(n) 
REAL(8) :: e(n-1)
REAL(8) :: z(ldz, n)
REAL(8) :: work(n)
  
DATA d / 72.1673, 66.1857, 64.7644, 28.0199 / 
DATA e / 6.8955, 7.2465, 3.5019 /
EXTERNAL DSTEQR
 CALL DSTEQR(compz, n, d, e, z, ldz, work, info);
* 
* Output: 
* d:  
* 27.676252       56.816901       68.501999       78.142148
* e:
* 0.000000        0.000000        0.000000