def inv_posdef(mat):
<EOL>chol = np.linalg.cholesky(mat)<EOL>ident = np.eye(mat.shape[<NUM_LIT:0>])<EOL>res = solve_triangular(chol, ident, lower=True, overwrite_b=True)<EOL>return np.transpose(res).dot(res)<EOL>
Stable inverse of a positive definite matrix.