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

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

`\n\nAdditional gates can now be added simply by introducing additional qumodes with the appropriate\nprojective measurements, all 'stacked vertically' (i.e., coupled to the each consecutive qumode\nvia a controlled-phase gate). From this primitive, the model of cluster state quantum computation\ncan be derived [[3]_].\n\n

What happens if the unitary is *not* diagonal in the computational basis? In this case,\n **feedforward** is required; additional qumodes and projective measurements are introduced,\n with successive measurements dependent on the previous result [[5]_].

`\n\nHere, the state $\\ket{\\psi}$, a squeezed state with $r=0.1$, is teleported to the\nfinal qumode, with the quadratic phase gate (:class:`~strawberryfields.ops.Pgate`)\n$P(s)=e^{is\\hat{x}^2/2\\hbar}$ teleported to act on it - with the quadratic phase gate\nchosen as it is diagonal in the $\\x$ quadrature. This can be easily implemented\nusing Strawberry Fields:\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import numpy as np\n\n# set the random seed\nnp.random.seed(42)\n\nimport strawberryfields as sf\nfrom strawberryfields.ops import *\n\ngate_teleportation = sf.Program(3)\n\nwith gate_teleportation.context as q:\n # create initial states\n Squeezed(0.1) | q[0]\n Squeezed(-2) | q[1]\n Squeezed(-2) | q[2]\n\n # apply the gate to be teleported\n Pgate(0.5) | q[1]\n\n # conditional phase entanglement\n CZgate(1) | (q[0], q[1])\n CZgate(1) | (q[1], q[2])\n\n # projective measurement onto\n # the position quadrature\n Fourier.H | q[0]\n MeasureX | q[0]\n Fourier.H | q[1]\n MeasureX | q[1]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Some important notes:\n\n* As with the :doc:`state teleportation circuit