SymmetricProjection
SymmetricProjection | |
Produces the projection onto the symmetric subspace | |
Other toolboxes required | none |
---|---|
Related functions | AntisymmetricProjection PermutationOperator SwapOperator |
Function category | Permutations and symmetry of subsystems |
SymmetricProjection is a function that computes the orthogonal projection onto the symmetric subspace of two or more subsystems. The output of this function is always a sparse matrix.
Contents
Syntax
- PS = SymmetricProjection(DIM)
- PS = SymmetricProjection(DIM,P)
- PS = SymmetricProjection(DIM,P,PARTIAL)
- PS = SymmetricProjection(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 PS isn't the orthogonal projection itself, but rather a matrix whose columns form an orthonormal basis for the symmetric subspace (and hence PS*PS' is the orthogonal projection onto the symmetric subspace).
- MODE (optional, default -1): A flag that determines which of two algorithms is used to compute the symmetric 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 symmetric projection by explicitly constructing an orthonormal basis of the symmetric subspace. The details of how to construct such a basis can be found in ^{[1]}. This method is typically fast when DIM is small compared to P.
- MODE = 1: Computes the symmetric projection by averaging all P! permutation operators (in the sense of the PermutationOperator function). Because P! grows very quickly, this method is only practical when P is small.
Examples
Two subsystems
To compute the symmetric projection on two-qubit space, the following code suffices:
>> SymmetricProjection(2) ans = (1,1) 1.0000 (2,2) 0.5000 (3,2) 0.5000 (2,3) 0.5000 (3,3) 0.5000 (4,4) 1.0000
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 (as in the following example).
Three subsystems
To compute a matrix whose columns form an orthonormal basis for the symmetric subspace of three-qubit space, set PARTIAL = 1:
>> PS = full(SymmetricProjection(2,3,1)) PS = 1.0000 0 0 0 0 0 -0.5774 0 0 0 -0.5774 0 0 0 0 -0.5774 0 0 -0.5774 0 0 0 0 -0.5774 0 0 0 -0.5774 0 1.0000 0 0
Note that PS is an isometry from the symmetric subspace to the full three-qubit space. In other words, PS'*PS is the identity matrix and PS*PS' is the orthogonal projection onto the symmetric subspace, which we can verify as follows:
Source code
Click on "expand" to the right to view the MATLAB source code for this function.
%% SYMMETRICPROJECTION Produces the projection onto the symmetric subspace
% This function has one required argument:
% DIM: the dimension of the local systems
%
% PS = SymmetricProjection(DIM) is the orthogonal projection onto the
% symmetric subspace of two copies of DIM-dimensional space. PS is always
% a sparse matrix.
%
% This function has five optional arguments:
% P (default 2)
% PARTIAL (default 0)
% MODE (default -1)
%
% PS = SymmetricProjection(DIM,P,PARTIAL,MODE) is the orthogonal
% projection onto the symmetric subspace of P copies of DIM-dimensional
% space. If PARTIAL = 1 then PS isn't the orthogonal projection itself,
% but rather a matrix whose columns form an orthonormal basis for the
% symmetric subspace (and hence PS*PS' is the orthogonal projection onto
% the symmetric subspace). MODE is a flag that determines which of two
% algorithms is used to compute the symmetric projection. If MODE = -1
% then this script chooses whichever algorithm it thinks will be faster
% based on the values of DIM and P. If you wish to force one specific
% algorithm, set either MODE = 0 (which generally works best when DIM is
% small) or MODE = 1 (which generally works best when P is small).
%
% URL: http://www.qetlab.com/SymmetricProjection
% requires: opt_args.m, PermutationOperator.m, PermuteSystems.m, sporth.m
% author: Nathaniel Johnston (nathaniel@njohnston.ca)
% package: QETLAB
% last updated: December 15, 2014
function PS = SymmetricProjection(dim,varargin)
% set optional argument defaults: p=2, partial=0, mode=-1
[p,partial,mode] = opt_args({ 2, 0, -1 },varargin{:});
dimp = dim^p;
if(p == 1)
PS = speye(dim);
return
elseif(mode == -1)
mode = (dim >= p-1);
end
% The symmetric projection is the normalization of the sum of all
% permutation operators. This method of computing the symmetric
% projection is reasonably quick when the local dimension is large
% compared to the number of spaces.
if(mode == 1)
plist = perms(1:p);
pfac = factorial(p);
PS = sparse(dimp,dimp);
for j = 1:pfac
PS = PS + PermutationOperator(dim*ones(1,p),plist(j,:),0,1);
end
PS = PS/pfac;
if(partial)
PS = sporth(PS);
end
% When the local dimension is small compared to the number of spaces,
% it is quicker to just explicitly construct an orthonormal basis for
% the symmetric subspace.
else
lim = nchoosek(dim+p-1,dim-1);
PS = spalloc(dimp,lim,dimp); % allocate dim^p non-zero elements to PS for speed/memory reasons
slist = sum_vector(p,dim);
Id = speye(dim);
for j = 1:lim
ind = cell2mat(arrayfun(@(x,y) repmat(y,1,x), slist(j,:),1:dim,'un',0));
plist = unique_perms(ind);
v = spalloc(dimp,1,nchoosek(p,floor(p/2)));
sp = size(plist,1);
for k = 1:sp
vt = Id(:,plist(k,1));
for m = 2:p
vt = kron(vt,Id(:,plist(k,m)));
end
v = v + vt/sqrt(sp);
end
PS(:,j) = v;
end
if(~partial)
PS = PS*PS';
end
end
end
% We need some helper functions to help us through the MODE = 0 algorithm.
function slist = sum_vector(dim,p)
if p <= 1
slist = dim;
else
k = 0;
slist = zeros(nchoosek(dim+p-1,p-1),p);
for j = 0:dim
cs = nchoosek(j+p-2,p-2);
t = [sum_vector(j,p-1),(dim-j)*ones(cs,1)];
slist(k+1:k+cs,:) = t;
k = k + cs;
end
end
end
References
- ↑ John Watrous. Lecture 21: The quantum de Finetti theorem, Theory of Quantum Information Lecture Notes, 2008.