You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using Random, SparseArrays, LinearAlgebra
using Distributions
using PDMats
Random.seed!(2)
z =randn(size(Q, 1))
pdQ =PDSparseMat(cholesky(Q))
xldiv = pdQ.chol.UP \ z
xwh =whiten(pdQ, z)
These two realizations should be the same, but they are not.
The ldiv version results in a random field with the expected structure, while the whiten 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.
The text was updated successfully, but these errors were encountered:
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:
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.The text was updated successfully, but these errors were encountered: