# Near positive definite (NearPD) of a symmetric matrix in Julia

**URL:** <https://discourse.julialang.org/t/near-positive-definite-nearpd-of-a-symmetric-matrix-in-julia/45793>\
**Category:** Performance\
**Created:** [August 30, 2020, 3:35pm UTC](https://discourse.julialang.org/t/near-positive-definite-nearpd-of-a-symmetric-matrix-in-julia/45793 "2020-08-30T15:35:16Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![lostella](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lostella/32/356_2.png) [@lostella](https://discourse.julialang.org/u/lostella)\
**Post date:** [August 30, 2020, 3:50pm UTC](https://discourse.julialang.org/t/near-positive-definite-nearpd-of-a-symmetric-matrix-in-julia/45793/2 "2020-08-30T15:50:33Z")

</div>

[ProximalOperators](https://github.com/kul-forbes/ProximalOperators.jl) exposes the `IndPSD` type, whose proximal operator is the projection onto the positive semidefinite cone (with the Frobenius norm taken as distance).

More info [here](https://kul-forbes.github.io/ProximalOperators.jl/stable/functions/#ProximalOperators.IndPSD).

Is this what you’re looking for?

Edit: an example snippet

```julia
using ProximalOperators

# X is your symmetric matrix
P, _ = prox(IndPSD(), X)

```

---

_[View the full topic](https://discourse.julialang.org/t/near-positive-definite-nearpd-of-a-symmetric-matrix-in-julia/45793)._
