# AntisymmetricProjection

 Other toolboxes required AntisymmetricProjection Produces the projection onto the antisymmetric subspace none SymmetricProjectionSwapOperator Permutations and symmetry of subsystems

AntisymmetricProjection is a function that computes the orthogonal projection onto the antisymmetric subspace of two or more subsystems. The output of this function is always a sparse matrix.

## Syntax

• PA = AntisymmetricProjection(DIM)
• PA = AntisymmetricProjection(DIM,P)
• PA = AntisymmetricProjection(DIM,P,PARTIAL)
• PA = AntisymmetricProjection(DIM,P,PARTIAL,MODE)

## Argument descriptions

• DIM: The dimension of each of the subsystems.
• P (optional, default 2): The number of subsystems.
• PARTIAL (optional, default 0): If PARTIAL = 1 then PA isn't the orthogonal projection itself, but rather a matrix whose columns form an orthonormal basis for the antisymmetric subspace (and hence PA*PA' is the orthogonal projection onto the antisymmetric subspace).
• MODE (optional, default -1): A flag that determines which of two algorithms is used to compute the antisymmetric projection. If MODE = -1 then this script chooses which algorithm it thinks will be faster based on the values of DIM and P. If you wish to force the script to use a specific one of the algorithms (not recommended!), they are as follows:
• MODE = 0: Computes the antisymmetric projection by explicitly constructing an orthonormal basis of the antisymmetric subspace. The method for constructing such a basis is a modification of the procedure described for the symmetric subspace in [1]. This method is typically fast when DIM is small compared to P.
• MODE = 1: Computes the antisymmetric projection by averaging all P! permutation operators (in the sense of the PermutationOperator function). Permutation operators corresponding to an even permutation are given a weight of +1, while permutation operators corresponding to an odd permutation are given a weight of -1.[2] Because P! grows very quickly, this method is only practical when P is small.

## Examples

### Two subsystems

To compute the antisymmetric projection on two-qubit space, the following code suffices:

```>> AntisymmetricProjection(2)

ans =

(2,2)       0.5000
(3,2)      -0.5000
(2,3)      -0.5000
(3,3)       0.5000```

Note that the output of this function is always sparse. If you want a full matrix (not recommended for even moderately large DIM or P), you must explicitly convert it using MATLAB's built-in full function.

### More subsystems and PARTIAL

To compute a matrix whose columns form an orthonormal basis for the symmetric subspace of three-qutrit space, set PARTIAL = 1:

```>> PA = AntisymmetricProjection(3,3,1)

PA =

(6,1)       0.4082
(8,1)      -0.4082
(12,1)      -0.4082
(16,1)       0.4082
(20,1)       0.4082
(22,1)      -0.4082```

Note that PA is an isometry from the antisymmetric subspace (which is one-dimensional in this case) to the full three-qutrit space. In other words, PA'*PA is the identity matrix (i.e., the scalar 1 here) and PA*PA' is the orthogonal projection onto the antisymmetric subspace, which we can verify as follows:

```>> PA'*PA

ans =

(1,1)       1.0000

>> norm(PA*PA' - AntisymmetricProjection(3,3),'fro')

ans =

3.3307e-016```

### When DIM is too small

When DIM < P, the antisymmetric subspace is zero-dimensional, as verified in the DIM = 4, P = 6 case by the following line of code:

```>> AntisymmetricProjection(4,6)

ans =

All zero sparse: 4096-by-4096```

## Source code

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

