Pauli

From QETLAB
Revision as of 19:46, 14 January 2015 by Nathaniel (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
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:

\[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}.\]

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.

External links