CV Hamiltonians¶
Here, we provided several auxillary Hamiltonians for CV systems.
Gates¶
This file contains the Hamiltonian representations of the CV operations found in StrawberryFields.
All Hamiltonians in the file return a tuple containing the Hamiltonian operator (either as a BosonOperator or a QuadOperator) and the time propagation.
displacement (alpha[, mode, hbar]) |
Returns the Hamiltonian of the displacement operation. |
xdisplacement (x[, mode]) |
Returns the Hamiltonian of the \(x\) displacement operation. |
zdisplacement (p[, mode]) |
Returns the Hamiltonian of the \(p\) displacement operation. |
rotation (phi[, mode, hbar]) |
Returns the Hamiltonian of the rotation operation. |
squeezing (r[, phi, mode, hbar]) |
Returns the Hamiltonian of the squeezing operation. |
quadratic_phase ([s, mode]) |
Returns the Hamiltonian of the quadratic phase operation. |
beamsplitter ([theta, phi, mode1, mode2, hbar]) |
Returns the Hamiltonian of the beamsplitter operation. |
two_mode_squeezing (r[, phi, mode1, mode2, hbar]) |
Returns the Hamiltonian of the two-mode squeezing operation. |
controlled_addition ([s, mode1, mode2]) |
Returns the Hamiltonian of the controlled addition operation. |
controlled_phase ([s, mode1, mode2]) |
Returns the Hamiltonian of the controlled phase operation. |
cubic_phase ([gamma, mode]) |
Returns the Hamiltonian of the cubic phase operation. |
kerr ([kappa, mode, hbar]) |
Returns the Hamiltonian of the Kerr operation. |
Code details¶
-
sfopenboson.hamiltonians.
displacement
(alpha, mode=0, hbar=2)[source]¶ Returns the Hamiltonian of the displacement operation.
The time evolution unitary associated with displacement is
\[D(\alpha) = \exp( \alpha \ad -\alpha^* \a) = \exp(r (e^{i\phi}\ad -e^{-i\phi}\a))\]where \(\alpha=r e^{i \phi}\) with \(r \geq 0\) and \(\phi \in [0,2 \pi)\).
Therefore, \(U=e^{-iHt/\hbar}\) where \(H = {i}{\hbar}(e^{i\phi}\ad -e^{-i\phi}\a)\) and \(t=r\).
Parameters: - a (complex) – the displacement in the phase space
- mode (int) – the qumode on which the operation acts
- hbar (float) – the scaling convention chosen in the definition of the quadrature operators: \([\x,\p]=i\hbar\)
Returns: tuple containing the Hamiltonian representing the operation and the propagation time
Return type: tuple (BosonOperator, t)
-
sfopenboson.hamiltonians.
xdisplacement
(x, mode=0)[source]¶ Returns the Hamiltonian of the \(x\) displacement operation.
The time evolution unitary associated with \(x\) displacement is
\[X(x) = \exp(-ix\p/\hbar)\]Therefore, \(U=e^{-iHt/\hbar}\) where \(H = \p\) and \(t=x\).
Parameters: - x (float) – the position displacement in the phase space
- mode (int) – the qumode on which the operation acts
Returns: tuple containing the Hamiltonian representing the operation and the propagation time
Return type: tuple (QuadOperator, t)
-
sfopenboson.hamiltonians.
zdisplacement
(p, mode=0)[source]¶ Returns the Hamiltonian of the \(p\) displacement operation.
The time evolution unitary associated with \(p\) displacement is
\[X(x) = \exp(ip\x/\hbar)\]Therefore, \(U=e^{-iHt/\hbar}\) where \(H =-\x\) and \(t=p\).
Parameters: - p (float) – the position displacement in the phase space
- mode (int) – the qumode on which the operation acts
Returns: tuple containing the Hamiltonian representing the operation and the propagation time
Return type: tuple (QuadOperator, t)
-
sfopenboson.hamiltonians.
rotation
(phi, mode=0, hbar=2)[source]¶ Returns the Hamiltonian of the rotation operation.
The time evolution unitary associated with rotation is
\[R(\phi) = \exp\left(i \phi \ad \a\right) =\exp\left(i \frac{\phi}{2} \left(\frac{\x^2+ \p^2}{\hbar}-I\right)\right)\]Therefore, \(U=e^{-iHt/\hbar}\) where \(H = -\hbar\ad\a\) and \(t=\phi\).
Parameters: - phi (float) – the rotation angle
- mode (int) – the qumode on which the operation acts
- hbar (float) – the scaling convention chosen in the definition of the quadrature operators: \([\x,\p]=i\hbar\)
Returns: tuple containing the Hamiltonian representing the operation and the propagation time
Return type: tuple (BosonOperator, t)
-
sfopenboson.hamiltonians.
squeezing
(r, phi=0, mode=0, hbar=2)[source]¶ Returns the Hamiltonian of the squeezing operation.
The time evolution unitary associated with squeezing is
\[S(r,\phi) = \exp\left(\frac{r}{2}\left(e^{-i\phi}\a^2 -e^{i\phi}{\ad}^{2} \right) \right)\]Therefore, \(U=e^{-iHt/\hbar}\) where \(H = \frac{i\hbar}{2}\left(e^{-i\phi}\a^2 -e^{i\phi}{\ad}^{2}\right)\) and \(t=r\).
Parameters: - r (float) – the squeezing magnitude
- phi (float) – the quadrature angle in which the squeezing occurs. \(\phi=0\) corresponds to squeezing in the \(\x\) quadrature, and \(\phi=\pi/2\) corresponds to squeezing in the \(\p\) quadrature.
- mode (int) – the qumode on which the operation acts
- hbar (float) – the scaling convention chosen in the definition of the quadrature operators: \([\x,\p]=i\hbar\)
Returns: tuple containing the Hamiltonian representing the operation and the propagation time
Return type: tuple (BosonOperator, t)
-
sfopenboson.hamiltonians.
quadratic_phase
(s=1, mode=0)[source]¶ Returns the Hamiltonian of the quadratic phase operation.
The time evolution unitary associated with the quadratic phase is
\[P(s) = \exp\left(i \frac{s}{2 \hbar} \x^2\right)\]Therefore, \(U=e^{-iHt/\hbar}\) where \(H = -\x^2/2\) and \(t=s\).
Parameters: - s (float) – the quadratic phase parameter
- mode (int) – the qumode on which the operation acts
Returns: tuple containing the Hamiltonian representing the operation and the propagation time
Return type: tuple (QuadOperator, t)
-
sfopenboson.hamiltonians.
beamsplitter
(theta=0.7853981633974483, phi=0, mode1=0, mode2=1, hbar=2)[source]¶ Returns the Hamiltonian of the beamsplitter operation.
The time evolution unitary associated with the beamsplitter is
\[B(\theta,\phi) = \exp\left(\theta (e^{i \phi} \ad_0 \a_1 - e^{-i \phi}\a_0 \ad_1) \right)\]Therefore, \(U=e^{-iHt/\hbar}\) where \(H(\phi) = {i}{\hbar}\left(e^{i \phi} \ad_0 \a_1 - e^{-i \phi}\a_0 \ad_1\right)\) and \(t=\theta\).
Parameters: - theta (float) – transmitivity angle \(\theta\) where \(t=\cos(\theta)\)
- phi (float) – phase angle \(\phi\) where \(r=e^{i\phi}\sin(\theta)\)
- mode1 (int) – the first qumode \(\a_0\) on which the operation acts
- mode2 (int) – the second qumode \(\a_1\) on which the operation acts
- hbar (float) – the scaling convention chosen in the definition of the quadrature operators: \([\x,\p]=i\hbar\)
Returns: tuple containing the Hamiltonian representing the operation and the propagation time
Return type: tuple (BosonOperator, t)
-
sfopenboson.hamiltonians.
two_mode_squeezing
(r, phi=0, mode1=0, mode2=1, hbar=2)[source]¶ Returns the Hamiltonian of the two-mode squeezing operation.
The time evolution unitary associated with two-mode squeezing is
\[S_2(r,\phi) = \exp\left(r\left(e^{-i\phi}\a_0 \a_1 -e^{i\phi}{\ad_0} \ad_1 \right) \right)\]Therefore, \(U=e^{-iHt/\hbar}\) where \(H = {i}{\hbar}\left(e^{-i\phi}\a_0 \a_1 -e^{i\phi}{\ad_0} \ad_1\right)\) and \(t=r\).
Parameters: - r (float) – the squeezing magnitude
- phi (float) – the quadrature in which the squeezing occurs. \(\phi=0\) corresponds to squeezing in the \(\x\) quadrature, and \(\phi=\pi/2\) corresponds to squeezing in the \(\p\) quadrature.
- mode1 (int) – the first qumode \(\a_0\) on which the operation acts
- mode2 (int) – the second qumode \(\a_1\) on which the operation acts
- hbar (float) – the scaling convention chosen in the definition of the quadrature operators: \([\x,\p]=i\hbar\)
Returns: tuple containing the Hamiltonian representing the operation and the propagation time
Return type: tuple (BosonOperator, t)
-
sfopenboson.hamiltonians.
controlled_addition
(s=1, mode1=0, mode2=1)[source]¶ Returns the Hamiltonian of the controlled addition operation.
The time evolution unitary associated with controlled addition is
\[CX(s) = \exp\left( -i \frac{s}{\hbar}\x_0\otimes \p_1 \right)\]Therefore, \(U=e^{-iHt/\hbar}\) where \(H =\x_0\otimes \p_1\) and \(t=s\).
Parameters: - s (float) – the controlled addition parameter
- mode1 (int) – the first qumode \(\a_0\) on which the operation acts
- mode2 (int) – the second qumode \(\a_1\) on which the operation acts
Returns: tuple containing the Hamiltonian representing the operation and the propagation time
Return type: tuple (QuadOperator, t)
-
sfopenboson.hamiltonians.
controlled_phase
(s=1, mode1=0, mode2=1)[source]¶ Returns the Hamiltonian of the controlled phase operation.
The time evolution unitary associated with controlled phase is
\[CZ(s) = \exp\left( i \frac{s}{\hbar}\x_0\otimes \x_1 \right)\]Therefore, \(U=e^{-iHt/\hbar}\) where \(H = -\x_0\otimes \x_1\) and \(t=s\).
Parameters: - s (float) – the controlled addition parameter
- mode1 (int) – the first qumode \(\a_0\) on which the operation acts
- mode2 (int) – the second qumode \(\a_1\) on which the operation acts
Returns: tuple containing the Hamiltonian representing the operation and the propagation time
Return type: tuple (QuadOperator, t)
-
sfopenboson.hamiltonians.
cubic_phase
(gamma=1, mode=0)[source]¶ Returns the Hamiltonian of the cubic phase operation.
The time evolution unitary associated with the cubic phase is
\[V(\gamma) = \exp\left(i \frac{\gamma}{3 \hbar} \x^3\right)\]Therefore, \(U=e^{-iHt/\hbar}\) where \(H = -\x^3/3\) and \(t=\gamma\).
Parameters: - gamma (float) – the cubic phase parameter
- mode (int) – the qumode on which the operation acts
Returns: tuple containing the Hamiltonian representing the operation and the propagation time
Return type: tuple (QuadOperator, t)
-
sfopenboson.hamiltonians.
kerr
(kappa=1, mode=0, hbar=2)[source]¶ Returns the Hamiltonian of the Kerr operation.
The time evolution unitary associated with the Kerr gate is
\[K(\kappa) = \exp\left(i \kappa \hat{n}^2 \right)\]Therefore, \(U=e^{-iHt/\hbar}\) where \(H = -\hat{n}^2\hbar=-(\ad \a)^2\hbar\) and \(t=\kappa\).
Parameters: - kappa (float) – the Kerr parameter
- mode (int) – the qumode on which the operation acts
- hbar (float) – the scaling convention chosen in the definition of the quadrature operators: \([\x,\p]=i\hbar\)
Returns: tuple containing the Hamiltonian representing the operation and the propagation time
Return type: tuple (BosonOperator, t)