Probabilistic transformations of quantum resources

Code accompanying the manuscript arXiv:2109.04481.

We show how the computation of the projective robustness $\Omega_{\mathbb{F}}$ as well as the optimization problems $\Xi_{\varepsilon}$ and $\Theta_{\varepsilon}$ used in the manuscript can be implemented in MATLAB using CVX. We consider a few representative resource theories.


Non-negative partial transpose

The free states $\mathbb{F}$ here are all quantum states with a positive partial transpose. The projective robustness $\Omega_{\mathbb{F}}$ is then implemented as follows. The code uses the helper function PartialTranspose from QETLAB, and for simplicity we assume that the two constituent subsystems are of equal dimension. In addition to the optimal value and an optimal primal solution, the program returns optimal dual variables A and B (following notation in the manuscript).

function [cvx_optval,F,A,B] = ProjRobPPT(rho)

d = size(rho,1);

cvx_begin sdp quiet

  variable F(d,d) hermitian semidefinite
  variable gam nonnegative
  dual variable A
  dual variable B

  A: rho <= F
  B: F <= gam*rho

  PartialTranspose(F) >= 0;

  minimize gam

cvx_end


end

One can similarly implement the problems $\Xi_\varepsilon$ (maximal probability of success for a fixed distillation error $\varepsilon$) and $\Theta_p$ (minimal distillation error for a fixed probability of success). We denote them by XiPPT and ThetaPPT, respectively.

function [cvx_optval,W,Z] = XiPPT(rho, k, err)

d = size(rho,1);
  
cvx_begin sdp quiet

    variable W(d,d) hermitian semidefinite
    variable Z(d,d) hermitian semidefinite
    variable Q(d,d) hermitian semidefinite
    
    W <= Z <= eye(d)
    
    trace(W*rho) == (1-err)*trace(Z*rho)

    Z/k - W >= PartialTranspose(Q)

    maximize trace(Z*rho)

cvx_end

end
function [cvx_optval,W,Z] = ThetaPPT(rho, k, p)

d = size(rho,1);
  
cvx_begin sdp quiet

    variable W(d,d) hermitian semidefinite
    variable Z(d,d) hermitian semidefinite
    variable Q(d,d) hermitian semidefinite
    
    W <= Z <= eye(d)
    trace(Z*rho) == p

    Z/k - W >= PartialTranspose(Q)

    maximize trace(W*rho)/p

cvx_end

end

Here, we used the fact that the dual cone of the set of all PPT states — the union of the dual cones of the set of all states and the set of all PPT (Hermitian) operators — is formed by operators of the form P + Q, where P is a PSD matrix and Q is a matrix such that PartialTranspose(Q) is PSD.


Coherence and imaginarity

Let us begin with the resource theory of coherence, where the free states $\mathbb{F}$ are all states whose density matrix is diagonal in the given basis. The implementation of the projective robustness is done very similarly.

function [cvx_optval,F,A,B] = ProjRobCoh(rho)

d = size(rho,1);

cvx_begin sdp quiet

  variable F(d,d) hermitian semidefinite
  variable gam nonnegative
  dual variable A
  dual variable B

  A: rho <= F
  B: F <= gam*rho

  F == diag(diag(F))

  minimize gam

cvx_end


end

In the quantification of achievable probabilities/errors, care needs to be taken to impose strict equality in line with the definition of the problems $\Xi_\varepsilon^{\mathrm{aff}}$ and $\Theta_p^{\mathrm{aff}}$.

function [cvx_optval,W,Z] = XiCoh(rho, k, err)

d = size(rho,1);
  
cvx_begin sdp quiet

    variable W(d,d) hermitian semidefinite
    variable Z(d,d) hermitian semidefinite
    
    W <= Z <= eye(d)
    
    trace(W*rho) == (1-err)*trace(Z*rho)

    diag(diag(Z/k - W)) == 0

    maximize trace(Z*rho)

cvx_end

end
function [cvx_optval,W,Z] = ThetaCoh(rho, k, p)

d = size(rho,1);
  
cvx_begin sdp quiet

    variable W(d,d) hermitian semidefinite
    variable Z(d,d) hermitian semidefinite
    
    W <= Z <= eye(d)
    trace(Z*rho) == p

    diag(diag(Z/k - W)) == 0

    maximize trace(W*rho)/p

cvx_end

end

To apply the above to the resource theory of imaginarity (where the free states are those whose density matrix has only real elements in the given basis), it suffices to replace diag(diag(...)) with real(...).