## QuantumSeDuMi.m

**IMPORTANT UPDATE [March 26, 2013]:** I don’t recommend using the QuantumSeDuMi script anymore, as there are more robust and general-purpose solutions to this problem available elsewhere. Consider installing cvx, which is easy-to-use, robust, and can do everything that QuantumSeDuMi can do (and much, much more).

QuantumSeDuMi.m is a MATLAB script that converts a “quantum semidefinite program” (i.e., the form used by [1] as well as several other quantum information theory papers) into the “standard semidefinite program form” using the procedure described in Appendix I of [1]. The standard form semidefinite program is then fed into the SeDuMi solver and the optimal value of the semidefinite program is computed. The script can be easily modified to use another semidefinite program solver if desired.

Note that you must install SeDuMi (or another semidefinite program solver) before you can use this script. This script just converts the problem into a form that standard SDP solvers can read – it does not actually solve the SDP itself.

### Download and Install

In order to solve quantum semidefinite programs using QuantumSeDuMi, you must download and install two things: the QuantumSeDuMi.m script itself, and the SeDuMi SDP solver.

**SeDuMi**— Please follow the instructions on the SeDuMi website to download and install it. If possible, you should install SeDuMi 1.1R3,*not*SeDuMi 1.21 or SeDuMi 1.3, since there is a bug with the newer versions when dealing with complex matrices.**QuantumSeDuMi.m**— Once SeDuMi is installed,**download the QuantumSeDuMi.m MATLAB script**and place it in your MATLAB scripts directory. The help file and examples below explain its usage.

### MATLAB Help File

