Testing if matrix is symmetric positive definite
Hi,
May I know if there is a fortran code or algorithm somewhere which test if a matrix is symmetric positive definite (SPD)? Also is it true if a matrix is SPD, its eigenvectors 'll all be positive? Thanks 
Re: Testing if matrix is symmetric positive defini
For the symmetric test, take the difference of the matrix and its transpose. This would be zero for a symmetric matrix and exact arithmetic. Since one would have roundoff errors in a real computation, find the maximum element of the difference and see if it is small enough relative to the size of the maximum element of the original matrix. Instead of the maximum elements, you could use some other norm.
For the definite part, you could compute the determinant. For this you might use a routine that reduces the matrix to upper triangular (by elimination), then take the product of the diagonal elements. This must be positive. Someone else might have a better idea. 
Re: Testing if matrix is symmetric positive defini
I hope you mean positive eigen values ?
For the determinant .. Why even rotate the matrix system from its original coordinate system, just take the determinant , it should be fairly easy if you know the order. 
Re: Testing if matrix is symmetric positive defini
If NA knows of a faster way to find the determinant of, say, a 1000 X 1000 matrix, I would be interested. The determinant test does not tell you if a matrix is positive definite, but it MIGHT tell you it isn't. If you have an even number of negative eigenvalues it tells you nothing. It will alert you if there are zero eigenvalues or if there are an odd number.

Re: Testing if matrix is symmetric positive defini
Hi,
As far as I remember, there is one indirect method to check wether or not a matrix is symmetric positive definite: Try to solve the corresponding A*x=B system using the Cholesky method (A=L*L^T decomposition) which require to compute the square root of n quantities for a n*n system. If the method succeed in solving the system (i.e. if all the n quantities are positive), the matrix is indeed positive definite. See for instance numerical recipes for detail on the Cholesky method. Hope this helps, Lionel 
All times are GMT 4. The time now is 11:05. 