Browse Source

Merge branch 'master' into pete

master
Pete Shadbolt 8 years ago
parent
commit
a18cc5203b
10 changed files with 24 additions and 45 deletions
  1. +2
    -0
      .bumpversion.cfg
  2. +3
    -7
      README.md
  3. +0
    -4
      doc/index.rst
  4. BIN
      examples/demo.gif
  5. +0
    -24
      examples/mercedes_demo.py
  6. +0
    -8
      examples/tidying_vops.py
  7. +18
    -0
      examples/visualization/issues/unpositioned_nodes.py
  8. BIN
      examples/viz.png
  9. +1
    -1
      makefile
  10. +0
    -1
      tests/test_qi.py

+ 2
- 0
.bumpversion.cfg View File

@@ -9,3 +9,5 @@ tag = True

[bumpversion:file:abp/static/index.html]

[bumpversion:file:README.md]


+ 3
- 7
README.md View File

@@ -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/).

![demo](examples/demo.gif)

## Installation

It's easiest to install with `pip`:

```shell
$ pip install --user abp
$ pip install --user abp==0.4.19
```

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()
```

And you should see a visualization of the state:

![demo](examples/viz.png)
And you should see a visualization of the state.

## Testing



+ 0
- 4
doc/index.rst View File

@@ -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.
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
----------------------------

@@ -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.

.. image:: ../examples/viz.png

Reference
----------------------------



BIN
examples/demo.gif View File

Before After
Width: 381  |  Height: 302  |  Size: 517KB

+ 0
- 24
examples/mercedes_demo.py View File

@@ -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()

+ 0
- 8
examples/tidying_vops.py View File

@@ -1,8 +0,0 @@
import abp

# TODO

# make a random state

# try to tidy up such that all VOPs are in (X, Y, Z)


+ 18
- 0
examples/visualization/issues/unpositioned_nodes.py View File

@@ -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

BIN
examples/viz.png View File

Before After
Width: 529  |  Height: 321  |  Size: 10KB

+ 1
- 1
makefile View File

@@ -10,4 +10,4 @@ sdist:

deploy: sdist doc
$(MAKE) -C $(DOC_DIR) deploy
python setup.py sdist register upload
python setup.py sdist upload

+ 0
- 1
tests/test_qi.py View File

@@ -168,5 +168,4 @@ def test_sqrt_notation(n=2):
c = mock.random_stabilizer_circuit(n)
g = GraphState(range(n))
g.act_circuit(c)
print g.to_state_vector()


Loading…
Cancel
Save