How can I convert a negative definite matrix into positive definite matrix?
Show older comments
I want to convert matrix a=[-5 2; 6 1] into positive definite matrix.
2 Comments
Roger Stafford
on 15 Jul 2014
The matrix a = [-5 2; 6 1] is not negative definite! The expression z'*a*z for the column vector z can be either positive or negative depending on z. In other words, it has both a negative and a positive eigenvalue.
What kind of conversion do you allow on 'a' while endeavoring to make it positive definite?
kartik pandya
on 16 Jul 2014
Accepted Answer
More Answers (1)
You could switch temporarily to steepest descent at iterations where the Hessian is found to have negative eigenvalues. This is equivalent to replacing the Hessian with eye(N), which is of course positive definite.
Alternatively, you might be able to get better use of the Hessian if you do something similar to the Levenberg-Marquardt method, i.e., for some lambda>0
[V,D]=eig(Hessian);
d=diag(D);
Hessian=Hessian + eye(size(Hessian))*(lambda - min(d))*(d<0);
However, the best alternative might be to use an Optimization Toolbox solver, if you have it. The trust-region algorithm of fminunc, for example, can take advantage of negative Hessian eigenvalues to get further descent at zero gradient points, along the lines of what Roger was saying.
9 Comments
kartik pandya
on 18 Jul 2014
Edited: Matt J
on 18 Jul 2014
Matt J
on 18 Jul 2014
Should be
Hessian=Hessian + eye(size(Hessian))*((lambda - min(d))*min(d<0))
But the Hessian you've shown is non-symmetric, which shouldn't be the case.
kartik pandya
on 21 Jul 2014
kartik pandya
on 22 Jul 2014
Edited: kartik pandya
on 22 Jul 2014
Matt J
on 23 Jul 2014
kartik pandya Commented:
function [ Hessian ] = Hess_Neg_pos()
lambda=1;
Hessian=[-1 2 3; 2 8 10; 3 10 -40;]
[V,D]=eig(Hessian)
d=diag(D)
Hessian=Hessian + eye(size(Hessian))*(lambda - min(d))*(d<0);
end
Matt J
on 23 Jul 2014
dmin=min(d);
Hessian=Hessian + eye(size(Hessian))*(lambda - dmin)*(dmin<0);
kartik pandya
on 24 Jul 2014
Categories
Find more on Solver Outputs and Iterative Display in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
