# ChoiMatrix

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
 Other toolboxes required ChoiMatrix Computes the Choi matrix of a superoperator none KrausOperators Superoperators

ChoiMatrix is a function that computes the Choi matrix of a superoperator.

## Syntax

• C = ChoiMatrix(PHI)
• C = ChoiMatrix(PHI,SYS)

## Argument descriptions

• PHI: A superoperator. Should be provided as either a Choi matrix, or as a cell with either 1 or 2 columns (see the tutorial page for more details about specifying superoperators within QETLAB).
• SYS (optional, default 2): The subsystem that PHI is applied to when constructing the Choi matrix.

## Examples

### The transpose map

The Choi matrix of the transpose map is the swap operator, which is verified in the 2-dimensional case by the following code:

```>> T = {[1 0;0 0],[1 0;0 0]';[0 1;0 0],[0 1;0 0]';[0 0;1 0],[0 0;1 0]';[0 0;0 1],[0 0;0 1]'};
>> ChoiMatrix(T)

ans =

1     0     0     0
0     0     1     0
0     1     0     0
0     0     0     1```

## Source code

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

1. `%% CHOIMATRIX     Computes the Choi matrix of a superoperator`
2. `%   This function has one required argument:`
3. `%     PHI: a superoperator`
4. `%`
5. `%   C = ChoiMatrix(PHI) is the Choi matrix of the superoperator PHI. The`
6. `%   default convention used within this function (and throughout QETLAB) is`
7. `%   that the Choi matrix is the result of applying the map PHI to the`
8. `%   *second* subsystem of the standard maximally entangled (unnormalized)`
9. `%   state. PHI should be provided either as a Choi matrix, or as a cell`
10. `%   with either 1 or 2 columns whose entries are its Kraus operators (see`
11. `%   full QETLAB documentation for details).`
12. `%`
13. `%   This function has one optional argument:`
14. `%     SYS (default 2)`
15. `%`
16. `%   C = ChoiMatrix(PHI,SYS) is the Choi matrix of PHI, with the convention`
17. `%   that the map PHI is applied to the SYS subsystem of the standard`
18. `%   maximally entangled state. SYS must be either 1 or 2.`
19. `%`
20. `%   URL: http://www.qetlab.com/ChoiMatrix`
21. ` `
22. `%   requires: ApplyMap.m, iden.m, MaxEntangled.m, opt_args.m, PartialMap.m,`
23. `%             PermuteSystems.m, sporth.m, superoperator_dims.m`
24. `%`
25. `%   author: Nathaniel Johnston (nathaniel@njohnston.ca)`
26. `%   package: QETLAB`
27. `%   last updated: November 24, 2014`
28. ` `
29. `function C = ChoiMatrix(Phi,varargin)`
30. ` `
31. `if(~iscell(Phi)) % PHI is already a Choi matrix`
32. `    C = Phi;`
33. `    return`
34. `end`
35. ` `
36. `% Get the dimensions of PHI.`
37. `da = superoperator_dims(Phi); % we only need the input space dimensions`
38. ` `
39. `% Set optional argument defaults: sys=2`
40. `[sys] = opt_args({ 2 },varargin{:});`
41. ` `
42. `% Now create the Choi matrix: apply the map to half of the (unnormalized)`
43. `% maximally-entangled states.`
44. `C = PartialMap(MaxEntangled(da(1),1,0)*MaxEntangled(da(2),1,0).',Phi,sys,[da(1),da(1);da(2),da(2)]);`
45. `if(~issparse(Phi{1,1}))`
46. `    C = full(C);`
47. `end`