# LocalDistinguishability

 Other toolboxes required LocalDistinguishability Computes the maximum probability of distinguishing quantum states by symmetric-extendible measurements CVX ChannelDistinguishabilityDistinguishability Distinguishing objects

LocalDistinguishability is a function that computes the maximum probability of distinguishing two or more quantum states via PPT or symmetric-extendible measurements, which approximate separable measurements. That is, this function computes the maximum probability of winning the following game: You are given a complete description of a set of $k$ quantum states $\rho_1, \ldots, \rho_k$, and then are given one of those $k$ states, and asked to determine (via quantum measurement) which state was given to you. However, the only measurements that are available to you are "almost" local in the sense that they are PPT and/or have a symmetric extension.

## Syntax

• DIST = LocalDistinguishability(X)
• [DIST,MEAS,DUAL_SOL] = LocalDistinguishability(X)
• [DIST,MEAS,DUAL_SOL] = LocalDistinguishability(X,...)

## Argument descriptions

### Input arguments

• X: The quantum states to be distinguished. X can either be a cell containing 2 or more density matrices, or X can be a matrix whose columns are pure vector states.
• P (optional, default [1/k, 1/k, ..., 1/k], where k is the number of quantum states): A vector whose j-th entry is the probability that the state $\rho_j$ is given to you in the game described above. * DIM (optional, default has both subsystems of equal dimension): A 1-by-2 vector containing the dimensions of the subsystems on which the states described by X act.
• COPIES (optional, default 2): The number of copies of the second subsystem (i.e., the measurements will have a COPIES-level symmetric extension).
• PPT (optonal, default true): A flag (either true or false) indicating whether the symmetric extensions of the measurement operators must have positive partial transpose.
• BOS (optonal, default true): A flag (either true or false) indicating whether the symmetric extensions of the measurement operators must be Bosonic (i.e., be supported on the symmetric subspace).
• TOL (optonal, default eps^(1/4)): The numerical tolerance used when determining whether or not a symmetric extension exists.

Important note: The input arguments are mutually optional (this is different from other QETLAB functions!). For example, if you want to specify the number of COPIES to 3 and the dimension of the two subsystems to [2 3], you can call the function as follows: LocalDistinguishability(X, 'COPIES', 3, 'DIM', [2 3])

### Output arguments

• DIST: The maximum probability of distinguishing the states specified by X.
• MEAS (optional): A cell containing optimal measurement operators that distinguish the states specified by X with probability DIST.
• DUAL_SOL (optional): A dual solution that verifies that the maximum distinguishability probability is indeed no larger than DIST.

## Source code

Click on "expand" to the right to view the MATLAB source code for this function.

