PermuteSystems
PermuteSystems | |
Permutes subsystems within a state or operator | |
Other toolboxes required | opt_args |
---|---|
Related functions | PermutationOperator Swap SwapOperator |
PermuteSystems is a function that allows the user to permute the order of the subsystems underlying a quantum state or operator that is defined on the tensor product of 2 or more subsystems. It works with full and sparse numeric matrices as well as symbolic matrices.
Syntax
- PX = PermuteSystems(X,PERM)
- PX = PermuteSystems(X,PERM,DIM)
- PX = PermuteSystems(X,PERM,DIM,ROW_ONLY)
- PX = PermuteSystems(X,PERM,DIM,ROW_ONLY,INV_PERM)
Argument Descriptions
- X: a vector (e.g., a pure quantum state) or a matrix to have its subsystems permuted
- PERM: a permutation vector
- DIM (optional, default has all subsystems of equal dimension):
- ROW_ONLY (optional, default 0):
- INV_PERM (optional, default 0):
Examples
All subsystems of equal dimension
In cases when all subsystems have the same dimension, most arguments can be omitted. Let's start with a matrix $X \in M_2 \otimes M_2$:
>> X = [1 2 3 4;5 6 7 8;9 10 11 12;13 14 15 16] X = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
If we want to permute the two subsystems, we can call PermuteSystems with the permutation vector PERM = [2,1] (though if your needs are as simple as this, you may be better off using Swap.m):
>> PermuteSystems(X,[2,1]) ans = 1 3 2 4 9 11 10 12 5 7 6 8 13 15 14 16
Similarly, the following code acts on a matrix $X \in M_A \otimes M_B \otimes M_C$ (where each subsystem has dimension 2) and outputs a matrix representation in the standard basis of $M_B \otimes M_C \otimes M_A$:
>> X = reshape(1:64,8,8)' X = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 >> PermuteSystems(X,[2,3,1]) ans = 1 5 2 6 3 7 4 8 33 37 34 38 35 39 36 40 9 13 10 14 11 15 12 16 41 45 42 46 43 47 44 48 17 21 18 22 19 23 20 24 49 53 50 54 51 55 52 56 25 29 26 30 27 31 28 32 57 61 58 62 59 63 60 64