-
Notifications
You must be signed in to change notification settings - Fork 0
/
GNP_Neg.m
103 lines (89 loc) · 3.79 KB
/
GNP_Neg.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
%% Description
% This function computes the minimal Genuine Multipartite Negativity
% (GMN) of the normalised Choi operator of a channel, over all channels
% that map each state rho{i} into sigma{i}.
%
% OUTPUTS:
%
% NEG: The minimum negativity required to map rho{i} into sigma{i}
% JOUT: The optimal Choi operator which maps the states with the
% least negativity.
% WOUT: The Choi containing all the different slices that sum up to
% J.
% INPUTS:
%
% RHO: A cell containing the density matrices of the corresponding
% input states
% DIN: A vector containing all the dimensions of the subsystems of
% rho{i}. (We assume all states have the same subsystem
% dimensions.
% SIMGA: A cell containing the density matrices of the corresponding
% output states.
% DOUT: A vector containing all the dimensions of the subsystems of
% sigma{i}. (We assume all states have the same subsystem
% dimensions.)
%
% REQUIRES: SetPartition.m, Genuine_Negativity.m, PartialTrace.m,
% mappedOperators.m, CVX
% AUTHOR: Tom Bintener
%%
function [neg,Jout,Wout] = GNP_Neg(rho,dIn,sigma,dOut)
%% Initialising required variables.
n = length(dIn); %number of parties
m = length(rho); %number of states to be mapped
l = length(SetPartition(n,2)); %number of NT bipartitions
dInTot = length(rho{1}); %total input dimension
dOutTot = length(sigma{1}); %total output dimension
dim = [dOut,dIn]; %vector containing all sub-dimensions
perm(1:2:2*n) = 1:n; %permutation vector that contains the
perm(2:2:2*n) = n+1:2*n; %indices, [1,n+1,2,n+2,....n,2*n]
DIM = zeros(1,n); %vector containing products of
for i = 1:n; DIM(i)=dIn(i)*dOut(i);end %pairs of inputs and outputs.
%% Error checking
if(n ~= length(dOut))
error('Number of input systems must match number of output'+...
'systems dIn and dOut cannot differ in length.');
end
if(m ~= length(sigma))
error('Number of states in rho must match the number of states in sigma.');
end
for i = 1:length(rho)
if(length(rho{i}) ~= prod(dIn))
error('The product of the dimensions in dIn must match the length of rho{i}');
end
if(length(sigma{i}) ~= prod(dOut))
error('The product of the dimensions in dOut must match the length of sigma{i}');
end
end
%% --------------------------------------------------------------------
%% CVX
cvx_begin sdp quiet
%We need a SDP variable for the total Choi and one that contains l
%slices of which we will compute the Negativity across a different
%bipartition.
variable J(dInTot*dOutTot,dInTot*dOutTot) sparse hermitian semidefinite;
variable W(dInTot*dOutTot,dInTot*dOutTot,l) sparse hermitian semidefinite;
%We want to minimise the GMN of W across all NT bipartitions.
minimise Genuine_Negativity(W,dim);
subject to
%The sum of the slices should equal the total Choi.
tot = 0;
for i = 1:l
tot = tot + W(:,:,i);
end
tot == J;
%We want J to be trace-preserving, we trace over the output
%subsystems.
PartialTrace(J,1,[dOutTot,dInTot]) == eye(dInTot)/dInTot;
%Using the inverse of the Choi we impose the mapping of rho{i} into
%sigma{i}
map = mappedOperators(J,rho);
for i = 1:m
map{i} == sigma{i};
end
cvx_end
%% Outputs
neg = cvx_optval;
Jout = J;
Wout = W;
end