` Note that: * Unlike the spatially-separated quantum state teleportation we considered in the previous section, **local teleportation** can transport the state using only two qumodes; the state we are teleporting is entangled directly with the squeezed vacuum state in the momentum space through the use of a controlled-phase gate. * The state is then teleported to qumode :math:`q_1` via a homodyne measurement in the computational basis (the position quadrature). * Like in the previous section, to recover the teleported state exactly, we must perform Weyl-Heisenberg corrections to :math:`q_1`; here, that would be :math:`F^\dagger X(m)^\dagger`. However, for convenience and simplicity, we write the circuit without the corrections applied explicitly. Rather than simply teleporting the state as-is, we can introduce an arbitrary unitary :math:`U` that acts upon :math:`\ket{\psi}`, as follows: .. image:: /tutorials/images/gate_teleport2.svg :align: center :width: 50% :target: javascript:void(0); :html:`

` Now, the action of the unitary :math:`U` is similarly teleported along with the initial state --- this is a trivial extension of the local teleportation circuit. In order to view this in as a measurement-based universal quantum computing primitive, we make a couple of important changes: * The inverse Fourier gate is absorbed into the measurement, making it a homodyne detector in the momentum quadrature * The unitary gate :math:`U`, if diagonal in the computational basis (i.e., it is of the form :math:`U=e^{i f(\hat{x}^i)}`), commutes with the controlled-phase gate (:math:`CZ(s)=e^{i s ~\hat{x_1}\otimes\hat{x_2}/\hbar}`), and can be moved to the right of it. It is then also absorbed into the projective measurement. .. image:: /tutorials/images/gate_teleport3.svg :align: center :width: 50% :target: javascript:void(0); :html:`

` Additional gates can now be added simply by introducing additional qumodes with the appropriate projective measurements, all 'stacked vertically' (i.e., coupled to the each consecutive qumode via a controlled-phase gate). From this primitive, the model of cluster state quantum computation can be derived [[3]_]. .. note:: What happens if the unitary is *not* diagonal in the computational basis? In this case, **feedforward** is required; additional qumodes and projective measurements are introduced, with successive measurements dependent on the previous result [[5]_]. Code ---- Consider the following gate teleportation circuit, .. image:: /tutorials/images/gate_teleport_ex.svg :align: center :width: 70% :target: javascript:void(0); :html:`

` Here, the state :math:`\ket{\psi}`, a squeezed state with :math:`r=0.1`, is teleported to the final qumode, with the quadratic phase gate (:class:`~strawberryfields.ops.Pgate`) :math:`P(s)=e^{is\hat{x}^2/2\hbar}` teleported to act on it - with the quadratic phase gate chosen as it is diagonal in the :math:`\x` quadrature. This can be easily implemented using Strawberry Fields: """ import numpy as np # set the random seed np.random.seed(42) import strawberryfields as sf from strawberryfields.ops import * gate_teleportation = sf.Program(3) with gate_teleportation.context as q: # create initial states Squeezed(0.1) | q[0] Squeezed(-2) | q[1] Squeezed(-2) | q[2] # apply the gate to be teleported Pgate(0.5) | q[1] # conditional phase entanglement CZgate(1) | (q[0], q[1]) CZgate(1) | (q[1], q[2]) # projective measurement onto # the position quadrature Fourier.H | q[0] MeasureX | q[0] Fourier.H | q[1] MeasureX | q[1] ###################################################################### # Some important notes: # # * As with the :doc:`state teleportation circuit