Rate This Document
Findability
Accuracy
Completeness
Readability

?stedc

Compute the eigenvalues of a symmetric tridiagonal matrix using the Divide-and-Conquer algorithm.

Interface Definition

C interface:

sstedc_(const char *compz, const int *n, float *d, float *e, float *z, const int *ldz, float *work, const int lwork,

int *iwork, const int *liwork, int *info);

dstedc_(const char *compz, const int *n, double *d, double *e, double *z, const int *ldz, double *work, const int lwork,

int *iwork, const int *liwork, int *info);

cstedc_(const char *compz, const int *n, float *d, float *e, float _Complex *z, const int *ldz, float _Complex *work, const int lwork, float *rwork, const int *lrwork,

int *iwork, const int *liwork, int *info);

zstedc_(const char *compz, const int *n, double *d, double *e, double _Complex *z, const int *ldz, double _Complex *work, const int lwork, double *rwork, const int *lrwork,

int *iwork, const int *liwork, int *info);

Fortran interface:

SSTEDC(COMPZ, N, D, E, Z, LDZ, WORK, LWORK, RWORK, LRWORK, IWORK, LIWORK, INFO);

DSTEDC(COMPZ, N, D, E, Z, LDZ, WORK, LWORK, RWORK, LRWORK, IWORK, LIWORK, INFO);

CSTEDC(COMPZ, N, D, E, Z, LDZ, WORK, LWORK, RWORK, LRWORK, IWORK, LIWORK, INFO);

ZSTEDC(COMPZ, N, D, E, Z, LDZ, WORK, LWORK, RWORK, LRWORK, IWORK, LIWORK, INFO);

Parameters

Parameter

Type

Description

Input/Output

compz

Character

  • 'N': computes only eigenvalues.
  • 'V': computes both eigenvectors of the original Hermitian matrix and eigenvalues.
  • 'I': computes both eigenvectors of the tridiagonal matrix and eigenvalues.

Input

n

Integer

Matrix dimension; n ≥ 0.

Input

d

  • A single-precision floating-point array for sstedc
  • A double-precision floating-point array for dstedc
  • A single-precision floating-point array for cstedc
  • A double-precision floating-point array for zstedc

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 sstedc
  • A double-precision floating-point array for dstedc
  • A single-precision floating-point array for cstedc
  • A double-precision floating-point array for zstedc

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 sstedc
  • A double-precision floating-point array for dstedc
  • A single-precision complex array for cstedc
  • A double-precision complex array for zstedc

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 ≥ 1. If eigenvectors need to be computed, ldz ≥ max(1, n).

Input

work

  • 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

lwork

Integer

Size of the work array.

  • If compz = 'N' or compz = 'I', or n ≤ 1, lwork ≥ 1.
  • If compz = 'V' and n >1, lwork ≥ n*n.
  • If lwork = -1, the function queries only the optimal lwork size.

Input

rwork

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

Output

lrwork

Integer

Size of the rwork array.

  • If compz = 'N' or n ≤ 1, lrwork ≥ 1.
  • If compz = 'V' and n > 1, lrwork ≥ 1 + 3*n + 2*n*lgn + 4*n**2, where lgn is the minimum value that satisfies 2**k ≥ n.
  • If compz = 'I' and n > 1, lrwork ≥ 1+4*n+2*n**2.
  • If lrwork = -1, the function queries only the optimal lrwork size.

Input

iwork

Integer

  • Work array, with a size of max(1, liwork).
  • On exit: If info = 0, iwork(1) returns the optimal liwork size.

Output

liwork

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: success.
  • 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 char compz = 'N';
const int n = 4;
const int ldz = 4;
double d[] = {72.1673, 66.1857, 64.7644, 28.0199};
double e[] = {6.8955, 7.2465, 3.5019};
double z[] = {0.924528, 0.056604, 0.415094, 0.924528,
             0.622642, 0.905660, 0.150943, 0.471698,
             0.132075, 0.566038, 0.811321, 0.924528,
             0.339623, 0.283019, 0.679245, 0.283019};
int lwork = 1;
int liwork = 1;
double *work = (double*)malloc(lwork * sizeof(double));
int *iwork = (int*)malloc(liwork * sizeof(int));

int info = 0;

dstedc_(&compz, &n, d, e, z, &ldz, work, &lwork, iwork, &liwork, &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
* z
* 0.924528        0.056604        0.415094        0.924528        0.622642        0.905660        0.150943        0.471698        0.132075        0.566038        * 0.811321        0.924528        0.339623        0.283019        0.679245        0.283019

Fortran interface:

CHARACTER :: compz = "N"
PARAMETER (n = 4) 
PARAMETER (ldz = 4)
PARAMETER (lwork = 1)
PARAMETER (liwork = -1)
INTEGER :: info = 0 
REAL(8) :: d(n) 
REAL(8) :: e(n-1)
REAL(8) :: z(ldz, n)
REAL(8) :: work(lwork)
INTEGER :: iwork(liwork)
  
DATA d / 72.1673, 66.1857, 64.7644, 28.0199 / 
DATA e / 6.8955, 7.2465, 3.5019 /
DATA z / 0.924528, 0.056604, 0.415094, 0.924528,
         0.622642, 0.905660, 0.150943, 0.471698,
         0.132075, 0.566038, 0.811321, 0.924528,
         0.339623, 0.283019, 0.679245, 0.283019/
EXTERNAL DSTEDC
 CALL DSTEDC(compz, n, d, e, z, ldz, work, liwork, iwork, liwork, info);
* 
* Output: 
* d:  
* 27.676252       56.816901       68.501999       78.142148
* e:
* 0.000000        0.000000        0.000000
* z:
* 0.924528        0.056604        0.415094        0.924528        0.622642        0.905660        0.150943        0.471698        0.132075        0.566038        * 0.811321        0.924528        0.339623        0.283019        0.679245        0.283019