# I am trying to replicate these result of the quantum switch, but my values do not agree with the paper

I am trying to solve the SDP problem given in eq 53. of this paper: https://www.nature.com/articles/srep26018

The value given in the paper is -1.576, but the value I get is -0.325788. Any idea where the error is?

This is my code,

cvx_begin
variable x(32,32);
minimize ( trace(LxWswitch));
subject to;
PartialTrace(x,4,[2,2,2,2,2]) >= 0;
PartialTrace(x,2,[2,2,2,2,2]) >= 0;
trace(Lx(0.25*eye(32))) == 1;
cvx_end

where,

W = kron(kron(kron(kron(kron(ket([1 0]),ket([1 0])),ket([1 0])),ket([1 0])),ket([1 0])),ket([1 0]))+kron(kron(kron(kron(kron(ket([1 0]),ket([1 0])),ket([1 0])),ket([0 1])),ket([0 1])),ket([1 0]))+kron(kron(kron(kron(kron(ket([1 0]),ket([0 1])),ket([0 1])),ket([1 0])),ket([1 0])),ket([1 0]))+kron(kron(kron(kron(kron(ket([1 0]),ket([0 1])),ket([0 1])),ket([0 1])),ket([0 1])),ket([1 0]))+kron(kron(kron(kron(kron(ket([1 0]),ket([1 0])),ket([1 0])),ket([1 0])),ket([1 0])),ket([0 1]))+kron(kron(kron(kron(kron(ket([1 0]),ket([0 1])),ket([1 0])),ket([1 0])),ket([1 0])),ket([0 1]))+kron(kron(kron(kron(kron(ket([0 1]),ket([1 0])),ket([1 0])),ket([0 1])),ket([1 0])),ket([0 1]))+kron(kron(kron(kron(kron(ket([0 1]),ket([0 1])),ket([1 0])),ket([0 1])),ket([0 1])),ket([0 1]))

Wswitch=PartialTrace(ketbra(W),5,[2,2,2,2,2,2])

L= - kron(kron(Id,Id),PartialTrace(Wswitch,[1,2],[2,2,2,2,2])) + kron(kron(kron(Id,Id),Id),PartialTrace(Wswitch,[1,2,4],[2,2,2,2,2])) - kron(kron(Id,Id),PartialTrace(Wswitch,[3,4],[2,2,2,2,2])) + kron(kron(kron(Id,Id),Id),PartialTrace(Wswitch,[3,4,2],[2,2,2,2,2]))+ kron(Id,PartialTrace(Wswitch,4,[2,2,2,2,2]))+ kron(Id,PartialTrace(Wswitch,2,[2,2,2,2,2])) - kron(kron(Id,Id),PartialTrace(Wswitch,[2,4],[2,2,2,2,2]))

Are you using a standard implementation of PartialTrace, for instance from QETLAB?

I donâ€™t have the background, time, or energy to understand that paper. Do these supposed SDP formulations not have any explicit SDP constraints, and somehow the SDP constraints are accomplished indirectly in the formulation via PartialTrace? Or are some of the \ge 0 constraints intended as \succeq 0, or there is also a non explicitly stated SDP constraint (not in your code) . I have no idea,but it seems your program could only be correct if all the SDP constrains are handled indirectly in the formulation. Also, I have no idea whether `x` is supposed to be symmetric, but you have no declared it so in CVX, so CVX considers it to be a not necessarily symmetric matrix.

Have you asked the author for the CVX code used in the paper?

Maybe @Nathaniel_Johnston can help?

Iâ€™m not entirely sure either (much of the paperâ€™s notation is also quite unfamiliar to me), but I agree that the likely culprit is that CVX should be run in SDP mode (i.e., the original poster should change â€ścvx_beginâ€ť to â€ścvx_begin sdpâ€ť), and x should probably be declared to be symmetric or Hermitian.

1 Like

So I tried that.
cvx_begin sdp
variable x(32,32) symmetric;
minimize ( trace(LxWswitch));
subject to;
PartialTrace(x,4,[2,2,2,2,2]) >= 0;
PartialTrace(x,2,[2,2,2,2,2]) >= 0;
trace(Lx(0.25*eye(32))) == 1;
cvx_end

but this gives status unbound result.

Yes, I am using QETLAB.

And that is a lot of questions I do not have answers to. I thought I will write to the author after I discuss it here first.

A general rule for this forum, which I donâ€™t enforce as strictly as the CVX developer @mcg, is that it is the readersâ€™ responsibility to understand the optimization problem they want to formulate and solve with CVX. In particular, if they are trying to implement a model they or their advisor found in a paper or book, it is their responsibility, not the forum readersâ€™ responsibility, to understand the notation, conventions,and assumptions of the model. and also to "prove that the optimization problem is convex (or at least its continuous relaxation is).

it has also been noted on a number of occasions in this forum, that it would have been good for a paper to have included CVX code in their paper, or at least provide some information on any tricks or non-straightforward things they had to do to formulate and/;or solve in CVX. I think authors should expect to receive requests for code in such cases. Whether the authors send you code is up to them. But I think your first matter is not getting CVX code, but understanding what the model specification really is, i.e., what those numbered equations actually mean.

@Nathaniel_Johnston might be one of the few people, if not only person, whoâ€™s been on this forum in the past decade who even had a chance of understanding the problem formulations in that paper. Thatâ€™s why I tagged him in my post, as he had not been active on the forum in recent years.

Once you really understand what those equations really mean, and can convey that in your CVX forum post, perhaps forum readers can help on CVX formulation or solution questions.

1 Like