IsPPT

From QETLAB
Jump to: navigation, search
IsPPT
Determines whether or not a matrix has positive partial transpose

Other toolboxes required none
Related functions IsPSD
PartialTranspose
Function category Entanglement and separability

IsPPT is a function that determines whether or not a given matrix has positive partial transpose (PPT), which is a quick and easy separability criterion. This function works on both full and sparse matrices, and if desired a witness can be provided that verifies that the input matrix is not PPT.

Syntax

  • PPT = IsPPT(X)
  • PPT = IsPPT(X,SYS)
  • PPT = IsPPT(X,SYS,DIM)
  • PPT = IsPPT(X,SYS,DIM,TOL)
  • [PPT,WIT] = IsPPT(X,SYS,DIM,TOL)

Argument descriptions

Input arguments

  • X: A square matrix.
  • SYS (optional, default 2): A scalar or vector indicating which subsystem(s) the transpose should be applied on.
  • DIM (optional, default has X living on two subsystems of equal size): A vector containing the dimensions of the (possibly more than 2) subsystems on which X lives.
  • TOL (optional, default sqrt(eps)): The numerical tolerance used when determining positive semidefiniteness. The matrix will be determined to have positive partial transpose if its partial transpose's minimal eigenvalue is computed to be at least -TOL.

Output arguments

  • PPT: A flag (either 1 or 0) indicating that X does or does not have positive partial transpose.
  • WIT (optional): An eigenvector corresponding to the minimal eigenvalue of PartialTranspose(X). When PPT = 0, this serves as a witness that verifies that X does not have positive partial transpose, since WIT'*PartialTranspose(X)*WIT < 0.

Examples

The following code verifies that the 9-by-9 identity operator (thought of as an operator in $M_3 \otimes M_3$) has positive partial transpose:

>> IsPPT(eye(9))
 
ans =
 
     1

Notes

Do not request the WIT output argument unless you need it. If WIT is not requested, positive semidefiniteness is determined by attempting a Cholesky decomposition of X, which is both faster and more accurate than computing its minimum eigenvalue/eigenvector pair.

Source code

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

  1. %%  ISPPT    Determines whether or not a matrix has positive partial transpose
  2. %   This function has one required argument:
  3. %     X: a square matrix
  4. %
  5. %   PPT = IsPPT(X) is either 1 or 0, indicating that X does or does not
  6. %   have positive partial transpose (within numerical error). X is assumed
  7. %   to act on bipartite space.
  8. %
  9. %   This function has three optional input arguments:
  10. %     SYS (default 2)
  11. %     DIM (default sqrt(length(X)))
  12. %     TOL (default sqrt(eps))
  13. %
  14. %   [PPT,WIT] = IsPPT(X,SYS,DIM,TOL) determines whether or not X has
  15. %   positive partial transpose within the tolerance specified by TOL. DIM
  16. %   DIM is a vector containing the dimensions of the subsystems on which X
  17. %   acts, and SYS is a scalar or vector indicating which subsystems the
  18. %   transpose should be applied on. WIT is the eigenvector corresponding to
  19. %   the minimal eigenvalue of the partial transpose of X, and thus can
  20. %   act as a witness that proves X does not have positive partial transpose
  21. %   (i.e., WIT'*PartialTranspose(X,SYS,DIM)*WIT < 0).
  22. %
  23. %   URL: http://www.qetlab.com/IsPPT
  24.  
  25. %   requires: IsPSD.m, opt_args.m, PartialTranspose.m
  26. %   author: Nathaniel Johnston (nathaniel@njohnston.ca)
  27. %   package: QETLAB
  28. %   last updated: December 12, 2014
  29.  
  30. function [ppt,wit] = IsPPT(X,varargin)
  31.  
  32. % set optional argument defaults: sys=2, dim=sqrt(length(X)), tol=sqrt(eps)
  33. [sys,dim,tol] = opt_args({ 2, round(sqrt(length(X))), sqrt(eps) },varargin{:});
  34.  
  35. % Allow this function to be called within CVX optimization problems.
  36. if(isa(X,'cvx'))
  37.     cvx_begin sdp quiet
  38.     subject to
  39.     	PartialTranspose(X,sys,dim) >= 0;
  40.     cvx_end
  41.     ppt = 1-min(cvx_optval,1); % CVX-safe way to map (0,Inf) to (1,0)
  42.  
  43. % If the function is just being called on a non-CVX variable, just check
  44. % the PPT condition normally (which is much faster).
  45. else
  46.     if(nargout > 1)
  47.         [ppt,wit] = IsPSD(PartialTranspose(X,sys,dim),tol);
  48.     else
  49.         ppt = IsPSD(PartialTranspose(X,sys,dim),tol);
  50.     end
  51. end