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

Have matrix square root account for Rii=Rjj=0 to prevent NaN values #35758

Merged
merged 5 commits into from
May 8, 2020

Conversation

ssikdar1
Copy link
Contributor

@ssikdar1 ssikdar1 commented May 5, 2020

Description

Tries to Fix JuliaLang/LinearAlgebra.jl#700

Add a check when R[i,i] and R[j,j] is 0 to not call sylvester(0,0,-r)

Testing

julia> sqrt(A*B*A')
4×4 Array{Complex{Float64},2}:
     0.307265+0.0im     0.0455076+0.0im   2.29019e-16+0.0im  -2.01045e-16+0.0im
    0.0455076+0.0im      0.209085+0.0im  -2.37063e-16+0.0im  -7.04933e-17+0.0im
  2.29019e-16+0.0im  -2.37063e-16+0.0im   5.33599e-31+0.0im  -9.53187e-32+0.0im
 -2.01045e-16+0.0im  -7.04933e-17+0.0im  -9.53187e-32+0.0im   1.39738e-31+0.0im

Where previously it returned

julia> sqrt(A*B*A')
4×4 Array{Complex{Float64},2}:
 NaN+NaN*im  NaN+NaN*im  NaN+NaN*im  NaN+NaN*im
 NaN+NaN*im  NaN+NaN*im  NaN+NaN*im  NaN+NaN*im
 NaN+NaN*im  NaN+NaN*im  NaN+NaN*im  NaN+NaN*im
 NaN+NaN*im  NaN+NaN*im  NaN+NaN*im  NaN+NaN*im

@fredrikekre fredrikekre added linear algebra Linear algebra needs tests Unit tests are required for this change labels May 6, 2020
@stevengj stevengj removed the needs tests Unit tests are required for this change label May 7, 2020
@stevengj stevengj added backport 1.0 bugfix This change fixes an existing bug and removed backport 1.0 labels May 7, 2020
@ssikdar1
Copy link
Contributor Author

ssikdar1 commented May 7, 2020

@stevengj Is anything I need to for the backport labels?

@stevengj
Copy link
Member

stevengj commented May 7, 2020

@ssikdar1, no, the backport labels are used in the release process for 1.3.x etcetera to know which commits to backport.

@JeffBezanson JeffBezanson merged commit 880c731 into JuliaLang:master May 8, 2020
@ssikdar1 ssikdar1 deleted the matrix-sqrt branch May 8, 2020 20:19
@KristofferC KristofferC mentioned this pull request May 10, 2020
14 tasks
KristofferC pushed a commit that referenced this pull request May 10, 2020
KristofferC pushed a commit that referenced this pull request May 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This change fixes an existing bug linear algebra Linear algebra
Projects
None yet
Development

Successfully merging this pull request may close these issues.

spurious NaN values from matrix square root
5 participants