1. function [DIST, MEAS, DUAL_SOL] = LocalDistinguishability(X, varargin)
2. %%  LocalDistinguishability   Computes the maximum probability of distinguishing quantum states by symmetric-extendible measurements
3. %   This function has one required argument:
4. %      X: a cell array containing density matrices, or a single matrix
5. %           containing pure states as its column vectors
6. %
7. %   This function has six optional arguments:
8. %     P (default [1/N, ..., 1/N], where N is the number of states)
9. %     DIM (default has both subsystems of equal dimension)
10. %     COPIES (default 2)
11. %     PPT (default true)
12. %     BOS (default true)
13. %     TOL (default eps^(1/4))
14. %
15. %   [DIST, MEAS, DUAL_SOL] = LocalDistinguishability(X) returns the optimal
16. %      probability to distinguish the input states by a measurement whose
17. %      operators have 2-copies PPT bosonic symmetric extensions. MEAS is a
18. %       cell array containing the optimal measurement operators. DUAL_SOL
19. %       is the optimal solution of the dual problem.
20. %
21. %   P is a vector that contains the probability that each state is chosen
22. %   (by default, the states are chosen uniformly at random)
23. %   COPIES is the desired number of copies of the second subsystem.
24. %   DIM is a 1-by-2 vector containing the dimensions of the subsystems
25. %   on which X acts.
26. %   PPT is a flag (either true or false) indicating whether the symmetric
27. %   extensions of the measurement operators must have positive partial
28. %   transpose.
29. %   BOS is a flag (either true or false) indicating whether the symmetric
30. %   extensions of the measurement operators must be Bosonic (i.e., be
31. %   supported on the symmetric subspace).
32. %   TOL is the numerical tolerance used when determining whether or not
33. %   a symmetric extension exists.
34. %
35. %   The arguments are mutually optional (*note this is different from other
36. %   QETLAB functions!*). For example, if you want to specify the number of
37. %   COPIES to 3 and the dimension of the two subsystems to [2 3], you can
38. %   call the function as follows:
39. %   LocalDistinguishability(X, 'COPIES', 3, 'DIM', [2 3])
40. %
41. %   URL: http://www.qetlab.com/LocalDistinguishability
42. %
43. %   author: Alessandro Cosentino (cosenal@gmail.com)
44. 
45. if(iscell(X))
46.     num_ops = length(X);
47.     d = length(X{1});
48.     S = X;
49.     for j = 1:num_ops % make sure that the density operators are scaled
50.         S{j} = S{j}/trace(S{j});
51.     end
52. elseif(isnumeric(X))
53.     [d,num_ops] = size(X);
54.     S = mat2cell(normalize_cols(X), d, ones(1, num_ops));
55.     S = cellfun(@(x) x*x', S, 'UniformOutput', false);
56. else
57.     error('LocalDistinguishability:InvalidInput', ...
58.        'First argument must be a cell array or a single matrix');
59. end
60. 
61. parser = inputParser;
62. addRequired(parser, 'X', @(x) isnumeric(x) || iscell(x));
63. if verLessThan('matlab', '8.3')
64.     addParamValue(parser, 'P', ones(1,num_ops)/num_ops, @isnumeric);
65.     addParamValue(parser, 'DIM', round(sqrt(d)), @isnumeric);
66.     addParamValue(parser, 'COPIES', 2, @isscalar);
67.     addParamValue(parser, 'PPT', true, @islogical);
68.     addParamValue(parser, 'BOS', true, @islogical);
69.     addParamValue(parser, 'TOL', eps^(1/4), @isscalar);
70. else
71.     addParameter(parser, 'P', ones(1,num_ops)/num_ops, @isnumeric);
72.     addParameter(parser, 'DIM', round(sqrt(d)), @isnumeric);
73.     addParameter(parser, 'COPIES', 2, @isscalar);
74.     addParameter(parser, 'PPT', true, @islogical);
75.     addParameter(parser, 'BOS', true, @islogical);
76.     addParameter(parser, 'TOL', eps^(1/4), @isscalar);
77. end
78. parse(parser,X,varargin{:});
79. p = parser.Results.P;
80. dim = parser.Results.DIM;
81. copies = parser.Results.COPIES;
82. ppt = int8(parser.Results.PPT);
83. bos = int8(parser.Results.BOS);
84. tol = parser.Results.TOL;
85. 
86. if(abs(sum(p) - 1) > num_ops^2*eps || length(p) ~= num_ops)
87.     error('LocalDistinguishability:InvalidP', ...
88.         strcat('The vector P must be a probability distribution of ', ...
89.         'the same length as the number of states: its elements must', ...
90.         'be non-negative and they must sum to 1.'));
91. end
92. 
93. if(num_ops == 1 || max(p) >= 1) % of course we can distinguish 1 object
94.     DIST = 1;
95.     if(nargout > 1)
96.         MEAS = eye(dim); % optimal measurements is trivial in this case,
97.         DUAL_SOL = S{1}; % and so is the solution of the dual problem
98.     end
99. else
100.     cvx_begin sdp quiet
101.         cvx_precision(tol);
102.         variable P(d,d,num_ops) hermitian
103.         dual variable Y
104. 
105.         P_tr = 0;
106.         P_sum = zeros(d);
107.         for j = 1:num_ops
108.             P_tr = P_tr + p(j)*trace(P(:,:,j)*S{j});
109.             P_sum = P_sum + P(:,:,j);
110.         end
111.         P_tr = P_tr + P_tr';
112. 
113.         maximize P_tr
114.         subject to
115.             Y : eye(d) == P_sum;
116.             for j = 1:num_ops
117.                 SymmetricExtension(P(:,:,j),copies,dim,ppt,bos,tol) == 1;
118.             end
119.     cvx_end
120. 
121.     DIST = real(cvx_optval)/2;
122. 
123.     % Also return the optimal measurements and the optimal solution
124.     % of the dual problem, if requested.
125.     if(nargout > 1)
126.         MEAS = mat2cell(reshape(P,d,d*num_ops),d,d*ones(1,num_ops));
127.         DUAL_SOL = Y;
128.     end
129. end
130. end

## Notes

The methods used by this function to compute the local distinguishability of quantum states was developed in [1].

## References

1. A. Cosentino. Quantum State Local Distinguishability via Convex Optimization. PhD thesis, University of Waterloo, 2015.