Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix writesdpa.m sedumi form: A vs At #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 12 additions & 17 deletions matlab/writesdpa.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
%
% Usage:
%
% ret=writesdpa(fname,A,b,c,K,pars)
% ret=writesdpa(fname,At,b,c,K,pars)
%
% fname Name of SDPA file, in quotes
% A,b,c,K Problem in SeDuMi form
% At,b,c,K Problem in SeDuMi form
% pars Optional parameters.
% pars.printlevel=0 No printed output
% pars.printlevel=1 (default) Some printed output.
Expand Down Expand Up @@ -40,7 +40,7 @@
% First Version: 7/14/03. Modified from old writesdp.m which wrote problems
% in SDPPack format.
%
function ret=writesdpa(fname,A,b,c,K,pars)
function ret=writesdpa(fname,At,b,c,K,pars)
%
% First, check to see whether or not we should be quiet.
%
Expand All @@ -59,11 +59,11 @@
quiet=0;
end
%
% First, check for complex numbers in A, b, or c.
% First, check for complex numbers in At, b, or c.
%
if (isreal(A) ~= 1)
if (isreal(At) ~= 1)
if (quiet == 0)
fprintf('A is not real!\n');
fprintf('At is not real!\n');
end
ret=1;
return
Expand Down Expand Up @@ -123,17 +123,17 @@
%
m=length(b);
%
% Deal with the following special case. If A is transposed, transpose
% it again so that it is of the right size.
% Deal with the following special case. If At is transposed (i.e., if it
% is just A), transpose it to obtain the actual At so that it is of
% the right size.
%
[Am,An]=size(A);
[An,Am]=size(At);
if (Am ~= m)
if (An == m)
if (quiet==0)
fprintf('Transposing A to match b \n');
end
AT=A;
A=A';
At=At';
%
% Also swap Am and An so that they're correct.
%
Expand All @@ -150,11 +150,6 @@
ret=1;
return
end
else
%
% No need to transpose A, but we'll need AT.
%
AT=A';
end
%
% Deal with the following special case: if c==0, then c should really
Expand Down Expand Up @@ -334,7 +329,7 @@
% Print out the SDP part of constraint cn.
%
base=sizelin+1;
rowcn=AT(:,cn);
rowcn=At(:,cn);
for i=1:nsdpblocks
I=find(rowcn);
II=find(I>=base);
Expand Down