QUANTUMSEDUMI Quantum SDP front-end for SeDuMi requires: SeDuMi (http://sedumi.ie.lehigh.edu/) author: Nathaniel Johnston license: GPL2 [PRIM,DUAL,Y] = QUANTUMSEDUMI(A,B,PHIA,PHIB) returns the primal and dual optimal values, as well as the dual optimal operator Y of the "quantum" semidefinite program associated with the primal operator A, the dual operator B, and the Hermicity-preserving map defined by the left and right Choi-Kraus operators given by the arrays PHIA and PHIB, respectively. An optional fifth argument, PARS, may be supplied to QUANTUMSEDUMI, which performs the same functions as the PARS argument for SeDuMi itself. See the SeDuMi documentation to learn more. See [1] and its appendix for a description of this "quantum" semidefinite program form and how its conversion to the standard semidefinite program form takes place. You must have SeDuMi installed for this script to function. Use SeDuMi 1.1 if at all possible, since there is a bug in SeDuMi 1.21 and 1.3 when dealing with complex matrices that makes it fail sometimes. [1] N. Johnston and D. W. Kribs. A family of norms with applications in quantum information theory II. Quantum Inf. Comput., 11:104-123, 2011.

### Usage Examples

Consider the following simple quantum semidefinite program:

The following code solves this semidefinite program using QuantumSeDuMi.m. The lines involving PhiA and PhiB are used to define a generalized Choi-Kraus representation of Φ.

>> A = [1 1;1 1]; >> B = [2 i;-i 2]; >> PhiA(:,:,1) = [0 1;0 0]; >> PhiA(:,:,2) = [0 0;1 0]; >> PhiA(:,:,3) = [1 0;0 0]; >> PhiB(:,:,1) = [0 0;1 0]; >> PhiB(:,:,2) = [0 -1;0 0]; >> PhiB(:,:,3) = [1 0;0 0]; >> QuantumSeDuMi(A,B,PhiA,PhiB) QuantumSeDuMi front-end by Nathaniel Johnston, 2009. SeDuMi 1.1R3 by AdvOL, 2006 and Jos F. Sturm, 1998-2003. Alg = 2: xz-corrector, Adaptive Step-Differentiation, theta = 0.250, beta = 0.500 eqs m = 8, order n = 5, dim = 33, blocks = 2 nnz(A) = 9 + 0, nnz(ADA) = 36, nnz(L) = 23 it : b*y gap delta rate t/tP* t/tD* feas cg cg prec 0 : 1.08E+001 0.000 1 : 3.69E+000 6.68E-001 0.000 0.0619 0.9900 0.9900 0.68 1 1 4.6E-001 2 : 3.30E+000 6.44E-003 0.000 0.0096 0.9990 0.9990 1.24 1 1 4.4E-003 3 : 3.30E+000 1.89E-003 0.082 0.2934 0.9000 0.9000 1.00 1 1 1.3E-003 4 : 3.31E+000 4.61E-004 0.000 0.2439 0.9000 0.9000 1.00 1 1 2.9E-004 5 : 3.31E+000 4.53E-005 0.245 0.0983 0.9900 0.9900 1.00 1 1 2.8E-005 6 : 3.31E+000 7.46E-007 0.000 0.0165 0.9900 0.6374 1.00 1 1 3.5E-006 7 : 3.31E+000 2.05E-008 0.007 0.0275 0.9900 0.9902 1.00 1 1 6.7E-008 8 : 3.31E+000 9.93E-010 0.000 0.0483 0.9904 0.9900 1.00 2 2 2.8E-009 iter seconds digits c*x b*y 8 0.3 Inf 3.3051490600e+000 3.3051490619e+000 |Ax-b| = 2.0e-010, [Ay-c]_+ = 3.3E-009, |x|= 3.1e+000, |y|= 2.5e+000 Detailed timing (sec) Pre IPM Post 1.560E-002 3.432E-001 1.560E-002 Max-norms: ||b||=1, ||c|| = 2, Cholesky |add|=0, |skip| = 4, ||L.L|| = 8.60736. ans = 3.3051

As you can see, the optimal value of the semidefinite program is 3.3051. The extra output above is information given by SeDuMi that shows how many iterations it took to solve the SDP to the default accuracy threshold, and what algorithm was used. If you wish to suppress the “noisy” SeDuMi output and learn more about the solution to the SDP, change the QuantumSeDuMi call as shown below. In particular, the output below shows that the primal and dual optimal values are equal, and Y is a matrix that attains the optimal value in the dual problem.

>> pars.fid = 0; >> [prim,dual,Y] = QuantumSeDuMi(A,B,PhiA,PhiB,pars) prim = 3.3051 dual = 3.3051 Y = 2.1317 0.0000 - 0.7272i 0.0000 + 0.7272i 0.2480

### References

- N. Johnston and D. W. Kribs. A Family of Norms With Applications in Quantum Information Theory II.
*Quantum Inf. Comput.*, 11:104-123, 2011.

Hi Nathaniel,

Thanks for sharing this! I tried running the sample code above, using QuantumSeDumi, and it seems there are some issues with the implementation on my machine. I got the following output:

QuantumSeDuMi front-end by Nathaniel Johnston, 2009-2011.

SeDuMi 1.1R3 by AdvOL, 2006 and Jos F. Sturm, 1998-2003.

Alg = 2: xz-corrector, Adaptive Step-Differentiation, theta = 0.250, beta = 0.500

eqs m = 4, order n = 5, dim = 17, blocks = 2

nnz(A) = 7 + 0, nnz(ADA) = 16, nnz(L) = 10

it : b*y gap delta rate t/tP* t/tD* feas cg cg prec

0 : 1.08E+001 0.000

1 : 4.01E+000 6.58E-001 0.000 0.0609 0.9900 0.9900 0.85 1 1 4.2E-001

2 : 4.00E+000 4.05E-003 0.000 0.0062 0.9990 0.9990 1.18 1 1 2.3E-003

3 : 4.00E+000 1.16E-005 0.000 0.0029 0.9990 0.9990 1.00 1 1 6.7E-006

4 : 4.00E+000 7.10E-008 0.073 0.0061 0.9990 0.9990 1.00 1 1 3.8E-008

5 : 4.00E+000 3.70E-009 0.000 0.0521 0.9900 0.9900 1.00 2 2 1.8E-009

iter seconds digits c*x b*y

5 0.1 9.2 4.0000000009e+000 3.9999999985e+000

|Ax-b| = 8.5e-010, [Ay-c]_+ = 7.8E-010, |x|= 2.8e+000, |y|= 3.0e+000

Detailed timing (sec)

Pre IPM Post

0.000E+000 6.250E-002 0.000E+000

Max-norms: ||b||=1, ||c|| = 2,

Cholesky |add|=0, |skip| = 1, ||L.L|| = 1913.

ans =

4.0000

The answer is off by a significant margin. Any suggestion on how to fix this? Btw, I’m a newbie to SDPs trying to set up an SDP solver for quantum information problems. Any help would be much appreciated. Thanks!

@Ravi – That’s very strange, thanks for letting me know. It could be an issue with SeDuMi (some versions of it work well with complex numbers, but some other versions have a bug), but I’m not 100% sure about that.

Either way, I actually recommend not using the QuantumSeDuMi script anymore. You’re better off using a more general purpose toolbox like cvx, which can do everything that QuantumSeDuMi can do.

@Nathaniel There may have been an issue with SeDuMi. I tried the code using the SeDuMi included in cvx, still using QuantumSeDuMi, and it worked! Have to look around cvx to find what suits my needs. Do you have any suggestions on how to make the best use of cvx for quantum information applications? Thanks!

hi,

i am doing work on localization. i have download SeDuMi manual from

http://plato.asu.edu/ftp/usrguide.pdf

i found a problem when i simulating the complex values function given in page 18 of the above link (same function).

error is matrix dimensions must agree.