Anders and Briegel in Python
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

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.
  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:.