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

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