-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Description
I wrote a function to rotate the coordinates of a 2D MvNormal distribution, and in the course of testing it I discovered the Cholesky factorization throws an error depending on the input with bit-level sensitivity. Is this a bug? For my use case, the workaround of wrapping the input in Hermitian() doesn't work, because I can't pass a Hermitian to the MvNormal constructor, which is calling cholesky for me.
Example:
julia> VERSION
v"1.1.0"
julia> rot1 = [1 -1; 1 1] / sqrt(2)
2×2 Array{Float64,2}:
0.707107 -0.707107
0.707107 0.707107
julia> rot2 = [cos(π/4) -sin(π/4); sin(π/4) cos(π/4)]
2×2 Array{Float64,2}:
0.707107 -0.707107
0.707107 0.707107
julia> cholesky(rot1 * [25.0 0.0; 0.0 4.0] * rot1')
Cholesky{Float64,Array{Float64,2}}
U factor:
2×2 UpperTriangular{Float64,Array{Float64,2}}:
3.80789 2.75744
⋅ 2.62613
julia> cholesky(rot2 * [25.0 0.0; 0.0 4.0] * rot2')
ERROR: PosDefException: matrix is not Hermitian; Cholesky factorization failed.
Stacktrace:
[1] checkpositivedefinite(::Int64) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/LinearAlgebra/src/factorization.jl:11
[2] #cholesky!#97(::Bool, ::Function, ::Array{Float64,2}, ::Val{false}) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/LinearAlgebra/src/cholesky.jl:182
[3] #cholesky#101 at ./none:0 [inlined]
[4] cholesky at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/LinearAlgebra/src/cholesky.jl:275 [inlined] (repeats 2 times)
[5] top-level scope at none:0
Related issues from Discourse:
Metadata
Metadata
Assignees
Labels
No labels