Anders and Briegel in Python
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

7 лет назад
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # abp
  2. Python port of Anders and Briegel' s [method](https://arxiv.org/abs/quant-ph/0504117) for fast simulation of Clifford circuits.
  3. Install with `pip`:
  4. ```shell
  5. $ pip install --user abp
  6. ```
  7. ![demo](img/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](img/viz.jpg)
  32. ## Testing
  33. `abp` has a fairly rigorous test suite. You can run all the tests with `nose`:
  34. ```shell
  35. ```
  36. 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:.