1. `%%  ANTISYMMETRICPROJECTION    Produces the projection onto the antisymmetric subspace`
2. `%   This function has one required argument:`
3. `%     DIM: the dimension of the local systems`
4. `%`
5. `%   PA = AntisymmetricProjection(DIM) is the orthogonal projection onto the`
6. `%   anti symmetric subspace of two copies of DIM-dimensional space. PA is`
7. `%   always a sparse matrix.`
8. `%`
9. `%   This function has five optional arguments:`
10. `%     P (default 2)`
11. `%     PARTIAL (default 0)`
12. `%     MODE (default -1)`
13. `%`
14. `%   PA = AntisymmetricProjection(DIM,P,PARTIAL,MODE) is the orthogonal`
15. `%   projection onto the antisymmetric subspace of P copies of`
16. `%   DIM-dimensional space. If PARTIAL = 1 then PA isn't the orthogonal`
17. `%   projection itself, but rather a matrix whose columns form an`
18. `%   orthonormal basis for the antisymmetric subspace (and hence PA*PA' is`
19. `%   the orthogonal projection onto the antisymmetric subspace). MODE is a`
20. `%   flag that determines which of two algorithms is used to compute the`
21. `%   antisymmetric projection. If MODE = -1 then this script chooses`
22. `%   whichever algorithm it thinks will be faster based on the values of DIM`
23. `%   and P. If you wish to force one specific algorithm, set either MODE = 0`
24. `%   (which generally works best when DIM is small) or MODE = 1 (which`
25. `%   generally works best when P is small).`
26. `%`
27. `%   URL: http://www.qetlab.com/AntisymmetricProjection`
28. ` `
29. `%   requires: opt_args.m, perm_sign.m, PermutationOperator.m,`
30. `%             PermuteSystems.m, sporth.m`
31. `%   author: Nathaniel Johnston (nathaniel@njohnston.ca)`
32. `%   package: QETLAB`
33. `%   last updated: November 26, 2012`
34. ` `
35. `function PA = AntisymmetricProjection(dim,varargin)`
36. ` `
37. `    % set optional argument defaults: p=2, partial=0, mode=-1`
38. `    [p,partial,mode] = opt_args({ 2, 0, -1 },varargin{:});`
39. `    dimp = dim^p;`
40. ` `
41. `    if(p == 1)`
42. `        PA = speye(dim);`
43. `        return`
44. `    elseif(dim < p) % the antisymmetric subspace is empty if dim < p`
45. `        PA = sparse(dimp,dimp*(1-partial));`
46. `        return`
47. `    elseif(mode == -1) % guess which algorithm will be faster`
48. `        mode = (dim >= p+4);`
49. `    end`
50. ` `
51. `    plist = perms(1:p);`
52. `    pfac = size(plist,1);`
53. ` `
54. `    % The antisymmetric projection is the normalization of the sum of all`
55. `    % signed permutation operators. This method of computing the`
56. `    % antisymmetric projection is reasonably quick when the local dimension`
57. `    % is large compared to the number of systems.`
58. `    if(mode == 1)`
59. `        PA = sparse(dimp,dimp);`
60. `        for j = 1:pfac`
61. `            PA = PA + perm_sign(plist(j,:))*PermutationOperator(dim*ones(1,p),plist(j,:),0,1);`
62. `        end`
63. `        PA = PA/pfac;`
64. ` `
65. `        if(partial)`
66. `            PA = sporth(PA);`
67. `        end`
68. ` `
69. `    % When the local dimension is small compared to the number of systems,`
70. `    % it is quicker to just explicitly construct an orthonormal basis for`
71. `    % the antisymmetric subspace.`
72. `    else`
73. `        lim = nchoosek(dim,p);`
74. `        ind = nchoosek(1:dim,p);`
75. `        Id = speye(dim);`
76. `        PA = spalloc(dimp,lim,pfac*lim); % allocate the correct number of non-zero elements to PA for speed/memory reasons`
77. ` `
78. `        % construct an orthonormal basis for the antisymmetric subspace`
79. `        for j = 1:lim`
80. `            v = spalloc(dimp,1,pfac);`
81. `            for k = 1:pfac`
82. `                vt = Id(:,ind(j,plist(k,1)));`
83. `                for m = 2:p`
84. `                    vt = kron(vt,Id(:,ind(j,plist(k,m))));`
85. `                end`
86. `                v = v + perm_sign(plist(k,:))*vt;`
87. `            end`
88. `            PA(:,j) = v;`
89. `        end`
90. ` `
91. `        if(partial)`
92. `            PA = PA/sqrt(pfac);`
93. `        else`
94. `            PA = PA*PA'/pfac;`
95. `        end`
96. `    end`
97. `end`

## References

1. John Watrous. Lecture 21: The quantum de Finetti theorem, Theory of Quantum Information Lecture Notes, 2008.
2. R.B. Griffiths. Systems of Identical Particles, 33-756 Quantum Mechanics II Course Notes, 2011.