This repository has been archived by the owner on Oct 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathNegMapEns.m
128 lines (111 loc) · 4.2 KB
/
NegMapEns.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
%% NegMapEns
% Computes the minimum negativity N of the normalized Choi operator of a
% channel, over all channels AB -> CD that map each state setrhoAB{i}
% into setsigmaCD{i}; if a value for epsilon is provided an approximate
% mapping is considered.
%
% required arguments:
%
% setrhoAB: Cell array containing the set of input density matrices;
% all such states should have the same input dimension dInTot
%
% dA: Dimension of input system A
%
% setsigmaCD: Cell array containing the set of output density matrices;
% all such states should have the same output dimension dOutTot
%
% dC: Dimension of output system C
%
% optional arguments:
%
% epsilon: When a value for epsilon is provided an approximate mapping
% is considered,
% such that: TraceNorm(W[rho] - sigma) <= epsilon
%
% Output:
%
% neg: Minimum negativity of a normalised Choi state isomorphic to
% a bipartite channel AB->CD that maps each input state
% setrho{j} into the output state setsigma{j}
% W: an optimal normalised Choi isomorphic state that achieves
% the minimum negativity
%
% Additional package requirements:
% + CVX (http://cvxr.com/cvx/)
%
% + Qetlab (http://www.qetlab.com)
% - Negativity
% - Swap
% - Partial Trace
% - Tensor
% - TraceNorm
%
% authors: Marco Piani, Bintener Tom
%%-------------------------------------------------------------------------
function [neg,W_out] = NegMapEns(setrhoAB,dA,setsigmaCD,dC,varargin)
%% Calculate dimensions that are not given already
%number of input states
n = length(setrhoAB);
%total input dimension (the dimension of each state setrhoAB{j}
dInTot = length(setrhoAB{1});
%total output dimension (the dimension of each state setsigmaAB{j}
dOutTot = length(setsigmaCD{1});
%%--Error checking---------------------------------------------------------
if n == length(setsigmaCD)
for i = 2:n
if length(setrhoAB{i}) ~= dInTot
error('All input states should have the same dimension dInTot');
elseif length(setsigmaCD{i}) ~= dOutTot
error('All output states should have the same dimension dOutTot');
end
end
else
error('Number of input and output systems must be equal.')
end
%%-------------------------------------------------------------------------
%dimension of input system B
dB = dInTot/dA ;
%dimension of output system D
dD = dOutTot/dC ;
% Set optional argument
if nargin == 4
elseif nargin == 5
if length(varargin{1}) == 1
epsilon = varargin{1};
else
error('Epsilon should be a number.')
end
else
error('Unexpected number of arguments.')
end
%% CVX part
cvx_begin sdp quiet
%W is the Choi SDP variable
variable W(dInTot*dOutTot,dInTot*dOutTot) hermitian semidefinite;
%target funtion (Negativity) to be minimized
%(We calculate the Negativity in the cut AC:BD so we have to reorder the
%systems correctly using Swap)
minimize Negativity(Swap(W,[2 3],[dC,dD,dA,dB]),dA*dC);
% We impose necessary conditions
subject to
%Trace-preservation of the channel is imposed via condition on
% partial trace of W; trace is taken over output systems C and D
PartialTrace(W,[1,2],[dC,dD,dA,dB]) == eye(dInTot)/dInTot;
%Imposing the mapping using W^(-1) of setrhoAB{i} into setsigmaCD{i}
for i = 1:n
mapped = dInTot * PartialTrace(W*Tensor(eye(dOutTot),...
transpose(setrhoAB{i})),[3,4],[dC,dD,dA,dB]);
if nargin == 5 && epsilon ~= 0
TraceNorm(mapped-setsigmaCD{i}) <= epsilon;
else
mapped == setsigmaCD{i};
end
end
%End of CVX
cvx_end
%% Determine the output
%minimum negativity required
neg = cvx_optval;
%Choi of an optimal map
W_out = W;
end