# pyquil.simulation.matrices module¶

Standard gate set, as detailed in Quil whitepaper (arXiV:1608:03355v2)

Currently includes:

I - identity $$\begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}$$

X - Pauli-X $$\begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}$$

Y - Pauli-Y $$\begin{pmatrix} 0 & -i \\ i & 0 \end{pmatrix}$$

Z - Pauli-Z $$\begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}$$

H - Hadamard $$\frac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}$$

S - PHASE(pi/2) $$\begin{pmatrix} 1 & 0 \\ 0 & i \end{pmatrix}$$

T - PHASE(pi/4) $$\begin{pmatrix} 1 & 0 \\ 0 & e^{i \pi / 4} \end{pmatrix}$$

PHASE($$\phi$$) - PHASE $$\begin{pmatrix} 1 & 0 \\ 0 & e^{i \phi} \end{pmatrix}$$

RX($$\phi$$) - RX $$\begin{pmatrix} \cos(\phi / 2) & -i \sin(\phi/2) \\ -i \sin(\phi/2) & \cos(\phi/2) \end{pmatrix}$$

RY($$\phi$$) - RY $$\begin{pmatrix} \cos(\phi / 2) & -\sin(\phi / 2) \\ \sin(\phi/2) & \cos(\phi/2) \end{pmatrix}$$

RZ($$\phi$$) - RZ $$\begin{pmatrix} \cos(\phi/2) - i \sin(\phi/2) & 0 \\ 0 & \cos(\phi/2) + i \sin(\phi/2) \end{pmatrix}$$

U($$\theta, \phi, \lambda$$) - U3 $$\begin{pmatrix} \cos(\theta/2) & - \exp{i\lambda} \sin(\theta/2) \\ \exp{i\phi} \sin(\theta/2) & \exp{i\phi + \lambda} \cos(\theta/2) \end{pmatrix}$$

CZ - controlled-Z $$P_0 \otimes I + P_1 \otimes Z = \begin{pmatrix} 1&0&0&0 \\ 0&1&0&0 \\ 0&0&1&0 \\ 0&0&0&-1 \end{pmatrix}$$

CNOT - controlled-X / controlled-NOT $$P_0 \otimes I + P_1 \otimes X = \begin{pmatrix} 1&0&0&0 \\ 0&1&0&0 \\ 0&0&0&1 \\ 0&0&1&0 \end{pmatrix}$$

CCNOT - double-controlled-X $$P_0 \otimes P_0 \otimes I + P_0 \otimes P_1 \otimes I + P_1 \otimes P_0 \otimes I + P_1 \otimes P_1 \otimes X$$

CPHASE00($$\phi$$) - controlled-phase-on-|00> $$\text{diag}(e^{i \phi}, 1, 1, 1,)$$

CPHASE01($$\phi$$) - controlled-phase-on-|01> $$\text{diag}(1, e^{i \phi}, 1, 1,)$$

CPHASE10($$\phi$$) - controlled-phase-on-|10> $$\text{diag}(1, 1, e^{i \phi}, 1)$$

CPHASE($$\phi$$) - controlled-phase-on-|11> $$\text{diag}(1, 1, 1, e^{i \phi})$$

SWAP - swap $$\begin{pmatrix} 1&0&0&0 \\ 0&0&1&0 \\ 0&1&0&0 \\ 0&0&0&1 \end{pmatrix}$$

CSWAP - controlled-swap $$P_0 \otimes I_2 + P_1 \otimes \text{SWAP}$$

ISWAP - i-phase-swap $$\begin{pmatrix} 1&0&0&0 \\ 0&0&i&0 \\ 0&i&0&0 \\ 0&0&0&1 \end{pmatrix}$$

PSWAP($$\phi$$) - phi-phase-swap $$\begin{pmatrix} 1&0&0&0 \\ 0&0&e^{i\phi}&0 \\ 0&e^{i\phi}&0&0 \\ 0&0&0&1 \end{pmatrix}$$

XY($$\phi$$) - XY-interaction $$\begin{pmatrix} 1&0&0&0 \\ 0&\cos(\phi/2)&i\sin(\phi/2)&0 \\ 0&i\sin(\phi/2)&\cos(\phi/2)&0 \\ 0&0&0&1 \end{pmatrix}$$

SQISW - XY(:math: pi/2)-interaction $$\begin{pmatrix} 1&0&0&0 \\ 0&\frac{1}{\sqrt{2}}&\frac{i}{\sqrt{2}}&0 \\ \frac{i}{\sqrt{2}}&\frac{1}{\sqrt{2}} \\ 0&0&0&1 \end{pmatrix}$$

FSIM($$\theta, \phi$$) - XX+YY interaction with conditonal phase on |11> $$\begin{pmatrix} 1&0&0&0 \\ 0&\cos(\frac{\theta}{2})&i\sin(\frac{\theta}{2})&0 \\ 0&i\sin(\frac{\theta}{2})&\cos(\frac{\theta}{2})&0 \\ 0&0&0&e^{i \phi} \end{pmatrix}$$

