|
[Sponsors] |
Testing if matrix is symmetric positive definite |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 28, 2007, 21:40 |
Testing if matrix is symmetric positive definite
|
#1 |
Guest
Posts: n/a
|
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 |
|
July 29, 2007, 07:17 |
Re: Testing if matrix is symmetric positive defini
|
#2 |
Guest
Posts: n/a
|
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 round-off 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. |
|
July 30, 2007, 02:19 |
Re: Testing if matrix is symmetric positive defini
|
#3 |
Guest
Posts: n/a
|
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. |
|
July 30, 2007, 07:24 |
Re: Testing if matrix is symmetric positive defini
|
#4 |
Guest
Posts: n/a
|
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.
|
|
July 30, 2007, 09:28 |
Re: Testing if matrix is symmetric positive defini
|
#5 |
Guest
Posts: n/a
|
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 |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Force can not converge | colopolo | CFX | 13 | October 4, 2011 22:03 |
change symmetric lduMatrix into asymmetric | marek88 | OpenFOAM Programming & Development | 2 | August 24, 2011 09:02 |
OpenFOAM version 1.6 details | lakeat | OpenFOAM Running, Solving & CFD | 42 | August 26, 2009 21:47 |
RIPPLE symmetric positive definite matrix | Irfan | Main CFD Forum | 0 | November 3, 2005 02:44 |