# ChannelDistinguishability

 Other toolboxes required ChannelDistinguishability Computes the maximum probability of distinguishing two quantum channels CVX DistinguishabilityLocalDistinguishability Distinguishing objects

ChannelDistinguishability is a function that computes the maximum probability of distinguishing two quantum channels. That is, this function computes the maximum probability of winning the following game: You are given a complete description of two quantum channels $\Phi$ and $\Psi$, and then are given one of those two channels, and asked to determine which channel was given to you (by supplying some input state to the channel and then measuring the output).

## Syntax

• DIST = ChannelDistinguishability(PHI,PSI)
• DIST = ChannelDistinguishability(PHI,PSI,P)
• DIST = ChannelDistinguishability(PHI,PSI,P,DIM)

## Argument descriptions

• PHI,PSI: The quantum channels to be distinguished. They can either be input as Choi matrices or as cells of Kraus operators.
• P (optional, default [1/2, 1/2]): A vector that specifies that PHI and PSI are chosen with probability P(1) and P(2), respectively.
• DIM (optional, by default tries to guess the input and output dimensions): A 1-by-2 vector containing the input and output dimensions of PHI and PSI. DIM is required if and only if both PHI and PSI are provided as Choi matrices and the input and output dimensions are different.

## Examples

### Perfectly distinguishable channels

The following code demonstrates that the simple example of two channels that can be perfectly distinguished from  can indeed be perfectly distinguished:

>> n = 4;
>> Phi = SymmetricProjection(n)*2/(n+1);
>> Psi = AntisymmetricProjection(n)*2/(n-1);
>> ChannelDistinguishability(Phi,Psi)

ans =

1.0000

## Source code

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

1. %%  CHANNELDISTINGUISHABILITY    Computes the maximum probability of distinguishing two quantum channels
2. %   This function has two required input arguments:
3. %     PHI,PSI: linear maps (represented as either Choi matrices or cells of Kraus operators)
4. %
5. %   DIST = ChannelDistinguishability(PHI,PSI) is the maximum probability of
6. %   distinguishing the quantum channels PHI and PSI. Each of PHI and PSI
7. %   can either be represented by a Choi matrix or by a cell containing
8. %   Kraus operators of the channel.
9. %
10. %   This function has two optional arguments:
11. %     P (default [1/2, 1/2])
12. %     DIM (default tries to guess the input and output dimensions of PHI,PSI)
13. %
14. %   DIST = ChannelDistinguishability(PHI,PSI,P,DIM) is the maximum
15. %   probability of distinguishing the quantum channels PHI and PSI, chosen
16. %   with probability P(1) and P(2), respectively (by default, the channels
17. %   are chosen uniformly at random). DIM is a 1-by-2 vector containing the
18. %   input and output dimensions of PHI and PSI (DIM is required if and only
19. %   if PHI and PSI are provided as Choi matrices and the input and output
20. %   dimensions are unequal).
21. %
22. %   URL: http://www.qetlab.com/ChannelDistinguishability
23. 
24. %   requires: cvx (http://cvxr.com/cvx/), ApplyMap.m, ChoiMatrix.m,
25. %             ComplementaryMap.m, DiamondNorm.m, DualMap.m, iden.m, IsCP.m,
26. %             IsHermPreserving.m, IsPSD.m, KrausOperators.m,
27. %             MaxEntangled.m, opt_args.m, PermuteSystems.m, Swap.m
28. %
29. %   author: Nathaniel Johnston (nathaniel@njohnston.ca)
30. %   package: QETLAB
31. %   last updated: November 27, 2014
32. 
33. function dist = ChannelDistinguishability(Phi,Psi,varargin)
34. 
35. % Get the input and output dimensions of PHI and PSI.
36. [da,db] = superoperator_dims(Psi,0,varargin{2:end});
37. 
38. % set optional argument defaults: p = [1/2,1/2], dim guessed based on input
39. [p,dim] = opt_args({ [1,1]/2, [da,db] },varargin{:});
40. 
41. % We convert to a Choi matrix to make things easier -- we end up converting
42. % back to Kraus operators in the DiamondNorm function, but the performance
43. % impact is negligible, and we have to perform the Kraus decomposition
44. % again anyway to remove linear dependencies in the Kraus operators, or
45. % things slow down to a halt in the SDP.
46. Phi = ChoiMatrix(Phi);
47. Psi = ChoiMatrix(Psi);
48. 
49. if(length(Phi) ~= length(Psi))
50.     error('ChannelDistinguishability:DifferentDims','The channels PHI and PSI must have the same dimension input and output spaces as each other.');
51. elseif(prod(dim) ~= length(Phi))
52.     error('ChannelDistinguishability:InvalidDim','Could not determine the input and output dimensions of the channels: please provide the DIM argument.');
53. end
54. 
55. if(abs(sum(p) - 1) > 10*eps || length(p) ~= 2)
56.     error('ChannelDistinguishability:InvalidP','The vector P must be a probability distribution with 2 entries: its elements must be non-negative and they must sum to 1.');
57. end
58. 
59. if(max(p) >= 1) % of course we can distinguish 1 object
60.     dist = 1;
61.     return
62. end
63. 
64. % Finally, compute the distinguishability.
65. dist = DiamondNorm(p(1)*Phi - p(2)*Psi,dim);