Navigating Distributions.jl - actual code being run

Hi,

I have a need to extend

Distributions.pdf(MvNormalCanon(mu, Sigma),DIstributionMatrix :: Matrix{Float})

to replace the DistributionMatrix with an Arrow.Table, however, embarrassingly, I am unable to find the actual code being run in the library having essentially hit a dead end at line 196 : _pdf(d::MultivariateDistribution, X::AbstractVector) = exp(_logpdf(d, X))

Would anyone be able to help me get to the literal code being run?

Regards,

Which code are you looking for precisely?

If I start with

julia> dist = MvNormal([1.0, 2.0]);

julia> v = [0.0, 0.1];

julia> @less pdf(dist ,v)

I see that pdf(d, X) redirects to _pdf(d, X). With

@less Distributions._pdf(dist ,v)

I find that it’s calling exp(_logpdf(d, X)) as you mentioned. Now with

@less Distributions._logpdf(dist ,v)

I find it’s doing

_logpdf(d::AbstractMvNormal, x::AbstractVector) = mvnormal_c0(d) - sqmahal(d, x)/2

Using @edit instead of @less I see that’s on line 127 of src/multivariate/mvnormal.jl.

Hi,

Thanks @sudete for such a quick response and showing me @less and @edit - I don’t use the repl as much as I use VSCode

To your question: the below mvnormal_c0 etc would be what I am looking to extend - is that an easy search?

Regards,

1 Like

Scrap the above think I’ve found it - thanks!

1 Like