?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 |
|
Input |
n |
Integer |
Matrix dimension, N ≥ 0. |
Input |
d |
|
Array with a length of n.
|
Input/Output |
e |
|
Array with a length of n-1.
|
Input/Output |
z |
|
Array with a size of ldz*n.
|
Input/Output |
ldz |
Integer |
Leading dimension of matrix z. ldz ≥ max(1, n). |
Input |
work |
|
Work array, with a size of max(1, 2*n-2). If compz='N', this array is not used. |
Output |
info |
Integer |
|
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