I was using the code below to find inverse(P1):
P1 = [2 0;0 4];
%% Find inverse of P1
cvx_begin sdp
variable Q1(2,2) symmetric
[P1 eye(2);eye(2) Q1]>=0.0000001*eye(4)
cvx_end
disp(‘CVX program result:’);
disp(cvx_status);
Test = P1-Q1
And got :
Q1
Q1 =
10.7156 -0.0000
-0.0000 10.6030
Which is nowhere near inv(P1) - I am a novice in CVX programming and shall remain obliged for your kind help
You need to reexamine the mathematics of what you are doing. There is nothing to drive Q to be the inverse of P. What happens when you include an objective, such as minimize(trace(Q1)) ?
Thank you Mark.
I got success in my code by adding:
minimise(norm( P1-Q1))
And I think you are here referring to the matrix norm as the trace norm, is it?
Now Q1 comes out as Inverse(P1).
Sorry I forgot to mention that I replaced the code
[P1 eye; eye Q1] < etc
by
minimise(norm(P1 - Q1))
Regards,
Did you mean
minimise(norm(inv(P1) - Q1))
?
Without the inverse, it would produce P1, not its inverse.
In any event, I don’t know what your purpose is. If all you want to do is find inv(P1), you can do that directly in MATLAB without using CVX. If it’s an self-educational thing to do some Schur complement thing, then you need something else in your optimization problem to ensure “equality” at optimality, rather than just a semidefinite relaxation which need not be dirven to equality.