# Navigating Distributions.jl - actual code being run

**URL:** <https://discourse.julialang.org/t/navigating-distributions-jl-actual-code-being-run/68956>\
**Category:** General Usage\
**Tags:** question, package\
**Created:** [September 29, 2021, 6:16pm UTC](https://discourse.julialang.org/t/navigating-distributions-jl-actual-code-being-run/68956 "2021-09-29T18:16:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![djholiver](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/djholiver/32/50470_2.png) [@djholiver](https://discourse.julialang.org/u/djholiver)\
**Post date:** [September 29, 2021, 6:16pm UTC](https://discourse.julialang.org/t/navigating-distributions-jl-actual-code-being-run/68956/1 "2021-09-29T18:16:28Z")

</div>

Hi,

I have a need to extend

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

```

to replace the DistributionMatrix with an [Arrow.Table](https://arrow.juliadata.org/dev/manual/#Arrow.Table), however, embarrassingly, I am unable to find the actual code being run in the [library](https://github.com/JuliaStats/Distributions.jl/blob/2856bc3e106d751a02e3fe9cccb046916a52955e/src/multivariates.jl) 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,

---

<div class="post-metadata">

**Author:** ![sijo](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@sijo](https://discourse.julialang.org/u/sijo)\
**Post date:** [September 29, 2021, 6:54pm UTC](https://discourse.julialang.org/t/navigating-distributions-jl-actual-code-being-run/68956/2 "2021-09-29T18:54:53Z")

</div>

Which code are you looking for precisely?

If I start with

```julia
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

```julia
@less Distributions._pdf(dist ,v)

```

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

```julia
@less Distributions._logpdf(dist ,v)

```

I find it’s doing

```julia
_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`.

---

<div class="post-metadata">

**Author:** ![djholiver](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/djholiver/32/50470_2.png) [@djholiver](https://discourse.julialang.org/u/djholiver)\
**Post date:** [September 29, 2021, 7:04pm UTC](https://discourse.julialang.org/t/navigating-distributions-jl-actual-code-being-run/68956/3 "2021-09-29T19:04:35Z")

</div>

Hi,

Thanks @sijo 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?

> [@sijo](#):
>
> `mvnormal_c0(d) - sqmahal(d, x)/2`

Regards,

---

<div class="post-metadata">

**Author:** ![djholiver](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/djholiver/32/50470_2.png) [@djholiver](https://discourse.julialang.org/u/djholiver)\
**Post date:** [September 29, 2021, 7:08pm UTC](https://discourse.julialang.org/t/navigating-distributions-jl-actual-code-being-run/68956/4 "2021-09-29T19:08:56Z")

</div>

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