RandomPOVM

From QETLAB
Jump to: navigation, search
RandomPOVM
Generates a random POVM (positive-operator valued measure)

Other toolboxes required none
Related functions RandomSuperoperator
RandomUnitary
Function category Random things

RandomPOVM is a function that generates a random POVM (positive-operator valued measure) with a specified dimension and number of measurement outcomes.

Syntax

  • P = RandomPOVM(DIM,OUTC)
  • P = RandomPOVM(DIM,OUTC,RE)

Argument descriptions

  • DIM: A scalar indicating the size of the POVM elements (i.e., each POVM element will have size DIM-by-DIM).
  • OUTC: The number of POVM elements (i.e., the number of possible measurement outcomes).
  • RE (optional, default 0): A flag (either 1 or 0) indicating that the entries of the POVM should or should not all be real.

Examples

The following code generates a random POVM on 4-dimensional space with 3 measurement outcomes:

>> P  = RandomPOVM(4,3);
>> celldisp(P) % display the POVM elements
 
P{1} =
 
   0.3485 + 0.0000i   0.0512 + 0.0443i   0.0016 - 0.0853i  -0.0861 + 0.0509i
   0.0512 - 0.0443i   0.4188 + 0.0000i  -0.1040 - 0.0067i  -0.0271 - 0.0281i
   0.0016 + 0.0853i  -0.1040 + 0.0067i   0.3005 + 0.0000i  -0.0853 - 0.0330i
  -0.0861 - 0.0509i  -0.0271 + 0.0281i  -0.0853 + 0.0330i   0.3845          
 
P{2} =
 
   0.3658 + 0.0000i   0.0037 - 0.0577i   0.0351 + 0.0928i   0.0223 + 0.0511i
   0.0037 + 0.0577i   0.2127 + 0.0000i   0.0961 + 0.0384i   0.0656 - 0.0671i
   0.0351 - 0.0928i   0.0961 - 0.0384i   0.4426 + 0.0000i   0.0813 - 0.0791i
   0.0223 - 0.0511i   0.0656 + 0.0671i   0.0813 + 0.0791i   0.4032 - 0.0000i
 
P{3} =
 
   0.2857 + 0.0000i  -0.0549 + 0.0135i  -0.0367 - 0.0076i   0.0638 - 0.1020i
  -0.0549 - 0.0135i   0.3685 + 0.0000i   0.0079 - 0.0317i  -0.0385 + 0.0952i
  -0.0367 + 0.0076i   0.0079 + 0.0317i   0.2569 + 0.0000i   0.0040 + 0.1121i
   0.0638 + 0.1020i  -0.0385 - 0.0952i   0.0040 - 0.1121i   0.2123 + 0.0000i

It is straightforward to verify that these operators are positive semidefinite and sum to the identity (and thus form a valid POVM):

>> IsPSD(P{1})
 
ans =
 
     1
 
>> IsPSD(P{2})
 
ans =
 
     1
 
>> IsPSD(P{3})
 
ans =
 
     1
 
>> P{1} + P{2} + P{3}
 
ans =
 
   1.0000 + 0.0000i   0.0000 + 0.0000i  -0.0000 - 0.0000i  -0.0000 - 0.0000i
   0.0000 - 0.0000i   1.0000 + 0.0000i  -0.0000 + 0.0000i   0.0000 + 0.0000i
  -0.0000 + 0.0000i  -0.0000 - 0.0000i   1.0000 + 0.0000i   0.0000 - 0.0000i
  -0.0000 + 0.0000i   0.0000 - 0.0000i   0.0000 + 0.0000i   1.0000 + 0.0000i

Source code

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

  1. %%  RANDOMPOVM    Generates a random positive-operator valued measure
  2. %   This function has two required arguments:
  3. %     DIM: a scalar specifying the size of the POVM elements
  4. %     OUTC: the number of outcomes of the measurement (i.e., the number of
  5. %           POVM elements)
  6. %
  7. %   P = RandomPOVM(DIM,OUTC) generates a cell array with OUTC entries, each
  8. %   of which is a DIM-by-DIM matrix that represents one of the measurement
  9. %   operators in a POVM. Each element of the cell array is positive
  10. %   semidefinite, and their sum is the identity matrix.
  11. %
  12. %   This function has one optional argument:
  13. %     RE (default 0)
  14. %
  15. %   P = RandomPOVM(DIM,OUTC,RE) generates a cell array that represents a
  16. %   POVM as above, and all of the entries of this POVM will be real if
  17. %   RE=1.
  18. %
  19. %   URL: http://www.qetlab.com/RandomPOVM
  20.  
  21. %   requires: opt_args.m, RandomSuperoperator.m
  22. %             
  23. %   author: Nathaniel Johnston (nathaniel@njohnston.ca)
  24. %   package: QETLAB
  25. %   last updated: January 6, 2016
  26.  
  27. function P = RandomPOVM(dim,outc,varargin)
  28.  
  29. % set optional argument defaults: re=0
  30. [re] = opt_args({ 0 },varargin{:});
  31.  
  32. % Generate the Choi matrix of a random quantum channel: we will generate
  33. % the POVM from this.
  34. Phi = RandomSuperoperator([outc,dim],0,1,re);
  35.  
  36. % The POVM elements are the diagonal blocks of the channel.
  37. for j = outc:-1:1
  38.     ind = (1:dim) + (j-1)*dim;
  39.     P{j} = Phi(ind,ind);
  40. end