GenPauli

From QETLAB
Revision as of 19:06, 18 December 2013 by Nathaniel (talk | contribs) (Created page with "{{Function |name=GenPauli |desc=Produces a generalized Pauli operator |req=opt_args |rel=GellMann<br />Pauli |upd=December 18, 2013 |v=1.00}} <tt>'''GenPauli'''</t...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
GenPauli
Produces a generalized Pauli operator

Other toolboxes required opt_args
Related functions GellMann
Pauli

GenPauli is a function that produces generalized Pauli matrices. More specifically, it produces a unitary matrix of the form $X^j Z^k$, where $X$ and $Z$ are the $d \times d$ "shift" and "clock" matrices defined by: \[X = \begin{bmatrix} 0 & 0 & 0 & \cdots &0 & 1\\ 1 & 0 & 0 & \cdots & 0 & 0\\ 0 & 1 & 0 & \cdots & 0 & 0\\ 0 & 0 & 1 & \cdots & 0 & 0 \\ \vdots & \vdots & \vdots & \ddots &\vdots &\vdots \\ 0 & 0 &0 & \cdots & 1 & 0\\ \end{bmatrix} \quad \text{and} \quad Z = \begin{bmatrix} 1 & 0 & 0 & \cdots & 0\\ 0 & \omega & 0 & \cdots & 0\\ 0 & 0 &\omega ^2 & \cdots & 0\\ \vdots & \vdots & \vdots & \ddots & \vdots\\ 0 & 0 & 0 & \cdots & \omega ^{d-1} \end{bmatrix}, \] and $\omega = \exp(2\pi i/d)$ is a primitive root of unity.

Syntax

  • P = GenPauli(IND1,IND2,DIM)
  • P = GenPauli(IND1,IND2,DIM,SP)

Argument descriptions

  • IND1: The exponent of $X$, the shift matrix (this was called $j$ above). Should be an integer from 0 to DIM-1, inclusive.
  • IND2: The exponent of $Z$, the clock matrix (this was called $k$ above). Should be an integer from 0 to DIM-1, inclusive.
  • DIM: The size of the output matrix (this was called $d$ above).
  • SP (optional, default 0): A flag (either 1 or 0) indicating that the generalized Pauli matrix produced should or should not be sparse.

Examples

Gives the Pauli operators when DIM = 2

>> GenPauli(1,0,2) % Pauli X operator

ans =

     0     1
     1     0

>> GenPauli(0,1,2) % Pauli Z operator

ans =

   1.0000 + 0.0000i   0.0000 + 0.0000i
   0.0000 + 0.0000i  -1.0000 + 0.0000i

>> GenPauli(1,1,2) % Pauli Y operator (up to global phase)

ans =

   0.0000 + 0.0000i  -1.0000 + 0.0000i
   1.0000 + 0.0000i   0.0000 + 0.0000i

>> GenPauli(0,0,2) % identity operator

ans =

     1     0
     0     1

External links