New implementation for calculating nearest positive definite matrix using convergent series of projections


I worked on a feature that I couldn’t find in the library. It takes as an input a non positive definite but symmetric matrix, and calculates the nearest positive definite matrix using a convergent algorithm.

The technique is described in Higham, Nick (2002) Computing the nearest correlation matrix - a problem from finance

The method converges towards the nearest positive definite matrix. However due to rounding errors, the final results is never completely positive definite and the Cholesky decomposition always fails. To make it work I can “chop off” some digits from the values but this is a pretty ugly technique.

I wanted to know:

  • Can a subject expert matter give me a hand with the code in order to fix these rounding issues?
  • Where can this code be added to the library? In which file should the implementation be placed?


Hi. I would be interested to know whether you managed to resolve the rounding issues you mentioned. I’m by no means an expert but would be interested in playing with it. Is your implementation anywhere I can see it (github?)