Closed knuesel closed 9 months ago
As mentioned in #1602, #1596 and #791 a naive MvNormal([0 0; 0 1]) fails with
MvNormal([0 0; 0 1])
ERROR: PosDefException: matrix is not positive definite; Cholesky factorization failed.
The proposed workaround for rand is to use PSDMat but that gives wrong results. Here's a MWE with Distribution 0.25.100 and PDMatsExtras 2.6.3:
rand
PSDMat
julia> using Distributions, PDMatsExtras julia> x = MvNormal([0, 0], PSDMat([0. 0; 0 1])) MvNormal{Float64, PSDMat{Float64, Matrix{Float64}}, Vector{Float64}}( dim: 2 μ: [0.0, 0.0] Σ: [0.0 0.0; 0.0 1.0] ) julia> rand(x) 2-element Vector{Float64}: -1.045836214782949 0.0
It looks like the output values are swapped.
Should be fixed by https://github.com/invenia/PDMatsExtras.jl/pull/33
I believe this can now be closed as fixed in PDMatsExtras
Thanks for the quick fix!
As mentioned in #1602, #1596 and #791 a naive
MvNormal([0 0; 0 1])
fails withThe proposed workaround for
rand
is to usePSDMat
but that gives wrong results. Here's a MWE with Distribution 0.25.100 and PDMatsExtras 2.6.3:It looks like the output values are swapped.