Download Matlab files:
The semidefinite programs used to compute the maximal probability of successful distillation of a given quantum state are derived in the manuscript. The implementation below uses CVX and returns both the primal and the dual optimal solutions, following the notation used in the Supplemental Material of the manuscript.
function [prob,C,G,X,Y,Z,lam] = prob_mio(rho, m, tol)
% prob_mio(rho,m,tol) computes the maximal probability of distillation of an m-dimensional maximally coherent state under DIO with tolerance tol
% rho: dxd density matrix or normalised state vector
% m: target state dimension
% tol: error tolerance 0<=tol<=1
d=size(rho,2);
if d==1
rho=rho*rho';
d=size(rho,1);
end
rho=(rho+rho')/2;
cvx_begin sdp quiet
variable C(d,d) hermitian semidefinite
variable G(d,d) hermitian
dual variable X
dual variable Y
dual variable Z
dual variable lam
maximize ( trace(G*rho) )
Y : C <= G
X : G <= eye(d)
Z : diag(diag(G))==m*diag(diag(C))
lam : trace(C*rho) >= (1-tol)*trace(G*rho)
cvx_end
prob = cvx_optval;
end
function [prob,C,X,Y,lam] = prob_dio(rho, m, tol)
% prob_dio(rho,m,tol) computes the maximal probability of distillation of an m-dimensional maximally coherent state under DIO with tolerance tol
% rho: dxd density matrix or normalised state vector
% m: target state dimension
% tol: error tolerance 0<=tol<=1
d=size(rho,2);
if d==1
rho=rho*rho';
d=size(rho,1);
end
rho=(rho+rho')/2;
cvx_begin sdp quiet
variable C(d,d) hermitian semidefinite
dual variable X
dual variable Y
dual variable lam
maximize ( m*trace(diag(diag(C))*rho) )
Y : C - m*diag(diag(C)) <= 0
X : m*diag(diag(C)) <= eye(d)
lam : trace(C*rho) >= (1-tol)*trace(m*diag(diag(C))*rho)
cvx_end
prob = cvx_optval;
end
Note that we show the probability of exact ($\varepsilon=0$) distillation under DIO for pure states to be equal to the probability of distillation under SIO, which is much simpler to compute — an example implementation is given below.
function [prob] = prob_sio(psi, m)
% prob_sio(psi,m) computes the probability of distillation of an m-dimensional maximally coherent state from the pure state vector psi
d = max(size(psi));
psi = sort(abs(psi),'descend');
minsum=sum(psi(m:d).^2);
for j=2:m
jsum = sum(psi(m-j+1:d).^2)/j;
minsum = min([jsum, minsum]);
end
prob = m*minsum;
end