PermutationOperator

From QETLAB
Revision as of 19:10, 28 November 2012 by Nathaniel (talk | contribs)
Jump to navigation Jump to search
PermutationOperator
Produces a unitary operator that permutes subsystems

Other toolboxes required iden
opt_args
PermuteSystems
Related functions Swap
SwapOperator
SymmetricProjection

PermutationOperator is a function that returns a unitary operator that permutes two or more subsystems. The unitary can be chosen to be full or sparse.

Syntax

  • P = PermutationOperator(DIM,PERM)
  • P = PermutationOperator(DIM,PERM,INV_PERM)
  • P = PermutationOperator(DIM,PERM,INV_PERM,SP)

Argument descriptions

  • DIM: A specification of the dimensions of the subsystems that P will act on. DIM can be provided in one of two ways:
    • If DIM is a scalar, then all subsystems are assumed to have dimension DIM.
    • If the subsystems have unequal dimensions, DIM should be a vector containing their dimensions.
  • PERM: a permutation vector (i.e., a permutation of the vector 1:n)
  • INV_PERM (optional, default 0): If equal to 0, this argument has no effect. If equal to 1, the permutation operator permutes subsystems according to the inverse of PERM rather than PERM itself.
  • SP (optional, default 0): If set equal to 1, the permutation operator is sparse. If equal to 0, the permutation operator is full.

Examples

The standard swap operator

The following code produces the operator that swaps two qubits (note that for simple uses like this one, it may be easier to just use the SwapOperator function):

>> PermutationOperator(2,[2,1])

ans =

     1     0     0     0
     0     0     1     0
     0     1     0     0
     0     0     0     1

Similarly, the following code produces a sparse operator that swaps two qutrits:

>> PermutationOperator(3,[2,1],0,1)

ans =

   (1,1)        1
   (4,2)        1
   (7,3)        1
   (2,4)        1
   (5,5)        1
   (8,6)        1
   (3,7)        1
   (6,8)        1
   (9,9)        1