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.

README.md 1.5KB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. # abp
  2. 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/).
  3. ![demo](examples/demo.gif)
  4. ## Installation
  5. Install with `pip`:
  6. ```shell
  7. $ pip install --user abp
  8. ```
  9. Or clone and install:
  10. ```shell
  11. $ git clone https://github.com/peteshadbolt/abp.git
  12. $ python setup.py install --user
  13. ```
  14. ## Visualization
  15. `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.
  16. First, run `abpserver` in a terminal:
  17. ```shell
  18. $ abpserver
  19. Listening on port 5000 for clients..
  20. ```
  21. Then browse to `http://localhost:5001/` (in some circumstances `abp` will automatically pop a browser window).
  22. Now, in another terminal, use `abp.fancy.GraphState` to run a Clifford circuit:
  23. ```python
  24. >>> from abp.fancy import GraphState
  25. >>> g = GraphState(10)
  26. >>> g = GraphState(range(10))
  27. >>> for i in range(10):
  28. ... g.act_hadamard(i)
  29. ...
  30. >>> g.update()
  31. >>> for i in range(9):
  32. ... g.act_cz(i, i+1)
  33. ...
  34. >>> g.update()
  35. ```
  36. And you should see a visualization of the state:
  37. ![demo](examples/viz.png)
  38. ## Testing
  39. `abp` has a bunch of tests. You can run them all with `nose`:
  40. ```shell
  41. $ nosetests
  42. 53 tests run in 39.5 seconds (53 tests passed)
  43. ```
  44. 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.