-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Type instability for eigen of a complex matrix #52289
Labels
domain:linear algebra
Linear algebra
Comments
Thank you. When will it be available after the merging? |
aviatesk
pushed a commit
that referenced
this issue
Nov 25, 2023
Indexing using integers instead of a `Vector` uses constant-propagation to improve the inferred return types. After this, the return type of `eigen(::Matrix{ComplexF64})` is inferred as a small union. ```julia julia> @code_typed eigen(rand(ComplexF64,2,2)) CodeInfo( 1 ─ %1 = invoke LinearAlgebra.:(var"#eigen#94")(true::Bool, true::Bool, LinearAlgebra.eigsortby::typeof(LinearAlgebra.eigsortby), #self#::typeof(eigen), A::Matrix{ComplexF64})::Union{Eigen{ComplexF64, ComplexF64, Matrix{ComplexF64}, Vector{ComplexF64}}, Eigen{ComplexF64, Float64, Matrix{ComplexF64}, Vector{Float64}}} └── return %1 ) => Union{Eigen{ComplexF64, ComplexF64, Matrix{ComplexF64}, Vector{ComplexF64}}, Eigen{ComplexF64, Float64, Matrix{ComplexF64}, Vector{Float64}}} ``` Close #52289
mkitti
pushed a commit
to mkitti/julia
that referenced
this issue
Dec 9, 2023
Indexing using integers instead of a `Vector` uses constant-propagation to improve the inferred return types. After this, the return type of `eigen(::Matrix{ComplexF64})` is inferred as a small union. ```julia julia> @code_typed eigen(rand(ComplexF64,2,2)) CodeInfo( 1 ─ %1 = invoke LinearAlgebra.:(var"#eigen#94")(true::Bool, true::Bool, LinearAlgebra.eigsortby::typeof(LinearAlgebra.eigsortby), #self#::typeof(eigen), A::Matrix{ComplexF64})::Union{Eigen{ComplexF64, ComplexF64, Matrix{ComplexF64}, Vector{ComplexF64}}, Eigen{ComplexF64, Float64, Matrix{ComplexF64}, Vector{Float64}}} └── return %1 ) => Union{Eigen{ComplexF64, ComplexF64, Matrix{ComplexF64}, Vector{ComplexF64}}, Eigen{ComplexF64, Float64, Matrix{ComplexF64}, Vector{Float64}}} ``` Close JuliaLang#52289
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, this is a simple example.
First, I test the code_warntype with a Float matrix.
I get a Unition type, but I think that it is because I can have complex or real eigenvalues depending on A, if it is Hermitian or not. (Should it be fixed by introducing a function barrier, perhaps with a
Val
argument depending on the hermiticity?)Here, instead, there is the code in the case of a complex matrix.
Here there is my versioninfo
The text was updated successfully, but these errors were encountered: