diff --git a/src/eigenSelfAdjoint.jl b/src/eigenSelfAdjoint.jl index fb683ca..5768afb 100644 --- a/src/eigenSelfAdjoint.jl +++ b/src/eigenSelfAdjoint.jl @@ -216,7 +216,10 @@ function eigvalsPWK!(S::SymTridiagonal{T}; tol = eps(T), sortby::Union{Function, end end end - LinearAlgebra.sorteig!(d, sortby) + + # LinearAlgebra.eigvals will pass sortby=nothing but LAPACK always sort the symmetric + # eigenvalue problem so we'll will do the same here + LinearAlgebra.sorteig!(d, sortby === nothing ? LinearAlgebra.eigsortby : sortby) end function eigQL!( @@ -639,30 +642,30 @@ else LinearAlgebra.copy_oftype end -function LinearAlgebra.eigvals(A::Hermitian{<:Real}) - T = typeof(sqrt(zero(eltype(A)))) - return eigvals!(_eigencopy_oftype(A, T)) -end -function LinearAlgebra.eigvals(A::Hermitian{<:Complex}) - T = typeof(sqrt(zero(eltype(A)))) - return eigvals!(_eigencopy_oftype(A, T)) -end -function LinearAlgebra.eigvals(A::Hermitian) - T = typeof(sqrt(zero(eltype(A)))) - return eigvals!(_eigencopy_oftype(A, T)) -end -function LinearAlgebra.eigen(A::Hermitian{<:Real}) - T = typeof(sqrt(zero(eltype(A)))) - return eigen!(_eigencopy_oftype(A, T)) -end -function LinearAlgebra.eigen(A::Hermitian{<:Complex}) - T = typeof(sqrt(zero(eltype(A)))) - return eigen!(_eigencopy_oftype(A, T)) -end -function LinearAlgebra.eigen(A::Hermitian) - T = typeof(sqrt(zero(eltype(A)))) - return eigen!(_eigencopy_oftype(A, T)) -end +# function LinearAlgebra.eigvals(A::Hermitian{<:Real}) +# T = typeof(sqrt(zero(eltype(A)))) +# return eigvals!(_eigencopy_oftype(A, T)) +# end +# function LinearAlgebra.eigvals(A::Hermitian{<:Complex}) +# T = typeof(sqrt(zero(eltype(A)))) +# return eigvals!(_eigencopy_oftype(A, T)) +# end +# function LinearAlgebra.eigvals(A::Hermitian) +# T = typeof(sqrt(zero(eltype(A)))) +# return eigvals!(_eigencopy_oftype(A, T)) +# end +# function LinearAlgebra.eigen(A::Hermitian{<:Real}) +# T = typeof(sqrt(zero(eltype(A)))) +# return eigen!(_eigencopy_oftype(A, T)) +# end +# function LinearAlgebra.eigen(A::Hermitian{<:Complex}) +# T = typeof(sqrt(zero(eltype(A)))) +# return eigen!(_eigencopy_oftype(A, T)) +# end +# function LinearAlgebra.eigen(A::Hermitian) +# T = typeof(sqrt(zero(eltype(A)))) +# return eigen!(_eigencopy_oftype(A, T)) +# end # Aux (should go somewhere else at some point) function LinearAlgebra.givensAlgorithm(f::Real, g::Real) diff --git a/test/eigenselfadjoint.jl b/test/eigenselfadjoint.jl index 9565647..847adc0 100644 --- a/test/eigenselfadjoint.jl +++ b/test/eigenselfadjoint.jl @@ -164,4 +164,11 @@ using Test, GenericLinearAlgebra, LinearAlgebra, Quaternions @test eigen(A).values == diag(A) end end + + if VERSION >= v"1.11" + @testset "Method ambiguity in eigen with Julia 1.11 #141" begin + M = Hermitian(Tridiagonal(ones(ComplexF64, 2), ones(ComplexF64, 3), ones(ComplexF64, 2))) + @test eigen(M).values ≈ Float64.(eigen(big.(M)).values) + end + end end