Difference between revisions of "SwapOperator"
Jump to navigation
Jump to search
(Created page with "{{Function |name=SwapOperator |desc=Produces a unitary operator that swaps two subsystems |req=opt_args<br />PermuteSystems<br />Swap |rel=[[PermutationOperato...") |
m |
||
| Line 3: | Line 3: | ||
|desc=Produces a [[unitary operator]] that swaps two subsystems | |desc=Produces a [[unitary operator]] that swaps two subsystems | ||
|req=[[opt_args]]<br />[[PermuteSystems]]<br />[[Swap]] | |req=[[opt_args]]<br />[[PermuteSystems]]<br />[[Swap]] | ||
| − | |rel=[[PermutationOperator]] | + | |rel=[[PermutationOperator]]<br />[[SymmetricProjection]] |
|upd=November 15, 2012 | |upd=November 15, 2012 | ||
|v=1.00|}} | |v=1.00|}} | ||
Revision as of 21:37, 20 November 2012
| SwapOperator | |
| Produces a unitary operator that swaps two subsystems | |
| Other toolboxes required | opt_args PermuteSystems Swap |
|---|---|
| Related functions | PermutationOperator SymmetricProjection |
SwapOperator is a function that returns a unitary operator that swaps two subsystems (there may be more than two subsystems overall – the extra subsystems are left alone). The unitary can be chosen to be full or sparse.
Syntax
- S = SwapOperator(DIM)
- S = SwapOperator(DIM,SYS)
- S = SwapOperator(DIM,SYS,SP)
Argument descriptions
- DIM: A specification of the dimensions of the subsystems that S will act on. DIM can be provided in one of two ways:
- If DIM is a scalar, then all subsystems are assumed to have dimension DIM.
- If the subsystems have unequal dimensions, DIM should be a vector containing their dimensions.
- SYS (optional, default [1,2]): A 1-by-2 vector containing the indices of the subsystems to be swapped.
- SP (optional, default 0): If set equal to 1, the swap operator is sparse. If equal to 0, the swap operator is full.
Examples
The standard swap operator
The following code produces the operator that swaps two qubits:
>> SwapOperator(2)
ans =
1 0 0 0
0 0 1 0
0 1 0 0
0 0 0 1