-
Notifications
You must be signed in to change notification settings - Fork 3
/
steeringWeight.m
82 lines (66 loc) · 2.72 KB
/
steeringWeight.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
function [SW, F] = steeringWeight(sigma,varargin)
%STEERINGWEIGHT calculates the steering weight of an assemblage
% This function has one required argument:
% sigma: a 4-D array, containing the members of the assemblage. The first
% two dimensions contain the (unnormalised) quantum states, while the
% remaining two dimensions are (a,x), such that sigma(:,:,a,x) =
% \sigma_a|x.
%
% SW = steeringWeight(sigma) returns the steering weight SW of the
% assemblage sigma.
%
% [SW, F] = steeringWeight(sigma) also returns the steering functional F
% that certifies that the steering weight is SW. F is a 4-D array, with the
% first two dimensions containing the members of the steering functional,
% and the last two labelling (a,x).
%
% This function has one optional argument:
% consistent: (default 0)
%
% [SW, F] = steeringWeight(sigma,consistent) calculates the standard
% steering weight when consistent = 0, and the consistent steering weight
% when consistent = 1.
%
% requires: CVX (http://cvxr.com/cvx/), QETLAB (http://www.qetlab.com)
% authors: Paul Skrzypczyk, Daniel Cavalcanti
% last updated: March 17, 2016
[consistent] = opt_args({0},varargin{:});
% if unspecified, it is assumed the standard steering weight is required.
[dB,~,oa,ma] = size(sigma);
% dB = dim. of Bob, oa = # outcomes for Alice, ma = # inputs for Alice
Ndet = oa^ma;
% number of determinstic probability distributions for Alice
SingleParty = genSinglePartyArray(oa,ma);
% generate array containing the single party distributions
% check that the assemblage is valid
if NSAssemblage(sigma) == 0
error('assemblage is not valid')
end
sigR = sum(sigma(:,:,:,1),3);
% sigR = reduced state of Bob, necessary for consistent steering robust.
% NOTE: Here we use the dual formulation of the steering weight.
cvx_begin sdp quiet
variable F(dB,dB,oa,ma) hermitian semidefinite
% members of the steering functional
if consistent == 1
variable X(dB,dB) hermitian
% if consistent steering weight is required, we need an additional
% variable.
else
X = zeros(dB,dB);
% if we want the standard steering weight, we can set this variable
% equal to the zero matrix.
end
maximise 1 - real(sum(reshape(F.*conj(sigma),1,[])))
% max 1 - sum_ax trace(F_ax*sigma_a|x)
subject to
for i = 1:Ndet
sum(sum(permute(repmat(SingleParty(:,:,i),[1,1,dB,dB]),[3,4,1,2]).*F,3),4) ...
- X + trace(X*sigR)*eye(dB) - eye(dB) == hermitian_semidefinite(dB);
% standard SW: sum_ax F_ax D(a|x,lam) - eye(dB) >= 0, forall lam
% consist. SW: sum_ax F_ax D(a|x,lam) - X + tr(X*sigR)eye(dB) -
% eye(dB) >= 0, forall lam
end
cvx_end
SW = cvx_optval;
end