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

Symmetry failure in inv with StaticArrays.SMatrix #208

Closed
timholy opened this issue Sep 22, 2024 · 1 comment
Closed

Symmetry failure in inv with StaticArrays.SMatrix #208

timholy opened this issue Sep 22, 2024 · 1 comment

Comments

@timholy
Copy link
Contributor

timholy commented Sep 22, 2024

julia> C = PDMat(@SMatrix([0.2958383840919454 -0.19638474565333153; -0.19638474565333153 0.29835205505598084]))
2×2 PDMat{Float64, SMatrix{2, 2, Float64, 4}}:
  0.295838  -0.196385
 -0.196385   0.298352

julia> inv(C)
ERROR: PosDefException: matrix is not Hermitian; Cholesky factorization failed.
Stacktrace:
 [1] non_hermitian_error()
   @ StaticArrays ~/.julia/packages/StaticArrays/MSJcA/src/cholesky.jl:2
 [2] #cholesky#549
   @ ~/.julia/packages/StaticArrays/MSJcA/src/cholesky.jl:4 [inlined]
 [3] cholesky
   @ ~/.julia/packages/StaticArrays/MSJcA/src/cholesky.jl:3 [inlined]
 [4] PDMat(mat::SMatrix{2, 2, Float64, 4})
   @ PDMats ~/.julia/dev/PDMats/src/pdmat.jl:19
 [5] inv(a::PDMat{Float64, SMatrix{2, 2, Float64, 4}})
   @ PDMats ~/.julia/dev/PDMats/src/pdmat.jl:92
 [6] top-level scope
   @ REPL[31]:1

julia> invC = inv(C.chol); @show invC - invC'
invC - invC' = [0.0 -4.440892098500626e-16; 4.440892098500626e-16 0.0]
2×2 SMatrix{2, 2, Float64, 4} with indices SOneTo(2)×SOneTo(2):
 0.0          -4.44089e-16
 4.44089e-16   0.0

Not sure if this should be viewed as a bug in StaticArrays or here.

@timholy
Copy link
Contributor Author

timholy commented Sep 22, 2024

Ah, xref JuliaArrays/StaticArrays.jl#1218.

@timholy timholy closed this as completed Sep 22, 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

1 participant