Difference between revisions of "Swap"

From QETLAB
Jump to navigation Jump to search
(Created page with "{{Function |name=Swap |desc=Swaps two subsystems within a state or operator |req=opt_args<br />PermuteSystems |rel=PermutationOperator<br />[[SwapOperator]...")
 
m (typos)
Line 6: Line 6:
 
|upd=November 14, 2012
 
|upd=November 14, 2012
 
|v=1.00|}}
 
|v=1.00|}}
<tt>'''Swap'''</tt> is a function the swap the position of two subsystems in the space on which a [[quantum state]] or [[operator]] live. Note that the state or operator can have more than two subsystems altogether -- the remaining subsystems are not affected. To permute the positions of more than two subsystems, use the <tt>[[PermuteSystems]]</tt> function.
+
<tt>'''Swap'''</tt> is a [[List of functions|function]] that swaps the position of two subsystems in the space on which a [[quantum state]] or [[operator]] live. Note that the state or operator can have more than two subsystems altogether &ndash; the remaining subsystems are not affected. To permute the positions of more than two subsystems, use the <tt>[[PermuteSystems]]</tt> function.
  
 
==Syntax==
 
==Syntax==

Revision as of 00:02, 15 November 2012

Swap
Swaps two subsystems within a state or operator

Other toolboxes required opt_args
PermuteSystems
Related functions PermutationOperator
SwapOperator

Swap is a function that swaps the position of two subsystems in the space on which a quantum state or operator live. Note that the state or operator can have more than two subsystems altogether – the remaining subsystems are not affected. To permute the positions of more than two subsystems, use the PermuteSystems function.

Syntax

  • SX = Swap(X)
  • SX = Swap(X,DIM)
  • SX = Swap(X,DIM,SYS)
  • SX = Swap(X,DIM,SYS,ROW_ONLY)

Argument descriptions

  • X: a vector (e.g., a pure quantum state) or a matrix to have its subsystems permuted
  • DIM (optional, by default has all subsystems of equal dimension): A specification of the dimensions of the subsystems that X lives on. DIM can be provided in one of three ways:
    • If DIM is a scalar, it is assumed that X lives on the tensor product of two spaces, the first of which has dimension DIM and the second of which has dimension length(X)/DIM.
    • If $X \in M_{n_1} \otimes \cdots \otimes M_{n_p}$ then DIM should be a row vector containing the dimensions (i.e., DIM = [n_1, ..., n_p]).
    • If the subsystems aren't square (i.e., $X \in M_{m_1, n_1} \otimes \cdots \otimes M_{m_p, n_p}$) then DIM should be a matrix with two rows. The first row of DIM should contain the row dimensions of the subsystems (i.e., the mi's) and its second row should contain the column dimensions (i.e., the ni's). In other words, you should set DIM = [m_1, ..., m_p; n_1, ..., n_p].
  • SYS (optional, default [1,2]): a 1-by-2 vector containing the indices of the subsystems to be swapped
  • ROW_ONLY (optional, default 0): If set equal to 1, only the rows of X are permuted (this is equivalent to multiplying X on the left by SwapOperator(DIM,SYS)). If equal to 0, both the rows and columns of X are permuted (this is equivalent to multiplying X on both the left and right by the swap operator).

Examples

Please add examples here.