@@ -6,10 +6,16 @@ eigencopy_oftype(A::Hermitian, S) = Hermitian(copytrito!(similar(parent(A), S, s
66eigencopy_oftype (A:: Symmetric , S) =  Symmetric (copytrito! (similar (parent (A), S, size (A)), A. data, A. uplo), sym_uplo (A. uplo))
77eigencopy_oftype (A:: Symmetric{<:Complex} , S) =  copyto! (similar (parent (A), S), A)
88
9- default_eigen_alg (A) =  DivideAndConquer ()
9+ """ 
10+     default_eigen_alg(A) 
11+ 
12+ Return the default algorithm used to solve the eigensystem `A v = λ v` for a symmetric matrix `A`. 
13+ Defaults to `LinearAlegbra.DivideAndConquer()`, which corresponds to the LAPACK function `LAPACK.syevd!`. 
14+ """ 
15+ default_eigen_alg (@nospecialize (A)) =  DivideAndConquer ()
1016
1117#  Eigensolvers for symmetric and Hermitian matrices
12- function  eigen! (A:: RealHermSymComplexHerm{<:BlasReal,<:StridedMatrix} ,  alg:: Algorithm  =  default_eigen_alg (A);  sortby:: Union{Function,Nothing} = nothing )
18+ function  eigen! (A:: RealHermSymComplexHerm{<:BlasReal,<:StridedMatrix} ;  alg:: Algorithm  =  default_eigen_alg (A),  sortby:: Union{Function,Nothing} = nothing )
1319    if  alg ===  DivideAndConquer ()
1420        Eigen (sorteig! (LAPACK. syevd! (' V'  , A. uplo, A. data)... , sortby)... )
1521    elseif  alg ===  QRIteration ()
@@ -22,7 +28,7 @@ function eigen!(A::RealHermSymComplexHerm{<:BlasReal,<:StridedMatrix}, alg::Algo
2228end 
2329
2430""" 
25-     eigen(A::Union{Hermitian, Symmetric},  alg::Algorithm = default_eigen_alg(A)) -> Eigen 
31+     eigen(A::Union{Hermitian, Symmetric};  alg::LinearAlgebra. Algorithm = LinearAlgebra. default_eigen_alg(A)) -> Eigen 
2632
2733Compute the eigenvalue decomposition of `A`, returning an [`Eigen`](@ref) factorization object `F` 
2834which contains the eigenvalues in `F.values` and the eigenvectors in the columns of the 
@@ -45,19 +51,19 @@ The default `alg` used may change in the future.
4551
4652The following functions are available for `Eigen` objects: [`inv`](@ref), [`det`](@ref), and [`isposdef`](@ref). 
4753""" 
48- function  eigen (A:: RealHermSymComplexHerm ,  alg:: Algorithm  =  default_eigen_alg (A);  sortby:: Union{Function,Nothing} = nothing )
49-     _eigen (A,  alg;  sortby)
54+ function  eigen (A:: RealHermSymComplexHerm ;  alg:: Algorithm  =  default_eigen_alg (A),  sortby:: Union{Function,Nothing} = nothing )
55+     _eigen (A;  alg,  sortby)
5056end 
5157
5258#  we dispatch on the eltype in an internal method to avoid ambiguities
53- function  _eigen (A:: RealHermSymComplexHerm ,  alg:: Algorithm ;  sortby)
59+ function  _eigen (A:: RealHermSymComplexHerm ;  alg:: Algorithm ,  sortby)
5460    S =  eigtype (eltype (A))
55-     eigen! (eigencopy_oftype (A, S),  alg;  sortby)
61+     eigen! (eigencopy_oftype (A, S);  alg,  sortby)
5662end 
5763
58- function  _eigen (A:: RealHermSymComplexHerm{Float16} ,  alg:: Algorithm ;  sortby:: Union{Function,Nothing} = nothing )
64+ function  _eigen (A:: RealHermSymComplexHerm{Float16} ;  alg:: Algorithm ,  sortby:: Union{Function,Nothing} = nothing )
5965    S =  eigtype (eltype (A))
60-     E =  eigen! (eigencopy_oftype (A, S),  alg, sortby = sortby)
66+     E =  eigen! (eigencopy_oftype (A, S);  alg, sortby)
6167    values =  convert (AbstractVector{Float16}, E. values)
6268    vectors =  convert (AbstractMatrix{isreal (E. vectors) ?  Float16 :  Complex{Float16}}, E. vectors)
6369    return  Eigen (values, vectors)
@@ -114,7 +120,7 @@ function eigen(A::RealHermSymComplexHerm, vl::Real, vh::Real)
114120end 
115121
116122
117- function  eigvals! (A:: RealHermSymComplexHerm{<:BlasReal,<:StridedMatrix} ,  alg:: Algorithm  =  default_eigen_alg (A);  sortby:: Union{Function,Nothing} = nothing )
123+ function  eigvals! (A:: RealHermSymComplexHerm{<:BlasReal,<:StridedMatrix} ;  alg:: Algorithm  =  default_eigen_alg (A),  sortby:: Union{Function,Nothing} = nothing )
118124    vals:: Vector{real(eltype(A))}  =  if  alg ===  DivideAndConquer ()
119125        LAPACK. syevd! (' N'  , A. uplo, A. data)
120126    elseif  alg ===  QRIteration ()
@@ -129,7 +135,7 @@ function eigvals!(A::RealHermSymComplexHerm{<:BlasReal,<:StridedMatrix}, alg::Al
129135end 
130136
131137""" 
132-     eigvals(A::Union{Hermitian, Symmetric},  alg::Algorithm = default_eigen_alg(A))) -> values 
138+     eigvals(A::Union{Hermitian, Symmetric};  alg::Algorithm = default_eigen_alg(A))) -> values 
133139
134140Return the eigenvalues of `A`. 
135141
@@ -143,9 +149,9 @@ a comparison of the accuracy and performance of different methods.
143149
144150The default `alg` used may change in the future. 
145151""" 
146- function  eigvals (A:: RealHermSymComplexHerm ,  alg:: Algorithm  =  default_eigen_alg (A);  sortby:: Union{Function,Nothing} = nothing )
152+ function  eigvals (A:: RealHermSymComplexHerm ;  alg:: Algorithm  =  default_eigen_alg (A),  sortby:: Union{Function,Nothing} = nothing )
147153    S =  eigtype (eltype (A))
148-     eigvals! (eigencopy_oftype (A, S),  alg;  sortby)
154+     eigvals! (eigencopy_oftype (A, S);  alg,  sortby)
149155end 
150156
151157
0 commit comments