|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- .. abp documentation master file, created by
- sphinx-quickstart on Sun Jul 24 18:12:02 2016.
- You can adapt this file completely to your liking, but it should at least
- contain the root `toctree` directive.
-
- .. toctree::
- :maxdepth: 2
-
-
- Welcome to ``abp``
- ===============================
-
- This is the documentation for ``abp``. It's a work in progress.
-
- ``abp`` is a Python port of Anders and Briegel' s `method <https://arxiv.org/abs/quant-ph/0504117>`_ for fast simulation of Clifford circuits.
- 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\}`.
- It should do thousands of qubits without much trouble.
-
- .. image:: ../examples/demo.gif
-
- Installing
- ----------------------------
-
- You can install from ``pip``:
-
- .. code-block:: bash
-
- $ pip install --user abp
-
- Alternatively, clone from the `github repo <https://github.com/peteshadbolt/abp>`_ and run ``setup.py``:
-
- .. code-block:: bash
-
- $ git clone https://github.com/peteshadbolt/abp
- $ cd abp
- $ python setup.py install --user
-
- If you want to modify and test ``abp`` without having to re-install, switch into ``develop`` mode:
-
- .. code-block:: bash
-
- $ python setup.py develop --user
-
- Quickstart
- ----------------------------
-
- It's pretty easy to build a graph state, act some gates, and do measurements::
-
- >>> from abp import GraphState
- >>> g = GraphState(range(5))
- >>> for i in range(5):
- ... g.act_hadamard(i)
- ...
- >>> for i in range(4):
- ... g.act_cz(i, i+1)
- ...
- >>> print g
- 0: IA (1,)
- 1: IA (0,2)
- 2: IA (1,3)
- 3: IA (2,4)
- 4: IA (3,)
- >>> g.measure(2, "px")
- 0
- >>> print g
- 0: IA (3,)
- 1: ZC (3,)
- 2: IA -
- 3: ZA (0,1,4)
- 4: IA (3,)
-
- Working with GraphStates
- -------------------------
-
- The ``abp.GraphState`` class is your main interface to ``abp``.
- Here follows complete documentation
-
- .. autoclass:: abp.GraphState
-
- .. automethod:: abp.GraphState.__init__
-
- .. automethod:: abp.GraphState.add_node
-
- .. automethod:: abp.GraphState.add_nodes
-
- .. automethod:: abp.GraphState.act_local_rotation
-
- .. automethod:: abp.GraphState.act_hadamard
-
- .. automethod:: abp.GraphState.act_cz
-
- .. automethod:: abp.GraphState.act_circuit
-
- .. automethod:: abp.GraphState.measure
-
- .. automethod:: abp.GraphState.to_json
-
- .. automethod:: abp.GraphState.to_state_vector
-
- .. automethod:: abp.GraphState.to_stabilizer
-
- The Clifford group
- ----------------------
-
- Visualization
- ----------------------
-
- ``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.
-
- First, run ``abpserver`` in a terminal:
-
- .. code-block:: bash
-
- $ abpserver
- Listening on port 5000 for clients..
-
- Then browse to ``http://localhost:5001/`` (in some circumstances ``abp`` will automatically pop a browser window).
-
- Now, in another terminal, use ``abp.fancy.GraphState`` to run a Clifford circuit::
-
- >>> from abp.fancy import GraphState
- >>> g = GraphState(10)
- >>> g = GraphState(range(10))
- >>> for i in range(10):
- ... g.act_hadamard(i)
- ...
- >>> g.update()
- >>> for i in range(9):
- ... g.act_cz(i, i+1)
- ...
- >>> g.update()
- ```
-
- And you should see a 3D visualization of the state.
-
- .. image:: ../examples/viz.png
-
- Reference
- ----------------------------
-
- More detailed docs are available here:
-
- * :ref:`genindex`
- * :ref:`modindex`
- * :ref:`search`
-
|