Computable entanglement cost

Code accompanying the manuscript arXiv:2405.09613.


$E_{\chi,p}$ and $E_{\kappa,q}$

The code below implements the functions $\chi_p$ and $\kappa_q$ from the paper, the logarithms of which correspond to the quantities $E_{\chi,p}$ and $E_{\kappa,q}$. It requires CVX for MATLAB and additionally uses the helper function PartialTranspose from QETLAB.

The functions take two parameters:

Here we assume for simplicity that $\rho$ is a bipartite state with both local systems of equal dimension $d$.

The function Echi returns the optimal value of $\chi_p(\rho)$ and an optimal solution represented by a $d^2 \times d^2 \times (p+1)$-dimensional array S such that S(:,:,i+1) corresponds to $S_{i}$ from the manuscript, for all $i \in \{0, \ldots, p \}$. Similarly, the function Ekappa returns the optimal value of $\kappa_q(\rho)$ and an optimal solution represented by a $d^2 \times d^2 \times q$-dimensional array S such that S(:,:,i+1) corresponds to $S_{i}$ from the manuscript for all $i \in \{0, \ldots, q-1\}$.

function [cvx_optval,S] = Echi(rho,p)
% chi_p(rho)
    arguments
        rho
        p = 1
    end

    d = max(size(rho));

    cvx_begin sdp quiet

        variable S(d,d,p+1) hermitian

        -S(:,:,1) <= PartialTranspose(rho) <= S(:,:,1);

        for j=2:p+1
            -S(:,:,j) <= PartialTranspose(S(:,:,j-1)) <= S(:,:,j);
        end

        minimize trace(S(:,:,p+1))

    cvx_end

end
function [cvx_optval,S] = Ekappa(rho,q)
% kappa_q(rho)
    arguments
        rho
        q = 1
    end

    d = max(size(rho));

    cvx_begin sdp quiet

        variable S(d,d,q) hermitian

        -S(:,:,1) <= PartialTranspose(rho) <= S(:,:,1);

        for j=2:q
            -S(:,:,j) <= PartialTranspose(S(:,:,j-1)) <= S(:,:,j);
        end

        PartialTranspose(S(:,:,q)) >= 0;

        minimize trace(S(:,:,q))

    cvx_end

end

Punch card states

Below is a simple function that generates random punch card states (see manuscript for definition). They are a class of states that have non-zero binegativity, i.e. satisfy $\vert\rho^{\Gamma}\vert^{\Gamma} \not\geq 0$, which makes them good candidates for violating various conjectures in the theory of NPT entanglement. The function allows for the randomisation of the choice of matrices $A$ and $Q$ to give a broader spectrum of states to study, but the default option is to generate a simple class of states with no randomisation.

To get the state $\pi_{A,Q}$ studied in the manuscript, simply run punch(3).

%% punchcard state
% notation: punch(d,h,r)
% d = dimension
% h = [optional] number of random (pairs of) holes in the diagonal.
%     if h=0, Q has holes in the position (1,2) and (2,1). default: 0
% r = [optional] rank of the underlying randomly generated dxd matrix A
%     if r=0, A is taken to be the all-ones matrix. default: 0

function [rho,A,Q] = punch(d,h,r)
    arguments
        d
        h = 0
        r = 0
    end

    if r>0
        A = RandomDensityMatrix(d,1,r);
    else
        A = ones(d);
    end
    
    Q = holes(d,h);

    rho = MC ( A ) + sparse(diag(reshape(abs(A).*(Q - diag(diag(Q))), d^2, 1)));
    
    rho = rho/trace(rho);

end

%% randomised holed matrix of 1's
function Q = holes(d,hol)
% d = dimension; hol = how many random (pairs of) holes, or 0 if no randomisation

    Q = ones(d,d);

    if hol==0
        Q(1,2)=0;
        Q(2,1)=0;
    else
        pairs = nchoosek([1:d],2);
        indices = randperm(size(pairs,1),hol);

        Q(sub2ind([d,d],pairs(indices,1),pairs(indices,2)))=0;
        Q(sub2ind([d,d],pairs(indices,2),pairs(indices,1)))=0;
    end
   
end

function rho = MC(pre)
% turn a dxd state into a (d^2)x(d^2) maximally correlated state

    d = size(pre,2);
    rho = sparse(d^2,d^2);

    for i=0:d-1
        for j=0:d-1
            rho(i*d+i+1,j*d+j+1) = pre(i+1,j+1);
        end
    end

end

Note that the randomly generated states are not guaranteed to always have zero bi-negativity — one needs to check that $A \circ Q \not\geq 0$ is satisfied.