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

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