XLPack 6.1
Julia API Reference Manual
Loading...
Searching...
No Matches

◆ dsyev()

function dsyev ( jobz::Char  ,
uplo::Char  ,
n::Integer  ,
a::Array{Float64}  ,
w::Array{Float64}   
)

Eigenvalues and eigenvectors of a symmetric matrix

Purpose
dsyev computes all eigenvalues and, optionally, eigenvectors of a real symmetric matrix A.
Returns
info (Int32)
= 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]nOrder of the matrix A. (n >= 0) (If n = 0, returns without computation)
[in,out]a2-dimensional array (Float64, 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]w1-dimensional array (Float64, 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 )
function TestDsyev()
n = 3
a = [ 2.2 -0.11 -0.32;
0.0 2.93 0.81;
0.0 0.0 2.37 ]
w = Vector{Cdouble}(undef, n)
info = dsyev('V', 'U', n, a, w)
println("w = ", w, ", info = ", info)
println("a:")
println(a)
end
function dsyev(jobz::Char, uplo::Char, n::Integer, a::Array{Float64}, w::Array{Float64})
Eigenvalues and eigenvectors of a symmetric matrix
Example Results
> TestDsyev()
w = [1.7070595491104588, 2.22943643244226, 3.5635040184472837], info = 0
a:
[-0.3993220772133821 0.894521385341403 -0.20093125644579898;
0.4810264443405481 0.3909945886772715 0.7846889775383503;
-0.7804841052161664 -0.2166903846320573 0.586421212707156]