Coins
Cx
\[
C_x = \frac{1}{\sqrt{2}}\left(\begin{matrix}
1 & i \\
i & 1 \\
\end{matrix}\right)
\]
Cy
\[
C_y = \frac{1}{\sqrt{2}}\left(\begin{matrix}
1 & -i \\
-i & 1 \\
\end{matrix}\right)
\]
H
\[
H = \frac{1}{\sqrt{2}}\left(\begin{matrix}
1 & 1 \\
1 & -1 \\
\end{matrix}\right)
\]
I
\[
I = \left(\begin{matrix}
1 & 0 \\
0 & 1 \\
\end{matrix}\right)
\]
S
\[
S = \left(\begin{matrix}
1 & 0 \\
0 & i \\
\end{matrix}\right)
\]
T
\[
T = \left(\begin{matrix}
1 & 0 \\
0 & e^{i\frac{\pi}{4}} \\
\end{matrix}\right)
\]
X
\[
X = \left(\begin{matrix}
0 & 1 \\
1 & 0 \\
\end{matrix}\right)
\]
Z
\[
Z = \left(\begin{matrix}
1 & 0 \\
0 & -1 \\
\end{matrix}\right)
\]
generalized_coin(theta, phi, lbd)
General coin
\[
U(\theta,\phi,\lambda) = \left(\begin{matrix}
\cos \theta & -e^{i\lambda} \sin \theta \\
e^{i\lambda} \sin \theta & e^{i(\lambda+\phi)} \cos \theta \\
\end{matrix}\right)
\]
Parameters:
Name | Type | Description | Default |
---|---|---|---|
theta |
float |
The angle \(\theta\). |
required |
phi |
float |
The angle \(\phi\). |
required |
lbd |
float |
The angle \(\lambda\). |
required |
Returns:
Type | Description |
---|---|
(complex numpy array) |
\(U(\theta,\phi,\lambda)\) |
Source code in qwgraph/coins.py
def generalized_coin(theta, phi, lbd):
""" General coin
$$
U(\\theta,\\phi,\\lambda) = \\left(\\begin{matrix}
\\cos \\theta & -e^{i\\lambda} \\sin \\theta \\\\
e^{i\\lambda} \\sin \\theta & e^{i(\\lambda+\\phi)} \\cos \\theta \\\\
\\end{matrix}\\right)
$$
Args:
theta (float): The angle $\\theta$.
phi (float): The angle $\\phi$.
lbd (float): The angle $\\lambda$.
Returns:
(complex numpy array): $U(\\theta,\\phi,\\lambda)$
"""
return np.array([[np.cos(theta) , -np.exp(1j*lbd)*np.sin(theta)],
[np.exp(1j*lbd)*np.sin(theta) , np.exp(1j*(lbd+phi))*np.cos(theta)]],dtype=complex)
phase_shift(phi)
Phase shift coin
\[
P(\phi) = \left(\begin{matrix}
1 & 0 \\
0 & e^{i(\phi)}\\
\end{matrix}\right)
\]
Parameters:
Name | Type | Description | Default |
---|---|---|---|
phi |
float |
The angle \(\phi\). |
required |
Returns:
Type | Description |
---|---|
(complex numpy array) |
\(P(\phi)\) |
Source code in qwgraph/coins.py
def phase_shift(phi):
""" Phase shift coin
$$
P(\\phi) = \\left(\\begin{matrix}
1 & 0 \\\\
0 & e^{i(\\phi)}\\\\
\\end{matrix}\\right)
$$
Args:
phi (float): The angle $\\phi$.
Returns:
(complex numpy array): $P(\\phi)$
"""
return np.array([
[1,0],
[0,np.exp(1j*phi)]],dtype=complex)