# KrausOperators

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
 Other toolboxes required KrausOperators Computes a set of Kraus operators for a superoperator none ChoiMatrix Superoperators

KrausOperators is a function that computes a set of Kraus operators for a superoperator $\Phi$. These superoperators will always be canonical in the following ways:

1. If $\Phi$ is completely positive, only the left Kraus operators will be returned (and the right Kraus operators are the same). That is, a cell will be returned that contains operators $\{A_j\}$ so that $\Phi(X) = \sum_j A_j X A_j^*$.
2. If $\Phi$ is Hermiticity preserving, the right Kraus operators are the same as the left Kraus operators, up to sign. The pairs of Kraus operators that are equal are given first, followed by the pairs that are negatives of each other.
3. The left Kraus operators form an orthogonal set in the Hilbert-Schmidt inner product, and similarly for the right Kraus operators.

## Syntax

• KO = KrausOperators(PHI)
• KO = KrausOperators(PHI,DIM)

## 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).
• DIM (optional, default has input and output spaces of equal dimension): This argument should only be given if PHI is provided as a Choi matrix. In this case, DIM should be a 1-by-2 vector containing the input and output dimensions of PHI, in that order (equivalently, these are the dimensions of the first and second subsystems of the Choi matrix PHI, in that order).

## Examples

Since the Choi matrix of the transpose map is the swap operator, the following code finds a family of Kraus operators for the transpose map on 2-by-2 matrices:

>> T = KrausOperators(SwapOperator(2));
>> celldisp(T)

T{1,1} =

0    0.7071
0.7071         0

T{2,1} =

1     0
0     0

T{3,1} =

0     0
0     1

T{4,1} =

0    0.7071
-0.7071         0

T{1,2} =

0    0.7071
0.7071         0

T{2,2} =

1     0
0     0

T{3,2} =

0     0
0     1

T{4,2} =

0   -0.7071
0.7071         0

In other words, the following holds for all 2-by-2 matrices $X$: $$X^T = \frac{1}{2}\begin{bmatrix}0 & 1 \\ 1 & 0\end{bmatrix}X\begin{bmatrix}0 & 1 \\ 1 & 0\end{bmatrix} + \begin{bmatrix}1 & 0 \\ 0 & 0\end{bmatrix}X\begin{bmatrix}1 & 0 \\ 0 & 0\end{bmatrix} + \begin{bmatrix}0 & 0 \\ 0 & 1\end{bmatrix}X\begin{bmatrix}0 & 0 \\ 0 & 1\end{bmatrix} + \frac{1}{2}\begin{bmatrix}0 & 1 \\ -1 & 0\end{bmatrix}X\begin{bmatrix}0 & 1 \\ -1 & 0\end{bmatrix}.$$

## Source code

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

1. %%  KRAUSOPERATORS    Computes a set of Kraus operators for a superoperator
2. %   This function has one required input argument:
3. %     PHI: a superoperator
4. %
5. %   KO = KrausOperators(PHI) is a cell containing Kraus operators for PHI.
6. %   This set of Kraus operators will always be canonical in the following
7. %   ways:
8. %     (1) If PHI is completely positive, only the left Kraus operators will
9. %     be returned (and the right Kraus operators are the same).
10. %     (2) If PHI is Hermiticity preserving, the right Kraus operators are
11. %     the same as the left Kraus operators, up to sign. The pairs of Kraus
12. %     operators that are equal are given first, followed by the pairs that
13. %     are negatives of each other.
14. %     (3) The left Kraus operators form an orthogonal set in the
15. %     Hilbert-Schmidt inner product, and similarly for the right Kraus
16. %     operators.
17. %
18. %   This function has one optional input argument:
19. %     DIM (default has both subsystems of equal dimension)
20. %
21. %   KO = KrausOperators(PHI,DIM) is the same as above, where DIM is a
22. %   1-by-2 vector containing the input and output dimensions of PHI, in
23. %   that order (equivalently, these are the dimensions of the first and
24. %   second subsystems of the Choi matrix PHI, in that order). DIM is
25. %   required if and only if PHI has unequal input and output dimensions and
26. %   is provided as a Choi matrix.
27. %
28. %   URL: http://www.qetlab.com/KrausOperators
29. 
30. %   requires: ApplyMap.m, ChoiMatrix.m, iden.m, IsCP.m, IsHermPreserving.m,
31. %             IsPSD.m, MaxEntangled.m, opt_args.m, PermuteSystems.m,
32. %             sporth.m, superoperator_dims.m
33. %
34. %   author: Nathaniel Johnston (nathaniel@njohnston.ca)
35. %   package: QETLAB
36. %   last updated: March 19, 2015
37. 
38. function ko = KrausOperators(Phi,varargin)
39. 
40. % Compute the dimensions of PHI.
41. [da,db] = superoperator_dims(Phi,1,varargin{:});
42. max_dim = max(da(1)*db(1),da(2)*db(2));
43. 
44. % If PHI is already a set of Kraus operators, still do some work: we want a
45. % *canonical* set of Kraus operators, so convert everything to a Choi
46. % matrix first.
47. Phi = ChoiMatrix(Phi); % if PHI is a Choi matrix already, this does no work: don't worry
48. if(norm(Phi,'fro') < da(1)^2*db(1)^2*eps)
49.     ko = {zeros(db(1),da(1)),zeros(db(2),da(2))}; % need to handle this case separately, or no Kraus operators are returned
50.     return
51. end
52. 
53. % Compute a canonical set of Kraus operators for Hermiticity-preserving
54. % maps.
55. if(IsHermPreserving(Phi))
56.     ep = max_dim*eps(norm(Phi,'fro'));
57.     [V,S] = eig(full(Phi));
58.     [S,ind] = sort(diag(S),'descend');
59.     V = V(:,ind);
60. 
61.     ind1 = find(S <= ep,1) - 1;
62.     ind2 = find(S < -ep,1) - 1;
63.     if(min(size(ind1)) == 0)
64.         ind1 = length(S);
65.     end
66.     if(min(size(ind2)) == 0)
67.         ind2 = length(S);
68.     end
69. 
70.     sgnS = sign(S);
71.     V = V*diag(sqrt(abs(S)));
72.     ko(:,1) = mat2cell(reshape(V(:,[1:ind1,ind2+1:end]),db(1),da(1)*(ind1+length(S)-ind2)),db(1),da(1)*ones((ind1+length(S)-ind2),1)).';
73.     if(~IsCP(Phi))
74.         V = V*diag(sgnS);
75.         ko(:,2) = mat2cell(reshape(V(:,[1:ind1,ind2+1:end]),db(1),da(1)*(ind1+length(S)-ind2)),db(1),da(1)*ones((ind1+length(S)-ind2),1)).';
76.     end
77. 
78. % Compute a canonical set of Kraus operators for all other maps.
79. else
80.     [U,S,V] = svd(full(Phi));
81.     S = diag(S);
82.     ind = find(S <= max_dim*eps(norm(Phi,'fro')),1) - 1;
83.     if(min(size(ind)) == 0)
84.         ind = length(S);
85.     end
86.     S = diag(sqrt(S));
87.     U = U*padarray(S,size(U,2)-size(S,1),'post');
88.     V = V*padarray(S,size(V,2)-size(S,1),'post');
89. 
90.     ko(:,1) = mat2cell(reshape(U(:,1:ind),db(1),da(1)*ind),db(1),da(1)*ones(ind,1)).';
91.     ko(:,2) = mat2cell(reshape(V(:,1:ind),db(2),da(2)*ind),db(2),da(2)*ones(ind,1)).';
92. end