SSPEV and DSPEV compute the eigenvalues and, optionally, the eigenvectors of real symmetric matrix A, stored in lower- or upper-packed storage mode. CHPEV and ZHPEV compute the eigenvalues and, optionally, the eigenvectors of complex Hermitian matrix A, stored in lower- or upper-packed storage mode. Eigenvalues are returned in vector w, and eigenvectors are returned in matrix Z:
where A = AT or
A = AH.
A, z | w, aux | Subroutine |
Short-precision real | Short-precision real | SSPEV |
Long-precision real | Long-precision real | DSPEV |
Short-precision complex | Short-precision real | CHPEV |
Long-precision complex | Long-precision real | ZHPEV |
Fortran | CALL SSPEV | DSPEV | CHPEV | ZHPEV (iopt, ap, w, z, ldz, n, aux, naux) |
C and C++ | sspev | dspev | chpev | zhpev (iopt, ap, w, z, ldz, n, aux, naux); |
PL/I | CALL SSPEV | DSPEV | CHPEV | ZHPEV (iopt, ap, w, z, ldz, n, aux, naux); |
If iopt = 0 or 20, eigenvalues only are computed.
If iopt = 1 or 21, eigenvalues and eigenvectors are computed.
Specified as: a fullword integer; iopt = 0, 1, 20, or 21.
If iopt = 0 or 1, it is stored in lower-packed storage mode.
If iopt = 20 or 21, 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 124. On output, for SSPEV and DSPEV if iopt = 0 or 20, and for CHPEV and ZHPEV, AP is overwritten; that is, the original input is not preserved.
If iopt = 0 or 20, it is not used in the computation.
If iopt = 1 or 21, 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 or 20, ldz > 0.
If iopt = 1 or 21, 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 124. On output, the contents are overwritten.
If naux = 0 and error 2015 is unrecoverable, SSPEV, DSPEV, CHPEV, and ZHPEV 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 SSPEV and DSPEV:
For CHPEV and ZHPEV:
If iopt = 0 or 20, it is not used in the computation.
If iopt = 1 or 21, it is the matrix Z of order n, containing the 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) n array, containing numbers of the data type indicated in Table 124.
For a description of how complex Hermitian matrices are stored in lower- or upper-packed storage mode, see Complex Hermitian Matrix.
The next two sections describe the methods used to compute the eigenvalues and, optionally, the eigenvectors for either a real symmetric matrix or a complex Hermitian matrix. For more information on these methods, see references [39], [43], [63], [87], [97], and [99]. If n is 0, no computation is performed. The results of the computations using short- and long-precision data can vary in accuracy. See Example 3 and Example 4 for an illustration of the difference in results. 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 eigenvalues and, optionally, the eigenvectors of a real symmetric matrix A are computed as follows:
The eigenvalues and, optionally, the eigenvectors of a complex Hermitian matrix A are computed as follows:
Error 2015 is unrecoverable, naux = 0, and unable to allocate work area.
Eigenvalue (i) failed to converge after (xxx) iterations:
This example shows how to find the eigenvalues only of a real short-precision symmetric matrix A of order 3, stored in lower-packed storage mode Matrix A is:
* * | 1.0 -1.0 0.0 | | -1.0 2.0 -1.0 | | 0.0 -1.0 1.0 | * *
where:
IOPT AP W Z LDZ N AUZ NAUX | | | | | | | | CALL SSPEV( 0 , AP , W , DUMMY , 1 , 3 , AUX , 3 ) AP = (1.0, -1.0, 0.0, 2.0, -1.0, 1.0)
* * | 0.000000 | W = | 1.000000 | | 3.000000 | * *
This example shows how to find the eigenvalues and eigenvectors of a real short-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 AUZ NAUX | | | | | | | | CALL SSPEV( 21 , AP , W , Z , 4 , 4 , AUX , 8 ) 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 | | 5.000000 | | 9.999999 | * *
* * | 0.707107 0.000000 0.316227 0.632455 | Z = | -0.707107 0.000000 0.316228 0.632455 | | 0.000000 -0.707106 -0.632455 0.316227 | | 0.000000 0.707107 -0.632455 0.316228 | * *
This example shows how to find the eigenvalues and eigenvectors of a real short-precision symmetric matrix A, stored in lower-packed storage mode, which has an eigenvalue of multiplicity 2. 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 AUZ NAUX | | | | | | | | CALL SSPEV( 1 , AP , W , Z , 7 , 4 , AUX , 8 ) AP = (6.0, 4.0, 4.0, 1.0, 6.0, 1.0, 4.0, 6.0, 4.0, 6.0)
* * | -1.000000 | W = | 4.999999 | | 5.000000 | | 15.000000 | * *
* * | -0.500000 0.000000 0.707107 0.500000 | | 0.500000 0.707107 0.000000 0.500000 | | 0.500000 -0.707107 0.000000 0.500000 | Z = | -0.500000 0.000000 -0.707107 0.500000 | | . . . . | | . . . . | | . . . . | * *
This example shows how the results of Example 3 differ if matrix A is a real long-precision symmetric matrix.
IOPT AP W Z LDZ N AUZ NAUX | | | | | | | | CALL DSPEV( 1 , AP , W , Z , 7 , 4 , AUX , 8 )
* * | -1.000000 | W = | 5.000000 | | 5.000000 | | 15.000000 | * *
* * | -0.500000 -0.216773 -0.673060 0.500000 | | 0.500000 0.673060 -0.216773 0.500000 | | 0.500000 -0.673060 0.216773 0.500000 | Z = | -0.500000 0.216773 0.673060 0.500000 | | . . . . | | . . . . | | . . . . | * *
This example shows how to find the eigenvalues and eigenvectors 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 AUZ NAUX | | | | | | | | CALL ZHPEV( 1 , AP , W , Z , 2 , 2 , AUX , 8 ) AP = ((1.0, . ), (0.0, 1.0), (1.0, . ))
* * W = | 0.000000 | | 2.000000 | * *
* * Z = | (0.000000, -0.707107) (0.000000, -0.707107) | | (-0.707107, 0.000000) (0.707107, 0.000000) | * *
This example shows how to find the 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 AUZ NAUX | | | | | | | | CALL ZHPEV( 20 , AP , W , DUMMY , 1 , 4 , AUX , 12 ) 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 | | 4.000000 | | 4.828427 | * *
This example shows how to find the eigenvalues and eigenvectors of a complex Hermitian matrix A of order 2, stored in lower-packed storage mode. Matrix A is:
* * | (1.0, 0.0) (1.0, -1.0) | | (1.0, 1.0) (1.0, 0.0) | * *
where:
IOPT AP W Z LDZ N AUZ NAUX | | | | | | | | CALL ZHPEV( 1 , AP , W , Z , 2 , 2 , AUX , 8 ) AP = ((1.0, . ), (1.0, 1.0), (1.0, . ))
* * W = | -0.414214 | | 2.414214 | * *
* * Z = | (0.500000, -0.500000) (0.500000, -0.500000) | | (-0.707107, 0.000000) (0.707107, 0.000000) | * *