Skip to content

Commit cf3f93e

Browse files
authored
Fix complex interface (#74)
As it is the complex interface is not working, it gives the wrong answer when we use the field K.scomplex. The problem is an error in the construction of the QR matrix: to compute 2*real(m(i,j)) it does m(i,j) - m(j,i) instead of m(i,j) + m(j,i). As such this only affects problems where the real part of the SDP coefficients are nonzero (which might be useful for testing). This PR fixes it. I'm happy to send code to demonstrate the issue, but I don't see how to attach a file to a PR. I also fixed a typo in an error message that made me waste a lot of time with debugging.
1 parent 878498a commit cf3f93e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pretransfo.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140
if any(K.scomplex~=floor(K.scomplex)) || any(K.scomplex<1)
141141
error('K.scomplex should contain only positive integers');
142142
elseif any(K.scomplex>L_s)
143-
error('Elements of K.xcomplex are out of range');
143+
error('Elements of K.scomplex are out of range');
144144
end
145145
end
146146
if L_z
@@ -473,7 +473,7 @@
473473
imgv = cols >= dsize;
474474
cols = cols - imgv .* dsize;
475475
indxs = max(rows,cols) + min(rows,cols) .* dsize + imgv .* jsize(dblks) + istrt;
476-
vals = ( 1 - 2 * ( cols > rows ) ) .* ( 1 - ( 1 + 1j ) .* imgv );
476+
vals = 1 + imgv .* (-1 + 1j * (1 - 2 * (rows > cols) ) );
477477
keep = ~imgv | ( rows ~= cols );
478478
jndxs = rows + cols .* dsize + jstrt(dblks);
479479
ii{end+1} = indxs(keep);

0 commit comments

Comments
 (0)