IsHermPreserving

From QETLAB
Jump to: navigation, search
IsHermPreserving
Determines whether or not a superoperator is Hermiticity preserving

Other toolboxes required none
Related functions IsCP
Function category Superoperators

IsHermPreserving is a function that determines whether or not a given superoperator is Hermiticity preserving.

Syntax

  • HP = IsHermPreserving(PHI)
  • HP = IsHermPreserving(PHI,TOL)

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).
  • TOL (optional, default eps^(3/4)): The numerical tolerance used.

Examples

The following code verifies that the map $\Phi$ defined by $\Phi(X) = X - UXU^*$ is Hermiticity preserving, where $U = \frac{1}{\sqrt{2}}\begin{bmatrix}1 & 1 \\ -1 & 1\end{bmatrix}$.

>> U = [1 1;-1 1]/sqrt(2);
>> Phi = {eye(2),eye(2); U,-U};
>> IsHermPreserving(Phi)
 
ans =
 
     1

Source code

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

  1. %%  ISHERMPRESERVING    Determines whether or not a superoperator is Hermiticity preserving
  2. %   This function has one required argument:
  3. %     PHI: a superoperator
  4. %
  5. %   IHP = IsHermPreserving(PHI) is either 1 or 0, indicating that PHI is or
  6. %   is not Hermiticity preserving (within reasonable numerical error).
  7. %
  8. %   This function has one optional input argument:
  9. %     TOL (default eps^(3/4))
  10. %
  11. %   IHP = IsHermPreserving(PHI,TOL) determines whether or not PHI is
  12. %   Hermiticity preserving within the numerical tolerance specified by TOL.
  13. %
  14. %   URL: http://www.qetlab.com/IsHermPreserving
  15.  
  16. %   requires: ApplyMap.m, ChoiMatrix.m, iden.m, MaxEntangled.m, opt_args.m,
  17. %             PermuteSystems.m, sporth.m, superoperator_dims.m
  18. %   author: Nathaniel Johnston (nathaniel@njohnston.ca)
  19. %   package: QETLAB
  20. %   last updated: January 4, 2013
  21.  
  22. function hp = IsHermPreserving(Phi,varargin)
  23.  
  24. if(iscell(Phi) && size(Phi,2) == 1)
  25.     hp = 1;
  26.     return
  27. end
  28.  
  29. % set optional argument defaults: tol=eps^(3/4)
  30. [tol] = opt_args({ eps^(3/4) },varargin{:});
  31.  
  32. % Phi is Hermiticity-preseerving iff its Choi matrix is Hermitian.
  33. C = ChoiMatrix(Phi);
  34. sC = size(C);
  35. if(sC(1) ~= sC(2))
  36.     hp = 0;
  37. else
  38.     hp = (max(max(abs(C-C'))) <= tol);
  39. end