Hi,
I am encountering an issue with Cholesky decomposition in Julia. The code I am using is as follows:
using StaticArrays, LinearAlgebra
sigma = @MMatrix [20+1.0*cos(2.0) 3.0; 3.0 20-1.0 *cos(2.0)]
sigma1 = @SMatrix [0.01^2 0;0 0.01^2]
sigma2 = sigma1*inv(sigma1+sigma)*sigma
sigma3 = Symmetric(sigma2)
display(sigma3)
display(ishermitian(sigma3))
cholesky!(sigma3)
and the result is
2×2 Symmetric{Float64, SMatrix{2, 2, Float64, 4}}:
9.99995e-5 7.67596e-11
7.67596e-11 9.99995e-5
true
PosDefException: matrix is not Hermitian; Cholesky factorization failed.
I expected the Cholesky factorization to succeed since the matrix sigma3
is Hermitian, but it failed. I tried using cholesky(sigma3).L instead, and it succeeded. However, I would like to perform the Cholesky factorization in-place.
I would appreciate any assistance you can provide.