fix issue with Cholesky decomposition corrupting the input matrix