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

Fixed diagonal matrix eigen decomposition to return eigenvectors as diagonal matrix #54882

Merged
merged 5 commits into from
Jun 27, 2024

Conversation

OzgurMertEmir
Copy link
Contributor

@OzgurMertEmir OzgurMertEmir commented Jun 21, 2024

Solution to issue Eigen decomposition of Diagonal matrix returns Dense eigenvectors #53007. Modified the eigen function for diagonal matrices to return eigenvectors as diagonal matrices.

Closes #53007.

return eigenvectors as diagonal matrix
@jishnub
Copy link
Contributor

jishnub commented Jun 22, 2024

You might need to update some tests that are explicitly checking for a dense matrix.

@dkarrasch dkarrasch added the domain:linear algebra Linear algebra label Jun 22, 2024
@dkarrasch
Copy link
Member

This infers just fine:

julia> using LinearAlgebra

julia> using Test

julia> @inferred eigen(Diagonal(ones(3)))
Eigen{Float64, Float64, Diagonal{Float64, Vector{Float64}}, Vector{Float64}}
values:
3-element Vector{Float64}:
 1.0
 1.0
 1.0
vectors:
3×3 Diagonal{Float64, Vector{Float64}}:
 1.0        
     1.0    
         1.0

julia> @inferred eigvecs(Diagonal(ones(3)))
3×3 Diagonal{Float64, Vector{Float64}}:
 1.0        
     1.0    
         1.0

@dkarrasch dkarrasch added the status:merge me PR is reviewed. Merge when all tests are passing label Jun 26, 2024
@dkarrasch
Copy link
Member

The failing tests are unrelated. Thanks @OzgurMertEmir for picking this up, and welcome to the Julia community.

@dkarrasch dkarrasch merged commit b2657a5 into JuliaLang:master Jun 27, 2024
6 of 8 checks passed
@dkarrasch dkarrasch removed the status:merge me PR is reviewed. Merge when all tests are passing label Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Eigen decomposition of Diagonal matrix returns Dense eigenvectors
3 participants