Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eigmax type constrained differently than eigmin #627

Closed
nickrobinson251 opened this issue Apr 26, 2019 · 4 comments
Closed

eigmax type constrained differently than eigmin #627

nickrobinson251 opened this issue Apr 26, 2019 · 4 comments

Comments

@nickrobinson251
Copy link
Contributor

nickrobinson251 commented Apr 26, 2019

Implementing eigvals for an AbstractMatrix gets you eigmin but not eigmax.

I think the definition for eigmax should change StridedMatrix -> AbstractMatrix (to match the definition of eigmin)?

Example:

julia> using LinearAlgebra

julia> struct MyMat{T} <: AbstractMatrix{T}
           data::AbstractMatrix{T}
       end

julia> Base.getindex(m::MyMat, i, j) = getindex(m.data, i, j)

julia> Base.size(m::MyMat) = size(m.data)

julia> LinearAlgebra.eigvals(m::MyMat; kwargs...) = eigvals(m.data; kwargs...)

julia> M = MyMat(rand(3,3))
3×3 MyMat{Float64}:
 0.316192  0.915257  0.559555
 0.153994  0.978667  0.406342
 0.114911  0.249647  0.87979

julia> eigvals(M)
3-element Array{Float64,1}:
 1.4367338354952857
 0.13582144904446486
 0.6020940832444935

julia> eigmin(M)
0.13582144904446486

julia> eigmax(M)
ERROR: MethodError: no method matching eigmax(::MyMat{Float64})
Closest candidates are:
  eigmax(::SymTridiagonal) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/LinearAlgebra/src/tridiag.jl:227
@andreasnoack
Copy link
Member

I agree. It would be great if you could prepare a PR.

@nickrobinson251
Copy link
Contributor Author

(related #620)

@nickrobinson251
Copy link
Contributor Author

actually should be fixed by JuliaLang/julia#31117 :D

@dkarrasch
Copy link
Member

Looks like this is fixed and can be closed? The above code does no longer error.

@KristofferC KristofferC transferred this issue from JuliaLang/julia Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants