|
|
◆ dsyev()
| def dsyev |
( |
jobz |
, |
|
|
uplo |
, |
|
|
n |
, |
|
|
a |
, |
|
|
w |
|
|
) |
| |
Eigenvalues and eigenvectors of a symmetric matrix
- Purpose
- dsyev computes all eigenvalues and, optionally, eigenvectors of a real symmetric matrix A.
- Returns
- info (int)
= 0: Successful exit
= -1: The argument jobz had an illegal value (jobz != 'V' nor 'N')
= -2: The argument uplo had an illegal value (uplo != 'U' nor 'L')
= -3: The argument n had an illegal value (n < 0)
= -4: The argument a is invalid.
= -5: The argument w is invalid.
= i > 0: The algorithm failed to converge; i off-diagonal elements of an intermediate tridiagonal form did not converge to zero.
- Parameters
-
| [in] | jobz | = 'N': Compute eigenvalues only.
= 'V': Compute eigenvalues and eigenvectors. |
| [in] | uplo | = 'U': Upper triangle of A is stored.
= 'L': Lower triangle of A is stored. |
| [in] | n | Order of the matrix A. (n >= 0) (If n = 0, returns without computation) |
| [in,out] | a | Numpy ndarray (2-dimensional, float, n x n)
[in] n x n symmetric matrix A. The upper or lower triangular part is to be stored in accordance with uplo.
[out] jobz = 'V': If info = 0, a contains the orthonormal eigenvectors of the matrix A.
jobz = 'N': The lower triangle (if uplo = 'L') or the upper triangle (if uplo = 'U') of a, including the diagonal, is destroyed. |
| [out] | w | Numpy ndarray (1-dimensional, float, n)
If info = 0, the eigenvalues in ascending order. |
- Reference
- LAPACK
- Example Program
- Compute all eigenvalues and eigenvectors of the symmetric matrix A, where
( 2.20 -0.11 -0.32 )
A = ( -0.11 2.93 0.81 )
( -0.32 0.81 2.37 )
def TestDsyev():
n = 3
a = np.array([
[2.2, 0.0, 0.0],
[-0.11, 2.93, 0.0],
[-0.32, 0.81, 2.37]])
w = np.empty(3)
info = dsyev( 'V', 'U', n, a, w)
print(w, info)
print(a)
def dsyev(jobz, uplo, n, a, w) Eigenvalues and eigenvectors of a symmetric matrix
- Example Results
>>> TestDsyev()
[1.70705955 2.22943643 3.56350402] 0
[[-0.39932208 0.48102644 -0.78048411]
[ 0.89452139 0.39099459 -0.21669038]
[-0.20093126 0.78468898 0.58642121]]
|