Pauli: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
No edit summary |
||
| (4 intermediate revisions by the same user not shown) | |||
| Line 2: | Line 2: | ||
|name=Pauli | |name=Pauli | ||
|desc=Produces a Pauli operator | |desc=Produces a Pauli operator | ||
| | |rel=[[GellMann]]<br />[[GenGellMann]]<br />[[GenPauli]]<br />[[PauliChannel]] | ||
|cat=[[List of functions#Special_states,_vectors,_and_operators|Special states, vectors, and operators]] | |||
| | |upd=November 27, 2014}} | ||
| | |||
<tt>'''Pauli'''</tt> is a [[List of functions|function]] that produces the 2-by-2 Pauli X, Y, Z, or identity operator, as defined here: | <tt>'''Pauli'''</tt> is a [[List of functions|function]] that produces the 2-by-2 Pauli X, Y, Z, or identity operator, as defined here: | ||
:<math>X = \begin{bmatrix}0 & 1\\ 1 & 0\end{bmatrix}, \ \ Y = \begin{bmatrix}0 & -i\\ i & 0\end{bmatrix}, \ \ Z = \begin{bmatrix}1 & 0\\ 0 & -1\end{bmatrix}, \ \ I = \begin{bmatrix}1 & 0\\ 0 & 1\end{bmatrix}.</math> | :<math>X = \begin{bmatrix}0 & 1\\ 1 & 0\end{bmatrix}, \ \ Y = \begin{bmatrix}0 & -i\\ i & 0\end{bmatrix}, \ \ Z = \begin{bmatrix}1 & 0\\ 0 & -1\end{bmatrix}, \ \ I = \begin{bmatrix}1 & 0\\ 0 & 1\end{bmatrix}.</math> | ||
This function can also produce multi-qubit Pauli operators. | |||
==Syntax== | ==Syntax== | ||
| Line 15: | Line 16: | ||
==Argument descriptions== | ==Argument descriptions== | ||
* <tt>IND</tt>: An index indicating which Pauli operator you would like to be generated. Values of <tt>1</tt>, <tt>2</tt>, <tt>3</tt>, and <tt>0</tt> correspond to the Pauli X, Y, Z, and identity operators, respectively. Values of <tt>' | * <tt>IND</tt>: An index indicating which Pauli operator you would like to be generated. Values of <tt>1</tt>, <tt>2</tt>, <tt>3</tt>, and <tt>0</tt> correspond to the Pauli X, Y, Z, and identity operators, respectively. Values of <tt>'I'</tt>, <tt>'X'</tt>, <tt>'Y'</tt>, and <tt>'Z'</tt> are also accepted, and indicate the Pauli identity, X, Y, and Z operators, respectively. If <tt>IND</tt> is a vector then this function returns a multi-qubit Pauli operator whose action on the <tt>K</tt>-th qubit is the same as <tt>Pauli(IND(K))</tt>. | ||
* <tt>SP</tt> (optional, default | * <tt>SP</tt> (optional, default 1): A flag (either 1 or 0) indicating that the Pauli operator produced should or should not be sparse. | ||
==Examples== | ==Examples== | ||
< | ===Single-qubit examples=== | ||
>> Pauli(' | <syntaxhighlight> | ||
>> full(Pauli('X')) | |||
ans = | ans = | ||
| Line 27: | Line 29: | ||
1 0 | 1 0 | ||
>> Pauli(1) | >> full(Pauli(1)) | ||
ans = | ans = | ||
| Line 34: | Line 36: | ||
1 0 | 1 0 | ||
>> Pauli(0) | >> full(Pauli(0)) | ||
ans = | ans = | ||
| Line 41: | Line 43: | ||
0 1 | 0 1 | ||
>> Pauli(' | >> full(Pauli('Y')) | ||
ans = | ans = | ||
| Line 48: | Line 50: | ||
0.0000 + 1.0000i 0.0000 + 0.0000i | 0.0000 + 1.0000i 0.0000 + 0.0000i | ||
>> Pauli(' | >> Pauli('Z',1) % sparse Pauli Z operator | ||
ans = | ans = | ||
| Line 54: | Line 56: | ||
(1,1) 1 | (1,1) 1 | ||
(2,2) -1 | (2,2) -1 | ||
</ | </syntaxhighlight> | ||
===Multi-qubit examples=== | |||
<syntaxhighlight> | |||
>> full(Pauli('XZI')) % the three-qubit Pauli operator X \otimes Z \otimes I | |||
ans = | |||
0 0 0 0 1 0 0 0 | |||
0 0 0 0 0 1 0 0 | |||
0 0 0 0 0 0 -1 0 | |||
0 0 0 0 0 0 0 -1 | |||
1 0 0 0 0 0 0 0 | |||
0 1 0 0 0 0 0 0 | |||
0 0 -1 0 0 0 0 0 | |||
0 0 0 -1 0 0 0 0 | |||
>> Pauli([0,1,2]) % the three-qubit Pauli operator I \otimes X \otimes Y | |||
ans = | |||
(4,1) 0 + 1.0000i | |||
(3,2) 0 - 1.0000i | |||
(2,3) 0 + 1.0000i | |||
(1,4) 0 - 1.0000i | |||
(8,5) 0 + 1.0000i | |||
(7,6) 0 - 1.0000i | |||
(6,7) 0 + 1.0000i | |||
(5,8) 0 - 1.0000i | |||
</syntaxhighlight> | |||
{{SourceCode|name=Pauli}} | |||
==External links== | ==External links== | ||
* [http://en.wikipedia.org/wiki/Pauli_matrices Pauli matrices] at Wikipedia | * [http://en.wikipedia.org/wiki/Pauli_matrices Pauli matrices] at Wikipedia | ||
Latest revision as of 19:46, 14 January 2015
| Pauli | |
| Produces a Pauli operator | |
| Other toolboxes required | none |
|---|---|
| Related functions | GellMann GenGellMann GenPauli PauliChannel |
| Function category | Special states, vectors, and operators |
Pauli is a function that produces the 2-by-2 Pauli X, Y, Z, or identity operator, as defined here:
- <math>X = \begin{bmatrix}0 & 1\\ 1 & 0\end{bmatrix}, \ \ Y = \begin{bmatrix}0 & -i\\ i & 0\end{bmatrix}, \ \ Z = \begin{bmatrix}1 & 0\\ 0 & -1\end{bmatrix}, \ \ I = \begin{bmatrix}1 & 0\\ 0 & 1\end{bmatrix}.</math>
This function can also produce multi-qubit Pauli operators.
Syntax
- P = Pauli(IND)
- P = Pauli(IND,SP)
Argument descriptions
- IND: An index indicating which Pauli operator you would like to be generated. Values of 1, 2, 3, and 0 correspond to the Pauli X, Y, Z, and identity operators, respectively. Values of 'I', 'X', 'Y', and 'Z' are also accepted, and indicate the Pauli identity, X, Y, and Z operators, respectively. If IND is a vector then this function returns a multi-qubit Pauli operator whose action on the K-th qubit is the same as Pauli(IND(K)).
- SP (optional, default 1): A flag (either 1 or 0) indicating that the Pauli operator produced should or should not be sparse.
Examples
Single-qubit examples
>> full(Pauli('X'))
ans =
0 1
1 0
>> full(Pauli(1))
ans =
0 1
1 0
>> full(Pauli(0))
ans =
1 0
0 1
>> full(Pauli('Y'))
ans =
0.0000 + 0.0000i 0.0000 - 1.0000i
0.0000 + 1.0000i 0.0000 + 0.0000i
>> Pauli('Z',1) % sparse Pauli Z operator
ans =
(1,1) 1
(2,2) -1Multi-qubit examples
>> full(Pauli('XZI')) % the three-qubit Pauli operator X \otimes Z \otimes I
ans =
0 0 0 0 1 0 0 0
0 0 0 0 0 1 0 0
0 0 0 0 0 0 -1 0
0 0 0 0 0 0 0 -1
1 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0
0 0 -1 0 0 0 0 0
0 0 0 -1 0 0 0 0
>> Pauli([0,1,2]) % the three-qubit Pauli operator I \otimes X \otimes Y
ans =
(4,1) 0 + 1.0000i
(3,2) 0 - 1.0000i
(2,3) 0 + 1.0000i
(1,4) 0 - 1.0000i
(8,5) 0 + 1.0000i
(7,6) 0 - 1.0000i
(6,7) 0 + 1.0000i
(5,8) 0 - 1.0000iSource code
Click here to view this function's source code on github.
External links
- Pauli matrices at Wikipedia