@@ -9,3 +9,5 @@ tag = True | |||||
[bumpversion:file:abp/static/index.html] | [bumpversion:file:abp/static/index.html] | ||||
[bumpversion:file:README.md] | |||||
@@ -1,15 +1,13 @@ | |||||
# abp | |||||
# abp 0.4.19 | |||||
Python port of Anders and Briegel' s [method](https://arxiv.org/abs/quant-ph/0504117) for fast simulation of Clifford circuits. You can read the full documentation [here](https://peteshadbolt.co.uk/abp/). | Python port of Anders and Briegel' s [method](https://arxiv.org/abs/quant-ph/0504117) for fast simulation of Clifford circuits. You can read the full documentation [here](https://peteshadbolt.co.uk/abp/). | ||||
![demo](examples/demo.gif) | |||||
## Installation | ## Installation | ||||
It's easiest to install with `pip`: | It's easiest to install with `pip`: | ||||
```shell | ```shell | ||||
$ pip install --user abp | |||||
$ pip install --user abp==0.4.19 | |||||
``` | ``` | ||||
Or clone and install in `develop` mode: | Or clone and install in `develop` mode: | ||||
@@ -48,9 +46,7 @@ Now, in another terminal, use `abp.fancy.GraphState` to run a Clifford circuit: | |||||
>>> g.update() | >>> g.update() | ||||
``` | ``` | ||||
And you should see a visualization of the state: | |||||
![demo](examples/viz.png) | |||||
And you should see a visualization of the state. | |||||
## Testing | ## Testing | ||||
@@ -19,8 +19,6 @@ 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. | ``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\}`. | 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\}`. | ||||
.. image:: ../examples/demo.gif | |||||
Installing | Installing | ||||
---------------------------- | ---------------------------- | ||||
@@ -119,8 +117,6 @@ Now, in another terminal, use ``abp.fancy.GraphState`` to run a Clifford circuit | |||||
And you should see a 3D visualization of the state. You can call ``update()`` in a loop to see an animation. | And you should see a 3D visualization of the state. You can call ``update()`` in a loop to see an animation. | ||||
.. image:: ../examples/viz.png | |||||
Reference | Reference | ||||
---------------------------- | ---------------------------- | ||||
@@ -1,24 +0,0 @@ | |||||
from abp.fancy import GraphState as FGS | |||||
import abp | |||||
from abp.util import xyz | |||||
def linear_cluster(n): | |||||
g = FGS(range(n), deterministic=False) | |||||
g.act_circuit([(i, "hadamard") for i in range(n)]) | |||||
g.act_circuit([((i, i+1), "cz") for i in range(n-1)]) | |||||
return g | |||||
def test_mercedes_example_1(): | |||||
""" Run an example provided by mercedes """ | |||||
g = linear_cluster(5) | |||||
g.measure(2, "px", 1) | |||||
g.measure(3, "px", 1) | |||||
g.remove_vop(0, 1) | |||||
g.remove_vop(1, 0) | |||||
print g.node | |||||
if __name__ == '__main__': | |||||
test_mercedes_example_1() |
@@ -1,8 +0,0 @@ | |||||
import abp | |||||
# TODO | |||||
# make a random state | |||||
# try to tidy up such that all VOPs are in (X, Y, Z) | |||||
@@ -0,0 +1,18 @@ | |||||
from abp.fancy import GraphState | |||||
import networkx as nx | |||||
edges = [(0,1),(1,2),(2,3),(3,4)] | |||||
nodes = [(i, {'x': i, 'y': 0, 'z':0}) for i in range(5)] | |||||
gs = GraphState() | |||||
for node, position in nodes: | |||||
gs.add_qubit(node, position=position) | |||||
gs.act_hadamard(node) | |||||
for edge in edges: | |||||
gs.act_cz(*edge) | |||||
gs.update(3) | |||||
# a single line of qubits are created along the x axis | |||||
gs.add_qubit('start') | |||||
gs.update(0) | |||||
# a curved 5-qubit cluster and single qubit is depicted |
@@ -10,4 +10,4 @@ sdist: | |||||
deploy: sdist doc | deploy: sdist doc | ||||
$(MAKE) -C $(DOC_DIR) deploy | $(MAKE) -C $(DOC_DIR) deploy | ||||
python setup.py sdist register upload | |||||
python setup.py sdist upload |
@@ -168,5 +168,4 @@ def test_sqrt_notation(n=2): | |||||
c = mock.random_stabilizer_circuit(n) | c = mock.random_stabilizer_circuit(n) | ||||
g = GraphState(range(n)) | g = GraphState(range(n)) | ||||
g.act_circuit(c) | g.act_circuit(c) | ||||
print g.to_state_vector() | |||||