@@ -2,6 +2,8 @@ | |||||
Python port of Anders and Briegel' s [method](https://arxiv.org/abs/quant-ph/0504117) for fast simulation of Clifford circuits. Should do thousands of qubits without much trouble. | Python port of Anders and Briegel' s [method](https://arxiv.org/abs/quant-ph/0504117) for fast simulation of Clifford circuits. Should do thousands of qubits without much trouble. | ||||
**You can read the full documentation [here](https://peteshadbolt.co.uk/abp/)**. | |||||
![demo](examples/demo.gif) | ![demo](examples/demo.gif) | ||||
## Installation | ## Installation | ||||
@@ -19,9 +21,6 @@ $ git clone https://github.com/peteshadbolt/abp.git | |||||
$ python setup.py install --user | $ python setup.py install --user | ||||
``` | ``` | ||||
# Documentation | |||||
You can read the documentation [here](https://peteshadbolt.co.uk/abp/). | |||||
## Visualization | ## Visualization | ||||
@@ -65,4 +64,4 @@ $ nosetests | |||||
53 tests run in 39.5 seconds (53 tests passed) | 53 tests run in 39.5 seconds (53 tests passed) | ||||
``` | ``` | ||||
Currently I use some reference implementations of `CHP` and `graphsim` which you won't have installed, hence some tests will fail with `ImportErrors`. You can ignore those :feelsgood:. | |||||
Currently I use some reference implementations of `CHP` and `graphsim` which you won't have installed, hence some tests will fail with `ImportErrors`. You can ignore those. |
@@ -47,7 +47,7 @@ def conjugate(operator, unitary): | |||||
return measurement_table[operator, unitary] | return measurement_table[operator, unitary] | ||||
def use_old_cz(): | def use_old_cz(): | ||||
""" Use the CZ table from A&B's code """ | |||||
""" Use the CZ lookup table from A&B's code, rather than our own. Useful for testing. """ | |||||
global cz_table | global cz_table | ||||
from anders_cz import cz_table | from anders_cz import cz_table | ||||
@@ -104,6 +104,13 @@ The Clifford group | |||||
.. automodule:: abp.clifford | .. automodule:: abp.clifford | ||||
| | |||||
The ``clifford`` module provides a few useful functions: | |||||
.. autofunction:: abp.clifford.use_old_cz | |||||
:noindex: | |||||
Visualization | Visualization | ||||
---------------------- | ---------------------- | ||||
@@ -121,17 +128,9 @@ Then browse to ``http://localhost:5001/`` (in some circumstances ``abp`` will au | |||||
Now, in another terminal, use ``abp.fancy.GraphState`` to run a Clifford circuit:: | Now, in another terminal, use ``abp.fancy.GraphState`` to run a Clifford circuit:: | ||||
>>> from abp.fancy import GraphState | >>> from abp.fancy import GraphState | ||||
>>> g = GraphState(10) | |||||
>>> g = GraphState(range(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() | |||||
``` | |||||
>>> g.act_circuit([(i, "hadamard") for i in range(10)]) | |||||
>>> g.act_circuit([((i, i+1), "cz") for i in range(9)]) | |||||
And you should see a 3D visualization of the state. | And you should see a 3D visualization of the state. | ||||