# IsAbsPPT

 Other toolboxes required IsAbsPPT Determines whether or not a density matrix is absolutely PPT none AbsPPTConstraintsInSeparableBall Ball of separability

IsAbsPPT is a function that determines whether or not a density matrix $\rho$ is "absolutely PPT" (that is, whether or not $U\rho U^\dagger$ has positive partial transpose for all unitary matrices $U$). The conditions that determine whether or not a state is absolutely PPT were derived in [1].

This function returns 1 if $\rho$ is absolutely PPT, 0 if it is not absolutely PPT, and -1 if it was unable to determine whether or not $\rho$ is absolutely PPT within a reasonable amount of time.

## Syntax

• IAPPT = IsAbsPPT(RHO)
• IAPPT = IsAbsPPT(RHO,DIM)

## Argument descriptions

• RHO: A bipartite density matrix (or any bipartite positive semidefinite operator).
• DIM (optional, by default has both subsystems of equal dimension): A 1-by-2 vector containing the dimensions of the two subsystems that X acts on.

## Examples

The maximally-mixed state is the simplest example of an absolutely PPT state:

>> d = 5;
>> rho = eye(d^2);
>> IsAbsPPT(rho)

ans =

1

## Notes

• This function always gives an answer of either 0 or 1 if at least one of the local dimensions is 6 or less. If both local dimensions are 7 or higher, than sometimes an answer of -1 is returned, indicating that the script was unable to determine whether or not RHO is absolutely PPT within a reasonable amount of time (but these situations are still relatively rare).
• Absolutely PPT states are sometimes said to be "PPT from spectrum".

## Source code

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

1. %%  ISABSPPT    Determines whether or not a density matrix is absolutely PPT
2. %   This function has one required input argument:
3. %     RHO: a density matrix, or a vector of the eigenvalues of a density
4. %          matrix
5. %
6. %   IAPPT = IsAbsPPT(RHO) is either 1 or 0, indicating that RHO (which is
7. %   assumed to act on bipartite space with each of the two subsystems of
8. %   equal dimension) is or is not absolutely PPT (see [1] for the
9. %   definition of absolutely PPT states). If the two subsystems are both
10. %   of dimension 7 or higher, than this function may sometimes return a
11. %   value of -1, indicating that it could not determine whether or not RHO
12. %   is absolutely PPT within a reasonable amount of time.
13. %
14. %   This function has on optional arguments:
15. %     DIM (default has both subsystems of equal dimension)
16. %
17. %   IAPPT = IsAbsPPT(RHO,DIM) is as above, where DIM is a 1-by-2 vector
18. %   containing the dimensions of the subsystems on which RHO acts.
19. %
20. %   URL: http://www.qetlab.com/IsAbsPPT
21. %
22. %   References:
23. %   [1] R. Hildebrand. Positive partial transpose from spectra. Phys. Rev.
24. %       A, 76:052325, 2007. E-print: arXiv:quant-ph/0502170
25. 
26. %   requires: AbsPPTConstraints.m, InSeparableBall.m, IsPSD.m, opt_args.m,
27. %             perm_inv.m
28. %
29. %   author: Nathaniel Johnston (nathaniel@njohnston.ca)
30. %   package: QETLAB
31. %   last updated: December 24, 2014
32. 
33. function iappt = IsAbsPPT(rho,varargin)
34. 
35. iappt = -1; % by default, we don't know the answer
36. sz = size(rho);
37. len = max(sz);
38. 
39. % set optional argument defaults: dim=sqrt(length(rho))
40. [dim] = opt_args({ round(sqrt(len)) },varargin{:});
41. 
42. % If rho is a vector, it is a vector of eigenvalues. If it is a matrix,
43. % we should find its eigenvalues.
44. if(min(sz) == 1) % rho is a vector of eigenvalues
45.     if(~isa(rho,'cvx'))
46.         lam = sort(real(rho),'descend');
47.     else
48.         lam = rho;
49.     end
50. else % rho is a density matrix
51.     if(isa(rho,'cvx'))
52.         error('IsAbsPPT:InvalidRHO','If used within a CVX optimization problem, RHO must be a vector of eigenvalues, not a density matrix.');
53.     else
54.         lam = sort(real(eig(full(rho))),'descend');
55.     end
56. end
57. 
58. % allow the user to enter a single number for dim
59. if(length(dim) == 1)
60.     dim = [dim,len/dim];
61.     if abs(dim(2) - round(dim(2))) >= 2*len*eps
62.         error('IsAbsPPT:InvalidDim','If DIM is a scalar, it must evenly divide length(RHO); please provide the DIM array containing the dimensions of the subsystems.');
63.     end
64.     dim(2) = round(dim(2));
65. end
66. pd = prod(dim);
67. p = min(dim);
68. 
69. % Now do some error checking.
70. if(pd ~= length(lam))
71.     error('IsAbsPPT:InvalidDim','The dimensions provided by DIM do not match the length of RHO.');
72. end
73. 
74. % Do fast checks first, if the input is numeric.
75. if(~isa(lam,'cvx'))
76.     % Check if it's in the Gurvits-Barnum ball.
77.     if(InSeparableBall(lam))
78.         iappt = 1;
79.         return;
80. 
81.     % Check if it satisfies the Gerschgorin circle property from arXiv:1406.1277.
82.     elseif(sum(lam(1:p-1)) <= 2*lam(end) + sum(lam(end-p+1:end-1)))
83.         iappt = 1;
84.         return;
85.     end
86. end
87. 
88. % Still don't know the answer, and dim is small enough? Roll up your
89. % sleeves and *really* check whether or not it's absolutely PPT.
90. if(isa(lam,'cvx'))
91.     if(p >= 7)
92.         warning('IsAbsPPT:LargeDim','Only optimizing over the first 2612 linear matrix inequalities for absolutely PPT states, since there are over a million constraints in this case. Thus the set being optimized over is slightly larger than the true set of absolutely PPT states.');
93.     end
94. 
95.     cvx_begin sdp quiet
96.     L = AbsPPTConstraints(lam,dim,0,2612);
97.     subject to
98.         for j = 1:length(L)
99.             L{j} >= 0;
100.         end
101.         for j = 1:pd-1
102.             lam(j) >= lam(j+1); % eigenvalues must be in order
103.         end
104.         lam >= 0;
105.     cvx_end
106.     iappt = 1-min(cvx_optval,1); % CVX-safe way to map (0,Inf) to (1,0)
107. else
108.     % Compute *all* constraints up to 6 local dimensions, otherwise only
109.     % compute a few thousand constraints.
110.     L = AbsPPTConstraints(lam,dim,1,2612);
111.     if(~IsPSD(L{end})) % only need to check this one constraint: the AbsPPTConstraints function already checked all the earlier ones
112.         iappt = 0;
113.     elseif(p <= 6) % the test we just did is complete for local dimensions up to 6
114.         iappt = 1;
115.     end
116. end

## References

1. R. Hildebrand. Positive partial transpose from spectra. Phys. Rev. A, 76:052325, 2007. E-print: arXiv:quant-ph/0502170