Eigen shows that the matrix is not positive definite (it has a negative eigenvalue). And isSymmetric() also shows it is not symmetric - compare (3,4) and (4,3)
On Tue, Nov 13, 2018 at 5:39 PM Hoffman, Gabriel <gabriel.hoff...@mssm.edu> wrote: > My understanding is that a Cholesky decomposition should work on any > square, positive definite matrix. I am encountering an issue where chol() > fails and give the error: "the leading minor of order 3 is not positive > definite" > > This occurs on multiple machines and version of R. > > Here is a minimal reproducible example: > > # initialize matrix > values = c(1,0.725,0,0,0.725,1,0.692,0,0,0.692,1,0.644,0,0,0.664,1) > B = matrix(values, 4,4) > > # show that singular values are positive > svd(B)$d > > # show that matrix is symmetric > isSymmetric(B) > > # B is symmetric positive definite, but Cholesky still fails > chol(B) > > Is this a numerical stability issue? How can I predict which matrices > will fail? > > - Gabriel > > > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.