Commutant

From QETLAB
Jump to: navigation, search
Commutant
Computes the commutant of a set of matrices

Other toolboxes required none
Function category Miscellaneous

Commutant is a function that computes an orthonormal basis (in the Hilbert-Schmidt inner product) of the commutant of a matrix or set of matrices.

Syntax

  • C = Commutant(A)

Argument descriptions

  • A: Either a matrix, or a cell containing one or more matrices of the same size.

Examples

A single matrix

Everything commutes with the identity matrix, which we can verify in the 2-dimensional case as follows:

>> C = Commutant(eye(2));
>> celldisp(C) % display the contents of C
 
C{1} =
     1     0
     0     0
 
C{2} =
     0     1
     0     0
 
C{3} =
     0     0
     1     0
 
C{4} = 
     0     0
     0     1

Bicommutant

If A is a cell that contains a basis of a unital, self-adjoint algebra, then its bicommutant spans the same set, by the von Neumann bicommutant theorem. The following code verifies this in the case of the subalgebra $M_2 \oplus M_1 \subseteq M_3$:

>> A = {[1 0 0;0 0 0;0 0 0] [0 1 0;0 0 0;0 0 0] [0 0 0;1 0 0;0 0 0] [0 0 0;0 1 0;0 0 0] [0 0 0;0 0 0;0 0 1]};
>> B = Commutant(Commutant(A));
>> celldisp(B)
 
B{1} =
     1     0     0
     0     0     0
     0     0     0
 
B{2} =
     0     1     0
     0     0     0
     0     0     0
 
B{3} =
     0     0     0
     1     0     0
     0     0     0
 
B{4} =
     0     0     0
     0     1     0
     0     0     0
 
B{5} =
     0     0     0
     0     0     0
     0     0     1

Note that the basis output for the bicommutant in general may be different than the basis provided as input.

Source code

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

  1. %%  COMMUTANT    Computes the commutant of a set of matrices
  2. %   This function has one required argument:
  3. %     A: a matrix, or a cell containing one or more matrices of the same size
  4. %
  5. %   C = Commutant(A) is a cell containing an orthonormal basis (in the
  6. %   Hilbert-Schmidt inner product) for the algebra of matrices that commute
  7. %   with each matrix in the cell A. The elements of C are sparse if and
  8. %   only if the elements of A are sparse.
  9. %
  10. %   URL: http://www.qetlab.com/Commutant
  11.  
  12. %   requires: opt_args.m, PartialTranspose.m, PermuteSystems.m, spnull.m,
  13. %             Swap.m
  14. %
  15. %   author: Nathaniel Johnston (nathaniel@njohnston.ca)
  16. %   package: QETLAB
  17. %   last updated: November 12, 2014
  18.  
  19. function C = Commutant(A)
  20.  
  21. if(iscell(A)) % allow A to just be a matrix instead of a cell if they only want the commutant of one matrix
  22.     A = [A{:}].';
  23. else
  24.     A = A.';
  25. end
  26. dim = size(A,2);
  27. num_ops = length(A)/dim;
  28.  
  29. % a sneaky (and fast) way of constructing the commutant that works by
  30. % noting that AX = XA if and only if (kron(A,I) - kron(I,A^T))x = 0, where
  31. % x is the vectorization of X
  32. C = reshape(spnull( kron(PartialTranspose(A,2,[num_ops,dim;1,dim]),speye(dim)) - Swap(kron(speye(dim),A),[1,2],[dim,num_ops,dim],1) ),dim,[]);
  33.  
  34. % from here on, we're just reshaping the resulting data into matrices of
  35. % the proper size and sparsity
  36. num_comm_ops = size(C,2)/dim;
  37. if(~issparse(A))
  38.     C = full(C);
  39. end
  40. C = mat2cell(PartialTranspose(C,2,[1,dim;num_comm_ops,dim]),dim,dim*ones(1,num_comm_ops));