Closed jkbest2 closed 1 year ago
This issue may be worth fixing in PDMats, but note that the unwhiten_winv!
method for rand(::Distributions.MvNormalCanon)
currently extracts the Cholesky factor directly, without calling chol_lower
:
This bit me. As far as I can see, PDSparseMat
seems to be non-functional and should not be offered to the ecosystem.
whiten!
andunwhiten
usechol_lower
to extract the lower triangular component of Cholesky decompositions. ForSuiteSparse.CHOLMOD.Factor{T}
, this extracts the lower triangular factor, but does not account for pivoting. This results in the same problem seen on this Discourse thread.Using the sparse precision matrix attached to that thread,
Generate a realization,
These two realizations should be the same, but they are not.
This is also clear when they are plotted.
The
ldiv
version results in a random field with the expected structure, while thewhiten
version does not.Downstream, this means that at least
rand(::Distributions.MvNormalCanon)
is giving incorrect results. I haven't looked closely at other methods in Distributions.jl yet.