## Upper bounds on the distillable randomness of bipartite quantum states

Code accompanying the manuscript arXiv:2212.09073.

The implementation requires CVX, QETLAB, and (for the $\Upsilon$ measure) CVXQUAD.

#### $\beta$ measure

The function takes two arguments, a bipartite input state $\sigma_{AB}$ and (optionally) a single-partite state $\rho_{A}$. If the second argument is not provided, $\rho_A$ is taken to be $\sigma_A$. For simplicity, the local systems of $\sigma_{AB}$ are assumed to be of equal dimension.

function [cvx_optval,L,V] = beta(sigm,varargin)

d = sqrt(max(size(sigm)));

if nargin<2
rho = PartialTrace(sigm);
else
rho = varargin{1};
end

cvx_begin sdp quiet

variable L(d,d) hermitian
variable V(d^2,d^2) hermitian

PartialTranspose(V+sigm)>=0
PartialTranspose(V-sigm)>=0

kron(rho,L)+V >= 0
kron(rho,L)-V >= 0

minimise trace(L)

cvx_end

end


#### $\Upsilon$ measure

function [c,L,V] = upsilon(rho)

d = sqrt(max(size(rho)));

cvx_begin sdp quiet

variable sigm(d^2,d^2) hermitian semidefinite
variable L(d,d) hermitian
variable V(d^2,d^2) hermitian

PartialTranspose(V+sigm)>=0
PartialTranspose(V-sigm)>=0

kron(PartialTrace(rho),L)+V >= 0
kron(PartialTrace(rho),L)-V >= 0

trace(L) <= 1

minimise quantum_rel_entr(rho,sigm)

cvx_end

c = cvx_optval/log(2);

end