[SciPy-user] verify whether a matrix is positive definite or not
Nils Wagner
nwagner@iam.uni-stuttgart...
Fri Jun 29 02:06:20 CDT 2007
Joachim Dahl wrote:
> Hi Nils,
>
> is this not similar to the eigenvalue problems we discussed off-list?
>
> You can numerically find the smallest x (if that's what you want) by
> solving
> minimize x s.t. Bo - B1*x >= 0
>
> In CVXOPT you can solve it as follows:
>
> from cvxopt.base import matrix
> from cvxopt.solvers import sdp
> from cvxopt.lapack import syev
>
> c = matrix(-1.0)
> B0 = matrix([ [11.,8.], [8.,7.] ])
> B1 = matrix([ [20.,1.] ,[1.,26.] ])
> Gs = [ B1[:] ]
> hs = [ B0 ]
>
> sol = sdp(c, Gs=Gs, hs=hs)
> x = sol['x']
>
> v = matrix([0., 0.])
> syev(B0 - x*B1, v)
> print v
>
>
> - Joachim
Hi Joachim,
Yes indeed. It is related to my previous problem. Thank you very much
for your solution !
Lieven sent me a randomly generated matrix
pair (A(x), B(x)) off-list. However, the matrix B(x) corresponds to the
mass matrix in structural dynamics (my background),
which is almost always positive definite. Hence I was confused by the
solution of
his example for maximizing the smallest eigenvalue of (A(x), B(x))
subjected to some constraints.
Anyway I found another way to detect the "border" by bisection. Thanks
to Anne !
I haven't tested the code on other examples, so there could be mistakes.
Nils
S.M. Rump. Verification of Positive Definiteness. BIT Numerical
Mathematics, 46:433–452, 2006.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_spd.py
Type: text/x-python
Size: 256 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/scipy-user/attachments/20070629/d6f8a958/attachment.py
More information about the SciPy-user
mailing list