SGEEV and DGEEV compute the eigenvalues and, optionally, all or selected eigenvectors of real general matrix A. CGEEV and ZGEEV compute the eigenvalues and, optionally, all or selected eigenvectors of complex general matrix A. Eigenvalues are returned in complex vector w, and eigenvectors are returned in complex matrix Z:
A | w, Z | aux | Subroutine |
---|---|---|---|
Short-precision real | Short-precision complex | Short-precision real | SGEEV |
Long-precision real | Long-precision complex | Long-precision real | DGEEV |
Short-precision complex | Short-precision complex | Short-precision real | CGEEV |
Long-precision complex | Long-precision complex | Long-precision real | ZGEEV |
Fortran | CALL SGEEV | DGEEV | CGEEV | ZGEEV (iopt, a, lda, w, z, ldz, select, n, aux, naux) |
C and C++ | sgeev | dgeev | cgeev | zgeev (iopt, a, lda, w, z, ldz, select, n, aux, naux); |
PL/I | CALL SGEEV | DGEEV | CGEEV | ZGEEV (iopt, a, lda, w, z, ldz, select, n, aux, naux); |
If iopt = 0, eigenvalues only are computed.
If iopt = 1, eigenvalues and eigenvectors are computed.
If iopt = 2, eigenvalues and eigenvectors corresponding to selected eigenvalues are computed.
Specified as: a fullword integer; iopt = 0, 1, or 2.
If iopt = 0, it is not used in the computation.
If iopt = 1 or 2, it is the leading dimension of the output array specified for z.
Specified as: a fullword integer. It must have the following values, where:
If iopt = 0, ldz > 0.
If iopt = 1 or 2, ldz > 0 and ldz >= n.
If iopt = 0 or 1, it is not used in the computation.
If iopt = 2, it is the logical vector select of length n whose true elements indicate those eigenvalues whose corresponding eigenvectors are to be computed.
Specified as: a one-dimensional array of (at least) length n, containing logical data items. Element values can be true (.TRUE.) or false (.FALSE.).
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 123. On output, the contents are overwritten.
If naux = 0 and error 2015 is unrecoverable, SGEEV, DGEEV, CGEEV, and ZGEEV 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 SGEEV and DGEEV:
naux >= n2+4n.
For CGEEV and ZGEEV:
Returned as: a one-dimensional array of (at least) length n, containing numbers of the data type indicated in Table 123.
If iopt = 0, it is not used in the computation.
If iopt = 1, it is the matrix Z of order n, containing the eigenvectors of matrix A. The eigenvector in column i of matrix Z corresponds to the eigenvalue wi.
If iopt = 2, it is the n by m matrix Z, containing the m eigenvectors of matrix A, which correspond to the m selected eigenvalues in wi,
where m is the number of true elements in the logical vector select. The eigenvector in column i of matrix Z corresponds to the i-th selected eigenvalue. Any eigenvector that does not converge is set to 0.
Returned as: a two-dimensional array, containing numbers of the data type indicated in Table 123, where:
If iopt = 1, the array must be ldz by (at least) n.
If iopt = 2, the array must be ldz by (at least) m.
The next two sections describe the methods used to compute the eigenvectors and eigenvalues for either a real general matrix or a complex general matrix. For more information on these methods, see references [39], [43], [45], [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 the examples for an illustration of the difference in the results.
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, all or selected eigenvectors of a real general matrix A are computed as follows.
The eigenvalues and, optionally, all or selected eigenvectors of a complex general 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 eigenvalues only of a real short-precision general matrix A of order 4, where:
IOPT A LDA W Z LDZ SELECT N AUX NAUX | | | | | | | | | | CALL SGEEV( 0 , A , 4 , W , DUMMY1 , 1 , DUMMY2 , 4 , AUX , 4 ) * * | -2.0 2.0 2.0 2.0 | A = | -3.0 3.0 2.0 2.0 | | -2.0 0.0 4.0 2.0 | | -1.0 0.0 0.0 5.0 | * *
* * | (0.999999, 0.000000) | W = | (2.000001, 0.000000) | | (2.999996, 0.000000) | | (3.999999, 0.000000) | * *
This example shows how to find the eigenvalues and eigenvectors of a real short-precision general matrix A of order 3, where:
IOPT A LDA W Z LDZ SELECT N AUX NAUX | | | | | | | | | | CALL SGEEV( 1 , A , 3 , W , Z , 3 , DUMMY , 3 , AUX , 6 ) * * | 33.0 16.0 72.0 | A = | -24.0 -10.0 -57.0 | | -8.0 -4.0 -17.0 | * *
* * | (3.000022, 0.000000) | W = | (1.000019, 0.000000) | | (1.999961, 0.000000) | * * * * | (2.498781, 0.000000) (76.837608, 0.000000) (79.999451, 0.000000) | Z = | (-1.874081, 0.000000) (-61.470169, 0.000000) (-64.999649, 0.000000) | | (-0.624695, 0.000000) (-20.489990, 0.000000) (-19.999886, 0.000000) | * *
This example shows how to find the eigenvalues and eigenvectors of a real short-precision general matrix A of order 3, where:
IOPT A LDA W Z LDZ SELECT N AUX NAUX | | | | | | | | | | CALL SGEEV( 1 , A , 3 , W , Z , 3 , DUMMY , 3 , AUX , 6 ) * * | 8.0 -1.0 -5.0 | A = | -4.0 4.0 -2.0 | | 18.0 -5.0 -7.0 | * *
* * | (1.999999, 3.999998) | W = | (1.999999, -3.999998) | | (0.999997, 0.000000) | * * * * | (0.044710, 0.410578) (0.044710, -0.410578) (1.732048, 0.000000) | Z = | (-0.365868, 0.455287) (-0.365868, -0.455287) (3.464096, 0.000000) | | (0.455287, 0.365868) (0.455287, -0.365868) (1.732049, 0.000000) | * *
This example shows how to find the eigenvalues and selected eigenvectors of a real short-precision general matrix A of order 4, where:
IOPT A LDA W Z LDZ SELECT N AUX NAUX | | | | | | | | | | CALL SGEEV( 2 , A , 4 , W , Z , 4 , SELECT , 4 , AUX , 32 )
* * | -2.0 2.0 2.0 2.0 | A = | -3.0 3.0 2.0 2.0 | | -2.0 0.0 4.0 2.0 | | -1.0 0.0 0.0 5.0 | * *
* * | .TRUE. | SELECT = | .FALSE. | | .TRUE. | | .TRUE. | * *
* * | (0.999999, 0.000000) | W = | (2.000001, 0.000000) | | (2.999996, 0.000000) | | (3.999999, 0.000000) | * *
* * | (1.000000, 0.000000) (-0.674014, 0.000000) (-0.474306, 0.000000) | Z = | (0.750000, 0.000000) (-0.674014, 0.000000) (-0.474306, 0.000000) | | (0.500000, 0.000000) (-0.674013, 0.000000) (-0.474306, 0.000000) | | (0.250000, 0.000000) (-0.337006, 0.000000) (-0.474305, 0.000000) | * *
This example shows how to find the eigenvalues and selected eigenvectors of a real short-precision general matrix A of order 3, where:
IOPT A LDA W Z LDZ SELECT N AUX NAUX | | | | | | | | | | CALL SGEEV( 2 , A , 3 , W , Z , 3 , SELECT , 3 , AUX , 21 )
* * | 8.0 -1.0 -5.0 | A = | -4.0 4.0 -2.0 | | 18.0 -5.0 -7.0 | * *
* * | .TRUE. | SELECT = | .TRUE. | | .FALSE. | * *
* * | (1.999999, 3.999998) | W = | (1.999999, -3.999998) | | (0.999997, 0.000000) | * *
* * | (0.500000, 0.000000) (0.500000, 0.000000) | Z = | (0.500000, 0.500000) (0.500000, -0.500000) | | (0.500000, -0.500000) (0.500000, 0.500000) | * *
This example shows how the results of Example 5 would differ if matrix A was a real long-precision general matrix. On output, A has been overwritten.
IOPT A LDA W Z LDZ SELECT N AUX NAUX | | | | | | | | | | CALL DGEEV( 2 , A , 3 , W , Z , 3 , SELECT , 3 , AUX , 21 )
* * | (2.000000, 4.000000) | W = | (2.000000, -4.000000) | | (1.000000, 0.000000) | * *
* * | (0.500000, 0.000000) (0.500000, 0.000000) | Z = | (0.500000, 0.500000) (0.500000, -0.500000) | | (0.500000, -0.500000) (0.500000, 0.500000) | * *
This example shows how to find the eigenvalues only of a complex long-precision general matrix A of order 3, where:
IOPT A LDA W Z LDZ SELECT N AUX NAUX | | | | | | | | | | CALL ZGEEV( 0 , A , 3 , W , DUMMY1 , 1 , DUMMY2 , 3 , AUX , 6 ) * * | (1.0, 2.0) (3.0, 4.0) (21.0, 22.0) | A = | (43.0, 44.0) (13.0, 14.0) (15.0, 16.0) | | (5.0, 6.0) (7.0, 8.0) (25.0, 26.0) | * *
* * | (39.776655, 42.995668) | W = | (-7.477530, 6.880321) | | (6.700876, -7.875989) | * *
This example shows how to find the eigenvalues and eigenvectors of a complex long-precision general matrix A of order 4, where:
IOPT A LDA W Z LDZ SELECT N AUX NAUX | | | | | | | | | | CALL ZGEEV( 1 , A , 4 , W , Z , 4 , DUMMY , 4 , AUX , 12 ) * * | (5.0, 9.0) (5.0, 5.0) (-6.0, -6.0) (-7.0, -7.0) | A = | (3.0, 3.0) (6.0, 10.0) (-5.0, -5.0) (-6.0, -6.0) | | (2.0, 2.0) (3.0, 3.0) (-1.0, 3.0) (-5.0, -5.0) | | (1.0, 1.0) (2.0, 2.0) (-3.0, -3.0) (0.0, 4.0) | * *
* * | (4.000000, 8.000000) | W = | (2.000000, 6.000000) | | (3.000000, 7.000000) | | (1.000000, 5.000000) | * *
* * | (0.625817, 0.229776) (0.333009, -0.729358) (-1.535458, 1.519551) (0.000000, 3.464102) | Z = | (0.625817, 0.229776) (0.666017, -1.458715) (-1.535458, 1.519551) (0.000000, 1.732051) | | (0.625817, 0.229776) (0.333009, -0.729358) ( 0.000000, 0.000000) (0.000000, 1.732051) | | (0.000000, 0.000000) (0.333009, -0.729358) (-1.535458, 1.519551) (0.000000, 1.732051) | * *
This example shows how to find the eigenvalues and selected eigenvectors of a complex long-precision general matrix A of order 4, where:
IOPT A LDA W Z LDZ SELECT N AUX NAUX | | | | | | | | | | CALL ZGEEV( 2 , A , 4 , W , Z , 4 , SELECT , 4 , AUX , 52 )
* * | (5.0, 9.0) (5.0, 5.0) (-6.0, -6.0) (-7.0, -7.0) | A = | (3.0, 3.0) (6.0, 10.0) (-5.0, -5.0) (-6.0, -6.0) | | (2.0, 2.0) (3.0, 3.0) (-1.0, 3.0) (-5.0, -5.0) | | (1.0, 1.0) (2.0, 2.0) (-3.0, -3.0) (0.0, 4.0) | * *
* * | .TRUE. | SELECT = | .FALSE. | | .TRUE. | | .TRUE. | * *
* * | (4.000000, 8.000000) | W = | (2.000000, 6.000000) | | (3.000000, 7.000000) | | (1.000000, 5.000000) | * *
* * | (-0.748331, 0.000000) (-0.935414, 0.000000) (-1.247219, 0.000000) | Z = | (-0.748331, 0.000000) (-0.935414, 0.000000) (-0.623610, 0.000000) | | (-0.748331, 0.000000) (0.000000, 0.000000) (-0.623610, 0.000000) | | (0.000000, 0.000000) (-0.935414, 0.000000) (-0.623610, 0.000000) | * *