PHASEDFSIM($$\theta, \zeta, \chi, \gamma, \phi$$) - XX+YY interaction with conditonal phase on |11> $$\begin{pmatrix} 1&0&0&0 \\ 0&\ e^{-i(\gamma+\zeta)}\cos(\frac{\theta}{2})&ie^{-i(\gamma-\chi)}\sin(\frac{\theta}{2})&0 \\ 0&ie^{-i(\gamma+\chi)}\sin(\frac{\theta}{2})&e^{-i(\gamma-\zeta)}\cos(\frac{\theta}{2})&0 \\ 0&0&0&e^{ i\phi - 2i\gamma} \end{pmatrix}$$

RXX($$\phi$$) - XX-interaction $$\begin{pmatrix} \cos(\phi/2)&0&0&-i\sin(\phi/2) \\ 0&\cos(\phi/2)&-i\sin(\phi/2)&0 \\ 0&-i\sin(\phi/2)&\cos(\phi/2)&0 \\ -i\sin(\phi/2)&0&0&cos(\phi/2) \end{pmatrix}$$

RYY($$\phi$$) - YY-interaction $$\begin{pmatrix} \cos(\phi/2)&0&0&i\sin(\phi/2) \\ 0&\cos(\phi/2)&-i\sin(\phi/2)&0 \\ 0&-i\sin(\phi/2)&\cos(\phi/2)&0 \\ i\sin(\phi/2)&0&0&cos(\phi/2) \end{pmatrix}$$

RZZ($$\phi$$) - ZZ-interaction $$\begin{pmatrix} 1&0&0&0 \\ 0&\cos(\phi/2)&-i\sin(\phi/2)&0 \\ 0&-i\sin(\phi/2)&\cos(\phi/2)&0 \\ 0&0&0&1 \end{pmatrix}$$

Specialized gates / internal utility gates:

BARENCO($$\alpha, \phi, \theta$$) - Barenco gate $$\begin{pmatrix} 1&0&0&0 \\ 0&1&0&0 \\ 0&0&e^{i\phi} \cos\theta & -i e^{i(\alpha-\phi)} \sin\theta \\ 0&0&-i e^{i(\alpha+\phi)} \sin\theta & e^{i\alpha} \cos\theta \end{pmatrix}$$

P0 - project-onto-zero $$\begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix}$$

P1 - project-onto-one $$\begin{pmatrix} 0 & 0 \\ 0 & 1 \end{pmatrix}$$

pyquil.simulation.matrices.BARENCO(alpha: float, phi: float, theta: float) ndarray[source]
pyquil.simulation.matrices.CPHASE(phi: float) ndarray[source]
pyquil.simulation.matrices.CPHASE00(phi: float) ndarray[source]
pyquil.simulation.matrices.CPHASE01(phi: float) ndarray[source]
pyquil.simulation.matrices.CPHASE10(phi: float) ndarray[source]
pyquil.simulation.matrices.FSIM(theta: float, phi: float) ndarray[source]
pyquil.simulation.matrices.PHASE(phi: float) ndarray[source]
pyquil.simulation.matrices.PHASEDFSIM(theta: float, zeta: float, chi: float, gamma: float, phi: float) ndarray[source]
pyquil.simulation.matrices.PSWAP(phi: float) ndarray[source]
pyquil.simulation.matrices.RX(phi: float) ndarray[source]
pyquil.simulation.matrices.RXX(phi: float) ndarray[source]
pyquil.simulation.matrices.RY(phi: float) ndarray[source]
pyquil.simulation.matrices.RYY(phi: float) ndarray[source]
pyquil.simulation.matrices.RZ(phi: float) ndarray[source]
pyquil.simulation.matrices.RZZ(phi: float) ndarray[source]
pyquil.simulation.matrices.SIC3 = array([ 0.57735027+0.j        , -0.40824829+0.70710678j])

The symmetric informationally complete POVMs for a qubit.

These can reduce the number of experiments to perform quantum process tomography. For more information, please see http://info.phys.unm.edu/~caves/reports/infopovm.pdf

pyquil.simulation.matrices.U(theta: float, phi: float, lam: float) ndarray[source]
pyquil.simulation.matrices.XY(phi: float) ndarray[source]
pyquil.simulation.matrices.bit_flip_operators(p: float) Tuple[ndarray, ndarray][source]

Return the phase flip kraus operators

pyquil.simulation.matrices.bitphase_flip_operators(p: float) Tuple[ndarray, ndarray][source]

Return the bitphase flip kraus operators

pyquil.simulation.matrices.dephasing_operators(p: float) Tuple[ndarray, ndarray][source]

Return the phase damping Kraus operators

pyquil.simulation.matrices.depolarizing_operators(p: float) Tuple[ndarray, ndarray, ndarray, ndarray][source]

Return the phase damping Kraus operators

pyquil.simulation.matrices.phase_flip_operators(p: float) Tuple[ndarray, ndarray][source]

Return the phase flip kraus operators

pyquil.simulation.matrices.relaxation_operators(p: float) Tuple[ndarray, ndarray][source]

Return the amplitude damping Kraus operators