# Using PDMats

**URL:** <https://discourse.julialang.org/t/using-pdmats/9236>\
**Category:** General Usage\
**Tags:** package\
**Created:** [February 21, 2018, 5:11pm UTC](https://discourse.julialang.org/t/using-pdmats/9236 "2018-02-21T17:11:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![orosen1](https://avatars.discourse-cdn.com/v4/letter/o/3ec8ea/32.png) [@orosen1](https://discourse.julialang.org/u/orosen1)\
**Post date:** [February 21, 2018, 5:11pm UTC](https://discourse.julialang.org/t/using-pdmats/9236/1 "2018-02-21T17:11:34Z")

</div>

Are there any examples of using the package PDMats? For example, how can I find the inverse of a symmetric positive definite matrix?

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [February 22, 2018, 11:05am UTC](https://discourse.julialang.org/t/using-pdmats/9236/2 "2018-02-22T11:05:59Z")

</div>

The best place to start is the [package README](https://github.com/JuliaStats/PDMats.jl), then the sources (which show that methods are defined for `Base.inv`), so you can just

```julia
using PDMats
A = randn(4,4)
B = PDMat(A*A')
inv(B)

```

That said, are you sure you need an inverse? If you are solving a linear system, you can do it directly with `\`.

---

<div class="post-metadata">

**Author:** ![orosen1](https://avatars.discourse-cdn.com/v4/letter/o/3ec8ea/32.png) [@orosen1](https://discourse.julialang.org/u/orosen1)\
**Post date:** [February 22, 2018, 4:41pm UTC](https://discourse.julialang.org/t/using-pdmats/9236/3 "2018-02-22T16:41:50Z")

</div>

Thank you. I do need to calculate variance-covariance matrices.

---

<div class="post-metadata">

**Author:** ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Post date:** [February 22, 2018, 4:55pm UTC](https://discourse.julialang.org/t/using-pdmats/9236/4 "2018-02-22T16:55:07Z")

</div>

This package is awesome. Thank you for posting a question about it so that I could learn it exists!

---

<div class="post-metadata">

**Author:** ![orosen1](https://avatars.discourse-cdn.com/v4/letter/o/3ec8ea/32.png) [@orosen1](https://discourse.julialang.org/u/orosen1)\
**Post date:** [February 22, 2018, 5:07pm UTC](https://discourse.julialang.org/t/using-pdmats/9236/5 "2018-02-22T17:07:01Z")

</div>

You are welcome!
