Pauli

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'</tt>, 'X'</tt>, 'Y'</tt>, and 'Z'</tt> are also accepted, and indicate the Pauli identity, X, Y, and Z operators, respectively. If IND</tt> is a vector then this function returns a multi-qubit Pauli operator whose action on the K</tt>-th qubit is the same as Pauli(IND(K))</tt>.
 * SP</tt> (optional, default 1): A flag (either 1 or 0) indicating that the Pauli operator produced should or should not be sparse.