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.6KB

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