Rate This Document
Findability
Accuracy
Completeness
Readability

Kml?steqr2

A modified version of the LAPACK function ?STEQR (restricted to the V case only), which computes all eigenvalues and optional eigenvectors of a symmetric tridiagonal matrix using the implicit QL or QR method. Designed for use within KML ScaLAPACK, this routine allows each ScaLAPACK process to independently update its local portion of the distributed matrix Q. Only the C interface is available.

Interface Definition

C interface:

int KmlSsteqr2(constint n, float*d, float*e, float*z, constint ldz, constint nr, float *work);

int KmlDsteqr2(const int n, double *d, double *e, double *z, const int ldz, const int nr, double *work);

Parameters

Parameter

Type

Description

Input/Output

N

Integer

Number of rows/columns in the matrix.

Input

D

A single-precision floating-point array for KmlSsteqr2

A double-precision floating-point array for KmlDsteqr2

The dimension is N.

On entry: It contains the diagonal elements of the tridiagonal matrix.

On exit: If INFO is 0, it contains the eigenvalues in ascending order.

Input/Output

E

A single-precision floating-point array for KmlSsteqr2

A double-precision floating-point array for KmlDsteqr2

The dimension is N-1.

On entry: It contains the subdiagonal elements of the tridiagonal matrix.

On exit: E is destroyed.

Input

Z

A single-precision floating-point array for KmlSsteqr2

A double-precision floating-point array for KmlDsteqr2

The dimension is N*N.

On entry: It contains the orthogonal matrix.

On exit: If INFO is 0, it contains the orthonormal eigenvectors.

Input/Output

LDZ

Integer

Leading dimension of matrix Z. LDZ ≥ max(1, N).

Input

NR

Integer

NR = MAX(1, NUMROC( N, NB, MYPROW, 0, NPROCS ) )

Input

WORK

A single-precision floating-point array for KmlSsteqr2

A double-precision floating-point array for KmlDsteqr2

Work array, with a dimension of max(1, 2*N-2).

Input

Dependencies

#include "klapack.h"

Examples

C interface:

const int n = 4;
const int ldz = 4;
const int nr = 2;

double d[] = {14.1234, 15.5678, 16.9012, 17.3456};
double e[] = {18.7890, 19.1234, 20.5678, 21.9012};
double *z = (double *)malloc(ldz * n * sizeof(double));
// 1st column
z[0 * ldz + 0] = 0.5;
z[0 * ldz + 1] = 0.5;
z[0 * ldz + 2] = 0.5;
z[0 * ldz + 3] = 0.5;
 
// 2nd column
z[1 * ldz + 0] = 0.5;
z[1 * ldz + 1] = -0.5;
z[1 * ldz + 2] = 0.5;
z[1 * ldz + 3] = -0.5;
 
// 3rd column
z[2 * ldz + 0] = 0.5;
z[2 * ldz + 1] = 0.5;
z[2 * ldz + 2] = -0.5;
z[2 * ldz + 3] = -0.5;
 
// 4th column
z[3 * ldz + 0] = 0.5;
z[3 * ldz + 1] = -0.5;
z[3 * ldz + 2] = -0.5;
z[3 * ldz + 3] = 0.5;

double *work = (double *)malloc((2 * n - 2) * sizeof(double));
KmlDsteqr2(n, d, e, z, ldz, nr, work);

/* 
 * Output: 
d :
   -1.534857e+01   3.519426e+00   2.804530e+01   4.772184e+01
z :
   -1.449053e-03   2.307024e-01   -8.569433e-02   9.692424e-01
   -9.756888e-01   1.491886e-03   -2.181372e-01   -2.110012e-02
   5.000000e-01   5.000000e-01   -5.000000e-01   -5.000000e-01
   5.000000e-01   -5.000000e-01   -5.000000e-01   5.000000e-01
*/