Hi Julia Users,

So I was looking at ConjugatePriors.jl and trying to resolve its problems 
with respect to the latest Distributions.jl. As discussed in issue 11 
<https://github.com/JuliaStats/ConjugatePriors.jl/issues/11>, testing 
ConjugatePriors after removing the REQUIRE bounds results in:

MethodError: no method matching 
_rand!(::Distributions.MvNormalCanon{PDMats.PDMat{Float64,Array{Float64,2}},Array{Float64,1}},
 
::Array{Float64,1}) on line 52 of conjugates_mvnormal.jl 
<https://github.com/JuliaStats/ConjugatePriors.jl/blob/master/test/conjugates_mvnormal.jl#L52>.
 
and line 25 of fallbacks.jl

If you check that line you find the following:

posterior_randmodel(pri, G::IncompleteFormulation, x) = complete(G, pri, 
posterior_rand(pri, G, x))

Okay, the problem isn't really there. The call to posterior_rand is inlined 
(I assume), so it doesn't show up in the test stack trace. So we manually 
go to:

posterior_rand(pri, G::IncompleteFormulation, x) = Base.rand(posterior_canon
(pri, G, x))


This also isn't the problem, at least not directly.

In fact, the also inlined call to posterior_canon(pri, G, x) works fine. It 
returns an MvNormalCanon object and then Base.rand is called.

This calls some inlined functions, which eventually call 
Base._rand!(MvNormalCanon, x::Vector), which leads to the problem, namely 
that _rand!(MvNormalCannon, x::Matrix) is all that is defined.

But why was that so hard to discover? Why does only line 25 of fallbacks,jl 
show up in the error stack trace? Was there a better way to debug this?

Reply via email to