Anders and Briegel in Python
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

před 8 roky
před 8 roky
před 8 roky
před 8 roky
před 8 roky
před 8 roky
před 8 roky
před 8 roky
před 8 roky
před 8 roky
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. .. abp documentation master file, created by
  2. sphinx-quickstart on Sun Jul 24 18:12:02 2016.
  3. You can adapt this file completely to your liking, but it should at least
  4. contain the root `toctree` directive.
  5. .. toctree::
  6. :maxdepth: 2
  7. ``abp``
  8. ===============================
  9. This is the documentation for ``abp``. It's a work in progress.
  10. ``abp`` is a Python port of Anders and Briegel' s `method <https://arxiv.org/abs/quant-ph/0504117>`_ for fast simulation of Clifford circuits.
  11. That means that you can make quantum states of thousands of qubits, perform any sequence of Clifford operations, and measure in any of :math:`\{\sigma_x, \sigma_y, \sigma_z\}`.
  12. .. image:: ../examples/demo.gif
  13. Installing
  14. ----------------------------
  15. You can install from ``pip``:
  16. .. code-block:: bash
  17. $ pip install --user abp
  18. Alternatively, clone from the `github repo <https://github.com/peteshadbolt/abp>`_ and run ``setup.py``:
  19. .. code-block:: bash
  20. $ git clone https://github.com/peteshadbolt/abp
  21. $ cd abp
  22. $ python setup.py install --user
  23. If you want to modify and test ``abp`` without having to re-install, switch into ``develop`` mode:
  24. .. code-block:: bash
  25. $ python setup.py develop --user
  26. Quickstart
  27. ----------------------------
  28. It's pretty easy to build a graph state, act some gates, and do measurements::
  29. >>> from abp import GraphState
  30. >>> g = GraphState(range(5))
  31. >>> for i in range(5):
  32. ... g.act_hadamard(i)
  33. ...
  34. >>> for i in range(4):
  35. ... g.act_cz(i, i+1)
  36. ...
  37. >>> print g
  38. 0: IA (1,)
  39. 1: IA (0,2)
  40. 2: IA (1,3)
  41. 3: IA (2,4)
  42. 4: IA (3,)
  43. >>> g.measure(2, "px")
  44. 0
  45. >>> print g
  46. 0: IA (3,)
  47. 1: ZC (3,)
  48. 2: IA -
  49. 3: ZA (0,1,4)
  50. 4: IA (3,)
  51. Working with GraphStates
  52. -------------------------
  53. The ``abp.GraphState`` class is your main interface to ``abp``.
  54. Here follows complete documentation
  55. .. autoclass:: abp.GraphState
  56. .. automethod:: abp.GraphState.__init__
  57. .. automethod:: abp.GraphState.add_node
  58. .. automethod:: abp.GraphState.add_nodes
  59. .. automethod:: abp.GraphState.act_local_rotation
  60. .. automethod:: abp.GraphState.act_hadamard
  61. .. automethod:: abp.GraphState.act_cz
  62. .. automethod:: abp.GraphState.act_circuit
  63. .. automethod:: abp.GraphState.measure
  64. .. automethod:: abp.GraphState.to_json
  65. .. automethod:: abp.GraphState.to_state_vector
  66. .. automethod:: abp.GraphState.to_stabilizer
  67. The Clifford group
  68. ----------------------
  69. .. automodule:: abp.clifford
  70. |
  71. The ``clifford`` module provides a few useful functions:
  72. .. autofunction:: abp.clifford.use_old_cz
  73. :noindex:
  74. Visualization
  75. ----------------------
  76. ``abp`` comes with a tool to visualize graph states in a WebGL compatible web browser (Chrome, Firefox, Safari etc). It uses a client-server architecture.
  77. First, run ``abpserver`` in a terminal:
  78. .. code-block:: bash
  79. $ abpserver
  80. Listening on port 5000 for clients..
  81. Then browse to ``http://localhost:5001/`` (in some circumstances ``abp`` will automatically pop a browser window).
  82. Now, in another terminal, use ``abp.fancy.GraphState`` to run a Clifford circuit::
  83. >>> from abp.fancy import GraphState
  84. >>> g = GraphState(range(10))
  85. >>> g.act_circuit([(i, "hadamard") for i in range(10)])
  86. >>> g.act_circuit([((i, i+1), "cz") for i in range(9)])
  87. And you should see a 3D visualization of the state.
  88. .. image:: ../examples/viz.png
  89. Reference
  90. ----------------------------
  91. More detailed docs are available here:
  92. * :ref:`genindex`
  93. * :ref:`modindex`
  94. * :ref:`search`