## Quantifying quantum speedups: improved classical simulation from tighter magic monotones

Code accompanying the manuscript arXiv:2002.06181.

The code implements several of the measures considered in the manuscript, in particular the robustness of magic $\mathcal{R}$, the generalised robustness of magic $\Lambda^+$, and the dyadic negativity $\Lambda$. The functions take two arguments: one is the density matrix rho, and one is a list of pure stabiliser states in the given dimension, given as a matrix T whose columns are the state vectors. The T matrices for 1-4 qubits (expressed in the computational basis) are provided above. Each function returns the value of the measure as well as the optimal decomposition (as a k-dimensional vector in the case of the robustness measures or a kxk-dimensional matrix in the case of the dyadic negativity, where k is the number of stabiliser states in the given dimension). The implementation requires CVX.

### Robustness of magic

function [cvx_optval, x] = RobMag(rho, T)

k = size(T,2);

cvx_begin quiet

variable x(k)

rho == T*diag(x)*T'

minimize norm(x,1)

cvx_end

end


### Generalised robustness of magic

function [cvx_optval, x] = RobMagG(rho, T)

k = size(T,2);

cvx_begin sdp quiet

variable x(k) nonnegative

rho <= T*diag(x)*T'

minimize sum(x)

cvx_end

end


function [cvx_optval, X] = Lambda(rho, T)

k = size(T,2);

cvx_begin quiet

variable X(k,k) complex

rho == T*X*T'

minimize sum(sum(abs(X)))

cvx_end

end