# Code

Eventually, I hope to provide some useful snippets of code that I have used in my research.

How to quantify MULTI-qubit Magic

via Convex Optimization of a Linear Program

### Matlab code for calculating Robustness

```
The files Amat2.mat ,..., Amat5.mat correspond to the A matrices for the linear system Ax=b. Each column corresponds to a stabilizer state written in the Pauli operator basis. The same ordering should be used for decomposing a state rho as vector b. We use the ordering
IIIII
IIIIX
IIIIY
IIIIZ
IIIXI
IIIXX
.....
ZZZZZ
```

`The syntax for calculating robustness (assuming a working CVX [http://cvxr.com/cvx/] installation) is :`

%n is one of {60,1080,36720,2423520}

cvx_begin

variable x(n)

minimize( norm( x, 1 ) )

subject to

A * x == b

cvx_end

robustness=cvx_optval;

`Another option is to ask for a certificate, y, of optimality`

cvx_begin

variable x(n)

dual variable y;

minimize( norm( x, 1 ) )

subject to

y: A * x == b

cvx_end

robustness=cvx_optval;