@lostella This perfect! Exactly what I was looking for! This is awesome. Thank you very much!
I will need to incorporate that in a inplace function since I will use this in a MCMC loop.
Also, inv (inverse of a matrix) sometimes fails for a matrix borderline invertible. In R, there is a function as.inverse in the LaplacesDemon package which quickly replaces the smallest eigen values by an epsilon.
Are you aware of any function that can do that in Julia?
Thanks