#### Note

Since all gates are diagonal in the computational basis, they all commute - therefore they can\n be applied in *any* temporal order. This is the origin of the term 'instantaneous' in IQP.

\n\nEfficient classically sampling the resulting probability distribution $H^{\\otimes\nN}UH^{\\otimes N}\\ket{0}^{\\otimes N}$ - even approximately [[3]_] or in the presence\nof noise [[4]_] - has been shown to be #P-hard, and would result in the\ncollapse of the polynomial hierarchy to the third level [[5]_][[6]_].\n\nUnlike boson sampling and Gaussian boson sampling, however, the IQP protocol was not constructed\nwith quantum linear optics in mind. Nevertheless, the IQP model was recently extended to the CV\nformulation of quantum computation [[7]_], taking advantage of the ability to\nefficiently prepare large resource states, and the higher efficiencies afforded by homodyne\ndetection. Furthermore, the computational complexity results of the discrete-variable case apply\nequally to the so-called CV-IQP model, assuming a specific input squeezing parameter dependent on\nthe circuit size.\n\nMoreover, the resulting probability distributions have been shown to be given by integrals of\noscillating functions in large dimensions, which are belived to be intractable to compute by\nclassical methods. This leads to the result that, even in the case of finite squeezing effects and\nreduced measurement precision, approximate sampling from the output CV-IQP model remains classically\nintractable [[1]_][[7]_].\n\n\nImplementation\n--------------\n\nThe CV-IQP model is defined as follows:\n\n1. inputs are squeezed momentum states $\\ket{z}$, where $z=r\\in\\mathbb{R}$ and\n $r<0$ - these are implemented using :class:`~strawberryfields.ops.Sgate`;\n\n\n2. the unitary transformation is diagonal in the $\\hat{x}$ quadrature basis, by randomly\n selecting from the set of gates $U=\\{Z(p),CZ(s),V(\\gamma)\\}$ (available respectively as\n :class:`~strawberryfields.ops.Zgate`, :class:`~strawberryfields.ops.CZgate`, and\n :class:`~strawberryfields.ops.Vgate`);\n\n3. and finally, homodyne measurements are performed on all modes in the $\\hat{p}$ quadrature.\n\nA circuit diagram of a 4 mode IQP circuit is given below.\n\n![](/tutorials/images/IQP.svg)\n\n :align: center\n :width: 50%\n :target: javascript:void(0);\n\n\nCode\n----\n\nThe 4 mode IQP circuit displayed above, with gate parameters chosen randomly, can be implemented\nusing Strawberry Fields:\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import strawberryfields as sf\nfrom strawberryfields.ops import *\n\niqp_circuit = sf.Program(4)\n\nwith iqp_circuit.context as q:\n # prepare the input squeezed states\n S = Sgate(-1)\n S | q[0]\n S | q[1]\n S | q[2]\n S | q[3]\n\n # gates diagonal in the x quadrature\n CZgate(0.5719) | (q[0], q[1])\n Vgate(-1.9782) | q[2]\n Zgate(2.0603) | q[3]\n Zgate(-0.7804) | q[0]\n Zgate(0.8578) | q[2]\n CZgate(1.321) | (q[1], q[2])\n Zgate(0.473) | q[3]\n CZgate(0.9946) | (q[0], q[3])\n Zgate(0.1223) | q[3]\n Vgate(0.6157) | q[0]\n Vgate(0.3110) | q[1]\n Zgate(-1.243) | q[2]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In the above circuit, the homodyne measurements have been excluded to allow for analysis of the\nfull quantum state; however these can be included using\n:class:`~strawberryfields.ops.MeasureHomodyne`.\n\nSince non-Gaussian cubic phase gates are used in the above circuit,\nwe must run it on a Fock backend. Here, we choose the Fock backend\nwith a cutoff dimension of 5.\n\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"# initialize engine\neng = sf.Engine(backend=\"fock\", backend_options={\"cutoff_dim\": 5})\n\n# run the engine\nresults = eng.run(iqp_circuit)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"References\n----------\n\n.. [1] J. M. Arrazola, P. Rebentrost, and C. Weedbrook. Quantum supremacy and high-dimensional integration.\n 2017. arXiv:1712.07288.\n\n.. [2] Dan Shepherd and Michael J. Bremner. Temporally unstructured quantum computation. Proceedings of the\n Royal Society of London A: Mathematical, Physical and Engineering Sciences, 465(2105):1413\u20131439,\n 2009. doi:10.1098/rspa.2008.0443.\n\n.. [3] Michael J. Bremner, Ashley Montanaro, and Dan J. Shepherd. Average-case complexity versus\n approximate simulation of commuting quantum computations. Physical Review Letters, 2016.\n doi:10.1103/PhysRevLett.117.080501.\n\n.. [4] Michael J. Bremner, Ashley Montanaro, and Dan J. Shepherd. Achieving quantum supremacy with sparse\n and noisy commuting quantum computations. Quantum, 1:8, 2017. doi:10.22331/q-2017-04-25-8.\n\n.. [5] A. P. Lund, Michael J. Bremner, and T. C. Ralph. Quantum sampling problems, BosonSampling and\n quantum supremacy. npj Quantum Information, 2017. arXiv:1702.03061,\n doi:10.1038/s41534-017-0018-2.\n\n.. [6] Michael J. Bremner, Richard Jozsa, and Dan J. Shepherd. Classical simulation of commuting quantum\n computations implies collapse of the polynomial hierarchy. Proceedings of the Royal Society of\n London A: Mathematical, Physical and Engineering Sciences, 2010. arXiv:1005.1407,\n doi:10.1098/rspa.2010.0301.\n\n.. [7] T. Douce, D. Markham, E. Kashefi, E. Diamanti, T. Coudreau, P. Milman, P. van Loock, and G. Ferrini.\n Continuous-variable instantaneous quantum computing is hard to sample. Physical Review Letters,\n 2017. arXiv:1607.07605, doi:10.1103/PhysRevLett.118.070503.\n\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.15"
}
},
"nbformat": 4,
"nbformat_minor": 0
}