Anders and Briegel in Python
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
2.5KB

  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. Welcome to ``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. It should do thousands of qubits without much trouble.
  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. >>> print g.to_state_vector()
  44. |00000>: 0.18+0.00j
  45. |00001>: 0.18+0.00j ...
  46. >>> g.measure(2, "px")
  47. 0
  48. >>> print g
  49. 0: IA (3,)
  50. 1: ZC (3,)
  51. 2: IA -
  52. 3: ZA (0,1,4)
  53. 4: IA (3,)
  54. GraphState
  55. -------------------------
  56. The ``abp.GraphState`` class is your main interface to ``abp``.
  57. Here follows complete documentation
  58. .. autoclass:: abp.GraphState
  59. .. automethod:: abp.GraphState.__init__
  60. .. automethod:: abp.GraphState.add_node
  61. .. automethod:: abp.GraphState.add_nodes
  62. .. automethod:: abp.GraphState.act_local_rotation
  63. .. automethod:: abp.GraphState.act_hadamard
  64. .. automethod:: abp.GraphState.act_cz
  65. .. automethod:: abp.GraphState.add_edge
  66. .. automethod:: abp.GraphState.add_edges
  67. .. automethod:: abp.GraphState.del_edge
  68. Reference
  69. ----------------------------
  70. * :ref:`genindex`
  71. * :ref:`modindex`
  72. * :ref:`search`