SSPSV and DSPSV compute the extreme eigenvalues and, optionally, the eigenvectors of real symmetric matrix A, stored in lower- or upper-packed storage mode. CHPSV and ZHPSV compute the extreme eigenvalues and, optionally, the eigenvectors of complex Hermitian matrix A, stored in lower- or upper-packed storage mode. The extreme eigenvalues are returned in vector w, and the corresponding eigenvectors are returned in matrix Z:
where A = AT or
A = AH.
A, z | w, aux | Subroutine |
Short-precision real | Short-precision real | SSPSV |
Long-precision real | Long-precision real | DSPSV |
Short-precision complex | Short-precision real | CHPSV |
Long-precision complex | Long-precision real | ZHPSV |
Fortran | CALL SSPSV | DSPSV | CHPSV | ZHPSV (iopt, ap, w, z, ldz, n, m, aux, naux) |
C and C++ | sspsv | dspsv | chpsv | zhpsv (iopt, ap, w, z, ldz, n, m, aux, naux); |
PL/I | CALL SSPSV | DSPSV | CHPSV | ZHPSV (iopt, ap, w, z, ldz, n, m, aux, naux); |
If iopt = 0 or 20, the m smallest eigenvalues only are computed.
If iopt = 1 or 21, the m smallest eigenvalues and the eigenvectors are computed.
If iopt = 10 or 30, the m largest eigenvalues only are computed.
If iopt = 11 or 31, the m largest eigenvalues and the eigenvectors are computed.
Specified as: a fullword integer; iopt = 0, 1, 10, 11, 20, 21, 30, or 31.
If iopt = 0, 1, 10, or 11, it is stored in lower-packed storage mode.
If iopt = 20, 21, 30, or 31, it is stored in upper-packed storage mode.
Specified as: a one-dimensional array of (at least) length n(n+1)/2, containing numbers of the data type indicated in Table 125. On output, AP is overwritten; that is, the original input is not preserved.
If iopt = 0, 10, 20, or 30, it is not used in the computation.
If iopt = 1, 11, 21, or 31, it is the leading dimension of the output array specified for z.
Specified as: a fullword integer. It must have the following value, where:
If iopt = 0, 10, 20, or 30, ldz > 0.
If iopt = 1, 11, 21, or 31, ldz > 0 and ldz >= n.
If naux = 0 and error 2015 is unrecoverable, aux is ignored.
Otherwise, it is a storage work area used by this subroutine. Its size is specified by naux.
Specified as: an area of storage, containing numbers of the data type indicated in Table 125. On output, the contents are overwritten.
If naux = 0 and error 2015 is unrecoverable, SSPSV, DSPSV, CHPSV, and ZHPSV dynamically allocate the work area used by the subroutine. The work area is deallocated before control is returned to the calling program.
Otherwise, It must have the following value, where:
For SSPSV and DSPSV:
For CHPSV and ZHPSV:
Returned as: a one-dimensional array of (at least) length n, containing numbers of the data type indicated in Table 125.
If iopt = 0, 10, 20, or 30, it is not used in the computation.
If iopt = 1, 11, 21, or 31, it is the n by m matrix Z, containing m orthonormal eigenvectors of matrix A. The eigenvector in column i of matrix Z corresponds to the eigenvalue wi.
Returned as: an ldz by (at least) m array, containing numbers of the data type indicated in Table 125.
For a description of how complex Hermitian matrices are stored in lower- or upper-packed storage mode, see Complex Hermitian Matrix.
The methods used to compute the extreme eigenvalues and, optionally, the eigenvectors for either a real symmetric matrix or a complex Hermitian matrix are described in the steps below. For more information on these methods, see references [39], [43], [63], [87], [97], and [99]. If n or m is 0, no computation is performed. The results of the computations using short- and long-precision data can vary in accuracy. Eigenvalues computed using equivalent iopt values are mathematically equivalent, but are not guaranteed to be bitwise identical. For example, the results computed using iopt = 0 and iopt = 20 are mathematically equivalent, but are not necessarily bitwise identical.
These algorithms have a tendency to generate underflows that may hurt overall performance. The system default is to mask underflow, which improves the performance of these subroutines.
The extreme eigenvalues and, optionally, the eigenvectors of a real symmetric matrix A or complex Hermitian matrix A are computed as follows:
Error 2015 is unrecoverable, naux = 0, and unable to allocate work area.
This example shows how to find the two smallest eigenvalues and corresponding eigenvectors of a real long-precision symmetric matrix A of order 4, stored in upper-packed storage mode. Matrix A is:
* * | 5.0 4.0 1.0 1.0 | | 4.0 5.0 1.0 1.0 | | 1.0 1.0 4.0 2.0 | | 1.0 1.0 2.0 4.0 | * *
where:
IOPT AP W Z LDZ N M AUX NAUX | | | | | | | | | CALL DSPSV( 21 , AP , W , Z , 4 , 4 , 2 , AUX , 36 ) AP = (5.0, 4.0, 5.0, 1.0, 1.0, 4.0, 1.0, 1.0, 2.0, 4.0)
* * | 1.000000 | W = | 2.000000 | | . | | . | * *
* * | -0.707107 0.000000 | Z = | 0.707107 0.000000 | | 0.000000 -0.707107 | | 0.000000 0.707107 | * *
This example shows how to find the three largest eigenvalues and corresponding eigenvectors of a real long-precision symmetric matrix A of order 4, stored in lower-packed storage mode, having an eigenvalue of multiplicity two. Matrix A is:
* * | 6.0 4.0 4.0 1.0 | | 4.0 6.0 1.0 4.0 | | 4.0 1.0 6.0 4.0 | | 1.0 4.0 4.0 6.0 | * *
where:
IOPT AP W Z LDZ N M AUX NAUX | | | | | | | | | CALL DSPSV( 11 , AP , W , Z , 8 , 4 , 3 , AUX , 36 ) AP = (6.0, 4.0, 4.0, 1.0, 6.0, 1.0, 4.0, 6.0, 4.0, 6.0)
* * | 15.000000 | W = | 5.000000 | | 5.000000 | | . | * *
* * | 0.500000 0.707107 0.000000 | | 0.500000 0.000000 -0.707107 | | 0.500000 0.000000 0.707107 | Z = | 0.500000 -0.707107 0.000000 | | . . . | | . . . | | . . . | | . . . | * *
This example shows how to find the largest eigenvalue and the corresponding eigenvector of a complex Hermitian matrix A of order 2, stored in lower-packed storage mode. Matrix A is:
* * | (1.0, 0.0) (0.0, -1.0) | | (0.0, 1.0) (1.0, 0.0) | * *
where:
IOPT AP W Z LDZ N M AUX NAUX | | | | | | | | | CALL ZHPSV( 11 , AP , W , Z , 2 , 2 , 1 , AUX , 22 ) AP = ((1.0, . ), (0.0, 1.0), (1.0, . ))
* * W = | 2.000000 | | . | * *
* * Z = | (0.000000, -0.707107) | | (0.707107, 0.000000) | * *
This example shows how to find the two smallest eigenvalues only of a complex Hermitian matrix A of order 4, stored in upper-packed storage mode. Matrix A is:
* * | (3.0, 0.0) (1.0, 0.0) (0.0, 0.0) (0.0, 2.0) | | (1.0, 0.0) (3.0, 0.0) (0.0, -2.0) (0.0, 0.0) | | (0.0, 0.0) (0.0, 2.0) (1.0, 0.0) (1.0, 0.0) | | (0.0, -2.0) (0.0, 0.0) (1.0, 0.0) (1.0, 0.0) | * *
where:
IOPT AP W Z LDZ N M AUX NAUX | | | | | | | | | CALL ZHPSV( 20 , AP , W , DUMMY , 1 , 4 , 2 , AUX , 20 ) AP = ((3.0, . ), (1.0, 0.0), (3.0, . ), (0.0, 0.0), (0.0, -2.0), (1.0, . ), (0.0, 2.0), (0.0, 0.0), (1.0, 0.0), (1.0, . ))
* * | -0.828427 | W = | 0.000000 | | . | | . | * *