Pauli: Difference between revisions

From QETLAB
Jump to navigation Jump to search
No edit summary
No edit summary
 
(3 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]]
|rel=[[GellMann]]<br />[[GenGellMann]]<br />[[GenPauli]]<br />[[PauliChannel]]
|cat=[[List of functions#Special_states,_vectors,_and_operators|Special states, vectors, and operators]]
|cat=[[List of functions#Special_states,_vectors,_and_operators|Special states, vectors, and operators]]
|upd=December 18, 2013
|upd=November 27, 2014}}
|v=0.50}}
<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>'x'</tt>, <tt>'y'</tt>, and <tt>'z'</tt> are also accepted, and indicate the Pauli X, Y, and Z operators, respectively.
* <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 0): A flag (either 1 or 0) indicating that the Pauli operator produced should or should not be sparse.
* <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===
<syntaxhighlight>
<syntaxhighlight>
>> Pauli('x')
>> 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('y')
>> 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('z',1) % sparse Pauli Z operator
>> 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>
</syntaxhighlight>



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)       -1

Multi-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.0000i

Source code

Click here to view this function's source code on github.