Re: [R] Efficient testing for +ve definiteness

2005-07-14 Thread Prof Brian Ripley
On Wed, 13 Jul 2005, Makram Talih wrote: Dear R-users, Is there a preferred method for testing whether a real symmetric matrix is positive definite? [modulo machine rounding errors.] The obvious way of computing eigenvalues via E - eigen(A, symmetric=T, only.values=T)$values and returning

Re: [R] Efficient testing for +ve definiteness

2005-07-14 Thread Spencer Graves
To reinforce Prof. Ripley's comment that, Knowing the determinant does not tell you if the matrix is close to non-positive definite, note that the determinant of the negative of the identity matrix, (-diag(k)), is (-1)^k; if k is even, the determinant is positive. This silly

Re: [R] Efficient testing for +ve definiteness

2005-07-13 Thread Spencer Graves
My preference is to test see if the smallest eigenvalue is less than something like sqrt(.Machine$double.eps) times the largest. This may be too conservative, but if the ratio of the smallest to the largest is less than some small number like that, the inverse of such a real